[
  {
    "path": ".gitignore",
    "content": "*.*swp\n.classpath\n.project\n.settings/*\ncontrib/lwjgl-*.pom\ncontrib/lwjgl-*.zip\ncontrib/lwjgl/*\ntarget/*\nlaunch4j/*\n*exe\nstart\n"
  },
  {
    "path": "DiabloMiner-Linux.sh",
    "content": "#!/bin/sh\nexport GPU_USE_SYNC_OBJECTS=1\nexport DISPLAY=`echo $DISPLAY | sed 's/\\.[0-9]//'`\nexport COMPUTE=$DISPLAY\ncd $(dirname ${0})\nexec java -Xmx32m -cp target/libs/*:target/DiabloMiner.jar -Djava.library.path=target/libs/natives com.diablominer.DiabloMiner.DiabloMiner $@\n"
  },
  {
    "path": "DiabloMiner-OSX.sh",
    "content": "#!/bin/sh\nexport GPU_USE_SYNC_OBJECTS=1\ncd $(dirname ${0})\nexec java -Xmx32m -cp target/libs/*:target/DiabloMiner.jar -Djava.awt.headless=true -Djava.library.path=target/libs/natives com.diablominer.DiabloMiner.DiabloMiner $@\n"
  },
  {
    "path": "DiabloMiner-Solaris.sh",
    "content": "#!/bin/sh\nexport GPU_USE_SYNC_OBJECTS=1\nexport DISPLAY=`echo $DISPLAY | sed 's/\\.[0-9]//'`\nexport COMPUTE=$DISPLAY\ncd $(dirname ${0})\nexec java -Xmx32m -cp target/libs/*:target/DiabloMiner.jar -Djava.library.path=target/libs/natives com.diablominer.DiabloMiner.DiabloMiner $@\n"
  },
  {
    "path": "DiabloMiner-Windows.l4j.ini",
    "content": "#lauch4j runtime config\n-Xmx32m\n-Djava.library.path=target\\libs\\natives\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "# This program is unmaintained and does not support the current miner protocol. Use cgminer instead. Do not create issues about this program being broken because it will not be fixed by the original developers. If you want to fix it, you're welcome to fork it.\n\n# DiabloMiner - OpenCL miner for BitCoin #\n    Copyright (C) 2010 - 2013 Patrick McFarland <diablod3@gmail.com>\n\n    This program is free software: you can redistribute it and_or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org_licenses/>.\n\n# Donations #\nBitcoins and Devcoins: __1DbeWKCxnVCt3sRaSAmZLoboqr8pVyFzP1__\n\n# Warning #\nDiabloMiner is a command line program. This means you need to open a terminal\n(cmd.exe, Terminal.app/iTerm2, xterm, etc) and run the program with the proper\narguments from there.\n\nYou __require__ hardware that is capable of running OpenCL.\n\n# MacOSX Warning #\nApple's OpenCL drivers often exhibit strange bugs.\n\nIf DiabloMiner is displaying warnings about `CL_INVALID_WORK_GROUP_SIZE`, add\n`-w 64` to your arguments.\n\n# How to download #\n__[Binary download here](http://adterrasperaspera.com/DiabloMiner.zip)__\n\nThis download is always kept up to date with the newest version of the source.\n\n# How to build #\nDiabloMiner requires the SDK for Java 6.0 or higher installed, as well as\nMaven 3.x. Maven will download the rest of the dependencies.\n\nDiabloMiner uses launch4j to build Windows binaries. launch4j requires and\npartially includes a build chain for Win32. launch4j cannot be ran on any\n64-bit only version of OSX (10.6 and up) and is difficult to run on Windows.\n\nDiabloMiner's git repo does not contain binaries, so if you want to build\nDiabloMiner from source, heed the above warning and run `mvn package`.\n\n# How to use #\n# Single pool and solo mining #\n`./DiabloMiner-YourOS.sh -u username -p password -o host -r port`\n\nor\n\n`./DiabloMiner-YourOS.sh -l http://username:password@host:port`\n\nFor solo mining, your host is `localhost` your port is `8332`, and your\nusername and password is what you set in your bitcoind's `bitcoin.conf`.\nSee bitcoin documentation for further information on how to enable the RPC\nAPI.\n\n## Multiple pools ##\n`./DiabloMiner-YourOS.sh -u username1,username2 -p password1,password2\n -o host1,host2 -r port1,port2`\n\nDiabloMiner supports unlimited pools and will switch to the next pool on\nconnection failure and return to the first pool every 60 minutes.\n\n# Optimization #\n## MacOSX on any hardware ##\nIt is recommended you use the default settings, see also the MacOSX warning\nabove.\n\n## Nvidia hardware on any OS ##\nIt is recommended you use the default settings, however if your desktop is\nlagging badly try adding `-f 120`, `-f 180`, or `-f 240`.\n\n## Intel hardware on any OS ##\nDiabloMiner has not been tested on Intel GPUs. Default is most likely correct.\n\n## AMD Radeon VLIW4 ##\nR7xx\n\n* Radeon discrete: 43xx, 45xx, 46xx, 47xx, 48xx\n* Radeon mobile: 43xxM, 45xxM, 46xxM, 48xxM, 5xxV, 51xxM\n* FirePro: V3750, V7750, V8700, V8750, 2450, RG220\n* FirePro mobile: M7740\n* FireStream: 9250, 9270\n\n`-v 2`\n\n## AMD Radeon VLIW5 ##\nCedar, Redwood, Juniper, Cypress, Hemlock\n\n* Radeon discrete: 54xx, 55xx, 56xx, 57xx, 58xx, 59xx, 63xx, 6750, 6770, 73xx\n* Radeon mobile: 54xxM, 56xxM, 57xxM, 58xxM, 63xxM, 65xxM, 68xxM,\n* FirePro: V3800, V4800, V5800, V7800, V8800, V9800, 2270, 2460\n* FirePro mobile: M5800, M7820\n* FireStream: 9350, 9370\n\nOn some cards `-v 2,1` is faster, on others `-v 2`. Try both.\n\n## AMD Radeon VLIW5 Gen2 ##\nCaicos, Turks, Barts, Wrestler, Ontario, Zacate, WinterPark, BeaverCreek\n\n* Radeon discrete: 64xx, 65xx, 66xx, 6790, 68xx, 74xx, 75xx, 76xx\n* Radeon mobile: 64xxM, 66xxM, 67xxM, 69xxM, 74xxM, 75xxM, 76xxM\n* Radeon mobile IGP: 63xxG, 64xxG, 65xxG, 66xxG\n* Fusion APU: 62xx, 63xx, 64xxD, 65xxD, 74xxD, 75xxD, 76xxD\n* FirePro: V3900, V4900\n* FirePro mobile: M5950, M8900, M2000\n\nUse `-v 2`\n\n## AMD Radeon VLIW4\nCayman, Antilles, Devastator\n\n* Radeon discrete: 69xx\n* Radeon mobile: 64xxM, 66xxM, 67xxM\n* Fusion APU: 74xxD\n* FirePro: V5900, V7900\n\nUse `-v 2`\n\n## AMD Radeon GCN\nCape Verde, Pitcairn, Tahiti, New Zealand, Malta, Bonaire\n* Radeon discrete: 77xx, 78xx, 79xx\n* Radeon mobile: 77xxM, 78xxM, 79xxM\n* FirePro: W600, W5000, W7000, W8000, W9000, S7000, S9000, S10000, R5000\n* FirePro mobile: M4000, M6000\n* Sky: 500, 700, 900\n\nUse defaults.\n\n# Command line arguments #\n* __-u, -p, -o, -r__ Username, password, host, port\n* __-l__ Fully fledged URL, ex: http://username:password@host:port/\n* __-x__ Proxy, ex: host:port<:username:password>\n* __-d__ Debug output\n* __-D__ Use specific devices. Default is all.\n* __-f__ FPS, controls how many kernel executions a second happen, default is 30\n* __-w__ Controls OpenCL workgroup size, default is hardware detected maximum\n* __-v__: Change manual SIMD parallel alignment.\n * -v 1: The same as off/single hash, and is the default (`uint`)\n * -v 2 through 16: Tries more than one hash via SIMD (`uint2` through `uint16`)\n * -v 1,1, etc: Non-SIMD interleaving on top of SIMD, faster on a very small\n   minority of hardware (`-v 2,1` is faster than `-v 2` on some Radeon VLIW5)\n\n"
  },
  {
    "path": "launch4j.xml",
    "content": "<launch4jConfig>\n\t<headerType>console</headerType>\n\t<outfile>DiabloMiner-Windows.exe</outfile>\n\t<jar>target/DiabloMiner.jar</jar>\n\t<errTitle>DiabloMiner</errTitle>\n\t<chdir>%EXECDIR%</chdir>\n\t<classPath>\n\t\t<mainClass>com.diablominer.DiabloMiner.DiabloMiner</mainClass>\n\t\t<cp>%EXEDIR%\\target\\libs\\*</cp>\n\t</classPath>\n\t<jre>\n\t\t<minVersion>1.6.0</minVersion>\n\t</jre>\n\t<customProcName>true</customProcName>\n</launch4jConfig>\n"
  },
  {
    "path": "pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n\t<modelVersion>4.0.0</modelVersion>\n\t<groupId>com.diablominer</groupId>\n\t<artifactId>DiabloMiner</artifactId>\n\t<version>0.0.1-SNAPSHOT</version>\n\n\t<properties>\n\t<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n\t<lwjgl.version>2.8.5</lwjgl.version>\n\t<launch4j.version>3.0.2</launch4j.version>\n\t<launch4j.x86-64.version>3.1.0-beta1</launch4j.x86-64.version>\n\t<launch4j.x86-64.os>macosx-x86-10.8</launch4j.x86-64.os>\n\t<launch4j.dir>${basedir}/launch4j/launch4j</launch4j.dir>\n\t</properties>\n\n\t<pluginRepositories>\n\t\t<pluginRepository>\n\t\t\t <id>sonatype-public-repository</id>\n\t\t\t <url>https://oss.sonatype.org/content/groups/public</url>\n\t\t\t <snapshots>\n\t\t\t<enabled>true</enabled>\n\t\t\t </snapshots>\n\t\t\t <releases>\n\t\t\t<enabled>true</enabled>\n\t\t\t </releases>\n\t\t</pluginRepository>\n\t</pluginRepositories>\n\n\t<dependencies>\n\t\t<dependency>\n\t\t\t<groupId>org.lwjgl.lwjgl</groupId>\n\t\t\t<artifactId>lwjgl</artifactId>\n\t\t\t<version>${lwjgl.version}</version>\n\t\t</dependency>\n\t\t<dependency>\n\t\t\t<groupId>org.lwjgl.lwjgl</groupId>\n\t\t\t<artifactId>lwjgl_util</artifactId>\n\t\t\t<version>${lwjgl.version}</version>\n\t\t</dependency>\n\t\t<dependency>\n\t\t\t<groupId>org.codehaus.jackson</groupId>\n\t\t\t<artifactId>jackson-mapper-asl</artifactId>\n\t\t\t<version>1.9.11</version>\n\t\t</dependency>\n\t\t<dependency>\n\t\t\t<groupId>commons-codec</groupId>\n\t\t\t<artifactId>commons-codec</artifactId>\n\t\t\t<version>1.7</version>\n\t\t</dependency>\n\t\t<dependency>\n\t\t\t<groupId>commons-cli</groupId>\n\t\t\t<artifactId>commons-cli</artifactId>\n\t\t\t<version>1.2</version>\n\t\t</dependency>\n\t</dependencies>\n\n\t<profiles>\n\t\t<profile>\n\t\t\t<id>exist-launch4j</id>\n\t\t\t<activation>\n\t\t\t<file>\n\t\t\t<missing>launch4j/</missing> <!-- MNG-3524 -->\n\t\t\t</file>\n\t\t\t</activation>\n\t\t\t<build>\n\t\t\t<plugins>\n\t\t\t<plugin>\n\t\t\t\t<groupId>org.codehaus.mojo</groupId>\n\t\t\t\t<artifactId>wagon-maven-plugin</artifactId>\n\t\t\t\t<version>1.0-beta-4</version>\n\t\t\t\t<executions>\n\t\t\t\t<execution>\n\t\t\t\t<id>download-launch4j</id>\n\t\t\t\t<phase>generate-resources</phase>\n\t\t\t\t<goals>\n\t\t\t\t<goal>download-single</goal>\n\t\t\t\t</goals>\n\t\t\t\t<configuration>\n\t\t\t\t\t<url>http://downloads.sourceforge.net</url>\n\t\t\t\t\t<fromFile>launch4j/launch4j-3/${launch4j.version}/launch4j-${launch4j.version}-${launch4j.os}.${launch4j.ext}</fromFile>\n\t\t\t\t\t<toDir>${basedir}/launch4j</toDir>\n\t\t\t\t</configuration>\n\t\t\t\t</execution>\n\t\t\t\t<execution>\n\t\t\t\t<id>download-launch4j-on-osx-10.8</id>\n\t\t\t\t<phase>generate-resources</phase>\n\t\t\t\t<goals>\n\t\t\t\t<goal>download-single</goal>\n\t\t\t\t</goals>\n\t\t\t\t<configuration>\n\t\t\t\t\t<url>http://downloads.sourceforge.net</url>\n\t\t\t\t\t<fromFile>project/launch4j/launch4j-3/${launch4j.x86-64.version}/launch4j-${launch4j.x86-64.version}-${launch4j.x86-64.os}.${launch4j.ext}</fromFile>\n\t\t\t\t\t<toDir>${basedir}/launch4j</toDir>\n\t\t\t\t</configuration>\n\t\t\t\t</execution>\n\t\t\t\t</executions>\n\t\t\t</plugin>\n\t\t\t</plugins>\n\t\t\t</build>\n\t\t</profile>\n\t\t<profile>\n\t\t\t<id>unpack-launch4j-windows</id>\n\t\t\t<activation>\n\t\t\t<os>\n\t\t\t<name>Windows</name>\n\t\t\t</os>\n\t\t\t</activation>\n\t\t\t<properties>\n\t\t\t<launch4j.os>win32</launch4j.os>\n\t\t\t<launch4j.ext>zip</launch4j.ext>\n\t\t\t</properties>\n\t\t\t<build>\n\t\t\t<plugins>\n\t\t\t<plugin>\n\t\t\t\t<groupId>org.apache.maven.plugins</groupId>\n\t\t\t\t<artifactId>maven-antrun-plugin</artifactId>\n\t\t\t\t<version>1.7</version>\n\t\t\t\t<executions>\n\t\t\t\t<execution>\n\t\t\t\t<id>unpack-on-windows</id>\n\t\t\t\t<phase>process-resources</phase>\n\t\t\t\t<configuration>\n\t\t\t\t\t<target>\n\t\t\t\t\t\t<unzip src=\"${basedir}/launch4j/launch4j-${launch4j.version}-${launch4j.os}.${launch4j.ext}\" dest=\"${basedir}/launch4j\" />\n\t\t\t\t\t</target>\n\t\t\t\t</configuration>\n\t\t\t\t<goals>\n\t\t\t\t<goal>run</goal>\n\t\t\t\t</goals>\n\t\t\t\t</execution>\n\t\t\t\t</executions>\n\t\t\t</plugin>\n\t\t\t</plugins>\n\t\t\t</build>\n\t\t</profile>\n\t\t<profile>\n\t\t\t<id>unpack-launch4j-linux-and-osx</id>\n\t\t\t<activation>\n\t\t\t<os>\n\t\t\t<name>!Windows</name>\n\t\t\t</os>\n\t\t\t</activation>\n\t\t\t<properties>\n\t\t\t<launch4j.ext>tgz</launch4j.ext>\n\t\t\t</properties>\n\t\t\t<build>\n\t\t\t<plugins>\n\t\t\t<plugin>\n\t\t\t\t<groupId>org.apache.maven.plugins</groupId>\n\t\t\t\t<artifactId>maven-antrun-plugin</artifactId>\n\t\t\t\t<version>1.7</version>\n\t\t\t\t<executions>\n\t\t\t\t<execution>\n\t\t\t\t<id>unpack-on-unix</id>\n\t\t\t\t<phase>process-resources</phase>\n\t\t\t\t<configuration>\n\t\t\t\t\t<target>\n\t\t\t\t\t<gunzip src=\"${basedir}/launch4j/launch4j-${launch4j.version}-${launch4j.os}.${launch4j.ext}\" dest=\"${basedir}/launch4j/launch4j-${launch4j.version}-${launch4j.os}.tar\" />\n\t\t\t\t\t<untar src=\"${basedir}/launch4j/launch4j-${launch4j.version}-${launch4j.os}.tar\" dest=\"${basedir}/launch4j\" />\n\t\t\t\t\t<chmod dir=\"${launch4j.dir}/bin\" perm=\"755\" includes=\"*\"/>\n\t\t\t\t\t</target>\n\t\t\t\t</configuration>\n\t\t\t\t<goals>\n\t\t\t\t<goal>run</goal>\n\t\t\t\t</goals>\n\t\t\t\t</execution>\n\t\t\t\t</executions>\n\t\t\t</plugin>\n\t\t\t</plugins>\n\t\t\t</build>\n\t\t</profile>\n\t\t<profile>\n\t\t\t<id>unpack-launch4j-linux</id>\n\t\t\t<activation>\n\t\t\t<os>\n\t\t\t<name>Linux</name>\n\t\t\t</os>\n\t\t\t</activation>\n\t\t\t<properties>\n\t\t\t<launch4j.os>linux</launch4j.os>\n\t\t\t</properties>\n\t\t</profile>\n\t\t<profile>\n\t\t\t<id>unpack-launch4j-osx</id>\n\t\t\t<activation>\n\t\t\t<os>\n\t\t\t<name>Mac OS X</name>\n\t\t\t</os>\n\t\t\t</activation>\n\t\t\t<properties>\n\t\t\t<launch4j.os>macosx</launch4j.os>\n\t\t\t</properties>\n\t\t</profile>\n\t\t<profile>\n\t\t\t<id>unpack-launch4j-osx-10.8</id>\n\t\t\t<activation>\n\t\t\t<os>\n\t\t\t<name>Mac OS X</name>\n\t\t\t<arch>x86_64</arch>\n\t\t\t</os>\n\t\t\t</activation>\n\t\t\t<properties>\n\t\t\t</properties>\n\t\t\t<build>\n\t\t\t<plugins>\n\n\t\t\t<plugin>\n\t\t\t\t<groupId>org.apache.maven.plugins</groupId>\n\t\t\t\t<artifactId>maven-antrun-plugin</artifactId>\n\t\t\t\t<version>1.7</version>\n\t\t\t\t<executions>\n\t\t\t\t<execution>\n\t\t\t\t<id>unpack-on-osx-10.8</id>\n\t\t\t\t<phase>process-resources</phase>\n\t\t\t\t<configuration>\n\t\t\t\t\t<target>\n\t\t\t\t\t<gunzip src=\"${basedir}/launch4j/launch4j-${launch4j.x86-64.version}-${launch4j.x86-64.os}.${launch4j.ext}\" dest=\"${basedir}/launch4j/launch4j-${launch4j.x86-64.version}-${launch4j.x86-64.os}.tar\" />\n\t\t\t\t\t<untar src=\"${basedir}/launch4j/launch4j-${launch4j.x86-64.version}-${launch4j.x86-64.os}.tar\" dest=\"${basedir}/launch4j\">\n\t\t\t\t\t<patternset>\n\t\t\t\t\t<include name=\"**/bin/*\" />\n\t\t\t\t\t</patternset>\n\t\t\t\t\t</untar>\n\t\t\t\t\t<chmod dir=\"${launch4j.dir}/bin\" perm=\"755\" includes=\"*\"/>\n\t\t\t\t\t</target>\n\t\t\t\t</configuration>\n\t\t\t\t<goals>\n\t\t\t\t<goal>run</goal>\n\t\t\t\t</goals>\n\t\t\t\t</execution>\n\t\t\t\t</executions>\n\t\t\t</plugin>\n\t\t\t</plugins>\n\t\t\t</build>\n\t\t</profile>\n\t</profiles>\n\n\t<build>\n\t\t<plugins>\n\t\t<plugin>\n\t\t\t<groupId>org.apache.maven.plugins</groupId>\n\t\t\t<artifactId>maven-compiler-plugin</artifactId>\n\t\t\t<version>3.1</version>\n\t\t\t<configuration>\n\t\t\t\t<source>1.6</source>\n\t\t\t\t<target>1.6</target>\n\t\t\t</configuration>\n\t\t</plugin>\n\t\t<plugin>\n\t\t\t<groupId>com.googlecode.mavennatives</groupId>\n\t\t\t<artifactId>maven-nativedependencies-plugin</artifactId>\n\t\t\t<version>0.0.7</version>\n\t\t\t<executions>\n\t\t\t<execution>\n\t\t\t<id>unpack-natives</id>\n\t\t\t<phase>generate-resources</phase>\n\t\t\t<goals>\n\t\t\t<goal>copy</goal>\n\t\t\t</goals>\n\t\t\t<configuration>\n\t\t\t\t<nativesTargetDir>${project.build.directory}/libs/natives</nativesTargetDir>\n\t\t\t</configuration>\n\t\t\t</execution>\n\t\t\t</executions>\n\t\t</plugin>\n\t\t<plugin>\n\t\t \t<groupId>org.apache.maven.plugins</groupId>\n\t\t \t<artifactId>maven-dependency-plugin</artifactId>\n\t\t \t<executions>\n\t\t\t<execution>\n\t\t\t<id>copy-dependencies</id>\n\t\t\t<phase>process-resources</phase>\n\t\t\t<goals>\n\t\t \t<goal>copy-dependencies</goal>\n\t\t\t</goals>\n\t\t\t<configuration>\n\t\t \t\t<outputDirectory>${project.build.directory}/libs</outputDirectory>\n\t\t\t \t<overWriteReleases>false</overWriteReleases>\n\t\t\t \t<overWriteSnapshots>true</overWriteSnapshots>\n\t\t\t \t<overWriteIfNewer>true</overWriteIfNewer>\n\t\t\t</configuration>\n\t\t\t</execution>\n\t\t \t</executions>\n\t\t</plugin>\n\t \t<plugin>\n\t\t\t<groupId>org.apache.maven.plugins</groupId>\n\t\t\t<artifactId>maven-jar-plugin</artifactId>\n\t\t\t<version>2.4</version>\n\t\t\t<executions>\n\t\t\t<execution>\n\t\t\t<id>default-jar</id>\n\t\t\t<phase>prepare-package</phase>\n\t\t\t<configuration>\n\t\t\t\t<finalName>DiabloMiner</finalName>\n\t\t\t</configuration>\n\t\t\t<goals>\n\t\t\t<goal>jar</goal>\n\t\t\t</goals>\n\t\t\t</execution>\n\t\t\t</executions>\n\t\t</plugin>\n\t\t<plugin>\n\t\t\t<groupId>org.apache.maven.plugins</groupId>\n\t\t\t<artifactId>maven-antrun-plugin</artifactId>\n\t\t\t<executions>\n\t\t\t<execution>\n\t\t\t<id>run-launch4j</id>\n\t\t\t<phase>package</phase>\n\t\t\t<configuration>\n\t\t\t\t<target>\n\t\t\t\t<taskdef name=\"launch4j\" classname=\"net.sf.launch4j.ant.Launch4jTask\" classpath=\"${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar\" />\n\t\t\t\t<launch4j configFile=\"${basedir}/launch4j.xml\" />\n\t\t\t\t</target>\n\t\t\t</configuration>\n\t\t\t<goals>\n\t\t\t<goal>run</goal>\n\t\t\t</goals>\n\t\t\t</execution>\n\t\t\t</executions>\n\t\t</plugin>\n\t\t</plugins>\n\t</build>\n</project>\n"
  },
  {
    "path": "src/main/java/com/diablominer/DiabloMiner/DeviceState/DeviceState.java",
    "content": "/*\n * DiabloMiner - OpenCL miner for Bitcoin\n * Copyright (C) 2010, 2011, 2012 Patrick McFarland <diablod3@gmail.com>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\tSee the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program.\tIf not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.diablominer.DiabloMiner.DeviceState;\n\nimport java.util.concurrent.LinkedBlockingDeque;\nimport java.util.concurrent.atomic.AtomicLong;\n\nimport com.diablominer.DiabloMiner.DiabloMiner;\nimport com.diablominer.DiabloMiner.DiabloMinerFatalException;\nimport com.diablominer.DiabloMiner.NetworkState.WorkState;\n\nabstract public class DeviceState {\n\tString deviceName;\n\tDiabloMiner diabloMiner;\n\n\tdouble basis;\n\tAtomicLong deviceHashCount = new AtomicLong(0);\n\n\tlong resetNetworkState;\n\n\tabstract public void checkDevice();\n\n\tpublic double getBasis() {\n\t\treturn basis;\n\t}\n\n\tpublic long getDeviceHashCount() {\n\t\treturn deviceHashCount.get();\n\t}\n\n\tabstract public class ExecutionState implements Runnable  {\n\t\tString executionName;\n\n\t\tWorkState workState;\n\t\tLinkedBlockingDeque<WorkState> incomingQueue = new LinkedBlockingDeque<WorkState>();\n\n\t\tpublic ExecutionState(String executionName) throws DiabloMinerFatalException {\n\t\t\tthis.executionName = executionName;\n\t\t\tthis.workState = null;\n\t\t}\n\n\t\tpublic void addIncomingQueue(WorkState workState) {\n\t\t\tincomingQueue.add(workState);\n\t\t}\n\n\t\tabstract public void run();\n\n\t\tpublic String getExecutionName() {\n\t\t\treturn executionName;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/main/java/com/diablominer/DiabloMiner/DeviceState/GPUDeviceState.java",
    "content": "/*\n * DiabloMiner - OpenCL miner for Bitcoin\n * Copyright (C) 2010, 2011, 2012 Patrick McFarland <diablod3@gmail.com>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\tSee the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program.\tIf not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.diablominer.DiabloMiner.DeviceState;\n\nimport java.nio.ByteBuffer;\nimport java.nio.IntBuffer;\nimport java.security.MessageDigest;\nimport java.security.NoSuchAlgorithmException;\nimport java.util.concurrent.atomic.AtomicLong;\n\nimport org.lwjgl.BufferUtils;\nimport org.lwjgl.LWJGLUtil;\nimport org.lwjgl.PointerBuffer;\nimport org.lwjgl.opencl.CL10;\nimport org.lwjgl.opencl.CL12;\nimport org.lwjgl.opencl.CLCommandQueue;\nimport org.lwjgl.opencl.CLContext;\nimport org.lwjgl.opencl.CLContextCallback;\nimport org.lwjgl.opencl.CLDevice;\nimport org.lwjgl.opencl.CLKernel;\nimport org.lwjgl.opencl.CLMem;\nimport org.lwjgl.opencl.CLPlatform;\nimport org.lwjgl.opencl.CLProgram;\n\nimport com.diablominer.DiabloMiner.DiabloMiner;\nimport com.diablominer.DiabloMiner.DiabloMinerFatalException;\nimport com.diablominer.DiabloMiner.NetworkState.WorkState;\n\npublic class GPUDeviceState extends DeviceState {\n\tfinal static int OUTPUTS = 16;\n\n\tfinal PlatformVersion platform_version;\n\tfinal CLDevice device;\n\tfinal CLContext context;\n\tfinal CLKernel kernel;\n\n\tAtomicLong workSize = new AtomicLong(0);\n\tlong workSizeBase;\n\tboolean hwcheck;\n\n\tfinal PointerBuffer localWorkSize = BufferUtils.createPointerBuffer(1);\n\n\tfinal ExecutionState executions[];\n\n\tAtomicLong runs = new AtomicLong(0);\n\tlong lastRuns = 0;\n\tlong startTime = 0;\n\tlong lastTime = 0;\n\n\tGPUHardwareType hardwareType;\n\n\tGPUDeviceState(GPUHardwareType hardwareType, String deviceName, CLPlatform platform, PlatformVersion platform_version, CLDevice device) throws DiabloMinerFatalException {\n\t\tthis.platform_version = platform_version;\n\t\tthis.hardwareType = hardwareType;\n\t\tthis.diabloMiner = hardwareType.getDiabloMiner();\n\t\tthis.deviceName = deviceName;\n\n\t\tthis.resetNetworkState = DiabloMiner.now();\n\n\t\tthis.executions = new ExecutionState[GPUHardwareType.EXECUTION_TOTAL];\n\n\t\tboolean hasBitAlign;\n\t\tboolean hasBFI_INT = false;\n\t\tCLProgram program;\n\n\t\tthis.device = device;\n\n\t\tPointerBuffer properties = BufferUtils.createPointerBuffer(3);\n\t\tproperties.put(CL10.CL_CONTEXT_PLATFORM).put(platform.getPointer()).put(0).flip();\n\t\tint err = 0;\n\n\t\tint deviceCU = device.getInfoInt(CL10.CL_DEVICE_MAX_COMPUTE_UNITS);\n\t\tlong deviceWorkSize;\n\n\t\tint forceWorkSize = diabloMiner.getGPUForceWorkSize();\n\n\t\tif(forceWorkSize > 0)\n\t\t\tdeviceWorkSize = forceWorkSize;\n\t\telse if(LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_MACOSX)\n\t\t\tdeviceWorkSize = device.getInfoSize(CL10.CL_DEVICE_MAX_WORK_GROUP_SIZE);\n\t\telse\n\t\t\tdeviceWorkSize = 64;\n\n\t\tcontext = CL10.clCreateContext(properties, device, new CLContextCallback() {\n\t\t\tprotected void handleMessage(String errinfo, ByteBuffer private_info) {\n\t\t\t\tdiabloMiner.error(errinfo);\n\t\t\t}\n\t\t}, null);\n\n\t\tByteBuffer extb = BufferUtils.createByteBuffer(1024);\n\t\tCL10.clGetDeviceInfo(device, CL10.CL_DEVICE_EXTENSIONS, extb, null);\n\t\tbyte[] exta = new byte[1024];\n\t\textb.get(exta);\n\n\t\tif(new String(exta).contains(\"cl_amd_media_ops\"))\n\t\t\thasBitAlign = true;\n\t\telse\n\t\t\thasBitAlign = false;\n\n\t\tif(hasBitAlign) {\n\t\t\tif(deviceName.contains(\"Cedar\") || deviceName.contains(\"Redwood\") || deviceName.contains(\"Juniper\") || deviceName.contains(\"Cypress\") || deviceName.contains(\"Hemlock\") || deviceName.contains(\"Caicos\") || deviceName.contains(\"Turks\") || deviceName.contains(\"Barts\") || deviceName.contains(\"Cayman\") || deviceName.contains(\"Antilles\") || deviceName.contains(\"Palm\") || deviceName.contains(\"Sumo\") || deviceName.contains(\"Wrestler\") || deviceName.contains(\"WinterPark\") || deviceName.contains(\"BeaverCreek\"))\n\t\t\t\thasBFI_INT = true;\n\t\t}\n\n\t\t// String compileOptions =\n\t\t// \"-save-temps=\"+(device.getInfoString(CL10.CL_DEVICE_NAME).trim());\n\t\tString compileOptions = \"\";\n\n\t\tcompileOptions += \" -D WORKSIZE=\" + deviceWorkSize;\n\n\t\tif(hasBitAlign)\n\t\t\tcompileOptions += \" -D BITALIGN\";\n\n\t\tif(hasBFI_INT)\n\t\t\tcompileOptions += \" -D BFIINT\";\n\n\t\tprogram = CL10.clCreateProgramWithSource(context, hardwareType.getSource(), null);\n\n\t\terr = CL10.clBuildProgram(program, device, compileOptions, null);\n\t\tif(err != CL10.CL_SUCCESS) {\n\t\t\tByteBuffer logBuffer = BufferUtils.createByteBuffer(1024);\n\t\t\tbyte[] log = new byte[1024];\n\n\t\t\tCL10.clGetProgramBuildInfo(program, device, CL10.CL_PROGRAM_BUILD_LOG, logBuffer, null);\n\n\t\t\tlogBuffer.get(log);\n\n\t\t\tSystem.out.println(new String(log));\n\n\t\t\tthrow new DiabloMinerFatalException(diabloMiner, \"Failed to build program on \" + deviceName);\n\t\t}\n\n\t\tif(hasBFI_INT) {\n\t\t\tdiabloMiner.info(\"BFI_INT patching enabled, disabling hardware check errors\");\n\t\t\thwcheck = false;\n\n\t\t\tint binarySize = (int) program.getInfoSizeArray(CL10.CL_PROGRAM_BINARY_SIZES)[0];\n\n\t\t\tByteBuffer binary = BufferUtils.createByteBuffer(binarySize);\n\t\t\tprogram.getInfoBinaries(binary);\n\n\t\t\tfor(int pos = 0; pos < binarySize - 4; pos++) {\n\t\t\t\tif((long) (0xFFFFFFFF & binary.getInt(pos)) == 0x464C457FL && (long) (0xFFFFFFFF & binary.getInt(pos + 4)) == 0x64010101L) {\n\t\t\t\t\tboolean firstText = true;\n\n\t\t\t\t\tint offset = binary.getInt(pos + 32);\n\t\t\t\t\tshort entrySize = binary.getShort(pos + 46);\n\t\t\t\t\tshort entryCount = binary.getShort(pos + 48);\n\t\t\t\t\tshort index = binary.getShort(pos + 50);\n\n\t\t\t\t\tint header = pos + offset;\n\n\t\t\t\t\tint nameTableOffset = binary.getInt(header + index * entrySize + 16);\n\t\t\t\t\tint size = binary.getInt(header + index * entrySize + 20);\n\n\t\t\t\t\tint entry = header;\n\n\t\t\t\t\tfor(int section = 0; section < entryCount; section++) {\n\t\t\t\t\t\tint nameIndex = binary.getInt(entry);\n\t\t\t\t\t\toffset = binary.getInt(entry + 16);\n\t\t\t\t\t\tsize = binary.getInt(entry + 20);\n\n\t\t\t\t\t\tint name = pos + nameTableOffset + nameIndex;\n\n\t\t\t\t\t\tif((long) (0xFFFFFFFF & binary.getInt(name)) == 0x7865742E) {\n\t\t\t\t\t\t\tif(firstText) {\n\t\t\t\t\t\t\t\tfirstText = false;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tint sectionStart = pos + offset;\n\t\t\t\t\t\t\t\tfor(int i = 0; i < size / 8; i++) {\n\t\t\t\t\t\t\t\t\tlong instruction1 = (long) (0xFFFFFFFF & binary.getInt(sectionStart + i * 8));\n\t\t\t\t\t\t\t\t\tlong instruction2 = (long) (0xFFFFFFFF & binary.getInt(sectionStart + i * 8 + 4));\n\n\t\t\t\t\t\t\t\t\tif((instruction1 & 0x02001000L) == 0x00000000L && (instruction2 & 0x9003F000L) == 0x0001A000L) {\n\t\t\t\t\t\t\t\t\t\tinstruction2 ^= (0x0001A000L ^ 0x0000C000L);\n\n\t\t\t\t\t\t\t\t\t\tbinary.putInt(sectionStart + i * 8 + 4, (int) instruction2);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tentry += entrySize;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tIntBuffer binaryErr = BufferUtils.createIntBuffer(1);\n\n\t\t\tCL10.clReleaseProgram(program);\n\t\t\tprogram = CL10.clCreateProgramWithBinary(context, device, binary, binaryErr, null);\n\n\t\t\terr = CL10.clBuildProgram(program, device, compileOptions, null);\n\n\t\t\tif(err != CL10.CL_SUCCESS) {\n\t\t\t\tthrow new DiabloMinerFatalException(diabloMiner, \"Failed to BFI_INT patch kernel on \" + deviceName);\n\t\t\t}\n\t\t}\n\n\t\tkernel = CL10.clCreateKernel(program, \"search\", null);\n\t\tif(kernel == null) {\n\t\t\tthrow new DiabloMinerFatalException(diabloMiner, \"Failed to create kernel on \" + deviceName);\n\n\t\t}\n\n\t\tif(forceWorkSize == 0) {\n\t\t\tByteBuffer rkwgs = BufferUtils.createByteBuffer(8);\n\n\t\t\terr = CL10.clGetKernelWorkGroupInfo(kernel, device, CL10.CL_KERNEL_WORK_GROUP_SIZE, rkwgs, null);\n\n\t\t\tlocalWorkSize.put(0, rkwgs.getLong(0));\n\n\t\t\tif(!(err == CL10.CL_SUCCESS) || localWorkSize.get(0) == 0)\n\t\t\t\tlocalWorkSize.put(0, deviceWorkSize);\n\t\t} else {\n\t\t\tlocalWorkSize.put(0, forceWorkSize);\n\t\t}\n\n\t\tdiabloMiner.info(\"Added \" + deviceName + \" (\" + deviceCU + \" CU, local work size of \" + localWorkSize.get(0) + \")\");\n\n\t\tworkSizeBase = 64 * 512;\n\n\t\tworkSize.set(workSizeBase * 16);\n\n\t\tfor(int i = 0; i < GPUHardwareType.EXECUTION_TOTAL; i++) {\n\t\t\tString executorName = deviceName + \"/\" + i;\n\t\t\texecutions[i] = this.new GPUExecutionState(executorName);\n\t\t\tThread thread = new Thread(executions[i], \"DiabloMiner Executor (\" + executorName + \")\");\n\t\t\tthread.start();\n\t\t\tdiabloMiner.addThread(thread);\n\t\t}\n\t}\n\n\tpublic void checkDevice() {\n\t\tlong now = DiabloMiner.now();\n\t\tlong elapsed = now - lastTime;\n\t\tlong currentRuns = runs.get();\n\t\tdouble targetFPSBasis = hardwareType.getTargetFPSBasis();\n\t\tint totalVectors = hardwareType.getTotalVectors();\n\t\tlong ws = workSize.get();\n\n\t\tif(now > startTime + DiabloMiner.TIME_OFFSET * 2 && currentRuns > lastRuns + diabloMiner.getGPUTargetFPS()) {\n\t\t\tbasis = (double) elapsed / (double) (currentRuns - lastRuns);\n\n\t\t\tif(basis < targetFPSBasis / 4)\n\t\t\t\tws += workSizeBase * 16;\n\t\t\telse if(basis < targetFPSBasis / 2)\n\t\t\t\tws += workSizeBase * 4;\n\t\t\telse if(basis < targetFPSBasis)\n\t\t\t\tws += workSizeBase;\n\t\t\telse if(basis > targetFPSBasis * 4)\n\t\t\t\tws -= workSizeBase * 16;\n\t\t\telse if(basis > targetFPSBasis * 2)\n\t\t\t\tws -= workSizeBase * 4;\n\t\t\telse if(basis > targetFPSBasis)\n\t\t\t\tws -= workSizeBase;\n\n\t\t\tif(ws < workSizeBase)\n\t\t\t\tws = workSizeBase;\n\t\t\telse if(ws > DiabloMiner.TWO32 / totalVectors - 1)\n\t\t\t\tws = DiabloMiner.TWO32 / totalVectors - 1;\n\n\t\t\tlastRuns = currentRuns;\n\t\t\tlastTime = now;\n\n\t\t\tworkSize.set(ws);\n\t\t}\n\t}\n\n\tpublic class GPUExecutionState extends ExecutionState {\n\t\tfinal CLCommandQueue queue;\n\n\t\tfinal CLMem output[] = new CLMem[2];\n\t\tfinal CLMem blank;\n\t\tByteBuffer outputBuffer;\n\t\tint outputIndex = 0;\n\n\t\tfinal PointerBuffer workBaseBuffer = BufferUtils.createPointerBuffer(1);\n\t\tfinal PointerBuffer workSizeBuffer = BufferUtils.createPointerBuffer(1);\n\n\t\tfinal IntBuffer errBuffer = BufferUtils.createIntBuffer(1);\n\t\tint err;\n\n\t\tWorkState workState;\n\t\tboolean requestedNewWork;\n\n\t\tfinal int[] midstate2 = new int[16];\n\t\tfinal MessageDigest digestInside;\n\t\tfinal MessageDigest digestOutside;\n\t\tfinal ByteBuffer digestInput = ByteBuffer.allocate(80);\n\t\tbyte[] digestOutput;\n\n\t\tpublic GPUExecutionState(String executionName) throws DiabloMinerFatalException {\n\t\t\tsuper(executionName);\n\n\t\t\ttry {\n\t\t\t\tdigestInside = MessageDigest.getInstance(\"SHA-256\");\n\t\t\t\tdigestOutside = MessageDigest.getInstance(\"SHA-256\");\n\t\t\t} catch(NoSuchAlgorithmException e) {\n\t\t\t\tthrow new DiabloMinerFatalException(diabloMiner, \"Your Java implementation does not have a MessageDigest for SHA-256\");\n\t\t\t}\n\n\t\t\tqueue = CL10.clCreateCommandQueue(context, device, 0, errBuffer);\n\n\t\t\tif(queue == null || errBuffer.get(0) != CL10.CL_SUCCESS) {\n\t\t\t\tthrow new DiabloMinerFatalException(diabloMiner, \"Failed to allocate queue\");\n\t\t\t}\n\n\t\t\tIntBuffer blankinit = BufferUtils.createIntBuffer(OUTPUTS * 4);\n\n\t\t\tfor(int i = 0; i < OUTPUTS; i++)\n\t\t\t\tblankinit.put(0);\n\n\t\t\tblankinit.rewind();\n\n\t\t\tif(platform_version == PlatformVersion.V1_1)\n\t\t\t\tblank = CL10.clCreateBuffer(context, CL10.CL_MEM_COPY_HOST_PTR | CL10.CL_MEM_READ_ONLY, blankinit, errBuffer);\n\t\t\telse\n\t\t\t\tblank = CL10.clCreateBuffer(context, CL10.CL_MEM_COPY_HOST_PTR | CL10.CL_MEM_READ_ONLY | CL12.CL_MEM_HOST_NO_ACCESS, blankinit, errBuffer);\n\n\t\t\tif(blank == null || errBuffer.get(0) != CL10.CL_SUCCESS)\n\t\t\t\tthrow new DiabloMinerFatalException(diabloMiner, \"Failed to allocate blank buffer\");\n\n\t\t\tblankinit.rewind();\n\n\t\t\tfor(int i = 0; i < 2; i++) {\n\t\t\t\tif(platform_version == PlatformVersion.V1_1)\n\t\t\t\t\toutput[i] = CL10.clCreateBuffer(context, CL10.CL_MEM_COPY_HOST_PTR | CL10.CL_MEM_WRITE_ONLY, blankinit, errBuffer);\n\t\t\t\telse\n\t\t\t\t\toutput[i] = CL10.clCreateBuffer(context, CL10.CL_MEM_COPY_HOST_PTR | CL10.CL_MEM_WRITE_ONLY | CL12.CL_MEM_HOST_READ_ONLY, blankinit, errBuffer);\n\n\t\t\t\tblankinit.rewind();\n\n\t\t\t\tif(output[i] == null || errBuffer.get(0) != CL10.CL_SUCCESS) {\n\t\t\t\t\tthrow new DiabloMinerFatalException(diabloMiner, \"Failed to allocate output buffer\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\toutputBuffer = CL10.clEnqueueMapBuffer(queue, output[outputIndex], 1, CL10.CL_MAP_READ, 0, OUTPUTS * 4, null, null, null);\n\n\t\t\tdiabloMiner.getNetworkStateHead().addGetQueue(this);\n\t\t\trequestedNewWork = true;\n\t\t}\n\n\t\tpublic void run() {\n\t\t\tboolean submittedBlock;\n\t\t\tboolean resetBuffer;\n\t\t\tboolean hwError;\n\t\t\tboolean skipProcessing;\n\t\t\tboolean skipUnmap = false;\n\n\t\t\twhile(diabloMiner.getRunning()) {\n\t\t\t\tsubmittedBlock = false;\n\t\t\t\tresetBuffer = false;\n\t\t\t\thwError = false;\n\t\t\t\tskipProcessing = false;\n\n\t\t\t\tWorkState workIncoming = null;\n\n\t\t\t\tif(requestedNewWork) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tworkIncoming = incomingQueue.take();\n\t\t\t\t\t} catch(InterruptedException f) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tworkIncoming = incomingQueue.poll();\n\t\t\t\t}\n\n\t\t\t\tif(workIncoming != null) {\n\t\t\t\t\tworkState = workIncoming;\n\t\t\t\t\trequestedNewWork = false;\n\t\t\t\t\tresetBuffer = true;\n\t\t\t\t\tskipProcessing = true;\n\t\t\t\t}\n\n\t\t\t\tif(!skipProcessing | !skipUnmap) {\n\t\t\t\t\tfor(int z = 0; z < OUTPUTS; z++) {\n\t\t\t\t\t\tint nonce = outputBuffer.getInt(z * 4);\n\n\t\t\t\t\t\tif(nonce != 0) {\n\t\t\t\t\t\t\tfor(int j = 0; j < 19; j++)\n\t\t\t\t\t\t\t\tdigestInput.putInt(j * 4, workState.getData(j));\n\n\t\t\t\t\t\t\tdigestInput.putInt(19 * 4, nonce);\n\n\t\t\t\t\t\t\tdigestOutput = digestOutside.digest(digestInside.digest(digestInput.array()));\n\n\t\t\t\t\t\t\tlong G = ((long) (0xFF & digestOutput[27]) << 24) | ((long) (0xFF & digestOutput[26]) << 16) | ((long) (0xFF & digestOutput[25]) << 8) | ((long) (0xFF & digestOutput[24]));\n\n\t\t\t\t\t\t\tlong H = ((long) (0xFF & digestOutput[31]) << 24) | ((long) (0xFF & digestOutput[30]) << 16) | ((long) (0xFF & digestOutput[29]) << 8) | ((long) (0xFF & digestOutput[28]));\n\n\t\t\t\t\t\t\tif(H == 0) {\n\t\t\t\t\t\t\t\tdiabloMiner.debug(\"Attempt \" + diabloMiner.incrementAttempts() + \" from \" + executionName);\n\n\t\t\t\t\t\t\t\tif(workState.getTarget(7) != 0 || G <= workState.getTarget(6)) {\n\t\t\t\t\t\t\t\t\tworkState.submitNonce(nonce);\n\t\t\t\t\t\t\t\t\tsubmittedBlock = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\thwError = true;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tresetBuffer = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif(hwError && submittedBlock == false) {\n\t\t\t\t\t\tif(hwcheck && !diabloMiner.getDebug())\n\t\t\t\t\t\t\tdiabloMiner.error(\"Invalid solution \" + diabloMiner.incrementHWErrors() + \" from \" + deviceName + \", possible driver or hardware issue\");\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tdiabloMiner.debug(\"Invalid solution \" + diabloMiner.incrementHWErrors() + \" from \" + executionName + \", possible driver or hardware issue\");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\t\t\t\tif(resetBuffer)\n\t\t\t\t\tCL10.clEnqueueCopyBuffer(queue, blank, output[outputIndex], 0, 0, OUTPUTS * 4, null, null);\n\n\t\t\t\tif(!skipUnmap) {\n\t\t\t\t\tCL10.clEnqueueUnmapMemObject(queue, output[outputIndex], outputBuffer, null, null);\n\n\t\t\t\t\toutputIndex = (outputIndex == 0) ? 1 : 0;\n\t\t\t\t}\n\n\n\n\t\t\t\tlong workBase = workState.getBase();\n\t\t\t\tlong increment = workSize.get();\n\n\t\t\t\tif(DiabloMiner.now() - 3600000 > resetNetworkState) {\n\t\t\t\t\tresetNetworkState = DiabloMiner.now();\n\n\t\t\t\t\tdiabloMiner.getNetworkStateHead().addGetQueue(this);\n\t\t\t\t\trequestedNewWork = skipUnmap = true;\n\t\t\t\t} else {\n\t\t\t\t\trequestedNewWork = skipUnmap = workState.update(increment);\n\t\t\t\t}\n\n\t\t\t\tif(!requestedNewWork) {\n\t\t\t\t\tdiabloMiner.addAndGetHashCount(increment);\n\t\t\t\t\tdeviceHashCount.addAndGet(increment);\n\t\t\t\t\truns.incrementAndGet();\n\n\t\t\t\t\tworkSizeBuffer.put(0, increment);\n\t\t\t\t\tworkBaseBuffer.put(0, workBase);\n\n\t\t\t\t\tSystem.arraycopy(workState.getMidstate(), 0, midstate2, 0, 8);\n\n\t\t\t\t\tDiabloMiner.sharound(midstate2, 0, 1, 2, 3, 4, 5, 6, 7, workState.getData(16), 0x428A2F98);\n\t\t\t\t\tDiabloMiner.sharound(midstate2, 7, 0, 1, 2, 3, 4, 5, 6, workState.getData(17), 0x71374491);\n\t\t\t\t\tDiabloMiner.sharound(midstate2, 6, 7, 0, 1, 2, 3, 4, 5, workState.getData(18), 0xB5C0FBCF);\n\n\t\t\t\t\tint W16 = workState.getData(16) + (DiabloMiner.rot(workState.getData(17), 7) ^ DiabloMiner.rot(workState.getData(17), 18) ^ (workState.getData(17) >>> 3));\n\t\t\t\t\tint W17 = workState.getData(17) + (DiabloMiner.rot(workState.getData(18), 7) ^ DiabloMiner.rot(workState.getData(18), 18) ^ (workState.getData(18) >>> 3)) + 0x01100000;\n\t\t\t\t\tint W18 = workState.getData(18) + (DiabloMiner.rot(W16, 17) ^ DiabloMiner.rot(W16, 19) ^ (W16 >>> 10));\n\t\t\t\t\tint W19 = 0x11002000 + (DiabloMiner.rot(W17, 17) ^ DiabloMiner.rot(W17, 19) ^ (W17 >>> 10));\n\t\t\t\t\tint W31 = 0x00000280 + (DiabloMiner.rot(W16, 7) ^ DiabloMiner.rot(W16, 18) ^ (W16 >>> 3));\n\t\t\t\t\tint W32 = W16 + (DiabloMiner.rot(W17, 7) ^ DiabloMiner.rot(W17, 18) ^ (W17 >>> 3));\n\n\t\t\t\t\tint PreVal4 = workState.getMidstate(4) + (DiabloMiner.rot(midstate2[1], 6) ^ DiabloMiner.rot(midstate2[1], 11) ^ DiabloMiner.rot(midstate2[1], 25)) + (midstate2[3] ^ (midstate2[1] & (midstate2[2] ^ midstate2[3]))) + 0xe9b5dba5;\n\t\t\t\t\tint T1 = (DiabloMiner.rot(midstate2[5], 2) ^ DiabloMiner.rot(midstate2[5], 13) ^ DiabloMiner.rot(midstate2[5], 22)) + ((midstate2[5] & midstate2[6]) | (midstate2[7] & (midstate2[5] | midstate2[6])));\n\n\t\t\t\t\tint PreVal4_state0 = PreVal4 + workState.getMidstate(0);\n\t\t\t\t\tint PreVal4_state0_k7 = (int) (PreVal4_state0 + 0xAB1C5ED5L);\n\t\t\t\t\tint PreVal4_T1 = PreVal4 + T1;\n\t\t\t\t\tint B1_plus_K6 = (int) (midstate2[1] + 0x923f82a4L);\n\t\t\t\t\tint C1_plus_K5 = (int) (midstate2[2] + 0x59f111f1L);\n\t\t\t\t\tint W16_plus_K16 = (int) (W16 + 0xe49b69c1L);\n\t\t\t\t\tint W17_plus_K17 = (int) (W17 + 0xefbe4786L);\n\n\t\t\t\t\tkernel.setArg(0, PreVal4_state0).setArg(1, PreVal4_state0_k7).setArg(2, PreVal4_T1).setArg(3, W18).setArg(4, W19).setArg(5, W16).setArg(6, W17).setArg(7, W16_plus_K16).setArg(8, W17_plus_K17).setArg(9, W31).setArg(10, W32).setArg(11, (int) (midstate2[3] + 0xB956c25bL)).setArg(12, midstate2[1]).setArg(13, midstate2[2]).setArg(14, midstate2[7]).setArg(15, midstate2[5]).setArg(16, midstate2[6]).setArg(17, C1_plus_K5).setArg(18, B1_plus_K6).setArg(19, workState.getMidstate(0)).setArg(20, workState.getMidstate(1)).setArg(21, workState.getMidstate(2)).setArg(22, workState.getMidstate(3)).setArg(23, workState.getMidstate(4)).setArg(24, workState.getMidstate(5)).setArg(25, workState.getMidstate(6)).setArg(26, workState.getMidstate(7)).setArg(27, output[outputIndex]);\n\n\t\t\t\t\terr = CL10.clEnqueueNDRangeKernel(queue, kernel, 1, workBaseBuffer, workSizeBuffer, localWorkSize, null, null);\n\n\t\t\t\t\tif(err != CL10.CL_SUCCESS && err != CL10.CL_INVALID_KERNEL_ARGS && err != CL10.CL_INVALID_GLOBAL_OFFSET) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tthrow new DiabloMinerFatalException(diabloMiner, \"Failed to queue kernel, error \" + err);\n\t\t\t\t\t\t} catch(DiabloMinerFatalException e) {\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif(err == CL10.CL_INVALID_KERNEL_ARGS) {\n\t\t\t\t\t\t\tdiabloMiner.debug(\"Spurious CL_INVALID_KERNEL_ARGS error, ignoring\");\n\t\t\t\t\t\t\tskipUnmap = true;\n\t\t\t\t\t\t} else if(err == CL10.CL_INVALID_GLOBAL_OFFSET) {\n\t\t\t\t\t\t\tdiabloMiner.error(\"Spurious CL_INVALID_GLOBAL_OFFSET error, offset: \" + workBase + \", work size: \" + increment);\n\t\t\t\t\t\t\tskipUnmap = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\toutputBuffer = CL10.clEnqueueMapBuffer(queue, output[outputIndex], 1, CL10.CL_MAP_READ, 0, OUTPUTS * 4, null, null, null);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/main/java/com/diablominer/DiabloMiner/DeviceState/GPUHardwareType.java",
    "content": "package com.diablominer.DiabloMiner.DeviceState;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Set;\n\nimport org.lwjgl.opencl.CL;\nimport org.lwjgl.opencl.CL10;\nimport org.lwjgl.opencl.CLDevice;\nimport org.lwjgl.opencl.CLPlatform;\n\nimport com.diablominer.DiabloMiner.DiabloMiner;\nimport com.diablominer.DiabloMiner.DiabloMinerFatalException;\n\npublic class GPUHardwareType extends HardwareType {\n\tfinal static int EXECUTION_TOTAL = 2;\n\tfinal static String UPPER[] = { \"X\", \"Y\", \"Z\", \"W\", \"T\", \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"k\" };\n\tfinal static String LOWER[] = { \"x\", \"y\", \"z\", \"w\", \"t\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\" };\n\n\tString source;\n\tdouble targetFPSBasis;\n\tint totalVectors;\n\n\tList<GPUDeviceState> deviceStates = new ArrayList<GPUDeviceState>();\n\n\tpublic GPUHardwareType(DiabloMiner diabloMiner) throws DiabloMinerFatalException {\n\t\tsuper(diabloMiner);\n\n\t\ttry {\n\t\t\tInputStream stream = DiabloMiner.class.getResourceAsStream(\"/DiabloMiner.cl\");\n\t\t\tbyte[] data = new byte[64 * 1024];\n\t\t\tint pos = 0;\n\n\t\t\twhile(pos < data.length) {\n\t\t\t\tint ret = stream.read(data, pos, data.length - pos);\n\n\t\t\t\tif(ret < 1)\n\t\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t\tpos += ret;\n\t\t\t}\n\n\t\t\tif(pos == 0)\n\t\t\t\tthrow new DiabloMinerFatalException(diabloMiner, \"Unable to read DiabloMiner.cl\");\n\n\t\t\tsource = new String(data).trim();\n\t\t\tstream.close();\n\t\t} catch(IOException e) {\n\t\t\tthrow new DiabloMinerFatalException(diabloMiner, \"Unable to read DiabloMiner.cl\");\n\t\t}\n\n\t\tString sourceLines[] = source.split(\"\\n\");\n\t\tsource = \"\";\n\n\t\tlong vectorBase = 0;\n\n\t\tInteger[] vectors = diabloMiner.getGPUVectors();\n\t\ttotalVectors = 0;\n\t\tint totalVectorsPOT;\n\n\t\tfor(Integer vector : vectors) {\n\t\t\ttotalVectors += vector;\n\t\t}\n\n\t\tif(totalVectors > 16)\n\t\t\tthrow new DiabloMinerFatalException(diabloMiner, \"DiabloMiner does not support more than 16 total vectors yet\");\n\n\t\tint powtwo = 1 << (32 - Integer.numberOfLeadingZeros(totalVectors) - 1);\n\n\t\tif(totalVectors != powtwo)\n\t\t\ttotalVectorsPOT = 1 << (32 - Integer.numberOfLeadingZeros(totalVectors));\n\t\telse\n\t\t\ttotalVectorsPOT = totalVectors;\n\n\t\tfor(int x = 0; x < sourceLines.length; x++) {\n\t\t\tString sourceLine = sourceLines[x];\n\n\t\t\tif(diabloMiner.getGPUNoArray() && !sourceLine.contains(\"z ZA\")) {\n\t\t\t\tsourceLine = sourceLine.replaceAll(\"ZA\\\\[([0-9]+)\\\\]\", \"ZA$1\");\n\t\t\t}\n\n\t\t\tif(sourceLine.contains(\"zz\")) {\n\t\t\t\tif(totalVectors > 1)\n\t\t\t\t\tsourceLine = sourceLine.replaceAll(\"zz\", String.valueOf(totalVectorsPOT));\n\t\t\t\telse\n\t\t\t\t\tsourceLine = sourceLine.replaceAll(\"zz\", \"\");\n\t\t\t}\n\n\t\t\tif(sourceLine.contains(\"= (io) ? Znonce\")) {\n\t\t\t\tint count = 0;\n\t\t\t\tString change = \"(uintzz)(\";\n\n\t\t\t\tfor(int z = 0; z < vectors.length; z++) {\n\t\t\t\t\tchange += UPPER[z] + \"nonce\";\n\t\t\t\t\tcount += vectors[z];\n\n\t\t\t\t\tif(z != vectors.length - 1)\n\t\t\t\t\t\tchange += \", \";\n\t\t\t\t}\n\n\t\t\t\tfor(int z = count; z < totalVectorsPOT; z++)\n\t\t\t\t\tchange += \", 0\";\n\n\t\t\t\tchange += \")\";\n\n\t\t\t\tsourceLine = sourceLine.replace(\"Znonce\", change);\n\n\t\t\t\tif(totalVectors > 1)\n\t\t\t\t\tsourceLine = sourceLine.replaceAll(\"zz\", String.valueOf(totalVectorsPOT));\n\t\t\t\telse\n\t\t\t\t\tsourceLine = sourceLine.replaceAll(\"zz\", \"\");\n\n\t\t\t\tsource += sourceLine + \"\\n\";\n\t\t\t} else if((sourceLine.contains(\"Z\") || sourceLine.contains(\"z\")) && !sourceLine.contains(\"__\")) {\n\t\t\t\tfor(int y = 0; y < vectors.length; y++) {\n\t\t\t\t\tString replace = sourceLine;\n\n\t\t\t\t\tif(diabloMiner.getGPUNoArray() && replace.contains(\"z ZA\")) {\n\t\t\t\t\t\treplace = \"\";\n\n\t\t\t\t\t\tfor(int z = 0; z < 930; z += 5) {\n\t\t\t\t\t\t\treplace += \"\t\t \";\n\n\t\t\t\t\t\t\tfor(int w = 0; w < 5; w++)\n\t\t\t\t\t\t\t\treplace += \"z ZA\" + (z + w) + \"; \";\n\n\t\t\t\t\t\t\treplace += \"\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif(vectors[y] > 1 && replace.contains(\"typedef\")) {\n\t\t\t\t\t\treplace = replace.replace(\"uint\", \"uint\" + vectors[y]);\n\t\t\t\t\t} else if(replace.contains(\"z Znonce\")) {\n\t\t\t\t\t\tString vectorGlobal;\n\n\t\t\t\t\t\tif(vectors[y] > 1)\n\t\t\t\t\t\t\tvectorGlobal = \" + (uint\" + vectors[y] + \")(\";\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tvectorGlobal = \" + (uint)(\";\n\n\t\t\t\t\t\tfor(int i = 0; i < vectors[y]; i++) {\n\t\t\t\t\t\t\tvectorGlobal += Long.toString((vectorBase + i));\n\n\t\t\t\t\t\t\tif(i != vectors[y] - 1)\n\t\t\t\t\t\t\t\tvectorGlobal += \", \";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tvectorGlobal += \");\";\n\n\t\t\t\t\t\treplace = replace.replace(\";\", vectorGlobal);\n\n\t\t\t\t\t\tvectorBase += vectors[y];\n\t\t\t\t\t}\n\n\t\t\t\t\tif(vectors[y] == 1 && replace.contains(\"bool Zio\")) {\n\t\t\t\t\t\treplace = replace.replace(\"any(\", \"(\");\n\t\t\t\t\t}\n\n\t\t\t\t\tsource += replace.replaceAll(\"Z\", UPPER[y]).replaceAll(\"z\", LOWER[y]) + \"\\n\";\n\t\t\t\t}\n\t\t\t} else if(totalVectors == 1 && sourceLine.contains(\"any(nonce\")) {\n\t\t\t\tsource += sourceLine.replace(\"any\", \"\") + \"\\n\";\n\t\t\t} else if(sourceLine.contains(\"__global\")) {\n\t\t\t\tif(totalVectors > 1)\n\t\t\t\t\tsource += sourceLine.replaceAll(\"uint\", \"uint\" + totalVectorsPOT) + \"\\n\";\n\t\t\t\telse\n\t\t\t\t\tsource += sourceLine + \"\\n\";\n\t\t\t} else {\n\t\t\t\tsource += sourceLine + \"\\n\";\n\t\t\t}\n\t\t}\n\n\t\tif(diabloMiner.getGPUDebugSource()) {\n\t\t\tSystem.out.println(\"\\n---\\n\" + source);\n\t\t\tthrow new DiabloMinerFatalException(diabloMiner, \"Debug kernel source output, quitting\");\n\t\t}\n\n\n\t\ttargetFPSBasis = 1000.0 / (diabloMiner.getGPUTargetFPS());\n\n\t\tList<CLPlatform> platforms = null;\n\n\t\ttry {\n\t\t\tCL.create();\n\n\t\t\tplatforms = CLPlatform.getPlatforms();\n\t\t} catch(Exception e) {\n\t\t\tthrow new DiabloMinerFatalException(diabloMiner, \"Failed to initialize OpenCL, make sure your environment is setup correctly\");\n\t\t}\n\n\t\tif(platforms == null || platforms.isEmpty())\n\t\t\tthrow new DiabloMinerFatalException(diabloMiner, \"No OpenCL platforms found\");\n\n\t\tSet<String> enabledDevices = diabloMiner.getEnabledDevices();\n\t\tint count = 1;\n\t\tint platformCount = 0;\n\n\t\tfor(CLPlatform platform : platforms) {\n\t\t\tPlatformVersion version;\n\n\t\t\tdiabloMiner.info(\"Using \" + platform.getInfoString(CL10.CL_PLATFORM_NAME).trim() + \" \" + platform.getInfoString(CL10.CL_PLATFORM_VERSION));\n\n\t\t\tString versions = platform.getInfoString(CL10.CL_PLATFORM_VERSION);\n\t\t\tif(versions.contains(\"OpenCL 1.0\"))\n\t\t\t\tversion = PlatformVersion.V1_0;\n\t\t\telse if (versions.contains(\"OpenCL 1.1\"))\n\t\t\t\tversion = PlatformVersion.V1_1;\n\t\t\telse\n\t\t\t\tversion = PlatformVersion.V1_2;\n\n\t\t\tif(version == PlatformVersion.V1_0) {\n\t\t\t\tdiabloMiner.error(\"OpenCL platform \" + platform.getInfoString(CL10.CL_PLATFORM_NAME).trim() + \" is not OpenCL 1.1 or later\");\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tList<CLDevice> devices = platform.getDevices(CL10.CL_DEVICE_TYPE_GPU | CL10.CL_DEVICE_TYPE_ACCELERATOR);\n\n\t\t\tif(devices == null || devices.isEmpty()) {\n\t\t\t\tdiabloMiner.error(\"OpenCL platform \" + platform.getInfoString(CL10.CL_PLATFORM_NAME).trim() + \" contains no devices\");\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif(devices != null) {\n\t\t\t\tfor(CLDevice device : devices) {\n\t\t\t\t\tif(enabledDevices == null || enabledDevices.contains(platformCount + \".\" + count) || enabledDevices.contains(Integer.toString(count))) {\n\t\t\t\t\t\tString deviceName = device.getInfoString(CL10.CL_DEVICE_NAME).trim() + \" (#\" + count + \")\";\n\t\t\t\t\t\tdeviceStates.add(new GPUDeviceState(this, deviceName, platform, version, device));\n\t\t\t\t\t}\n\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tplatformCount++;\n\t\t}\n\n\t\tif(deviceStates.size() == 0)\n\t\t\tthrow new DiabloMinerFatalException(diabloMiner, \"No OpenCL devices found\");\n\t}\n\n\tpublic String getSource() {\n\t\treturn source;\n\t}\n\n\tpublic double getTargetFPSBasis() {\n\t\treturn targetFPSBasis;\n\t}\n\n\tpublic int getTotalVectors() {\n\t\treturn totalVectors;\n\t}\n\n\tpublic List<? extends DeviceState> getDeviceStates() {\n\t   return deviceStates;\n   }\n}\n"
  },
  {
    "path": "src/main/java/com/diablominer/DiabloMiner/DeviceState/HardwareType.java",
    "content": "/*\n * DiabloMiner - OpenCL miner for Bitcoin\n * Copyright (C) 2010, 2011, 2012 Patrick McFarland <diablod3@gmail.com>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\tSee the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program.\tIf not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.diablominer.DiabloMiner.DeviceState;\n\nimport java.util.List;\n\nimport com.diablominer.DiabloMiner.DiabloMiner;\nimport com.diablominer.DiabloMiner.DiabloMinerFatalException;\n\nabstract public class HardwareType {\n\tDiabloMiner diabloMiner;\n\n\tList<? extends DeviceState> deviceStates = null;\n\n\tpublic HardwareType(DiabloMiner diabloMiner) throws DiabloMinerFatalException {\n\t\tthis.diabloMiner = diabloMiner;\n   }\n\n\tabstract public List<? extends DeviceState> getDeviceStates();\n\n\tpublic DiabloMiner getDiabloMiner() {\n\t\treturn diabloMiner;\n\t}\n}\n"
  },
  {
    "path": "src/main/java/com/diablominer/DiabloMiner/DeviceState/PlatformVersion.java",
    "content": "/*\n * DiabloMiner - OpenCL miner for Bitcoin\n * Copyright (C) 2010, 2011, 2012 Patrick McFarland <diablod3@gmail.com>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.diablominer.DiabloMiner.DeviceState;\n\npublic enum PlatformVersion {\n  V1_0,\n  V1_1,\n  V1_2\n}\n"
  },
  {
    "path": "src/main/java/com/diablominer/DiabloMiner/DiabloMiner.java",
    "content": "/*\n * DiabloMiner - OpenCL miner for Bitcoin\n * Copyright (C) 2010, 2011, 2012 Patrick McFarland <diablod3@gmail.com>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\tSee the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program.\tIf not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.diablominer.DiabloMiner;\n\nimport java.net.Authenticator;\nimport java.net.InetSocketAddress;\nimport java.net.MalformedURLException;\nimport java.net.PasswordAuthentication;\nimport java.net.Proxy;\nimport java.net.Proxy.Type;\nimport java.net.URL;\nimport java.text.DateFormat;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Date;\nimport java.util.Formatter;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.HashSet;\nimport java.util.concurrent.atomic.AtomicBoolean;\nimport java.util.concurrent.atomic.AtomicLong;\n\nimport org.apache.commons.cli.CommandLine;\nimport org.apache.commons.cli.HelpFormatter;\nimport org.apache.commons.cli.Options;\nimport org.apache.commons.cli.ParseException;\nimport org.apache.commons.cli.PosixParser;\n\nimport com.diablominer.DiabloMiner.DeviceState.DeviceState;\nimport com.diablominer.DiabloMiner.DeviceState.GPUHardwareType;\nimport com.diablominer.DiabloMiner.NetworkState.JSONRPCNetworkState;\nimport com.diablominer.DiabloMiner.NetworkState.NetworkState;\n\npublic class DiabloMiner {\n\tpublic final static long TWO32 = 4294967295L;\n\tpublic final static long TIME_OFFSET = 7500;\n\n\tNetworkState networkStateHead = null;\n\tNetworkState networkStateTail = null;\n\tProxy proxy = null;\n\tint workLifetime = 5000;\n\n\tboolean debug = false;\n\tboolean debugtimer = false;\n\n\tdouble GPUTargetFPS = 30.0;\n\tdouble GPUTargetFPSBasis;\n\tint GPUForceWorkSize = 0;\n\tInteger GPUVectors[] = null;\n\tboolean GPUNoArray = false;\n\tboolean GPUDebugSource = false;\n\n\tString source;\n\n\tAtomicBoolean running = new AtomicBoolean(true);\n\tList<Thread> threads = new ArrayList<Thread>();\n\n\tlong startTime;\n\n\tAtomicLong blocks = new AtomicLong(0);\n\tAtomicLong attempts = new AtomicLong(0);\n\tAtomicLong rejects = new AtomicLong(0);\n\tAtomicLong hwErrors = new AtomicLong(0);\n\tSet<String> enabledDevices = null;\n\tAtomicLong hashCount = new AtomicLong(0);\n\n\tfinal static String CLEAR = \"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \";\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tDiabloMiner diabloMiner = new DiabloMiner();\n\n\t\ttry {\n\t\t\tdiabloMiner.execute(args);\n\t\t} catch(DiabloMinerFatalException e) {\n\t\t\tSystem.exit(-1);\n\t\t}\n\t}\n\n\tvoid execute(String[] args) throws Exception {\n\t\tthreads.add(Thread.currentThread());\n\n\t\tOptions options = new Options();\n\t\toptions.addOption(\"u\", \"user\", true, \"bitcoin host username\");\n\t\toptions.addOption(\"p\", \"pass\", true, \"bitcoin host password\");\n\t\toptions.addOption(\"o\", \"host\", true, \"bitcoin host IP\");\n\t\toptions.addOption(\"r\", \"port\", true, \"bitcoin host port\");\n\t\toptions.addOption(\"l\", \"url\", true, \"bitcoin host url\");\n\t\toptions.addOption(\"x\", \"proxy\", true, \"optional proxy settings IP:PORT<:username:password>\");\n\t\toptions.addOption(\"g\", \"worklifetime\", true, \"maximum work lifetime in seconds\");\n\t\toptions.addOption(\"d\", \"debug\", false, \"enable debug output\");\n\t\toptions.addOption(\"dt\", \"debugtimer\", false, \"run for 1 minute and quit\");\n\t\toptions.addOption(\"D\", \"devices\", true, \"devices to enable, default all\");\n\t\toptions.addOption(\"f\", \"fps\", true, \"target GPU execution timing\");\n\t\toptions.addOption(\"na\", \"noarray\", false, \"turn GPU kernel array off\");\n\t\toptions.addOption(\"v\", \"vectors\", true, \"vector size in GPU kernel\");\n\t\toptions.addOption(\"w\", \"worksize\", true, \"override GPU worksize\");\n\t\toptions.addOption(\"ds\", \"ksource\", false, \"output GPU kernel source and quit\");\n\t\toptions.addOption(\"h\", \"help\", false, \"this help\");\n\n\t\tPosixParser parser = new PosixParser();\n\n\t\tCommandLine line = null;\n\n\t\ttry {\n\t\t\tline = parser.parse(options, args);\n\n\t\t\tif(line.hasOption(\"help\")) {\n\t\t\t\tthrow new ParseException(\"\");\n\t\t\t}\n\t\t} catch(ParseException e) {\n\t\t\tSystem.out.println(e.getLocalizedMessage() + \"\\n\");\n\t\t\tHelpFormatter formatter = new HelpFormatter();\n\t\t\tformatter.printHelp(\"DiabloMiner -u myuser -p mypassword [args]\\n\", \"\", options, \"\\nRemember to set rpcuser and rpcpassword in your ~/.bitcoin/bitcoin.conf \" + \"before starting bitcoind or bitcoin --daemon\");\n\t\t\treturn;\n\t\t}\n\n\t\tString splitUrl[] = null;\n\t\tString splitUser[] = null;\n\t\tString splitPass[] = null;\n\t\tString splitHost[] = null;\n\t\tString splitPort[] = null;\n\n\t\tif(line.hasOption(\"url\"))\n\t\t\tsplitUrl = line.getOptionValue(\"url\").split(\",\");\n\n\t\tif(line.hasOption(\"user\"))\n\t\t\tsplitUser = line.getOptionValue(\"user\").split(\",\");\n\n\t\tif(line.hasOption(\"pass\"))\n\t\t\tsplitPass = line.getOptionValue(\"pass\").split(\",\");\n\n\t\tif(line.hasOption(\"host\"))\n\t\t\tsplitHost = line.getOptionValue(\"host\").split(\",\");\n\n\t\tif(line.hasOption(\"port\"))\n\t\t\tsplitPort = line.getOptionValue(\"port\").split(\",\");\n\n\t\tint networkStatesCount = 0;\n\n\t\tif(splitUrl != null)\n\t\t\tnetworkStatesCount = splitUrl.length;\n\n\t\tif(splitUser != null)\n\t\t\tnetworkStatesCount = Math.max(splitUser.length, networkStatesCount);\n\n\t\tif(splitPass != null)\n\t\t\tnetworkStatesCount = Math.max(splitPass.length, networkStatesCount);\n\n\t\tif(splitHost != null)\n\t\t\tnetworkStatesCount = Math.max(splitHost.length, networkStatesCount);\n\n\t\tif(splitPort != null)\n\t\t\tnetworkStatesCount = Math.max(splitPort.length, networkStatesCount);\n\n\t\tif(networkStatesCount == 0) {\n\t\t\terror(\"You forgot to give any bitcoin connection info, please add either -l, or -u -p -o and -r\");\n\t\t\tSystem.exit(-1);\n\t\t}\n\n\t\tint j = 0;\n\n\t\tfor(int i = 0; j < networkStatesCount; i++, j++) {\n\t\t\tString protocol = \"http\";\n\t\t\tString host = \"localhost\";\n\t\t\tint port = 8332;\n\t\t\tString path = \"/\";\n\t\t\tString user = \"diablominer\";\n\t\t\tString pass = \"diablominer\";\n\t\t\tbyte hostChain = 0;\n\n\t\t\tif(splitUrl != null && splitUrl.length > i) {\n\t\t\t\tString[] usernameFix = splitUrl[i].split(\"@\", 3);\n\t\t\t\tif(usernameFix.length > 2)\n\t\t\t\t\tsplitUrl[i] = usernameFix[0] + \"+++++\" + usernameFix[1] + \"@\" + usernameFix[2];\n\n\t\t\t\tURL url = new URL(splitUrl[i]);\n\n\t\t\t\tif(url.getProtocol() != null && url.getProtocol().length() > 1)\n\t\t\t\t\tprotocol = url.getProtocol();\n\n\t\t\t\tif(url.getHost() != null && url.getHost().length() > 1)\n\t\t\t\t\thost = url.getHost();\n\n\t\t\t\tif(url.getPort() != -1)\n\t\t\t\t\tport = url.getPort();\n\n\t\t\t\tif(url.getPath() != null && url.getPath().length() > 1)\n\t\t\t\t\tpath = url.getPath();\n\n\t\t\t\tif(url.getUserInfo() != null && url.getUserInfo().length() > 1) {\n\t\t\t\t\tString[] userPassSplit = url.getUserInfo().split(\":\");\n\n\t\t\t\t\tuser = userPassSplit[0].replace(\"+++++\", \"@\");\n\n\t\t\t\t\tif(userPassSplit.length > 1 && userPassSplit[1].length() > 1)\n\t\t\t\t\t\tpass = userPassSplit[1];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(splitUser != null && splitUser.length > i)\n\t\t\t\tuser = splitUser[i];\n\n\t\t\tif(splitPass != null && splitPass.length > i)\n\t\t\t\tpass = splitPass[i];\n\n\t\t\tif(splitHost != null && splitHost.length > i)\n\t\t\t\thost = splitHost[i];\n\n\t\t\tif(splitPort != null && splitPort.length > i)\n\t\t\t\tport = Integer.parseInt(splitPort[i]);\n\n\t\t\tNetworkState networkState;\n\n\t\t\ttry {\n\t\t\t\tnetworkState = new JSONRPCNetworkState(this, new URL(protocol, host, port, path), user, pass, hostChain);\n\t\t\t} catch(MalformedURLException e) {\n\t\t\t\tthrow new DiabloMinerFatalException(this, \"Malformed connection parameters\");\n\t\t\t}\n\n\t\t\tif(networkStateHead == null) {\n\t\t\t\tnetworkStateHead = networkStateTail = networkState;\n\t\t\t} else {\n\t\t\t\tnetworkStateTail.setNetworkStateNext(networkState);\n\t\t\t\tnetworkStateTail = networkState;\n\t\t\t}\n\t\t}\n\n\t\tnetworkStateTail.setNetworkStateNext(networkStateHead);\n\n\t\tif(line.hasOption(\"proxy\")) {\n\t\t\tfinal String[] proxySettings = line.getOptionValue(\"proxy\").split(\":\");\n\n\t\t\tif(proxySettings.length >= 2) {\n\t\t\t\tproxy = new Proxy(Type.HTTP, new InetSocketAddress(proxySettings[0], Integer.valueOf(proxySettings[1])));\n\t\t\t}\n\n\t\t\tif(proxySettings.length >= 3) {\n\t\t\t\tAuthenticator.setDefault(new Authenticator() {\n\t\t\t\t\tprotected PasswordAuthentication getPasswordAuthentication() {\n\t\t\t\t\t\treturn new PasswordAuthentication(proxySettings[2], proxySettings[3].toCharArray());\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tif(line.hasOption(\"worklifetime\"))\n\t\t\tworkLifetime = Integer.parseInt(line.getOptionValue(\"worklifetime\")) * 1000;\n\n\t\tif(line.hasOption(\"debug\"))\n\t\t\tdebug = true;\n\n\t\tif(line.hasOption(\"debugtimer\")) \n\t\t\tdebugtimer = true;\n\t\n\n\t\tif(line.hasOption(\"devices\")) {\n\t\t\tString devices[] = line.getOptionValue(\"devices\").split(\",\");\n\t\t\tenabledDevices = new HashSet<String>();\n\t\t\tfor(String s : devices) {\n\t\t\t\tenabledDevices.add(s);\n\n\t\t\t\tif(Integer.parseInt(s) == 0) {\n\t\t\t\t\terror(\"Do not use 0 with -D, devices start at 1\");\n\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(line.hasOption(\"fps\")) {\n\t\t\tGPUTargetFPS = Float.parseFloat(line.getOptionValue(\"fps\"));\n\n\t\t\tif(GPUTargetFPS < 0.1) {\n\t\t\t\terror(\"--fps argument is too low, adjusting to 0.1\");\n\t\t\t\tGPUTargetFPS = 0.1;\n\t\t\t}\n\t\t}\n\n\t\tif(line.hasOption(\"noarray\")) \n\t\t\tGPUNoArray = true;\n\t\t\n\n\t\tif(line.hasOption(\"worksize\"))\n\t\t\tGPUForceWorkSize = Integer.parseInt(line.getOptionValue(\"worksize\"));\n\n\t\tif(line.hasOption(\"vectors\")) {\n\t\t\tString tempVectors[] = line.getOptionValue(\"vectors\").split(\",\");\n\n\t\t\tGPUVectors = new Integer[tempVectors.length];\n\n\t\t\ttry {\n\t\t\t\tfor(int i = 0; i < GPUVectors.length; i++) {\n\t\t\t\t\tGPUVectors[i] = Integer.parseInt(tempVectors[i]);\n\n\t\t\t\t\tif(GPUVectors[i] > 16) {\n\t\t\t\t\t\terror(\"DiabloMiner now uses comma-separated vector layouts, use those instead\");\n\t\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t\t} else if(GPUVectors[i] != 1 && GPUVectors[i] != 2 && GPUVectors[i] != 3 && GPUVectors[i] != 4 && GPUVectors[i] != 8 && GPUVectors[i] != 16) {\n\t\t\t\t\t\terror(GPUVectors[i] + \" is not a vector length of 1, 2, 3, 4, 8, or 16\");\n\t\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tArrays.sort(GPUVectors, Collections.reverseOrder());\n\t\t\t} catch(NumberFormatException e) {\n\t\t\t\terror(\"Cannot parse --vector argument(s)\");\n\t\t\t\tSystem.exit(-1);\n\t\t\t}\n\t\t} else {\n\t\t\tGPUVectors = new Integer[1];\n\t\t\tGPUVectors[0] = 1;\n\t\t}\n\n\t\tif(line.hasOption(\"ds\"))\n\t\t\tGPUDebugSource = true;\n\n\t\tinfo(\"Started\");\n\n\t\tStringBuilder list = new StringBuilder(networkStateHead.getQueryUrl().toString());\n\t\tNetworkState networkState = networkStateHead.getNetworkStateNext();\n\n\t\twhile(networkState != networkStateHead) {\n\t\t\tlist.append(\", \" + networkState.getQueryUrl());\n\t\t\tnetworkState = networkState.getNetworkStateNext();\n\t\t}\n\n\t\tinfo(\"Connecting to: \" + list);\n\n\t\tlong previousHashCount = 0;\n\t\tdouble previousAdjustedHashCount = 0.0;\n\t\tlong previousAdjustedStartTime = startTime = (now()) - 1;\n\t\tStringBuilder hashMeter = new StringBuilder(80);\n\t\tFormatter hashMeterFormatter = new Formatter(hashMeter);\n\n\t\tint deviceCount = 0;\n\n\t\tList<List<? extends DeviceState>> allDeviceStates = new ArrayList<List<? extends DeviceState>>();\n\n\t\tList<? extends DeviceState> GPUDeviceStates = new GPUHardwareType(this).getDeviceStates();\n\t\tdeviceCount += GPUDeviceStates.size();\n\t\tallDeviceStates.add(GPUDeviceStates);\n\n\t\twhile(running.get()) {\n\t\t\tfor(List<? extends DeviceState> deviceStates : allDeviceStates) {\n\t\t\t\tfor(DeviceState deviceState : deviceStates) {\n\t\t\t\t\tdeviceState.checkDevice();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlong now = now();\n\t\t\tlong currentHashCount = hashCount.get();\n\t\t\tdouble adjustedHashCount = (double) (currentHashCount - previousHashCount) / (double) (now - previousAdjustedStartTime);\n\t\t\tdouble hashLongCount = (double) currentHashCount / (double) (now - startTime) / 1000.0;\n\n\t\t\tif(now - startTime > TIME_OFFSET * 2) {\n\t\t\t\tdouble averageHashCount = (adjustedHashCount + previousAdjustedHashCount) / 2.0 / 1000.0;\n\n\t\t\t\thashMeter.setLength(0);\n\n\t\t\t\tif(!debug) {\n\t\t\t\t\thashMeterFormatter.format(\"\\rmhash: %.1f/%.1f | accept: %d | reject: %d | hw error: %d\", averageHashCount, hashLongCount, blocks.get(), rejects.get(), hwErrors.get());\n\t\t\t\t} else {\n\t\t\t\t\thashMeterFormatter.format(\"\\rmh: %.1f/%.1f | a/r/hwe: %d/%d/%d | gh: \", averageHashCount, hashLongCount, blocks.get(), rejects.get(), hwErrors.get());\n\n\t\t\t\t\tdouble basisAverage = 0.0;\n\n\t\t\t\t\tfor(List<? extends DeviceState> deviceStates : allDeviceStates) {\n\t\t\t\t\t\tfor(DeviceState deviceState : deviceStates) {\n\t\t\t\t\t\t\thashMeterFormatter.format(\"%.1f \", deviceState.getDeviceHashCount() / 1000.0 / 1000.0 / 1000.0);\n\t\t\t\t\t\t\tbasisAverage += deviceState.getBasis();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbasisAverage = 1000 / (basisAverage / deviceCount);\n\n\t\t\t\t\thashMeterFormatter.format(\"| fps: %.1f\", basisAverage);\n\t\t\t\t}\n\n\t\t\t\tSystem.out.print(hashMeter);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(\"\\rWaiting...\");\n\t\t\t}\n\n\t\t\tif(now() - TIME_OFFSET * 2 > previousAdjustedStartTime) {\n\t\t\t\tpreviousHashCount = currentHashCount;\n\t\t\t\tpreviousAdjustedHashCount = adjustedHashCount;\n\t\t\t\tpreviousAdjustedStartTime = now - 1;\n\t\t\t}\n\n\t\t\tif(debugtimer && now() > startTime + 60 * 1000) {\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t\tinfo(\"Debug timer is up, quitting...\");\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tif(now - startTime > TIME_OFFSET)\n\t\t\t\t\tThread.sleep(1000);\n\t\t\t\telse\n\t\t\t\t\tThread.sleep(1);\n\t\t\t} catch(InterruptedException e) {\n\t\t\t}\n\t\t}\n\n\t\thashMeterFormatter.close();\n\t}\n\n\tpublic static int rot(int x, int y) {\n\t\treturn (x >>> y) | (x << (32 - y));\n\t}\n\n\tpublic static void sharound(int out[], int na, int nb, int nc, int nd, int ne, int nf, int ng, int nh, int x, int K) {\n\t\tint a = out[na];\n\t\tint b = out[nb];\n\t\tint c = out[nc];\n\t\tint d = out[nd];\n\t\tint e = out[ne];\n\t\tint f = out[nf];\n\t\tint g = out[ng];\n\t\tint h = out[nh];\n\n\t\tint t1 = h + (rot(e, 6) ^ rot(e, 11) ^ rot(e, 25)) + ((e & f) ^ ((~e) & g)) + K + x;\n\t\tint t2 = (rot(a, 2) ^ rot(a, 13) ^ rot(a, 22)) + ((a & b) ^ (a & c) ^ (b & c));\n\n\t\tout[nd] = d + t1;\n\t\tout[nh] = t1 + t2;\n\t}\n\n\tpublic static String dateTime() {\n\t\treturn \"[\" + DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(new Date()) + \"]\";\n\t}\n\n\tpublic void info(String msg) {\n\t\tSystem.out.println(\"\\r\" + CLEAR + \"\\r\" + dateTime() + \" \" + msg);\n\t\tthreads.get(0).interrupt();\n\t}\n\n\tpublic void debug(String msg) {\n\t\tif(debug) {\n\t\t\tSystem.out.println(\"\\r\" + CLEAR + \"\\r\" + dateTime() + \" DEBUG: \" + msg);\n\t\t\tthreads.get(0).interrupt();\n\t\t}\n\t}\n\n\tpublic void error(String msg) {\n\t\tSystem.err.println(\"\\r\" + CLEAR + \"\\r\" + dateTime() + \" ERROR: \" + msg);\n\t\tthreads.get(0).interrupt();\n\t}\n\n\tpublic void addThread(Thread thread) {\n\t\tthreads.add(thread);\n\t}\n\n\tpublic long incrementBlocks() {\n\t\treturn blocks.incrementAndGet();\n\t}\n\n\tpublic long incrementAttempts() {\n\t\treturn attempts.incrementAndGet();\n\t}\n\n\tpublic long incrementRejects() {\n\t\treturn rejects.incrementAndGet();\n\t}\n\n\tpublic long incrementHWErrors() {\n\t\treturn hwErrors.incrementAndGet();\n\t}\n\n\tpublic long addAndGetHashCount(long delta) {\n\t\treturn hashCount.addAndGet(delta);\n\t}\n\n\tpublic static long now() {\n\t\treturn System.nanoTime() / 1000000;\n\t}\n\n\tpublic void halt() {\n\t\trunning.set(false);\n\n\t\tfor(int i = 0; i < threads.size(); i++) {\n\t\t\tThread thread = threads.get(i);\n\t\t\tif(thread != Thread.currentThread())\n\t\t\t\tthread.interrupt();\n\t\t}\n\t}\n\n\tpublic boolean getDebug() {\n\t\treturn debug;\n\t}\n\n\tpublic Set<String> getEnabledDevices() {\n\t\treturn enabledDevices;\n\t}\n\n\tpublic NetworkState getNetworkStateHead() {\n\t\treturn networkStateHead;\n\t}\n\n\tpublic Proxy getProxy() {\n\t\treturn proxy;\n\t}\n\n\tpublic int getWorkLifetime() {\n\t\treturn workLifetime;\n\t}\n\n\tpublic boolean getRunning() {\n\t\treturn running.get();\n\t}\n\n\tpublic double getGPUTargetFPS() {\n\t\treturn GPUTargetFPS;\n\t}\n\n\tpublic int getGPUForceWorkSize() {\n\t\treturn GPUForceWorkSize;\n\t}\n\n\tpublic Integer[] getGPUVectors() {\n\t\treturn GPUVectors;\n\t}\n\n\tpublic boolean getGPUNoArray() {\n\t\treturn GPUNoArray;\n\t}\n\n\tpublic boolean getGPUDebugSource() {\n\t\treturn GPUDebugSource;\n\t}\n}\n"
  },
  {
    "path": "src/main/java/com/diablominer/DiabloMiner/DiabloMinerFatalException.java",
    "content": "/*\n * DiabloMiner - OpenCL miner for Bitcoin\n * Copyright (C) 2010, 2011, 2012 Patrick McFarland <diablod3@gmail.com>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\tSee the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program.\tIf not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.diablominer.DiabloMiner;\n\npublic class DiabloMinerFatalException extends Exception {\n\tpublic DiabloMinerFatalException(DiabloMiner diabloMiner, String reason) {\n\t\tsuper(reason);\n\t\tdiabloMiner.error(reason);\n\t\tdiabloMiner.halt();\n\t}\n\n\tprivate static final long serialVersionUID = -9022549833049053386L;\n}"
  },
  {
    "path": "src/main/java/com/diablominer/DiabloMiner/NetworkState/JSONRPCNetworkState.java",
    "content": "/*\n * DiabloMiner - OpenCL miner for BitCoin\n * Copyright (C) 2010, 2011, 2012 Patrick McFarland <diablod3@gmail.com>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\tSee the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program.\tIf not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.diablominer.DiabloMiner.NetworkState;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.OutputStreamWriter;\nimport java.io.Writer;\nimport java.net.HttpURLConnection;\nimport java.net.Proxy;\nimport java.net.URL;\nimport java.util.Formatter;\nimport java.util.concurrent.LinkedBlockingDeque;\nimport java.util.zip.GZIPInputStream;\nimport java.util.zip.InflaterInputStream;\n\nimport org.apache.commons.codec.binary.Base64;\nimport org.codehaus.jackson.JsonNode;\nimport org.codehaus.jackson.JsonProcessingException;\nimport org.codehaus.jackson.map.ObjectMapper;\nimport org.codehaus.jackson.node.ArrayNode;\nimport org.codehaus.jackson.node.NullNode;\nimport org.codehaus.jackson.node.ObjectNode;\n\nimport com.diablominer.DiabloMiner.DiabloMiner;\nimport com.diablominer.DiabloMiner.DeviceState.DeviceState.ExecutionState;\n\npublic class JSONRPCNetworkState extends NetworkState {\n\tURL longPollUrl;\n\tString userPass;\n\n\tboolean rollNTime = false;\n\tboolean noDelay = false;\n\tString rejectReason = null;\n\n\tfinal GetWorkAsync getWorkAsync = this.new GetWorkAsync();\n\tfinal SendWorkAsync sendWorkAsync = this.new SendWorkAsync();\n\n\tLongPollAsync longPollAsync = null;\n\tLinkedBlockingDeque<WorkState> incomingQueue = new LinkedBlockingDeque<WorkState>();\n\n\tfinal ObjectMapper mapper = new ObjectMapper();\n\n\tpublic JSONRPCNetworkState(DiabloMiner diabloMiner, URL queryUrl, String user, String pass, byte hostChain) {\n\t\tsuper(diabloMiner, queryUrl, user, pass, hostChain);\n\t\tthis.userPass = \"Basic \" + Base64.encodeBase64String((user + \":\" + pass).getBytes()).trim().replace(\"\\r\\n\", \"\");\n\n\t\tThread thread = new Thread(getWorkAsync, \"DiabloMiner JSONRPC GetWorkAsync for \" + queryUrl.getHost());\n\t\tthread.start();\n\t\tdiabloMiner.addThread(thread);\n\n\t\tthread = new Thread(sendWorkAsync, \"DiabloMiner JSONRPC SendWorkAsync for \" + queryUrl.getHost());\n\t\tthread.start();\n\t\tdiabloMiner.addThread(thread);\n\t}\n\n\tJsonNode doJSONRPCCall(boolean longPoll, ObjectNode message) throws IOException {\n      HttpURLConnection connection = null;\n\t\ttry {\n\t      URL url;\n\n\t      if(longPoll)\n\t      \turl = longPollUrl;\n\t      else\n\t      \turl = queryUrl;\n\n\t      Proxy proxy = diabloMiner.getProxy();\n\n\t      if(proxy == null)\n\t      \tconnection = (HttpURLConnection) url.openConnection();\n\t      else\n\t      \tconnection = (HttpURLConnection) url.openConnection(proxy);\n\n\t      if(longPoll) {\n\t      \tconnection.setConnectTimeout(10 * 60 * 1000);\n\t      \tconnection.setReadTimeout(10 * 60 * 1000);\n\t      } else {\n\t      \tconnection.setConnectTimeout(15 * 1000);\n\t      \tconnection.setReadTimeout(15 * 1000);\n\t      }\n\n\t      connection.setRequestProperty(\"Authorization\", userPass);\n\t      connection.setRequestProperty(\"Accept\", \"application/json\");\n\t      connection.setRequestProperty(\"Accept-Encoding\", \"gzip,deflate\");\n\t      connection.setRequestProperty(\"Content-Type\", \"application/json\");\n\t      connection.setRequestProperty(\"Cache-Control\", \"no-cache\");\n\t      connection.setRequestProperty(\"User-Agent\", \"DiabloMiner\");\n\t      connection.setRequestProperty(\"X-Mining-Extensions\", \"longpoll rollntime switchto\");\n\t      connection.setDoOutput(true);\n\n\t      OutputStream requestStream = connection.getOutputStream();\n\t      Writer request = new OutputStreamWriter(requestStream);\n\t      request.write(message.toString());\n\t      request.close();\n\t      requestStream.close();\n\n\t      ObjectNode responseMessage = null;\n\n\t      InputStream responseStream = null;\n\n\t      try {\n\t      \tString xLongPolling = connection.getHeaderField(\"X-Long-Polling\");\n\n\t      \tif(xLongPolling != null && !\"\".equals(xLongPolling) && longPollAsync == null) {\n\t      \t\tif(xLongPolling.startsWith(\"http\"))\n\t      \t\t\tlongPollUrl = new URL(xLongPolling);\n\t      \t\telse if(xLongPolling.startsWith(\"/\"))\n\t      \t\t\tlongPollUrl = new URL(queryUrl.getProtocol(), queryUrl.getHost(), queryUrl.getPort(), xLongPolling);\n\t      \t\telse\n\t      \t\t\tlongPollUrl = new URL(queryUrl.getProtocol(), queryUrl.getHost(), queryUrl.getPort(), (url.getFile() + \"/\" + xLongPolling).replace(\"//\", \"/\"));\n\n\t      \t\tlongPollAsync = new LongPollAsync();\n\t      \t\tThread thread = new Thread(longPollAsync, \"DiabloMiner JSONRPC LongPollAsync for \" + url.getHost());\n\t      \t\tthread.start();\n\t      \t\tdiabloMiner.addThread(thread);\n\n\t      \t\tworkLifetime = 60000;\n\n\t      \t\tdiabloMiner.debug(queryUrl.getHost() + \": Enabling long poll support\");\n\t      \t}\n\n\t      \tString xRollNTime = connection.getHeaderField(\"X-Roll-NTime\");\n\n\t      \tif(xRollNTime != null && !\"\".equals(xRollNTime)) {\n\t      \t\tif(!\"n\".equalsIgnoreCase(xRollNTime) && rollNTime == false) {\n\t      \t\t\trollNTime = true;\n\n\t      \t\t\tif(xRollNTime.startsWith(\"expire=\")) {\n\t      \t\t\t\ttry {\n\t      \t\t\t\t\tworkLifetime = Integer.parseInt(xRollNTime.substring(7)) * 1000;\n\t      \t\t\t\t} catch(NumberFormatException ex) { }\n\t      \t\t\t} else {\n\t      \t\t\t\tworkLifetime = 60000;\n\t      \t\t\t}\n\n\t      \t\t\tdiabloMiner.debug(queryUrl.getHost() + \": Enabling roll ntime support, expire after \" + (workLifetime / 1000) + \" seconds\");\n\t      \t\t} else if(\"n\".equalsIgnoreCase(xRollNTime) && rollNTime == true) {\n\t      \t\t\trollNTime = false;\n\n\t      \t\t\tif(longPoll)\n\t      \t\t\t\tworkLifetime = 60000;\n\t      \t\t\telse\n\t      \t\t\t\tworkLifetime = diabloMiner.getWorkLifetime();\n\n\t      \t\t\tdiabloMiner.debug(queryUrl.getHost() + \": Disabling roll ntime support\");\n\t      \t\t}\n\t      \t}\n\n\t      \tString xSwitchTo = connection.getHeaderField(\"X-Switch-To\");\n\n\t      \tif(xSwitchTo != null && !\"\".equals(xSwitchTo)) {\n\t      \t\tString oldHost = queryUrl.getHost();\n\t      \t\tJsonNode newHost = mapper.readTree(xSwitchTo);\n\n\t      \t\tqueryUrl = new URL(queryUrl.getProtocol(), newHost.get(\"host\").asText(), newHost.get(\"port\").getIntValue(), queryUrl.getPath());\n\n\t      \t\tif(longPollUrl != null)\n\t      \t\t\tlongPollUrl = new URL(longPollUrl.getProtocol(), newHost.get(\"host\").asText(), newHost.get(\"port\").getIntValue(), longPollUrl.getPath());\n\n\t      \t\tdiabloMiner.info(oldHost + \": Switched to \" + queryUrl.getHost());\n\t      \t}\n\n\t      \tString xRejectReason = connection.getHeaderField(\"X-Reject-Reason\");\n\n\t      \tif(xRejectReason != null && !\"\".equals(xRejectReason)) {\n\t      \t\trejectReason = xRejectReason;\n\t      \t}\n\n\t      \tString xIsP2Pool = connection.getHeaderField(\"X-Is-P2Pool\");\n\n\t      \tif(xIsP2Pool != null && !\"\".equals(xIsP2Pool)) {\n\t      \t\tif(!noDelay)\n\t      \t\t\tdiabloMiner.info(\"P2Pool no delay mode enabled\");\n\n\t      \t\tnoDelay = true;\n\t      \t}\n\n\t      \tif(connection.getContentEncoding() != null) {\n\t      \t\tif(connection.getContentEncoding().equalsIgnoreCase(\"gzip\"))\n\t      \t\t\tresponseStream = new GZIPInputStream(connection.getInputStream());\n\t      \t\telse if(connection.getContentEncoding().equalsIgnoreCase(\"deflate\"))\n\t      \t\t\tresponseStream = new InflaterInputStream(connection.getInputStream());\n\t      \t} else {\n\t      \t\tresponseStream = connection.getInputStream();\n\t      \t}\n\n\t      \tif(responseStream == null)\n\t      \t\tthrow new IOException(\"Drop to error handler\");\n\n\t      \tObject output = mapper.readTree(responseStream);\n\n\t      \tif(NullNode.class.equals(output.getClass())) {\n\t      \t\tthrow new IOException(\"Bitcoin returned unparsable JSON\");\n\t      \t} else {\n\t      \t\ttry {\n\t      \t\t\tresponseMessage = (ObjectNode) output;\n\t      \t\t} catch(ClassCastException e) {\n\t      \t\t\tthrow new IOException(\"Bitcoin returned unparsable JSON\");\n\t      \t\t}\n\t      \t}\n\n\t      \tresponseStream.close();\n\t      } catch(JsonProcessingException e) {\n\t      \tthrow new IOException(\"Bitcoin returned unparsable JSON\");\n\t      } catch(IOException e) {\n\t      \tInputStream errorStream = null;\n\t      \tIOException e2 = null;\n\n\t      \tif(connection.getErrorStream() == null)\n\t      \t\tthrow new IOException(\"Bitcoin disconnected during response: \" + connection.getResponseCode() + \" \" + connection.getResponseMessage());\n\n\t      \tif(connection.getContentEncoding() != null) {\n\t      \t\tif(connection.getContentEncoding().equalsIgnoreCase(\"gzip\"))\n\t      \t\t\terrorStream = new GZIPInputStream(connection.getErrorStream());\n\t      \t\telse if(connection.getContentEncoding().equalsIgnoreCase(\"deflate\"))\n\t      \t\t\terrorStream = new InflaterInputStream(connection.getErrorStream());\n\t      \t} else {\n\t      \t\terrorStream = connection.getErrorStream();\n\t      \t}\n\n\t      \tif(errorStream == null)\n\t      \t\tthrow new IOException(\"Bitcoin disconnected during response: \" + connection.getResponseCode() + \" \" + connection.getResponseMessage());\n\n\t      \tbyte[] errorbuf = new byte[8192];\n\n\t      \tif(errorStream.read(errorbuf) < 1)\n\t      \t\tthrow new IOException(\"Bitcoin returned an error, but with no message\");\n\n\t      \tString error = new String(errorbuf).trim();\n\n\t      \tif(error.startsWith(\"{\")) {\n\t      \t\ttry {\n\t      \t\t\tObject output = mapper.readTree(error);\n\n\t      \t\t\tif(NullNode.class.equals(output.getClass()))\n\t      \t\t\t\tthrow new IOException(\"Bitcoin returned an error message: \" + error);\n\t      \t\t\telse\n\t      \t\t\t\ttry {\n\t      \t\t\t\t\tresponseMessage = (ObjectNode) output;\n\t      \t\t\t\t} catch(ClassCastException f) {\n\t      \t\t\t\t\tthrow new IOException(\"Bitcoin returned unparsable JSON\");\n\t      \t\t\t\t}\n\n\t      \t\t\tif(responseMessage.get(\"error\") != null) {\n\t      \t\t\t\tif(responseMessage.get(\"error\").get(\"message\") != null && responseMessage.get(\"error\").get(\"message\").asText() != null) {\n\t      \t\t\t\t\terror = responseMessage.get(\"error\").get(\"message\").asText().trim();\n\t      \t\t\t\t\te2 = new IOException(\"Bitcoin returned error message: \" + error);\n\t      \t\t\t\t} else if(responseMessage.get(\"error\").asText() != null) {\n\t      \t\t\t\t\terror = responseMessage.get(\"error\").asText().trim();\n\n\t      \t\t\t\t\tif(!\"null\".equals(error) && !\"\".equals(error))\n\t      \t\t\t\t\t\te2 = new IOException(\"Bitcoin returned an error message: \" + error);\n\t      \t\t\t\t}\n\t      \t\t\t}\n\t      \t\t} catch(JsonProcessingException f) {\n\t      \t\t\te2 = new IOException(\"Bitcoin returned unparsable JSON\");\n\t      \t\t}\n\t      \t} else {\n\t      \t\te2 = new IOException(\"Bitcoin returned an error message: \" + error);\n\t      \t}\n\n\t      \terrorStream.close();\n\n\t      \tif(responseStream != null)\n\t      \t\tresponseStream.close();\n\n\t      \tif(e2 == null)\n\t      \t\te2 = new IOException(\"Bitcoin returned an error, but with no message\");\n\n\t      \tthrow e2;\n\t      }\n\n\t      if(responseMessage.get(\"error\") != null) {\n\t      \tif(responseMessage.get(\"error\").get(\"message\") != null && responseMessage.get(\"error\").get(\"message\").asText() != null) {\n\t      \t\tString error = responseMessage.get(\"error\").get(\"message\").asText().trim();\n\t      \t\tthrow new IOException(\"Bitcoin returned error message: \" + error);\n\t      \t} else if(responseMessage.get(\"error\").asText() != null) {\n\t      \t\tString error = responseMessage.get(\"error\").asText().trim();\n\n\t      \t\tif(!\"null\".equals(error) && !\"\".equals(error))\n\t      \t\t\tthrow new IOException(\"Bitcoin returned error message: \" + error);\n\t      \t}\n\t      }\n\n\t      JsonNode result;\n\n\t      try {\n\t      \tresult = responseMessage.get(\"result\");\n\t      } catch(Exception e) {\n\t      \tthrow new IOException(\"Bitcoin returned unparsable JSON\");\n\t      }\n\n\t      if(result == null)\n\t      \tthrow new IOException(\"Bitcoin did not return a result or an error\");\n\n\t      return result;\n      } catch(IOException e) {\n      \tif(connection != null)\n      \t\tconnection.disconnect();\n\n\t      throw e;\n      }\n\t}\n\n\tWorkState doGetWorkMessage(boolean longPoll) throws IOException {\n\t\tObjectNode getWorkMessage = mapper.createObjectNode();\n\n\t\tgetWorkMessage.put(\"method\", \"getwork\");\n\t\tgetWorkMessage.putArray(\"params\");\n\t\tgetWorkMessage.put(\"id\", 1);\n\n\t\tJsonNode responseMessage = doJSONRPCCall(longPoll, getWorkMessage);\n\n\t\tString datas;\n\t\tString midstates;\n\t\tString targets;\n\n\t\ttry {\n\t\t\tdatas = responseMessage.get(\"data\").asText();\n\t\t\tmidstates = responseMessage.get(\"midstate\").asText();\n\t\t\ttargets = responseMessage.get(\"target\").asText();\n\t\t} catch(Exception e) {\n\t\t\tthrow new IOException(\"Bitcoin returned unparsable JSON\");\n\t\t}\n\n\t\tWorkState workState = new WorkState(this);\n\n\t\tString parse;\n\n\t\tfor(int i = 0; i < 32; i++) {\n\t\t\tparse = datas.substring(i * 8, (i * 8) + 8);\n\t\t\tworkState.setData(i, Integer.reverseBytes((int) Long.parseLong(parse, 16)));\n\t\t}\n\n\t\tfor(int i = 0; i < 8; i++) {\n\t\t\tparse = midstates.substring(i * 8, (i * 8) + 8);\n\t\t\tworkState.setMidstate(i, Integer.reverseBytes((int) Long.parseLong(parse, 16)));\n\t\t}\n\n\t\tfor(int i = 0; i < 8; i++) {\n\t\t\tparse = targets.substring(i * 8, (i * 8) + 8);\n\t\t\tworkState.setTarget(i, (Long.reverseBytes(Long.parseLong(parse, 16) << 16)) >>> 16);\n\t\t}\n\n\t\treturn workState;\n\t}\n\n\tboolean doSendWorkMessage(WorkState workState) throws IOException {\n\t\tStringBuilder dataOutput = new StringBuilder(8 * 32 + 1);\n\t\tFormatter dataFormatter = new Formatter(dataOutput);\n\t\tint[] data = workState.getData();\n\n\t\tdataFormatter.format(\n\t\t\t\"%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x\" +\n\t\t\t\"%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x\",\n\t\t\tInteger.reverseBytes(data[0]), Integer.reverseBytes(data[1]),\n\t\t\tInteger.reverseBytes(data[2]), Integer.reverseBytes(data[3]),\n\t\t\tInteger.reverseBytes(data[4]), Integer.reverseBytes(data[5]),\n\t\t\tInteger.reverseBytes(data[6]), Integer.reverseBytes(data[7]),\n\t\t\tInteger.reverseBytes(data[8]), Integer.reverseBytes(data[9]),\n\t\t\tInteger.reverseBytes(data[10]), Integer.reverseBytes(data[11]),\n\t\t\tInteger.reverseBytes(data[12]), Integer.reverseBytes(data[13]),\n\t\t\tInteger.reverseBytes(data[14]), Integer.reverseBytes(data[15]),\n\t\t\tInteger.reverseBytes(data[16]), Integer.reverseBytes(data[17]),\n\t\t\tInteger.reverseBytes(data[18]), Integer.reverseBytes(data[19]),\n\t\t\tInteger.reverseBytes(data[20]), Integer.reverseBytes(data[21]),\n\t\t\tInteger.reverseBytes(data[22]), Integer.reverseBytes(data[23]),\n\t\t\tInteger.reverseBytes(data[24]), Integer.reverseBytes(data[25]),\n\t\t\tInteger.reverseBytes(data[26]), Integer.reverseBytes(data[27]),\n\t\t\tInteger.reverseBytes(data[28]), Integer.reverseBytes(data[29]),\n\t\t\tInteger.reverseBytes(data[30]), Integer.reverseBytes(data[31]));\n\n\t\tObjectNode sendWorkMessage = mapper.createObjectNode();\n\t\tsendWorkMessage.put(\"method\", \"getwork\");\n\t\tArrayNode params = sendWorkMessage.putArray(\"params\");\n\t\tparams.add(dataOutput.toString());\n\t\tsendWorkMessage.put(\"id\", 1);\n\n\t\tJsonNode responseMessage = doJSONRPCCall(false, sendWorkMessage);\n\n\t\tboolean accepted;\n\n\t\tdataFormatter.close();\n\n\t\ttry {\n\t\t\taccepted = responseMessage.getBooleanValue();\n\t\t} catch(Exception e) {\n\t\t\tthrow new IOException(\"Bitcoin returned unparsable JSON\");\n\t\t}\n\n\t\treturn accepted;\n\t}\n\n\tclass GetWorkAsync implements Runnable {\n\t\tpublic void run() {\n\t\t\twhile(diabloMiner.getRunning()) {\n\t\t\t\tExecutionState executionState = null;\n\n\t\t\t\ttry {\n\t\t\t\t\texecutionState = getQueue.take();\n\t\t\t\t} catch(InterruptedException e) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif(executionState != null) {\n\t\t\t\t\tWorkState workState = incomingQueue.poll();\n\n\t\t\t\t\tif(workState == null) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tworkState = doGetWorkMessage(false);\n\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\tdiabloMiner.error(\"Cannot connect to \" + queryUrl.getHost() + \": \" + e.getLocalizedMessage());\n\n\t\t\t\t\t\t\tnetworkStateNext.addGetQueue(executionState);\n\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tif(!noDelay)\n\t\t\t\t\t\t\t\t\tThread.sleep(250);\n\t\t\t\t\t\t\t} catch(InterruptedException f) { }\n\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tworkState.setExecutionState(executionState);\n\t\t\t\t\texecutionState.addIncomingQueue(workState);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tclass SendWorkAsync implements Runnable {\n\t\tpublic void run() {\n\t\t\twhile(diabloMiner.getRunning()) {\n\t\t\t\tWorkState workState = null;\n\n\t\t\t\ttry {\n\t\t\t\t\tworkState = sendQueue.take();\n\t\t\t\t} catch(InterruptedException e) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif(workState != null) {\n\t\t\t\t\tboolean accepted;\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\taccepted = doSendWorkMessage(workState);\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tdiabloMiner.error(\"Cannot connect to \" + queryUrl.getHost() + \": \" + e.getLocalizedMessage());\n\t\t\t\t\t\tsendQueue.addFirst(workState);\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif(!noDelay)\n\t\t\t\t\t\t\tThread.sleep(250);\n\t\t\t\t\t\t} catch(InterruptedException f) { }\n\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(accepted) {\n\t\t\t\t\t\tdiabloMiner.info(queryUrl.getHost() + \" accepted block \" + diabloMiner.incrementBlocks() + \" from \" + workState.getExecutionState().getExecutionName());\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdiabloMiner.info(queryUrl.getHost() + \" rejected block \" + diabloMiner.incrementRejects() + \" from \" + workState.getExecutionState().getExecutionName());\n\t\t\t\t\t\tdiabloMiner.debug(\"Rejected block \" + (float) ((DiabloMiner.now() - workState.timestamp) / 1000.0) + \" seconds old, roll ntime set to \" + workState.getNetworkState().getRollNTime() + \", rolled \" + workState.getRolledNTime() + \" times\");\n\t\t\t\t\t}\n\n\t\t\t\t\tif(rejectReason != null) {\n\t\t\t\t\t\tdiabloMiner.info(\"Reject reason: \" + rejectReason);\n\t\t\t\t\t\trejectReason = null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tclass LongPollAsync implements Runnable {\n\t\tpublic void run() {\n\t\t\twhile(diabloMiner.getRunning()) {\n\t\t\t\ttry {\n\t\t\t\t\tWorkState workState = doGetWorkMessage(true);\n\t\t\t\t\tincomingQueue.add(workState);\n\t\t\t\t\trefreshTimestamp.set(workState.getTimestamp());\n\n\t\t\t\t\tdiabloMiner.debug(queryUrl.getHost() + \": Long poll returned\");\n\t\t\t\t} catch(IOException e) {\n\t\t\t\t\tdiabloMiner.error(\"Cannot connect to \" + queryUrl.getHost() + \": \" + e.getLocalizedMessage());\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tif(!noDelay)\n\t\t\t\t\t\tThread.sleep(250);\n\t\t\t\t} catch(InterruptedException e) { }\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/main/java/com/diablominer/DiabloMiner/NetworkState/NetworkState.java",
    "content": "/*\n * DiabloMiner - OpenCL miner for Bitcoin\n * Copyright (C) 2010, 2011, 2012 Patrick McFarland <diablod3@gmail.com>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\tSee the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program.\tIf not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.diablominer.DiabloMiner.NetworkState;\n\nimport java.net.URL;\nimport java.util.concurrent.LinkedBlockingDeque;\nimport java.util.concurrent.atomic.AtomicLong;\n\nimport com.diablominer.DiabloMiner.DiabloMiner;\nimport com.diablominer.DiabloMiner.DeviceState.DeviceState.ExecutionState;\n\npublic abstract class NetworkState {\n\tDiabloMiner diabloMiner;\n\n\tURL queryUrl;\n\tString user;\n\tString pass;\n\n\tbyte hostChain;\n\tbyte hostProtocol;\n\n\tlong workLifetime;\n\tboolean rollNTime;\n\n\tAtomicLong refreshTimestamp = new AtomicLong(0);\n\n\tLinkedBlockingDeque<ExecutionState> getQueue = new LinkedBlockingDeque<ExecutionState>();\n\tLinkedBlockingDeque<WorkState> sendQueue = new LinkedBlockingDeque<WorkState>();\n\n\tNetworkState networkStateNext = null;\n\n\tpublic static final byte PROTOCOL_JSONRPC = 0;\n\tpublic static final byte PROTOCOL_STRATUM = 1;\n\tpublic static final byte CHAIN_BITCOIN = 0;\n\tpublic static final byte CHAIN_LITECOIN = 1;\n\n\tpublic NetworkState(DiabloMiner diabloMiner, URL queryUrl, String user, String pass, byte hostChain) {\n\t\tthis.diabloMiner = diabloMiner;\n\t\tthis.queryUrl = queryUrl;\n\t\tthis.user = user;\n\t\tthis.pass = pass;\n\t\tthis.hostChain = hostChain;\n\t\tthis.workLifetime = diabloMiner.getWorkLifetime();\n\t\tthis.rollNTime = false;\n\n\t\tif(\"stratum\".equals(queryUrl.getProtocol()))\n\t\t\thostProtocol = PROTOCOL_STRATUM;\n\t}\n\n\tpublic void addGetQueue(ExecutionState executionState) {\n\t\tgetQueue.add(executionState);\n\t}\n\n\tpublic void addSendQueue(WorkState workState) {\n\t\tsendQueue.add(workState);\n\t}\n\n\tpublic DiabloMiner getDiabloMiner() {\n\t\treturn diabloMiner;\n\t}\n\n\tpublic NetworkState getNetworkStateNext() {\n\t\treturn networkStateNext;\n\t}\n\n\tpublic void setNetworkStateNext(NetworkState networkState) {\n\t\tnetworkStateNext = networkState;\n\t}\n\n\tpublic URL getQueryUrl() {\n\t\treturn queryUrl;\n\t}\n\n\tpublic long getWorkLifetime() {\n\t\treturn workLifetime;\n\t}\n\n\tpublic long getRefreshTimestamp() {\n\t\treturn refreshTimestamp.get();\n\t}\n\n\tpublic boolean getRollNTime() {\n\t\treturn rollNTime;\n\t}\n}\n"
  },
  {
    "path": "src/main/java/com/diablominer/DiabloMiner/NetworkState/WorkState.java",
    "content": "/*\n * DiabloMiner - OpenCL miner for Bitcoin\n * Copyright (C) 2010, 2011, 2012 Patrick McFarland <diablod3@gmail.com>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\tSee the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program.\tIf not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.diablominer.DiabloMiner.NetworkState;\n\nimport com.diablominer.DiabloMiner.DiabloMiner;\nimport com.diablominer.DiabloMiner.DeviceState.DeviceState.ExecutionState;\n\npublic class WorkState {\n\tfinal int[] data = new int[32];\n\tfinal int[] midstate = new int[8];\n\tfinal long[] target = new long[8];\n\n\tlong timestamp;\n\tlong base;\n\n\tboolean rollNTimeEnable;\n\tint rolledNTime;\n\n\tDiabloMiner diabloMiner;\n\tNetworkState networkState;\n\tExecutionState executionState;\n\n\tWorkState(NetworkState networkState) {\n\t\tthis.networkState = networkState;\n\t\tthis.diabloMiner = networkState.getDiabloMiner();\n\n\t\tthis.timestamp = DiabloMiner.now();\n\t\tthis.base = 0;\n\t\tthis.rolledNTime = 0;\n\t}\n\n\tpublic boolean update(long delta) {\n\t\tboolean getWork;\n\n\t\tif((DiabloMiner.now() - timestamp) + 1000 >= networkState.getWorkLifetime()) {\n\t\t\tdiabloMiner.debug(executionState.getExecutionName() + \": Refresh work: work expired\");\n\t\t\tgetWork = true;\n\t\t} else if(networkState.getRefreshTimestamp() > timestamp) {\n\t\t\tdiabloMiner.debug(executionState.getExecutionName() + \": Refresh work: longpoll\");\n\t\t\tgetWork = true;\n\t\t} else if(base + delta > DiabloMiner.TWO32) {\n\t\t\tif(networkState.getRollNTime()) {\n\t\t\t\tdiabloMiner.debug(executionState.getExecutionName() + \": Rolled NTime\");\n\t\t\t\tbase = 0;\n\t\t\t\tdata[17] = Integer.reverseBytes(Integer.reverseBytes(data[17]) + 1);\n\t\t\t\trolledNTime++;\n\t\t\t\tgetWork = false;\n\t\t\t} else {\n\t\t\t\tdiabloMiner.debug(executionState.getExecutionName() + \": Refresh work: range expired\");\n\t\t\t\tgetWork = true;\n\t\t\t}\n\t\t} else {\n\t\t\tbase += delta;\n\t\t\tgetWork = false;\n\t\t}\n\n\t\tif(getWork) {\n\t\t\tnetworkState.addGetQueue(executionState);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic void submitNonce(int nonce) {\n\t\tdata[19] = nonce;\n\n\t\tnetworkState.addSendQueue(this);\n\t}\n\n\tpublic long getBase() {\n\t\treturn base;\n\t}\n\n\tpublic ExecutionState getExecutionState() {\n\t\treturn executionState;\n\t}\n\n\tpublic void setExecutionState(ExecutionState executionState) {\n\t\tthis.executionState = executionState;\n\t}\n\n\tpublic NetworkState getNetworkState() {\n\t\treturn networkState;\n\t}\n\n\tpublic int getRolledNTime() {\n\t\treturn rolledNTime;\n\t}\n\n\tpublic long getTimestamp() {\n\t\treturn timestamp;\n\t}\n\n\tpublic int[] getData() {\n\t\treturn data;\n\t}\n\n\tpublic int getData(int n) {\n\t\treturn data[n];\n\t}\n\n\tpublic void setData(int n, int x) {\n\t\tdata[n] = x;\n\t}\n\n\tpublic int getMidstate(int n) {\n\t\treturn midstate[n];\n\t}\n\n\tpublic int[] getMidstate() {\n\t\treturn midstate;\n\t}\n\n\tpublic void setMidstate(int n, int x) {\n\t\tmidstate[n] = x;\n\t}\n\n\tpublic long getTarget(int n) {\n\t\treturn target[n];\n\t}\n\n\tpublic void setTarget(int n, long x) {\n\t\ttarget[n] = x;\n\t}\n}\n"
  },
  {
    "path": "src/main/resources/DiabloMiner.cl",
    "content": "/*\n * DiabloMiner - OpenCL miner for BitCoin\n * Copyright (C) 2010, 2011, 2012 Patrick McFarland <diablod3@gmail.com>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\tSee the\n * GNU General Public License for more detail).\n *\n * You should have received a copy of the GNU General Public License\n * along with this program.\tIf not, see <http://www.gnu.org/licenses/>.\n */\n\ntypedef uint z;\n\n#if BITALIGN\n#pragma OPENCL EXTENSION cl_amd_media_ops : enable\n#define Zrotr(a, b) amd_bitalign((z)a, (z)a, (z)(32 - b))\n#else\n#define Zrotr(a, b) rotate((z)a, (z)b)\n#endif\n\n#if BFIINT\n#define ZCh(a, b, c) amd_bytealign(a, b, c)\n#define ZMa(a, b, c) amd_bytealign((c ^ a), (b), (a))\n#else\n#define ZCh(a, b, c) bitselect((z)c, (z)b, (z)a)\n#define ZMa(a, b, c) bitselect((z)a, (z)b, (z)c ^ (z)a)\n#endif\n\n#define ZR25(n) ((Zrotr((n), 25) ^ Zrotr((n), 14) ^ ((n) >> 3U)))\n#define ZR15(n) ((Zrotr((n), 15) ^ Zrotr((n), 13) ^ ((n) >> 10U)))\n#define ZR26(n) ((Zrotr((n), 26) ^ Zrotr((n), 21) ^ Zrotr((n), 7)))\n#define ZR30(n) ((Zrotr((n), 30) ^ Zrotr((n), 19) ^ Zrotr((n), 10)))\n\n__kernel __attribute__((reqd_work_group_size(WORKSIZE, 1, 1))) void search(\n\tconst uint PreVal4_state0, const uint PreVal4_state0_k7,\n\tconst uint PreVal4_T1,\n\tconst uint W18, const uint W19,\n\tconst uint W16, const uint W17,\n\tconst uint W16_plus_K16, const uint W17_plus_K17,\n\tconst uint W31, const uint W32,\n\tconst uint d1, const uint b1, const uint c1,\n\tconst uint h1, const uint f1, const uint g1,\n\tconst uint c1_plus_k5, const uint b1_plus_k6,\n\tconst uint state0, const uint state1, const uint state2, const uint state3,\n\tconst uint state4, const uint state5, const uint state6, const uint state7,\n\t__global uint * output)\n{\n\tz ZA[930];\n\n\tuint noncebase = get_global_id(0);\n\n\tz Znonce = noncebase;\n\tuintzz nonce = (uintzz)0;\n\n\tZA[15] = Znonce + PreVal4_state0;\n\t\n\tZA[16] = (ZCh(ZA[15], b1, c1) + d1) + ZR26(ZA[15]);\n\tZA[26] = Znonce + PreVal4_T1;\n\t\n\tZA[27] = ZMa(f1, g1, ZA[26]) + ZR30(ZA[26]);\n\tZA[17] = ZA[16] + h1;\n\t\n\tZA[19] = (ZCh(ZA[17], ZA[15], b1) + c1_plus_k5) + ZR26(ZA[17]);\n\tZA[28] = ZA[27] + ZA[16];\n\t\n\tZA[548] = ZMa(ZA[26], f1, ZA[28]) + ZR30(ZA[28]);\n\tZA[20] = ZA[19] + g1;\n\t\n\tZA[22] = (ZCh(ZA[20], ZA[17], ZA[15]) + b1_plus_k6) + ZR26(ZA[20]);\n\tZA[29] = ZA[548] + ZA[19];\n\t\n\tZA[549] = ZMa(ZA[28], ZA[26], ZA[29]) + ZR30(ZA[29]);\n\tZA[23] = ZA[22] + f1;\n\t\n\tZA[24] = ZCh(ZA[23], ZA[20], ZA[17]) + ZR26(ZA[23]);\n\tZA[180] = Znonce + PreVal4_state0_k7;\n\tZA[30] = ZA[549] + ZA[22];\n\t\n\tZA[31] = ZMa(ZA[29], ZA[28], ZA[30]) + ZR30(ZA[30]);\n\tZA[181] = ZA[180] + ZA[24];\n\t\n\tZA[182] = ZA[181] + ZA[26];\n\tZA[183] = ZA[181] + ZA[31];\n\tZA[18] = ZA[17] + 0xd807aa98U;\n\t\n\tZA[186] = (ZCh(ZA[182], ZA[23], ZA[20]) + ZA[18]) + ZR26(ZA[182]);\n\tZA[184] = ZMa(ZA[30], ZA[29], ZA[183]) + ZR30(ZA[183]);\n\t\n\tZA[187] = ZA[186] + ZA[28];\n\tZA[188] = ZA[186] + ZA[184];\n\tZA[21] = ZA[20] + 0x12835b01U;\n\t\n\tZA[191] = (ZCh(ZA[187], ZA[182], ZA[23]) + ZA[21]) + ZR26(ZA[187]);\n\tZA[189] = ZMa(ZA[183], ZA[30], ZA[188]) + ZR30(ZA[188]);\n\t\n\tZA[192] = ZA[191] + ZA[29];\n\tZA[193] = ZA[191] + ZA[189];\n\tZA[25] = ZA[23] + 0x243185beU;\n\t\n\tZA[196] = (ZCh(ZA[192], ZA[187], ZA[182]) + ZA[25]) + ZR26(ZA[192]);\n\tZA[194] = ZMa(ZA[188], ZA[183], ZA[193]) + ZR30(ZA[193]);\n\t\n\tZA[197] = ZA[196] + ZA[30];\n\tZA[198] = ZA[196] + ZA[194];\n\tZA[185] = ZA[182] + 0x550c7dc3U;\n\t\n\tZA[201] = (ZCh(ZA[197], ZA[192], ZA[187]) + ZA[185]) + ZR26(ZA[197]);\n\tZA[199] = ZMa(ZA[193], ZA[188], ZA[198]) + ZR30(ZA[198]);\n\t\n\tZA[202] = ZA[201] + ZA[183];\n\tZA[203] = ZA[201] + ZA[199];\n\tZA[190] = ZA[187] + 0x72be5d74U;\n\t\n\tZA[206] = (ZCh(ZA[202], ZA[197], ZA[192]) + ZA[190]) + ZR26(ZA[202]);\n\tZA[204] = ZMa(ZA[198], ZA[193], ZA[203]) + ZR30(ZA[203]);\n\t\n\tZA[207] = ZA[206] + ZA[188];\n\tZA[208] = ZA[206] + ZA[204];\n\tZA[195] = ZA[192] + 0x80deb1feU;\n\t\n\tZA[211] = (ZCh(ZA[207], ZA[202], ZA[197]) + ZA[195]) + ZR26(ZA[207]);\n\tZA[209] = ZMa(ZA[203], ZA[198], ZA[208]) + ZR30(ZA[208]);\n\t\n\tZA[212] = ZA[193] + ZA[211];\n\tZA[213] = ZA[211] + ZA[209];\n\tZA[200] = ZA[197] + 0x9bdc06a7U;\n\t\n\tZA[216] = (ZCh(ZA[212], ZA[207], ZA[202]) + ZA[200]) + ZR26(ZA[212]);\n\tZA[214] = ZMa(ZA[208], ZA[203], ZA[213]) + ZR30(ZA[213]);\n\t\n\tZA[217] = ZA[198] + ZA[216];\n\tZA[218] = ZA[216] + ZA[214];\n\tZA[205] = ZA[202] + 0xc19bf3f4U;\n\t\n\tZA[220] = (ZCh(ZA[217], ZA[212], ZA[207]) + ZA[205]) + ZR26(ZA[217]);\n\tZA[219] = ZMa(ZA[213], ZA[208], ZA[218]) + ZR30(ZA[218]);\n\t\n\tZA[222] = ZA[203] + ZA[220];\n\tZA[223] = ZA[220] + ZA[219];\n\tZA[210] = ZA[207] + W16_plus_K16;\n\t\n\tZA[226] = (ZCh(ZA[222], ZA[217], ZA[212]) + ZA[210]) + ZR26(ZA[222]);\n\tZA[225] = ZMa(ZA[218], ZA[213], ZA[223]) + ZR30(ZA[223]);\n\t\n\tZA[0] = ZR25(Znonce) + W18;\n\tZA[228] = ZA[226] + ZA[225];\n\tZA[227] = ZA[208] + ZA[226];\n\tZA[215] = ZA[212] + W17_plus_K17;\n\t\n\tZA[231] = (ZCh(ZA[227], ZA[222], ZA[217]) + ZA[215]) + ZR26(ZA[227]);\n\tZA[229] = ZMa(ZA[223], ZA[218], ZA[228]) + ZR30(ZA[228]);\n\tZA[1] = ZA[0] + 0x0fc19dc6U;\n\t\n\tZA[232] = ZA[213] + ZA[231];\n\tZA[233] = ZA[231] + ZA[229];\n\tZA[221] = ZA[217] + ZA[1];\n\tZA[32] = Znonce + W19;\n\t\n\tZA[236] = (ZCh(ZA[232], ZA[227], ZA[222]) + ZA[221]) + ZR26(ZA[232]);\n\tZA[234] = ZMa(ZA[228], ZA[223], ZA[233]) + ZR30(ZA[233]);\n\tZA[33] = ZA[32] + 0x240ca1ccU;\n\t\n\tZA[3] = ZR15(ZA[0]) + 0x80000000U;\n\tZA[238] = ZA[236] + ZA[234];\n\tZA[237] = ZA[218] + ZA[236];\n\tZA[224] = ZA[222] + ZA[33];\n\t\n\tZA[241] = (ZCh(ZA[237], ZA[232], ZA[227]) + ZA[224]) + ZR26(ZA[237]);\n\tZA[239] = ZMa(ZA[233], ZA[228], ZA[238]) + ZR30(ZA[238]);\n\tZA[4] = ZA[3] + 0x2de92c6fU;\n\t\n\tZA[35] = ZR15(ZA[32]);\n\tZA[243] = ZA[241] + ZA[239];\n\tZA[242] = ZA[223] + ZA[241];\n\tZA[230] = ZA[227] + ZA[4];\n\t\n\tZA[246] = (ZCh(ZA[242], ZA[237], ZA[232]) + ZA[230]) + ZR26(ZA[242]);\n\tZA[244] = ZMa(ZA[238], ZA[233], ZA[243]) + ZR30(ZA[243]);\n\tZA[36] = ZA[35] + 0x4a7484aaU;\n\t\n\tZA[7] = ZR15(ZA[3]) + 0x00000280U;\n\tZA[248] = ZA[246] + ZA[244];\n\tZA[247] = ZA[228] + ZA[246];\n\tZA[235] = ZA[232] + ZA[36];\n\t\n\tZA[251] = (ZCh(ZA[247], ZA[242], ZA[237]) + ZA[235]) + ZR26(ZA[247]);\n\tZA[249] = ZMa(ZA[243], ZA[238], ZA[248]) + ZR30(ZA[248]);\n\tZA[8] = ZA[7] + 0x5cb0a9dcU;\n\t\n\tZA[38] = ZR15(ZA[35]) + W16;\n\tZA[253] = ZA[251] + ZA[249];\n\tZA[252] = ZA[233] + ZA[251];\n\tZA[240] = ZA[237] + ZA[8];\n\t\n\tZA[256] = (ZCh(ZA[252], ZA[247], ZA[242]) + ZA[240]) + ZR26(ZA[252]);\n\tZA[254] = ZMa(ZA[248], ZA[243], ZA[253]) + ZR30(ZA[253]);\n\tZA[40] = ZA[38] + 0x76f988daU;\n\t\n\tZA[10] = ZR15(ZA[7]) + W17;\n\tZA[258] = ZA[256] + ZA[254];\n\tZA[257] = ZA[238] + ZA[256];\n\tZA[245] = ZA[242] + ZA[40];\n\t\n\tZA[261] = (ZCh(ZA[257], ZA[252], ZA[247]) + ZA[245]) + ZR26(ZA[257]);\n\tZA[259] = ZMa(ZA[253], ZA[248], ZA[258]) + ZR30(ZA[258]);\n\tZA[13] = ZA[10] + 0x983e5152U;\n\t\n\tZA[43] = ZR15(ZA[38]) + ZA[0];\n\tZA[263] = ZA[261] + ZA[259];\n\tZA[262] = ZA[243] + ZA[261];\n\tZA[250] = ZA[247] + ZA[13];\n\t\n\tZA[266] = (ZCh(ZA[262], ZA[257], ZA[252]) + ZA[250]) + ZR26(ZA[262]);\n\tZA[264] = ZMa(ZA[258], ZA[253], ZA[263]) + ZR30(ZA[263]);\n\tZA[11] = ZR15(ZA[10]);\n\tZA[45] = ZA[43] + 0xa831c66dU;\n\t\n\tZA[52] = ZA[11] + ZA[32];\n\tZA[267] = ZA[248] + ZA[266];\n\tZA[255] = ZA[252] + ZA[45];\n\tZA[268] = ZA[266] + ZA[264];\n\t\n\tZA[271] = (ZCh(ZA[267], ZA[262], ZA[257]) + ZA[255]) + ZR26(ZA[267]);\n\tZA[269] = ZMa(ZA[263], ZA[258], ZA[268]) + ZR30(ZA[268]);\n\tZA[54] = ZA[52] + 0xb00327c8U;\n\t\n\tZA[48] = ZR15(ZA[43]) + ZA[3];\n\tZA[273] = ZA[271] + ZA[269];\n\tZA[272] = ZA[253] + ZA[271];\n\tZA[260] = ZA[257] + ZA[54];\n\t\n\tZA[276] = (ZCh(ZA[272], ZA[267], ZA[262]) + ZA[260]) + ZR26(ZA[272]);\n\tZA[274] = ZMa(ZA[268], ZA[263], ZA[273]) + ZR30(ZA[273]);\n\tZA[49] = ZA[48] + 0xbf597fc7U;\n\t\n\tZA[61] = ZR15(ZA[52]) + ZA[35];\n\tZA[278] = ZA[276] + ZA[274];\n\tZA[277] = ZA[258] + ZA[276];\n\tZA[265] = ZA[262] + ZA[49];\n\t\n\tZA[281] = (ZCh(ZA[277], ZA[272], ZA[267]) + ZA[265]) + ZR26(ZA[277]);\n\tZA[279] = ZMa(ZA[273], ZA[268], ZA[278]) + ZR30(ZA[278]);\n\tZA[62] = ZA[61] + 0xc6e00bf3U;\n\t\n\tZA[53] = ZR15(ZA[48]) + ZA[7];\n\tZA[283] = ZA[281] + ZA[279];\n\tZA[282] = ZA[263] + ZA[281];\n\tZA[270] = ZA[267] + ZA[62];\n\t\n\tZA[286] = (ZCh(ZA[282], ZA[277], ZA[272]) + ZA[270]) + ZR26(ZA[282]);\n\tZA[284] = ZMa(ZA[278], ZA[273], ZA[283]) + ZR30(ZA[283]);\n\tZA[39] = ZA[38] + 0x00A00055U;\n\tZA[55] = ZA[53] + 0xd5a79147U;\n\t\n\tZA[66] = ZR15(ZA[61]) + ZA[39];\n\tZA[288] = ZA[286] + ZA[284];\n\tZA[287] = ZA[268] + ZA[286];\n\tZA[275] = ZA[272] + ZA[55];\n\t\n\tZA[291] = (ZCh(ZA[287], ZA[282], ZA[277]) + ZA[275]) + ZR26(ZA[287]);\n\tZA[289] = ZMa(ZA[283], ZA[278], ZA[288]) + ZR30(ZA[288]);\n\tZA[12] = ZA[10] + W31;\n\tZA[68] = ZA[66] + 0x06ca6351U;\n\t\n\tZA[67] = ZR15(ZA[53]) + ZA[12];\n\tZA[293] = ZA[291] + ZA[289];\n\tZA[292] = ZA[273] + ZA[291];\n\tZA[280] = ZA[277] + ZA[68];\n\t\n\tZA[296] = (ZCh(ZA[292], ZA[287], ZA[282]) + ZA[280]) + ZR26(ZA[292]);\n\tZA[294] = ZMa(ZA[288], ZA[283], ZA[293]) + ZR30(ZA[293]);\n\tZA[2] = ZR25(ZA[0]);\n\tZA[69] = ZA[67] + 0x14292967U;\n\tZA[44] = ZA[43] + W32;\n\t\n\tZA[75] = ZR15(ZA[66]) + ZA[44];\n\tZA[298] = ZA[296] + ZA[294];\n\tZA[297] = ZA[278] + ZA[296];\n\tZA[285] = ZA[282] + ZA[69];\n\tZA[5] = ZA[2] + W17;\n\t\n\tZA[301] = (ZCh(ZA[297], ZA[292], ZA[287]) + ZA[285]) + ZR26(ZA[297]);\n\tZA[299] = ZMa(ZA[293], ZA[288], ZA[298]) + ZR30(ZA[298]);\n\tZA[56] = ZA[52] + ZA[5];\n\tZA[76] = ZA[75] + 0x27b70a85U;\n\t\n\tZA[34] = ZR25(ZA[32]) + ZA[0];\n\tZA[70] = ZR15(ZA[67]) + ZA[56];\n\tZA[302] = ZA[283] + ZA[301];\n\tZA[303] = ZA[301] + ZA[299];\n\tZA[290] = ZA[287] + ZA[76];\n\t\n\tZA[306] = (ZCh(ZA[302], ZA[297], ZA[292]) + ZA[290]) + ZR26(ZA[302]);\n\tZA[304] = ZMa(ZA[298], ZA[293], ZA[303]) + ZR30(ZA[303]);\n\tZA[6] = ZR25(ZA[3]);\n\tZA[77] = ZA[70] + 0x2e1b2138U;\n\tZA[50] = ZA[34] + ZA[48];\n\t\n\tZA[78] = ZR15(ZA[75]) + ZA[50];\n\tZA[308] = ZA[306] + ZA[304];\n\tZA[307] = ZA[288] + ZA[306];\n\tZA[295] = ZA[292] + ZA[77];\n\tZA[41] = ZA[32] + ZA[6];\n\t\n\tZA[311] = (ZCh(ZA[307], ZA[302], ZA[297]) + ZA[295]) + ZR26(ZA[307]);\n\tZA[309] = ZMa(ZA[303], ZA[298], ZA[308]) + ZR30(ZA[308]);\n\tZA[63] = ZA[41] + ZA[61];\n\tZA[85] = ZA[78] + 0x4d2c6dfcU;\n\t\n\tZA[37] = ZR25(ZA[35]) + ZA[3];\n\tZA[79] = ZR15(ZA[70]) + ZA[63];\n\tZA[312] = ZA[293] + ZA[311];\n\tZA[313] = ZA[311] + ZA[309];\n\tZA[300] = ZA[297] + ZA[85];\n\t\n\tZA[316] = (ZCh(ZA[312], ZA[307], ZA[302]) + ZA[300]) + ZR26(ZA[312]);\n\tZA[314] = ZMa(ZA[308], ZA[303], ZA[313]) + ZR30(ZA[313]);\n\tZA[9] = ZR25(ZA[7]);\n\tZA[86] = ZA[79] + 0x53380d13U;\n\tZA[57] = ZA[37] + ZA[53];\n\t\n\tZA[87] = ZR15(ZA[78]) + ZA[57];\n\tZA[318] = ZA[316] + ZA[314];\n\tZA[317] = ZA[298] + ZA[316];\n\tZA[305] = ZA[302] + ZA[86];\n\tZA[46] = ZA[35] + ZA[9];\n\t\n\tZA[321] = (ZCh(ZA[317], ZA[312], ZA[307]) + ZA[305]) + ZR26(ZA[317]);\n\tZA[319] = ZMa(ZA[313], ZA[308], ZA[318]) + ZR30(ZA[318]);\n\tZA[71] = ZA[46] + ZA[66];\n\tZA[92] = ZA[87] + 0x650a7354U;\n\t\n\tZA[42] = ZR25(ZA[38]) + ZA[7];\n\tZA[88] = ZR15(ZA[79]) + ZA[71];\n\tZA[322] = ZA[303] + ZA[321];\n\tZA[323] = ZA[321] + ZA[319];\n\tZA[310] = ZA[307] + ZA[92];\n\t\n\tZA[326] = (ZCh(ZA[322], ZA[317], ZA[312]) + ZA[310]) + ZR26(ZA[322]);\n\tZA[324] = ZMa(ZA[318], ZA[313], ZA[323]) + ZR30(ZA[323]);\n\tZA[14] = ZR25(ZA[10]);\n\tZA[93] = ZA[88] + 0x766a0abbU;\n\tZA[72] = ZA[42] + ZA[67];\n\t\n\tZA[94] = ZR15(ZA[87]) + ZA[72];\n\tZA[328] = ZA[326] + ZA[324];\n\tZA[327] = ZA[308] + ZA[326];\n\tZA[315] = ZA[312] + ZA[93];\n\tZA[51] = ZA[38] + ZA[14];\n\t\n\tZA[331] = (ZCh(ZA[327], ZA[322], ZA[317]) + ZA[315]) + ZR26(ZA[327]);\n\tZA[329] = ZMa(ZA[323], ZA[318], ZA[328]) + ZR30(ZA[328]);\n\tZA[80] = ZA[51] + ZA[75];\n\tZA[100] = ZA[94] + 0x81c2c92eU;\n\t\n\tZA[47] = ZR25(ZA[43]) + ZA[10];\n\tZA[95] = ZR15(ZA[88]) + ZA[80];\n\tZA[332] = ZA[313] + ZA[331];\n\tZA[333] = ZA[331] + ZA[329];\n\tZA[320] = ZA[317] + ZA[100];\n\t\n\tZA[336] = (ZCh(ZA[332], ZA[327], ZA[322]) + ZA[320]) + ZR26(ZA[332]);\n\tZA[334] = ZMa(ZA[328], ZA[323], ZA[333]) + ZR30(ZA[333]);\n\tZA[81] = ZA[47] + ZA[70];\n\tZA[101] = ZA[95] + 0x92722c85U;\n\t\n\tZA[58] = ZR25(ZA[52]) + ZA[43];\n\tZA[102] = ZR15(ZA[94]) + ZA[81];\n\tZA[337] = ZA[318] + ZA[336];\n\tZA[338] = ZA[336] + ZA[334];\n\tZA[325] = ZA[322] + ZA[101];\n\t\n\tZA[341] = (ZCh(ZA[337], ZA[332], ZA[327]) + ZA[325]) + ZR26(ZA[337]);\n\tZA[339] = ZMa(ZA[333], ZA[328], ZA[338]) + ZR30(ZA[338]);\n\tZA[89] = ZA[58] + ZA[78];\n\tZA[108] = ZA[102] + 0xa2bfe8a1U;\n\t\n\tZA[59] = ZR25(ZA[48]) + ZA[52];\n\tZA[103] = ZR15(ZA[95]) + ZA[89];\n\tZA[342] = ZA[323] + ZA[341];\n\tZA[343] = ZA[341] + ZA[339];\n\tZA[330] = ZA[327] + ZA[108];\n\t\n\tZA[346] = (ZCh(ZA[342], ZA[337], ZA[332]) + ZA[330]) + ZR26(ZA[342]);\n\tZA[344] = ZMa(ZA[338], ZA[333], ZA[343]) + ZR30(ZA[343]);\n\tZA[90] = ZA[59] + ZA[79];\n\tZA[109] = ZA[103] + 0xa81a664bU;\n\t\n\tZA[64] = ZR25(ZA[61]) + ZA[48];\n\tZA[110] = ZR15(ZA[102]) + ZA[90];\n\tZA[347] = ZA[328] + ZA[346];\n\tZA[348] = ZA[346] + ZA[344];\n\tZA[335] = ZA[332] + ZA[109];\n\t\n\tZA[351] = (ZCh(ZA[347], ZA[342], ZA[337]) + ZA[335]) + ZR26(ZA[347]);\n\tZA[349] = ZMa(ZA[343], ZA[338], ZA[348]) + ZR30(ZA[348]);\n\tZA[60] = ZR25(ZA[53]);\n\tZA[116] = ZA[110] + 0xc24b8b70U;\n\tZA[96] = ZA[87] + ZA[64];\n\t\n\tZA[111] = ZR15(ZA[103]) + ZA[96];\n\tZA[353] = ZA[351] + ZA[349];\n\tZA[352] = ZA[333] + ZA[351];\n\tZA[340] = ZA[337] + ZA[116];\n\tZA[65] = ZA[60] + ZA[61];\n\t\n\tZA[356] = (ZCh(ZA[352], ZA[347], ZA[342]) + ZA[340]) + ZR26(ZA[352]);\n\tZA[354] = ZMa(ZA[348], ZA[343], ZA[353]) + ZR30(ZA[353]);\n\tZA[97] = ZA[88] + ZA[65];\n\tZA[117] = ZA[111] + 0xc76c51a3U;\n\t\n\tZA[73] = ZR25(ZA[66]) + ZA[53];\n\tZA[118] = ZR15(ZA[110]) + ZA[97];\n\tZA[357] = ZA[338] + ZA[356];\n\tZA[358] = ZA[356] + ZA[354];\n\tZA[345] = ZA[342] + ZA[117];\n\t\n\tZA[361] = (ZCh(ZA[357], ZA[352], ZA[347]) + ZA[345]) + ZR26(ZA[357]);\n\tZA[359] = ZMa(ZA[353], ZA[348], ZA[358]) + ZR30(ZA[358]);\n\tZA[104] = ZA[73] + ZA[94];\n\tZA[124] = ZA[118] + 0xd192e819U;\n\t\n\tZA[74] = ZR25(ZA[67]) + ZA[66];\n\tZA[119] = ZR15(ZA[111]) + ZA[104];\n\tZA[362] = ZA[343] + ZA[361];\n\tZA[363] = ZA[361] + ZA[359];\n\tZA[350] = ZA[347] + ZA[124];\n\t\n\tZA[366] = (ZCh(ZA[362], ZA[357], ZA[352]) + ZA[350]) + ZR26(ZA[362]);\n\tZA[364] = ZMa(ZA[358], ZA[353], ZA[363]) + ZR30(ZA[363]);\n\tZA[105] = ZA[74] + ZA[95];\n\tZA[125] = ZA[119] + 0xd6990624U;\n\t\n\tZA[82] = ZR25(ZA[75]) + ZA[67];\n\tZA[126] = ZR15(ZA[118]) + ZA[105];\n\tZA[367] = ZA[348] + ZA[366];\n\tZA[368] = ZA[366] + ZA[364];\n\tZA[355] = ZA[352] + ZA[125];\n\t\n\tZA[371] = (ZCh(ZA[367], ZA[362], ZA[357]) + ZA[355]) + ZR26(ZA[367]);\n\tZA[369] = ZMa(ZA[363], ZA[358], ZA[368]) + ZR30(ZA[368]);\n\tZA[112] = ZA[102] + ZA[82];\n\tZA[132] = ZA[126] + 0xf40e3585U;\n\t\n\tZA[83] = ZR25(ZA[70]) + ZA[75];\n\tZA[127] = ZR15(ZA[119]) + ZA[112];\n\tZA[372] = ZA[353] + ZA[371];\n\tZA[373] = ZA[371] + ZA[369];\n\tZA[360] = ZA[357] + ZA[132];\n\t\n\tZA[376] = (ZCh(ZA[372], ZA[367], ZA[362]) + ZA[360]) + ZR26(ZA[372]);\n\tZA[374] = ZMa(ZA[368], ZA[363], ZA[373]) + ZR30(ZA[373]);\n\tZA[113] = ZA[103] + ZA[83];\n\tZA[133] = ZA[127] + 0x106aa070U;\n\t\n\tZA[84] = ZR25(ZA[78]) + ZA[70];\n\tZA[134] = ZR15(ZA[126]) + ZA[113];\n\tZA[377] = ZA[358] + ZA[376];\n\tZA[378] = ZA[376] + ZA[374];\n\tZA[365] = ZA[362] + ZA[133];\n\t\n\tZA[381] = (ZCh(ZA[377], ZA[372], ZA[367]) + ZA[365]) + ZR26(ZA[377]);\n\tZA[379] = ZMa(ZA[373], ZA[368], ZA[378]) + ZR30(ZA[378]);\n\tZA[120] = ZA[110] + ZA[84];\n\tZA[140] = ZA[134] + 0x19a4c116U;\n\t\n\tZA[91] = ZR25(ZA[79]) + ZA[78];\n\tZA[135] = ZR15(ZA[127]) + ZA[120];\n\tZA[382] = ZA[363] + ZA[381];\n\tZA[383] = ZA[381] + ZA[379];\n\tZA[370] = ZA[367] + ZA[140];\n\t\n\tZA[386] = (ZCh(ZA[382], ZA[377], ZA[372]) + ZA[370]) + ZR26(ZA[382]);\n\tZA[384] = ZMa(ZA[378], ZA[373], ZA[383]) + ZR30(ZA[383]);\n\tZA[121] = ZA[111] + ZA[91];\n\tZA[141] = ZA[135] + 0x1e376c08U;\n\t\n\tZA[98] = ZR25(ZA[87]) + ZA[79];\n\tZA[142] = ZR15(ZA[134]) + ZA[121];\n\tZA[387] = ZA[368] + ZA[386];\n\tZA[388] = ZA[386] + ZA[384];\n\tZA[375] = ZA[372] + ZA[141];\n\t\n\tZA[391] = (ZCh(ZA[387], ZA[382], ZA[377]) + ZA[375]) + ZR26(ZA[387]);\n\tZA[389] = ZMa(ZA[383], ZA[378], ZA[388]) + ZR30(ZA[388]);\n\tZA[128] = ZA[118] + ZA[98];\n\tZA[147] = ZA[142] + 0x2748774cU;\n\t\n\tZA[99] = ZR25(ZA[88]) + ZA[87];\n\tZA[143] = ZR15(ZA[135]) + ZA[128];\n\tZA[392] = ZA[373] + ZA[391];\n\tZA[393] = ZA[391] + ZA[389];\n\tZA[380] = ZA[377] + ZA[147];\n\t\n\tZA[396] = (ZCh(ZA[392], ZA[387], ZA[382]) + ZA[380]) + ZR26(ZA[392]);\n\tZA[394] = ZMa(ZA[388], ZA[383], ZA[393]) + ZR30(ZA[393]);\n\tZA[129] = ZA[119] + ZA[99];\n\tZA[148] = ZA[143] + 0x34b0bcb5U;\n\t\n\tZA[106] = ZR25(ZA[94]) + ZA[88];\n\tZA[149] = ZR15(ZA[142]) + ZA[129];\n\tZA[397] = ZA[378] + ZA[396];\n\tZA[398] = ZA[396] + ZA[394];\n\tZA[385] = ZA[382] + ZA[148];\n\t\n\tZA[401] = (ZCh(ZA[397], ZA[392], ZA[387]) + ZA[385]) + ZR26(ZA[397]);\n\tZA[399] = ZMa(ZA[393], ZA[388], ZA[398]) + ZR30(ZA[398]);\n\tZA[136] = ZA[126] + ZA[106];\n\tZA[153] = ZA[149] + 0x391c0cb3U;\n\t\n\tZA[107] = ZR25(ZA[95]) + ZA[94];\n\tZA[150] = ZR15(ZA[143]) + ZA[136];\n\tZA[402] = ZA[383] + ZA[401];\n\tZA[403] = ZA[401] + ZA[399];\n\tZA[390] = ZA[387] + ZA[153];\n\t\n\tZA[406] = (ZCh(ZA[402], ZA[397], ZA[392]) + ZA[390]) + ZR26(ZA[402]);\n\tZA[404] = ZMa(ZA[398], ZA[393], ZA[403]) + ZR30(ZA[403]);\n\tZA[137] = ZA[127] + ZA[107];\n\tZA[154] = ZA[150] + 0x4ed8aa4aU;\n\t\n\tZA[114] = ZR25(ZA[102]) + ZA[95];\n\tZA[155] = ZR15(ZA[149]) + ZA[137];\n\tZA[407] = ZA[388] + ZA[406];\n\tZA[408] = ZA[406] + ZA[404];\n\tZA[395] = ZA[392] + ZA[154];\n\t\n\tZA[411] = (ZCh(ZA[407], ZA[402], ZA[397]) + ZA[395]) + ZR26(ZA[407]);\n\tZA[409] = ZMa(ZA[403], ZA[398], ZA[408]) + ZR30(ZA[408]);\n\tZA[144] = ZA[134] + ZA[114];\n\tZA[159] = ZA[155] + 0x5b9cca4fU;\n\t\n\tZA[115] = ZR25(ZA[103]) + ZA[102];\n\tZA[156] = ZR15(ZA[150]) + ZA[144];\n\tZA[412] = ZA[393] + ZA[411];\n\tZA[413] = ZA[411] + ZA[409];\n\tZA[400] = ZA[397] + ZA[159];\n\t\n\tZA[416] = (ZCh(ZA[412], ZA[407], ZA[402]) + ZA[400]) + ZR26(ZA[412]);\n\tZA[414] = ZMa(ZA[408], ZA[403], ZA[413]) + ZR30(ZA[413]);\n\tZA[145] = ZA[135] + ZA[115];\n\tZA[160] = ZA[156] + 0x682e6ff3U;\n\t\n\tZA[122] = ZR25(ZA[110]) + ZA[103];\n\tZA[161] = ZR15(ZA[155]) + ZA[145];\n\tZA[417] = ZA[398] + ZA[416];\n\tZA[418] = ZA[416] + ZA[414];\n\tZA[405] = ZA[402] + ZA[160];\n\t\n\tZA[421] = (ZCh(ZA[417], ZA[412], ZA[407]) + ZA[405]) + ZR26(ZA[417]);\n\tZA[419] = ZMa(ZA[413], ZA[408], ZA[418]) + ZR30(ZA[418]);\n\tZA[151] = ZA[142] + ZA[122];\n\tZA[165] = ZA[161] + 0x748f82eeU;\n\t\n\tZA[123] = ZR25(ZA[111]) + ZA[110];\n\tZA[162] = ZR15(ZA[156]) + ZA[151];\n\tZA[422] = ZA[403] + ZA[421];\n\tZA[423] = ZA[421] + ZA[419];\n\tZA[410] = ZA[407] + ZA[165];\n\t\n\tZA[426] = (ZCh(ZA[422], ZA[417], ZA[412]) + ZA[410]) + ZR26(ZA[422]);\n\tZA[424] = ZMa(ZA[418], ZA[413], ZA[423]) + ZR30(ZA[423]);\n\tZA[152] = ZA[143] + ZA[123];\n\tZA[166] = ZA[162] + 0x78a5636fU;\n\t\n\tZA[130] = ZR25(ZA[118]) + ZA[111];\n\tZA[167] = ZR15(ZA[161]) + ZA[152];\n\tZA[427] = ZA[408] + ZA[426];\n\tZA[428] = ZA[426] + ZA[424];\n\tZA[415] = ZA[412] + ZA[166];\n\t\n\tZA[431] = (ZCh(ZA[427], ZA[422], ZA[417]) + ZA[415]) + ZR26(ZA[427]);\n\tZA[429] = ZMa(ZA[423], ZA[418], ZA[428]) + ZR30(ZA[428]);\n\tZA[157] = ZA[149] + ZA[130];\n\tZA[170] = ZA[167] + 0x84c87814U;\n\t\n\tZA[131] = ZR25(ZA[119]) + ZA[118];\n\tZA[168] = ZR15(ZA[162]) + ZA[157];\n\tZA[432] = ZA[413] + ZA[431];\n\tZA[433] = ZA[431] + ZA[429];\n\tZA[420] = ZA[417] + ZA[170];\n\t\n\tZA[436] = (ZCh(ZA[432], ZA[427], ZA[422]) + ZA[420]) + ZR26(ZA[432]);\n\tZA[434] = ZMa(ZA[428], ZA[423], ZA[433]) + ZR30(ZA[433]);\n\tZA[158] = ZA[150] + ZA[131];\n\tZA[171] = ZA[168] + 0x8cc70208U;\n\t\n\tZA[138] = ZR25(ZA[126]) + ZA[119];\n\tZA[172] = ZR15(ZA[167]) + ZA[158];\n\tZA[437] = ZA[418] + ZA[436];\n\tZA[438] = ZA[436] + ZA[434];\n\tZA[425] = ZA[422] + ZA[171];\n\t\n\tZA[441] = (ZCh(ZA[437], ZA[432], ZA[427]) + ZA[425]) + ZR26(ZA[437]);\n\tZA[439] = ZMa(ZA[433], ZA[428], ZA[438]) + ZR30(ZA[438]);\n\tZA[163] = ZA[155] + ZA[138];\n\tZA[174] = ZA[172] + 0x90befffaU;\n\t\n\tZA[139] = ZR25(ZA[127]) + ZA[126];\n\tZA[173] = ZR15(ZA[168]) + ZA[163];\n\tZA[442] = ZA[423] + ZA[441];\n\tZA[443] = ZA[441] + ZA[439];\n\tZA[430] = ZA[427] + ZA[174];\n\t\n\tZA[445] = (ZCh(ZA[442], ZA[437], ZA[432]) + ZA[430]) + ZR26(ZA[442]);\n\tZA[444] = ZMa(ZA[438], ZA[433], ZA[443]) + ZR30(ZA[443]);\n\tZA[164] = ZA[156] + ZA[139];\n\tZA[175] = ZA[173] + 0xa4506cebU;\n\t\n\tZA[146] = ZR25(ZA[134]) + ZA[127];\n\tZA[176] = ZR15(ZA[172]) + ZA[164];\n\tZA[446] = ZA[428] + ZA[445];\n\tZA[447] = ZA[445] + ZA[444];\n\tZA[435] = ZA[432] + ZA[175];\n\t\n\tZA[449] = (ZCh(ZA[446], ZA[442], ZA[437]) + ZA[435]) + ZR26(ZA[446]);\n\tZA[448] = ZMa(ZA[443], ZA[438], ZA[447]) + ZR30(ZA[447]);\n\tZA[169] = ZA[161] + ZA[146];\n\tZA[178] = ZA[176] + 0xbef9a3f7U;\n\t\n\tZA[177] = ZR15(ZA[173]) + ZA[169];\n\tZA[451] = ZA[449] + ZA[448];\n\tZA[450] = ZA[433] + ZA[449];\n\tZA[440] = ZA[437] + ZA[178];\n\t\n\tZA[453] = (ZCh(ZA[450], ZA[446], ZA[442]) + ZA[440]) + ZR26(ZA[450]);\n\tZA[452] = ZMa(ZA[447], ZA[443], ZA[451]) + ZR30(ZA[451]);\n\tZA[179] = ZA[177] + 0xc67178f2U;\n\t\n\tZA[454] = ZA[438] + ZA[453];\n\tZA[494] = ZA[442] + ZA[179];\n\tZA[455] = ZA[453] + ZA[452];\n\t\n\tZA[457] = (ZCh(ZA[454], ZA[450], ZA[446]) + ZA[494]) + ZR26(ZA[454]);\n\tZA[456] = ZMa(ZA[451], ZA[447], ZA[455]) + ZR30(ZA[455]);\n\t\n\tZA[459] = ZA[457] + ZA[456];\n\t\n\tZA[461] = ZA[455] + state1;\n\tZA[460] = ZA[459] + state0;\n\t\n\tZA[495] = ZA[460] + 0x98c7e2a2U;\n\tZA[469] = ZA[461] + 0x90bb1e3cU;\n\t\n\tZA[498] = (ZCh(ZA[495], 0x510e527fU, 0x9b05688cU) + ZA[469]) + ZR26(ZA[495]);\n\tZA[462] = ZA[451] + state2;\n\t\n\tZA[496] = ZA[460] + 0xfc08884dU;\n\tZA[506] = ZA[498] + 0x3c6ef372U;\n\tZA[470] = ZA[462] + 0x50c6645bU;\n\t\n\tZA[507] = (ZCh(ZA[506], ZA[495], 0x510e527fU) + ZA[470]) + ZR26(ZA[506]);\n\tZA[500] = ZMa(0x6a09e667U, 0xbb67ae85U, ZA[496]) + ZR30(ZA[496]);\n\tZA[463] = ZA[447] + state3;\n\t\n\tZA[458] = ZA[443] + ZA[457];\n\tZA[499] = ZA[498] + ZA[500];\n\tZA[508] = ZA[507] + 0xbb67ae85U;\n\tZA[473] = ZA[463] + 0x3ac42e24U;\n\t\n\tZA[510] = (ZCh(ZA[508], ZA[506], ZA[495]) + ZA[473]) + ZR26(ZA[508]);\n\tZA[928] = ZMa(ZA[496], 0x6a09e667U, ZA[499]) + ZR30(ZA[499]);\n\tZA[464] = ZA[458] + state4;\n\t\n\tZA[476] = ZA[464] + ZA[460] + 0xd21ea4fdU;\n\tZA[511] = ZA[510] + 0x6a09e667U;\n\tZA[509] = ZA[928] + ZA[507];\n\tZA[465] = ZA[454] + state5;\n\t\n\tZA[514] = (ZCh(ZA[511], ZA[508], ZA[506]) + ZA[476]) + ZR26(ZA[511]);\n\tZA[512] = ZMa(ZA[499], ZA[496], ZA[509]) + ZR30(ZA[509]);\n\tZA[478] = ZA[465] + 0x59f111f1U;\n\t\n\tZA[519] = ZA[506] + ZA[478];\n\tZA[516] = ZA[496] + ZA[514];\n\tZA[513] = ZA[510] + ZA[512];\n\tZA[466] = ZA[450] + state6;\n\t\n\tZA[520] = (ZCh(ZA[516], ZA[511], ZA[508]) + ZA[519]) + ZR26(ZA[516]);\n\tZA[515] = ZMa(ZA[509], ZA[499], ZA[513]) + ZR30(ZA[513]);\n\tZA[480] = ZA[466] + 0x923f82a4U;\n\t\n\tZA[524] = ZA[508] + ZA[480];\n\tZA[521] = ZA[499] + ZA[520];\n\tZA[517] = ZA[514] + ZA[515];\n\tZA[467] = ZA[446] + state7;\n\t\n\tZA[525] = (ZCh(ZA[521], ZA[516], ZA[511]) + ZA[524]) + ZR26(ZA[521]);\n\tZA[522] = ZMa(ZA[513], ZA[509], ZA[517]) + ZR30(ZA[517]);\n\tZA[484] = ZA[467] + 0xab1c5ed5U;\n\t\n\tZA[529] = ZA[511] + ZA[484];\n\tZA[526] = ZA[509] + ZA[525];\n\tZA[523] = ZA[520] + ZA[522];\n\t\n\tZA[530] = (ZCh(ZA[526], ZA[521], ZA[516]) + ZA[529]) + ZR26(ZA[526]);\n\tZA[550] = ZMa(ZA[517], ZA[513], ZA[523]) + ZR30(ZA[523]);\n\t\n\tZA[531] = ZA[513] + ZA[530];\n\tZA[533] = ZA[516] + 0x5807aa98U;\n\tZA[527] = ZA[550] + ZA[525];\n\t\n\tZA[534] = (ZCh(ZA[531], ZA[526], ZA[521]) + ZA[533]) + ZR26(ZA[531]);\n\tZA[551] = ZMa(ZA[523], ZA[517], ZA[527]) + ZR30(ZA[527]);\n\t\n\tZA[535] = ZA[517] + ZA[534];\n\tZA[538] = ZA[521] + 0x12835b01U;\n\tZA[532] = ZA[551] + ZA[530];\n\t\n\tZA[539] = (ZCh(ZA[535], ZA[531], ZA[526]) + ZA[538]) + ZR26(ZA[535]);\n\tZA[552] = ZMa(ZA[527], ZA[523], ZA[532]) + ZR30(ZA[532]);\n\t\n\tZA[540] = ZA[523] + ZA[539];\n\tZA[542] = ZA[526] + 0x243185beU;\n\tZA[536] = ZA[552] + ZA[534];\n\t\n\tZA[543] = (ZCh(ZA[540], ZA[535], ZA[531]) + ZA[542]) + ZR26(ZA[540]);\n\tZA[553] = ZMa(ZA[532], ZA[527], ZA[536]) + ZR30(ZA[536]);\n\t\n\tZA[544] = ZA[527] + ZA[543];\n\tZA[555] = ZA[531] + 0x550c7dc3U;\n\tZA[541] = ZA[553] + ZA[539];\n\t\n\tZA[558] = (ZCh(ZA[544], ZA[540], ZA[535]) + ZA[555]) + ZR26(ZA[544]);\n\tZA[547] = ZMa(ZA[536], ZA[532], ZA[541]) + ZR30(ZA[541]);\n\t\n\tZA[559] = ZA[532] + ZA[558];\n\tZA[556] = ZA[535] + 0x72be5d74U;\n\tZA[545] = ZA[547] + ZA[543];\n\t\n\tZA[562] = (ZCh(ZA[559], ZA[544], ZA[540]) + ZA[556]) + ZR26(ZA[559]);\n\tZA[561] = ZMa(ZA[541], ZA[536], ZA[545]) + ZR30(ZA[545]);\n\t\n\tZA[563] = ZA[536] + ZA[562];\n\tZA[560] = ZA[561] + ZA[558];\n\tZA[557] = ZA[540] + 0x80deb1feU;\n\t\n\tZA[568] = (ZCh(ZA[563], ZA[559], ZA[544]) + ZA[557]) + ZR26(ZA[563]);\n\tZA[564] = ZMa(ZA[545], ZA[541], ZA[560]) + ZR30(ZA[560]);\n\t\n\tZA[569] = ZA[541] + ZA[568];\n\tZA[572] = ZA[544] + 0x9bdc06a7U;\n\tZA[565] = ZA[562] + ZA[564];\n\t\n\tZA[574] = (ZCh(ZA[569], ZA[563], ZA[559]) + ZA[572]) + ZR26(ZA[569]);\n\tZA[570] = ZMa(ZA[560], ZA[545], ZA[565]) + ZR30(ZA[565]);\n\tZA[468] = ZR25(ZA[461]);\n\t\n\tZA[497] = ZA[468] + ZA[460];\n\tZA[575] = ZA[545] + ZA[574];\n\tZA[571] = ZA[568] + ZA[570];\n\tZA[573] = ZA[559] + 0xc19bf274U;\n\t\n\tZA[578] = (ZCh(ZA[575], ZA[569], ZA[563]) + ZA[573]) + ZR26(ZA[575]);\n\tZA[576] = ZMa(ZA[565], ZA[560], ZA[571]) + ZR30(ZA[571]);\n\tZA[929] = ZR25(ZA[462]);\n\tZA[503] = ZA[497] + 0xe49b69c1U;\n\t\n\tZA[471] = ZA[929] + ZA[461] + 0x00a00000U;\n\tZA[582] = ZA[563] + ZA[503];\n\tZA[579] = ZA[560] + ZA[578];\n\tZA[577] = ZA[574] + ZA[576];\n\t\n\tZA[583] = (ZCh(ZA[579], ZA[575], ZA[569]) + ZA[582]) + ZR26(ZA[579]);\n\tZA[580] = ZMa(ZA[571], ZA[565], ZA[577]) + ZR30(ZA[577]);\n\tZA[488] = ZA[471] + 0xefbe4786U;\n\t\n\tZA[472] = ZR25(ZA[463]) + ZA[462];\n\tZA[587] = ZA[569] + ZA[488];\n\tZA[584] = ZA[565] + ZA[583];\n\tZA[581] = ZA[578] + ZA[580];\n\t\n\tZA[588] = (ZCh(ZA[584], ZA[579], ZA[575]) + ZA[587]) + ZR26(ZA[584]);\n\tZA[586] = ZMa(ZA[577], ZA[571], ZA[581]) + ZR30(ZA[581]);\n\tZA[501] = ZR15(ZA[497]) + ZA[472];\n\tZA[475] = ZR15(ZA[471]);\n\tZA[926] = ZA[575] + 0x0fc19dc6U;\n\t\n\tZA[474] = ZA[475] + ZA[463] + ZR25(ZA[464]);\n\tZA[927] = ZA[926] + ZA[501];\n\tZA[589] = ZA[571] + ZA[588];\n\tZA[585] = ZA[583] + ZA[586];\n\t\n\tZA[592] = (ZCh(ZA[589], ZA[584], ZA[579]) + ZA[927]) + ZR26(ZA[589]);\n\tZA[590] = ZMa(ZA[581], ZA[577], ZA[585]) + ZR30(ZA[585]);\n\tZA[477] = ZR25(ZA[465]) + ZA[464];\n\tZA[489] = ZA[474] + 0x240ca1ccU;\n\t\n\tZA[518] = ZR15(ZA[501]) + ZA[477];\n\tZA[479] = ZR25(ZA[466]);\n\tZA[596] = ZA[579] + ZA[489];\n\tZA[593] = ZA[577] + ZA[592];\n\tZA[591] = ZA[588] + ZA[590];\n\t\n\tZA[597] = (ZCh(ZA[593], ZA[589], ZA[584]) + ZA[596]) + ZR26(ZA[593]);\n\tZA[594] = ZMa(ZA[585], ZA[581], ZA[591]) + ZR30(ZA[591]);\n\tZA[481] = ZA[479] + ZA[465];\n\tZA[601] = ZA[518] + 0x2de92c6fU;\n\t\n\tZA[482] = ZR15(ZA[474]) + ZA[481];\n\tZA[602] = ZA[584] + ZA[601];\n\tZA[598] = ZA[581] + ZA[597];\n\tZA[595] = ZA[592] + ZA[594];\n\t\n\tZA[632] = (ZCh(ZA[598], ZA[593], ZA[589]) + ZA[602]) + ZR26(ZA[598]);\n\tZA[599] = ZMa(ZA[591], ZA[585], ZA[595]) + ZR30(ZA[595]);\n\tZA[483] = ZA[466] + 0x00000100U + ZR25(ZA[467]);\n\tZA[490] = ZA[482] + 0x4a7484aaU;\n\t\n\tZA[528] = ZR15(ZA[518]) + ZA[483];\n\tZA[736] = ZA[585] + ZA[632];\n\tZA[605] = ZA[589] + ZA[490];\n\tZA[600] = ZA[597] + ZA[599];\n\tZA[485] = ZA[467] + 0x11002000U;\n\t\n\tZA[738] = (ZCh(ZA[736], ZA[598], ZA[593]) + ZA[605]) + ZR26(ZA[736]);\n\tZA[744] = ZMa(ZA[595], ZA[591], ZA[600]) + ZR30(ZA[600]);\n\tZA[487] = ZR15(ZA[482]) + ZA[485];\n\tZA[603] = ZA[528] + 0x5cb0a9dcU;\n\t\n\tZA[502] = ZA[497] + ZA[487];\n\tZA[739] = ZA[591] + ZA[738];\n\tZA[604] = ZA[593] + ZA[603];\n\tZA[737] = ZA[744] + ZA[632];\n\t\n\tZA[741] = (ZCh(ZA[739], ZA[736], ZA[598]) + ZA[604]) + ZR26(ZA[739]);\n\tZA[745] = ZMa(ZA[600], ZA[595], ZA[737]) + ZR30(ZA[737]);\n\tZA[486] = ZA[471] + 0x80000000U;\n\tZA[606] = ZA[502] + 0x76f988daU;\n\t\n\tZA[537] = ZR15(ZA[528]) + ZA[486];\n\tZA[742] = ZA[595] + ZA[741];\n\tZA[613] = ZA[598] + ZA[606];\n\tZA[740] = ZA[745] + ZA[738];\n\t\n\tZA[747] = (ZCh(ZA[742], ZA[739], ZA[736]) + ZA[613]) + ZR26(ZA[742]);\n\tZA[746] = ZMa(ZA[737], ZA[600], ZA[740]) + ZR30(ZA[740]);\n\tZA[607] = ZA[537] + 0x983e5152U;\n\t\n\tZA[546] = ZR15(ZA[502]) + ZA[501];\n\tZA[751] = ZA[736] + ZA[607];\n\tZA[748] = ZA[600] + ZA[747];\n\tZA[743] = ZA[746] + ZA[741];\n\t\n\tZA[752] = (ZCh(ZA[748], ZA[742], ZA[739]) + ZA[751]) + ZR26(ZA[748]);\n\tZA[749] = ZMa(ZA[740], ZA[737], ZA[743]) + ZR30(ZA[743]);\n\tZA[608] = ZA[546] + 0xa831c66dU;\n\t\n\tZA[554] = ZR15(ZA[537]) + ZA[474];\n\tZA[756] = ZA[739] + ZA[608];\n\tZA[753] = ZA[737] + ZA[752];\n\tZA[750] = ZA[747] + ZA[749];\n\t\n\tZA[757] = (ZCh(ZA[753], ZA[748], ZA[742]) + ZA[756]) + ZR26(ZA[753]);\n\tZA[754] = ZMa(ZA[743], ZA[740], ZA[750]) + ZR30(ZA[750]);\n\tZA[609] = ZA[554] + 0xb00327c8U;\n\t\n\tZA[566] = ZR15(ZA[546]) + ZA[518];\n\tZA[761] = ZA[742] + ZA[609];\n\tZA[758] = ZA[740] + ZA[757];\n\tZA[755] = ZA[752] + ZA[754];\n\t\n\tZA[762] = (ZCh(ZA[758], ZA[753], ZA[748]) + ZA[761]) + ZR26(ZA[758]);\n\tZA[759] = ZMa(ZA[750], ZA[743], ZA[755]) + ZR30(ZA[755]);\n\tZA[610] = ZA[566] + 0xbf597fc7U;\n\t\n\tZA[567] = ZR15(ZA[554]) + ZA[482];\n\tZA[766] = ZA[748] + ZA[610];\n\tZA[763] = ZA[743] + ZA[762];\n\tZA[760] = ZA[757] + ZA[759];\n\t\n\tZA[767] = (ZCh(ZA[763], ZA[758], ZA[753]) + ZA[766]) + ZR26(ZA[763]);\n\tZA[764] = ZMa(ZA[755], ZA[750], ZA[760]) + ZR30(ZA[760]);\n\tZA[611] = ZA[567] + 0xc6e00bf3U;\n\t\n\tZA[614] = ZR15(ZA[566]) + ZA[528];\n\tZA[771] = ZA[753] + ZA[611];\n\tZA[768] = ZA[750] + ZA[767];\n\tZA[765] = ZA[762] + ZA[764];\n\t\n\tZA[772] = (ZCh(ZA[768], ZA[763], ZA[758]) + ZA[771]) + ZR26(ZA[768]);\n\tZA[769] = ZMa(ZA[760], ZA[755], ZA[765]) + ZR30(ZA[765]);\n\tZA[612] = ZA[502] + 0x00400022U;\n\tZA[615] = ZA[614] + 0xd5a79147U;\n\t\n\tZA[616] = ZR15(ZA[567]) + ZA[612];\n\tZA[504] = ZR25(ZA[497]) + 0x00000100U;\n\tZA[776] = ZA[758] + ZA[615];\n\tZA[773] = ZA[755] + ZA[772];\n\tZA[770] = ZA[767] + ZA[769];\n\t\n\tZA[777] = (ZCh(ZA[773], ZA[768], ZA[763]) + ZA[776]) + ZR26(ZA[773]);\n\tZA[774] = ZMa(ZA[765], ZA[760], ZA[770]) + ZR30(ZA[770]);\n\tZA[492] = ZR25(ZA[471]);\n\tZA[618] = ZA[537] + ZA[504];\n\tZA[617] = ZA[616] + 0x06ca6351U;\n\t\n\tZA[619] = ZR15(ZA[614]) + ZA[618];\n\tZA[781] = ZA[763] + ZA[617];\n\tZA[778] = ZA[760] + ZA[777];\n\tZA[775] = ZA[772] + ZA[774];\n\tZA[505] = ZA[492] + ZA[497];\n\t\n\tZA[782] = (ZCh(ZA[778], ZA[773], ZA[768]) + ZA[781]) + ZR26(ZA[778]);\n\tZA[779] = ZMa(ZA[770], ZA[765], ZA[775]) + ZR30(ZA[775]);\n\tZA[621] = ZA[505] + ZA[546];\n\tZA[620] = ZA[619] + 0x14292967U;\n\t\n\tZA[622] = ZR15(ZA[616]) + ZA[621];\n\tZA[625] = ZR25(ZA[501]);\n\tZA[786] = ZA[768] + ZA[620];\n\tZA[783] = ZA[765] + ZA[782];\n\tZA[624] = ZA[554] + ZA[471];\n\tZA[780] = ZA[777] + ZA[779];\n\t\n\tZA[787] = (ZCh(ZA[783], ZA[778], ZA[773]) + ZA[786]) + ZR26(ZA[783]);\n\tZA[784] = ZMa(ZA[775], ZA[770], ZA[780]) + ZR30(ZA[780]);\n\tZA[493] = ZR25(ZA[474]);\n\tZA[626] = ZA[625] + ZA[624];\n\tZA[623] = ZA[622] + 0x27b70a85U;\n\t\n\tZA[627] = ZR15(ZA[619]) + ZA[626];\n\tZA[791] = ZA[773] + ZA[623];\n\tZA[788] = ZA[770] + ZA[787];\n\tZA[785] = ZA[782] + ZA[784];\n\tZA[629] = ZA[493] + ZA[501];\n\t\n\tZA[792] = (ZCh(ZA[788], ZA[783], ZA[778]) + ZA[791]) + ZR26(ZA[788]);\n\tZA[789] = ZMa(ZA[780], ZA[775], ZA[785]) + ZR30(ZA[785]);\n\tZA[630] = ZA[566] + ZA[629];\n\tZA[628] = ZA[627] + 0x2e1b2138U;\n\t\n\tZA[634] = ZR25(ZA[518]) + ZA[474];\n\tZA[631] = ZR15(ZA[622]) + ZA[630];\n\tZA[796] = ZA[778] + ZA[628];\n\tZA[793] = ZA[775] + ZA[792];\n\tZA[790] = ZA[787] + ZA[789];\n\t\n\tZA[797] = (ZCh(ZA[793], ZA[788], ZA[783]) + ZA[796]) + ZR26(ZA[793]);\n\tZA[794] = ZMa(ZA[785], ZA[780], ZA[790]) + ZR30(ZA[790]);\n\tZA[491] = ZR25(ZA[482]);\n\tZA[635] = ZA[567] + ZA[634];\n\tZA[633] = ZA[631] + 0x4d2c6dfcU;\n\t\n\tZA[636] = ZR15(ZA[627]) + ZA[635];\n\tZA[801] = ZA[783] + ZA[633];\n\tZA[798] = ZA[780] + ZA[797];\n\tZA[795] = ZA[792] + ZA[794];\n\tZA[638] = ZA[491] + ZA[518];\n\t\n\tZA[802] = (ZCh(ZA[798], ZA[793], ZA[788]) + ZA[801]) + ZR26(ZA[798]);\n\tZA[799] = ZMa(ZA[790], ZA[785], ZA[795]) + ZR30(ZA[795]);\n\tZA[639] = ZA[638] + ZA[614];\n\tZA[637] = ZA[636] + 0x53380d13U;\n\t\n\tZA[642] = ZR25(ZA[528]) + ZA[482];\n\tZA[640] = ZR15(ZA[631]) + ZA[639];\n\tZA[806] = ZA[788] + ZA[637];\n\tZA[803] = ZA[785] + ZA[802];\n\tZA[800] = ZA[797] + ZA[799];\n\t\n\tZA[807] = (ZCh(ZA[803], ZA[798], ZA[793]) + ZA[806]) + ZR26(ZA[803]);\n\tZA[804] = ZMa(ZA[795], ZA[790], ZA[800]) + ZR30(ZA[800]);\n\tZA[643] = ZA[616] + ZA[642];\n\tZA[641] = ZA[640] + 0x650a7354U;\n\t\n\tZA[646] = ZR25(ZA[502]) + ZA[528];\n\tZA[644] = ZR15(ZA[636]) + ZA[643];\n\tZA[811] = ZA[793] + ZA[641];\n\tZA[808] = ZA[790] + ZA[807];\n\tZA[805] = ZA[802] + ZA[804];\n\t\n\tZA[812] = (ZCh(ZA[808], ZA[803], ZA[798]) + ZA[811]) + ZR26(ZA[808]);\n\tZA[809] = ZMa(ZA[800], ZA[795], ZA[805]) + ZR30(ZA[805]);\n\tZA[647] = ZA[619] + ZA[646];\n\tZA[645] = ZA[644] + 0x766a0abbU;\n\t\n\tZA[650] = ZR25(ZA[537]) + ZA[502];\n\tZA[648] = ZR15(ZA[640]) + ZA[647];\n\tZA[816] = ZA[798] + ZA[645];\n\tZA[813] = ZA[795] + ZA[812];\n\tZA[810] = ZA[807] + ZA[809];\n\t\n\tZA[817] = (ZCh(ZA[813], ZA[808], ZA[803]) + ZA[816]) + ZR26(ZA[813]);\n\tZA[814] = ZMa(ZA[805], ZA[800], ZA[810]) + ZR30(ZA[810]);\n\tZA[925] = ZA[622] + ZA[650];\n\tZA[649] = ZA[648] + 0x81c2c92eU;\n\t\n\tZA[653] = ZR25(ZA[546]) + ZA[537];\n\tZA[651] = ZR15(ZA[644]) + ZA[925];\n\tZA[821] = ZA[803] + ZA[649];\n\tZA[818] = ZA[800] + ZA[817];\n\tZA[815] = ZA[812] + ZA[814];\n\t\n\tZA[822] = (ZCh(ZA[818], ZA[813], ZA[808]) + ZA[821]) + ZR26(ZA[818]);\n\tZA[819] = ZMa(ZA[810], ZA[805], ZA[815]) + ZR30(ZA[815]);\n\tZA[654] = ZA[627] + ZA[653];\n\tZA[652] = ZA[651] + 0x92722c85U;\n\t\n\tZA[657] = ZR25(ZA[554]) + ZA[546];\n\tZA[655] = ZR15(ZA[648]) + ZA[654];\n\tZA[826] = ZA[808] + ZA[652];\n\tZA[823] = ZA[805] + ZA[822];\n\tZA[820] = ZA[817] + ZA[819];\n\t\n\tZA[827] = (ZCh(ZA[823], ZA[818], ZA[813]) + ZA[826]) + ZR26(ZA[823]);\n\tZA[824] = ZMa(ZA[815], ZA[810], ZA[820]) + ZR30(ZA[820]);\n\tZA[658] = ZA[631] + ZA[657];\n\tZA[656] = ZA[655] + 0xa2bfe8a1U;\n\t\n\tZA[661] = ZR25(ZA[566]) + ZA[554];\n\tZA[659] = ZR15(ZA[651]) + ZA[658];\n\tZA[831] = ZA[813] + ZA[656];\n\tZA[828] = ZA[810] + ZA[827];\n\tZA[825] = ZA[822] + ZA[824];\n\t\n\tZA[832] = (ZCh(ZA[828], ZA[823], ZA[818]) + ZA[831]) + ZR26(ZA[828]);\n\tZA[829] = ZMa(ZA[820], ZA[815], ZA[825]) + ZR30(ZA[825]);\n\tZA[662] = ZA[636] + ZA[661];\n\tZA[660] = ZA[659] + 0xa81a664bU;\n\t\n\tZA[665] = ZR25(ZA[567]) + ZA[566];\n\tZA[663] = ZR15(ZA[655]) + ZA[662];\n\tZA[836] = ZA[818] + ZA[660];\n\tZA[833] = ZA[815] + ZA[832];\n\tZA[830] = ZA[827] + ZA[829];\n\t\n\tZA[837] = (ZCh(ZA[833], ZA[828], ZA[823]) + ZA[836]) + ZR26(ZA[833]);\n\tZA[834] = ZMa(ZA[825], ZA[820], ZA[830]) + ZR30(ZA[830]);\n\tZA[666] = ZA[640] + ZA[665];\n\tZA[664] = ZA[663] + 0xc24b8b70U;\n\t\n\tZA[669] = ZR25(ZA[614]) + ZA[567];\n\tZA[667] = ZR15(ZA[659]) + ZA[666];\n\tZA[841] = ZA[823] + ZA[664];\n\tZA[838] = ZA[820] + ZA[837];\n\tZA[835] = ZA[832] + ZA[834];\n\t\n\tZA[842] = (ZCh(ZA[838], ZA[833], ZA[828]) + ZA[841]) + ZR26(ZA[838]);\n\tZA[839] = ZMa(ZA[830], ZA[825], ZA[835]) + ZR30(ZA[835]);\n\tZA[670] = ZA[644] + ZA[669];\n\tZA[668] = ZA[667] + 0xc76c51a3U;\n\t\n\tZA[677] = ZR25(ZA[616]) + ZA[614];\n\tZA[671] = ZR15(ZA[663]) + ZA[670];\n\tZA[846] = ZA[828] + ZA[668];\n\tZA[843] = ZA[825] + ZA[842];\n\tZA[840] = ZA[837] + ZA[839];\n\t\n\tZA[847] = (ZCh(ZA[843], ZA[838], ZA[833]) + ZA[846]) + ZR26(ZA[843]);\n\tZA[844] = ZMa(ZA[835], ZA[830], ZA[840]) + ZR30(ZA[840]);\n\tZA[678] = ZA[648] + ZA[677];\n\tZA[676] = ZA[671] + 0xd192e819U;\n\t\n\tZA[682] = ZR25(ZA[619]) + ZA[616];\n\tZA[679] = ZR15(ZA[667]) + ZA[678];\n\tZA[851] = ZA[833] + ZA[676];\n\tZA[848] = ZA[830] + ZA[847];\n\tZA[845] = ZA[842] + ZA[844];\n\t\n\tZA[852] = (ZCh(ZA[848], ZA[843], ZA[838]) + ZA[851]) + ZR26(ZA[848]);\n\tZA[849] = ZMa(ZA[840], ZA[835], ZA[845]) + ZR30(ZA[845]);\n\tZA[683] = ZA[651] + ZA[682];\n\tZA[680] = ZA[679] + 0xd6990624U;\n\t\n\tZA[686] = ZR25(ZA[622]) + ZA[619];\n\tZA[684] = ZR15(ZA[671]) + ZA[683];\n\tZA[856] = ZA[838] + ZA[680];\n\tZA[853] = ZA[835] + ZA[852];\n\tZA[850] = ZA[847] + ZA[849];\n\t\n\tZA[857] = (ZCh(ZA[853], ZA[848], ZA[843]) + ZA[856]) + ZR26(ZA[853]);\n\tZA[854] = ZMa(ZA[845], ZA[840], ZA[850]) + ZR30(ZA[850]);\n\tZA[687] = ZA[655] + ZA[686];\n\tZA[685] = ZA[684] + 0xf40e3585U;\n\t\n\tZA[690] = ZR25(ZA[627]) + ZA[622];\n\tZA[688] = ZR15(ZA[679]) + ZA[687];\n\tZA[861] = ZA[843] + ZA[685];\n\tZA[858] = ZA[840] + ZA[857];\n\tZA[855] = ZA[852] + ZA[854];\n\t\n\tZA[862] = (ZCh(ZA[858], ZA[853], ZA[848]) + ZA[861]) + ZR26(ZA[858]);\n\tZA[859] = ZMa(ZA[850], ZA[845], ZA[855]) + ZR30(ZA[855]);\n\tZA[691] = ZA[659] + ZA[690];\n\tZA[689] = ZA[688] + 0x106aa070U;\n\t\n\tZA[694] = ZR25(ZA[631]) + ZA[627];\n\tZA[692] = ZR15(ZA[684]) + ZA[691];\n\tZA[866] = ZA[848] + ZA[689];\n\tZA[863] = ZA[845] + ZA[862];\n\tZA[860] = ZA[857] + ZA[859];\n\t\n\tZA[867] = (ZCh(ZA[863], ZA[858], ZA[853]) + ZA[866]) + ZR26(ZA[863]);\n\tZA[864] = ZMa(ZA[855], ZA[850], ZA[860]) + ZR30(ZA[860]);\n\tZA[695] = ZA[663] + ZA[694];\n\tZA[693] = ZA[692] + 0x19a4c116U;\n\t\n\tZA[698] = ZR25(ZA[636]) + ZA[631];\n\tZA[696] = ZR15(ZA[688]) + ZA[695];\n\tZA[871] = ZA[853] + ZA[693];\n\tZA[868] = ZA[850] + ZA[867];\n\tZA[865] = ZA[862] + ZA[864];\n\t\n\tZA[873] = (ZCh(ZA[868], ZA[863], ZA[858]) + ZA[871]) + ZR26(ZA[868]);\n\tZA[869] = ZMa(ZA[860], ZA[855], ZA[865]) + ZR30(ZA[865]);\n\tZA[699] = ZA[667] + ZA[698];\n\tZA[697] = ZA[696] + 0x1e376c08U;\n\t\n\tZA[702] = ZR25(ZA[640]) + ZA[636];\n\tZA[700] = ZR15(ZA[692]) + ZA[699];\n\tZA[877] = ZA[858] + ZA[697];\n\tZA[874] = ZA[855] + ZA[873];\n\tZA[870] = ZA[867] + ZA[869];\n\t\n\tZA[878] = (ZCh(ZA[874], ZA[868], ZA[863]) + ZA[877]) + ZR26(ZA[874]);\n\tZA[875] = ZMa(ZA[865], ZA[860], ZA[870]) + ZR30(ZA[870]);\n\tZA[703] = ZA[671] + ZA[702];\n\tZA[701] = ZA[700] + 0x2748774cU;\n\t\n\tZA[706] = ZR25(ZA[644]) + ZA[640];\n\tZA[704] = ZR15(ZA[696]) + ZA[703];\n\tZA[882] = ZA[863] + ZA[701];\n\tZA[879] = ZA[860] + ZA[878];\n\tZA[876] = ZA[873] + ZA[875];\n\t\n\tZA[883] = (ZCh(ZA[879], ZA[874], ZA[868]) + ZA[882]) + ZR26(ZA[879]);\n\tZA[880] = ZMa(ZA[870], ZA[865], ZA[876]) + ZR30(ZA[876]);\n\tZA[707] = ZA[679] + ZA[706];\n\tZA[705] = ZA[704] + 0x34b0bcb5U;\n\t\n\tZA[710] = ZR25(ZA[648]) + ZA[644];\n\tZA[708] = ZR15(ZA[700]) + ZA[707];\n\tZA[887] = ZA[868] + ZA[705];\n\tZA[884] = ZA[865] + ZA[883];\n\tZA[881] = ZA[878] + ZA[880];\n\t\n\tZA[888] = (ZCh(ZA[884], ZA[879], ZA[874]) + ZA[887]) + ZR26(ZA[884]);\n\tZA[885] = ZMa(ZA[876], ZA[870], ZA[881]) + ZR30(ZA[881]);\n\tZA[711] = ZA[684] + ZA[710];\n\tZA[709] = ZA[708] + 0x391c0cb3U;\n\t\n\tZA[714] = ZR25(ZA[651]) + ZA[648];\n\tZA[712] = ZR15(ZA[704]) + ZA[711];\n\tZA[892] = ZA[874] + ZA[709];\n\tZA[889] = ZA[870] + ZA[888];\n\tZA[886] = ZA[883] + ZA[885];\n\t\n\tZA[893] = (ZCh(ZA[889], ZA[884], ZA[879]) + ZA[892]) + ZR26(ZA[889]);\n\tZA[890] = ZMa(ZA[881], ZA[876], ZA[886]) + ZR30(ZA[886]);\n\tZA[715] = ZA[688] + ZA[714];\n\tZA[713] = ZA[712] + 0x4ed8aa4aU;\n\t\n\tZA[718] = ZR25(ZA[655]) + ZA[651];\n\tZA[716] = ZR15(ZA[708]) + ZA[715];\n\tZA[897] = ZA[879] + ZA[713];\n\tZA[894] = ZA[876] + ZA[893];\n\tZA[891] = ZA[888] + ZA[890];\n\t\n\tZA[898] = (ZCh(ZA[894], ZA[889], ZA[884]) + ZA[897]) + ZR26(ZA[894]);\n\tZA[895] = ZMa(ZA[886], ZA[881], ZA[891]) + ZR30(ZA[891]);\n\tZA[719] = ZA[692] + ZA[718];\n\tZA[717] = ZA[716] + 0x5b9cca4fU;\n\t\n\tZA[722] = ZR25(ZA[659]) + ZA[655];\n\tZA[720] = ZR15(ZA[712]) + ZA[719];\n\tZA[902] = ZA[884] + ZA[717];\n\tZA[899] = ZA[881] + ZA[898];\n\tZA[896] = ZA[893] + ZA[895];\n\t\n\tZA[903] = (ZCh(ZA[899], ZA[894], ZA[889]) + ZA[902]) + ZR26(ZA[899]);\n\tZA[900] = ZMa(ZA[891], ZA[886], ZA[896]) + ZR30(ZA[896]);\n\tZA[723] = ZA[696] + ZA[722];\n\tZA[721] = ZA[720] + 0x682e6ff3U;\n\t\n\tZA[672] = ZR25(ZA[663]) + ZA[659];\n\tZA[724] = ZR15(ZA[716]) + ZA[723];\n\tZA[907] = ZA[889] + ZA[721];\n\tZA[904] = ZA[886] + ZA[903];\n\tZA[901] = ZA[898] + ZA[900];\n\t\n\tZA[908] = (ZCh(ZA[904], ZA[899], ZA[894]) + ZA[907]) + ZR26(ZA[904]);\n\tZA[905] = ZMa(ZA[896], ZA[891], ZA[901]) + ZR30(ZA[901]);\n\tZA[673] = ZR25(ZA[667]) + ZA[663];\n\tZA[726] = ZA[700] + ZA[672];\n\tZA[725] = ZA[724] + 0x748f82eeU;\n\t\n\tZA[727] = ZR15(ZA[720]) + ZA[726];\n\tZA[912] = ZA[894] + ZA[725];\n\tZA[909] = ZA[891] + ZA[908];\n\tZA[906] = ZA[903] + ZA[905];\n\tZA[675] = ZA[667] + 0x8cc70208U;\n\tZA[729] = ZA[704] + ZA[673];\n\t\n\tZA[913] = (ZCh(ZA[909], ZA[904], ZA[899]) + ZA[912]) + ZR26(ZA[909]);\n\tZA[910] = ZMa(ZA[901], ZA[896], ZA[906]) + ZR30(ZA[906]);\n\tZA[674] = ZR25(ZA[671]) + ZA[675];\n\tZA[730] = ZR15(ZA[724]) + ZA[729];\n\tZA[728] = ZA[727] + 0x78a5636fU;\n\t\n\tZA[681] = ZR25(ZA[679]) + ZA[671];\n\tZA[917] = ZA[899] + ZA[901] + ZA[728];\n\tZA[914] = ZA[896] + ZA[913];\n\tZA[911] = ZA[908] + ZA[910];\n\tZA[732] = ZA[708] + ZA[674];\n\tZA[731] = ZA[730] + 0x84c87814U;\n\t\n\tZA[918] = (ZCh(ZA[914], ZA[909], ZA[904]) + ZA[917]) + ZR26(ZA[914]);\n\tZA[915] = ZMa(ZA[906], ZA[901], ZA[911]) + ZR30(ZA[911]);\n\tZA[733] = ZR15(ZA[727]) + ZA[732];\n\tZA[919] = ZA[906] + ZA[904] + ZA[731];\n\tZA[734] = ZA[712] + ZA[681];\n\t\n\tZA[920] = (ZCh(ZA[918], ZA[914], ZA[909]) + ZA[919]) + ZR26(ZA[918]);\n\tZA[735] = ZR15(ZA[730]) + ZA[734];\n\tZA[921] = ZA[911] + ZA[909] + ZA[733];\n\tZA[916] = ZA[913] + ZA[915];\n\t\n\tZA[922] = (ZCh(ZA[920], ZA[918], ZA[914]) + ZA[921]) + ZR26(ZA[920]);\n\tZA[923] = ZA[916] + ZA[914] + ZA[735];\n\t\n\tZA[924] = (ZCh(ZA[922], ZA[920], ZA[918]) + ZA[923]) + ZR26(ZA[922]);\n\t\n\tbool Zio = any(ZA[924] == (z)0x136032EDU);\n\n\tbool io = false;\n\tio = (Zio) ? Zio : io;\n\n\tnonce = (io) ? Znonce : nonce;\n\n\tif(io) { output[0] = (uintzz)nonce; }\n}\n\n// vim: set ft=c\n"
  }
]