github.com/emmansun/gmsm@v0.29.1/internal/sm2ec/fiat/sm2p256_fiat64.go (about)

     1  // Code generated by Fiat Cryptography. DO NOT EDIT.
     2  //
     3  // Autogenerated: word_by_word_montgomery --lang Go --no-wide-int --cmovznz-by-mul --relax-primitive-carry-to-bitwidth 32,64 --internal-static --public-function-case camelCase --public-type-case camelCase --private-function-case camelCase --private-type-case camelCase --doc-text-before-function-name '' --doc-newline-before-package-declaration --doc-prepend-header 'Code generated by Fiat Cryptography. DO NOT EDIT.' --package-name fiat --no-prefix-fiat sm2p256 64 '2^256 - 2^224 - 2^96 + 2^64 - 1' mul square add sub one from_montgomery to_montgomery selectznz to_bytes from_bytes nonzero opp msat divstep divstep_precomp
     4  //
     5  // curve description: sm2p256
     6  //
     7  // machine_wordsize = 64 (from "64")
     8  //
     9  // requested operations: mul, square, add, sub, one, from_montgomery, to_montgomery, selectznz, to_bytes, from_bytes, nonzero, opp, msat, divstep, divstep_precomp
    10  //
    11  // m = 0xfffffffeffffffffffffffffffffffffffffffff00000000ffffffffffffffff (from "2^256 - 2^224 - 2^96 + 2^64 - 1")
    12  //
    13  //
    14  //
    15  // NOTE: In addition to the bounds specified above each function, all
    16  //
    17  //   functions synthesized for this Montgomery arithmetic require the
    18  //
    19  //   input to be strictly less than the prime modulus (m), and also
    20  //
    21  //   require the input to be in the unique saturated representation.
    22  //
    23  //   All functions also ensure that these two properties are true of
    24  //
    25  //   return values.
    26  //
    27  //
    28  //
    29  // Computed values:
    30  //
    31  //   eval z = z[0] + (z[1] << 64) + (z[2] << 128) + (z[3] << 192)
    32  //
    33  //   bytes_eval z = z[0] + (z[1] << 8) + (z[2] << 16) + (z[3] << 24) + (z[4] << 32) + (z[5] << 40) + (z[6] << 48) + (z[7] << 56) + (z[8] << 64) + (z[9] << 72) + (z[10] << 80) + (z[11] << 88) + (z[12] << 96) + (z[13] << 104) + (z[14] << 112) + (z[15] << 120) + (z[16] << 128) + (z[17] << 136) + (z[18] << 144) + (z[19] << 152) + (z[20] << 160) + (z[21] << 168) + (z[22] << 176) + (z[23] << 184) + (z[24] << 192) + (z[25] << 200) + (z[26] << 208) + (z[27] << 216) + (z[28] << 224) + (z[29] << 232) + (z[30] << 240) + (z[31] << 248)
    34  //
    35  //   twos_complement_eval z = let x1 := z[0] + (z[1] << 64) + (z[2] << 128) + (z[3] << 192) in
    36  //
    37  //                            if x1 & (2^256-1) < 2^255 then x1 & (2^256-1) else (x1 & (2^256-1)) - 2^256
    38  
    39  package fiat
    40  
    41  import "math/bits"
    42  
    43  type sm2p256Uint1 uint64 // We use uint64 instead of a more narrow type for performance reasons; see https://github.com/mit-plv/fiat-crypto/pull/1006#issuecomment-892625927
    44  type sm2p256Int1 int64 // We use uint64 instead of a more narrow type for performance reasons; see https://github.com/mit-plv/fiat-crypto/pull/1006#issuecomment-892625927
    45  
    46  // The type sm2p256MontgomeryDomainFieldElement is a field element in the Montgomery domain.
    47  //
    48  // Bounds: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
    49  type sm2p256MontgomeryDomainFieldElement [4]uint64
    50  
    51  // The type sm2p256NonMontgomeryDomainFieldElement is a field element NOT in the Montgomery domain.
    52  //
    53  // Bounds: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
    54  type sm2p256NonMontgomeryDomainFieldElement [4]uint64
    55  
    56  // sm2p256CmovznzU64 is a single-word conditional move.
    57  //
    58  // Postconditions:
    59  //   out1 = (if arg1 = 0 then arg2 else arg3)
    60  //
    61  // Input Bounds:
    62  //   arg1: [0x0 ~> 0x1]
    63  //   arg2: [0x0 ~> 0xffffffffffffffff]
    64  //   arg3: [0x0 ~> 0xffffffffffffffff]
    65  // Output Bounds:
    66  //   out1: [0x0 ~> 0xffffffffffffffff]
    67  func sm2p256CmovznzU64(out1 *uint64, arg1 sm2p256Uint1, arg2 uint64, arg3 uint64) {
    68  	x1 := (uint64(arg1) * 0xffffffffffffffff)
    69  	x2 := ((x1 & arg3) | ((^x1) & arg2))
    70  	*out1 = x2
    71  }
    72  
    73  // sm2p256Mul multiplies two field elements in the Montgomery domain.
    74  //
    75  // Preconditions:
    76  //   0 ≤ eval arg1 < m
    77  //   0 ≤ eval arg2 < m
    78  // Postconditions:
    79  //   eval (from_montgomery out1) mod m = (eval (from_montgomery arg1) * eval (from_montgomery arg2)) mod m
    80  //   0 ≤ eval out1 < m
    81  //
    82  func sm2p256Mul(out1 *sm2p256MontgomeryDomainFieldElement, arg1 *sm2p256MontgomeryDomainFieldElement, arg2 *sm2p256MontgomeryDomainFieldElement) {
    83  	x1 := arg1[1]
    84  	x2 := arg1[2]
    85  	x3 := arg1[3]
    86  	x4 := arg1[0]
    87  	var x5 uint64
    88  	var x6 uint64
    89  	x6, x5 = bits.Mul64(x4, arg2[3])
    90  	var x7 uint64
    91  	var x8 uint64
    92  	x8, x7 = bits.Mul64(x4, arg2[2])
    93  	var x9 uint64
    94  	var x10 uint64
    95  	x10, x9 = bits.Mul64(x4, arg2[1])
    96  	var x11 uint64
    97  	var x12 uint64
    98  	x12, x11 = bits.Mul64(x4, arg2[0])
    99  	var x13 uint64
   100  	var x14 uint64
   101  	x13, x14 = bits.Add64(x12, x9, uint64(0x0))
   102  	var x15 uint64
   103  	var x16 uint64
   104  	x15, x16 = bits.Add64(x10, x7, uint64(sm2p256Uint1(x14)))
   105  	var x17 uint64
   106  	var x18 uint64
   107  	x17, x18 = bits.Add64(x8, x5, uint64(sm2p256Uint1(x16)))
   108  	x19 := (uint64(sm2p256Uint1(x18)) + x6)
   109  	var x20 uint64
   110  	var x21 uint64
   111  	x21, x20 = bits.Mul64(x11, 0xfffffffeffffffff)
   112  	var x22 uint64
   113  	var x23 uint64
   114  	x23, x22 = bits.Mul64(x11, 0xffffffffffffffff)
   115  	var x24 uint64
   116  	var x25 uint64
   117  	x25, x24 = bits.Mul64(x11, 0xffffffff00000000)
   118  	var x26 uint64
   119  	var x27 uint64
   120  	x27, x26 = bits.Mul64(x11, 0xffffffffffffffff)
   121  	var x28 uint64
   122  	var x29 uint64
   123  	x28, x29 = bits.Add64(x27, x24, uint64(0x0))
   124  	var x30 uint64
   125  	var x31 uint64
   126  	x30, x31 = bits.Add64(x25, x22, uint64(sm2p256Uint1(x29)))
   127  	var x32 uint64
   128  	var x33 uint64
   129  	x32, x33 = bits.Add64(x23, x20, uint64(sm2p256Uint1(x31)))
   130  	x34 := (uint64(sm2p256Uint1(x33)) + x21)
   131  	var x36 uint64
   132  	_, x36 = bits.Add64(x11, x26, uint64(0x0))
   133  	var x37 uint64
   134  	var x38 uint64
   135  	x37, x38 = bits.Add64(x13, x28, uint64(sm2p256Uint1(x36)))
   136  	var x39 uint64
   137  	var x40 uint64
   138  	x39, x40 = bits.Add64(x15, x30, uint64(sm2p256Uint1(x38)))
   139  	var x41 uint64
   140  	var x42 uint64
   141  	x41, x42 = bits.Add64(x17, x32, uint64(sm2p256Uint1(x40)))
   142  	var x43 uint64
   143  	var x44 uint64
   144  	x43, x44 = bits.Add64(x19, x34, uint64(sm2p256Uint1(x42)))
   145  	var x45 uint64
   146  	var x46 uint64
   147  	x46, x45 = bits.Mul64(x1, arg2[3])
   148  	var x47 uint64
   149  	var x48 uint64
   150  	x48, x47 = bits.Mul64(x1, arg2[2])
   151  	var x49 uint64
   152  	var x50 uint64
   153  	x50, x49 = bits.Mul64(x1, arg2[1])
   154  	var x51 uint64
   155  	var x52 uint64
   156  	x52, x51 = bits.Mul64(x1, arg2[0])
   157  	var x53 uint64
   158  	var x54 uint64
   159  	x53, x54 = bits.Add64(x52, x49, uint64(0x0))
   160  	var x55 uint64
   161  	var x56 uint64
   162  	x55, x56 = bits.Add64(x50, x47, uint64(sm2p256Uint1(x54)))
   163  	var x57 uint64
   164  	var x58 uint64
   165  	x57, x58 = bits.Add64(x48, x45, uint64(sm2p256Uint1(x56)))
   166  	x59 := (uint64(sm2p256Uint1(x58)) + x46)
   167  	var x60 uint64
   168  	var x61 uint64
   169  	x60, x61 = bits.Add64(x37, x51, uint64(0x0))
   170  	var x62 uint64
   171  	var x63 uint64
   172  	x62, x63 = bits.Add64(x39, x53, uint64(sm2p256Uint1(x61)))
   173  	var x64 uint64
   174  	var x65 uint64
   175  	x64, x65 = bits.Add64(x41, x55, uint64(sm2p256Uint1(x63)))
   176  	var x66 uint64
   177  	var x67 uint64
   178  	x66, x67 = bits.Add64(x43, x57, uint64(sm2p256Uint1(x65)))
   179  	var x68 uint64
   180  	var x69 uint64
   181  	x68, x69 = bits.Add64(uint64(sm2p256Uint1(x44)), x59, uint64(sm2p256Uint1(x67)))
   182  	var x70 uint64
   183  	var x71 uint64
   184  	x71, x70 = bits.Mul64(x60, 0xfffffffeffffffff)
   185  	var x72 uint64
   186  	var x73 uint64
   187  	x73, x72 = bits.Mul64(x60, 0xffffffffffffffff)
   188  	var x74 uint64
   189  	var x75 uint64
   190  	x75, x74 = bits.Mul64(x60, 0xffffffff00000000)
   191  	var x76 uint64
   192  	var x77 uint64
   193  	x77, x76 = bits.Mul64(x60, 0xffffffffffffffff)
   194  	var x78 uint64
   195  	var x79 uint64
   196  	x78, x79 = bits.Add64(x77, x74, uint64(0x0))
   197  	var x80 uint64
   198  	var x81 uint64
   199  	x80, x81 = bits.Add64(x75, x72, uint64(sm2p256Uint1(x79)))
   200  	var x82 uint64
   201  	var x83 uint64
   202  	x82, x83 = bits.Add64(x73, x70, uint64(sm2p256Uint1(x81)))
   203  	x84 := (uint64(sm2p256Uint1(x83)) + x71)
   204  	var x86 uint64
   205  	_, x86 = bits.Add64(x60, x76, uint64(0x0))
   206  	var x87 uint64
   207  	var x88 uint64
   208  	x87, x88 = bits.Add64(x62, x78, uint64(sm2p256Uint1(x86)))
   209  	var x89 uint64
   210  	var x90 uint64
   211  	x89, x90 = bits.Add64(x64, x80, uint64(sm2p256Uint1(x88)))
   212  	var x91 uint64
   213  	var x92 uint64
   214  	x91, x92 = bits.Add64(x66, x82, uint64(sm2p256Uint1(x90)))
   215  	var x93 uint64
   216  	var x94 uint64
   217  	x93, x94 = bits.Add64(x68, x84, uint64(sm2p256Uint1(x92)))
   218  	x95 := (uint64(sm2p256Uint1(x94)) + uint64(sm2p256Uint1(x69)))
   219  	var x96 uint64
   220  	var x97 uint64
   221  	x97, x96 = bits.Mul64(x2, arg2[3])
   222  	var x98 uint64
   223  	var x99 uint64
   224  	x99, x98 = bits.Mul64(x2, arg2[2])
   225  	var x100 uint64
   226  	var x101 uint64
   227  	x101, x100 = bits.Mul64(x2, arg2[1])
   228  	var x102 uint64
   229  	var x103 uint64
   230  	x103, x102 = bits.Mul64(x2, arg2[0])
   231  	var x104 uint64
   232  	var x105 uint64
   233  	x104, x105 = bits.Add64(x103, x100, uint64(0x0))
   234  	var x106 uint64
   235  	var x107 uint64
   236  	x106, x107 = bits.Add64(x101, x98, uint64(sm2p256Uint1(x105)))
   237  	var x108 uint64
   238  	var x109 uint64
   239  	x108, x109 = bits.Add64(x99, x96, uint64(sm2p256Uint1(x107)))
   240  	x110 := (uint64(sm2p256Uint1(x109)) + x97)
   241  	var x111 uint64
   242  	var x112 uint64
   243  	x111, x112 = bits.Add64(x87, x102, uint64(0x0))
   244  	var x113 uint64
   245  	var x114 uint64
   246  	x113, x114 = bits.Add64(x89, x104, uint64(sm2p256Uint1(x112)))
   247  	var x115 uint64
   248  	var x116 uint64
   249  	x115, x116 = bits.Add64(x91, x106, uint64(sm2p256Uint1(x114)))
   250  	var x117 uint64
   251  	var x118 uint64
   252  	x117, x118 = bits.Add64(x93, x108, uint64(sm2p256Uint1(x116)))
   253  	var x119 uint64
   254  	var x120 uint64
   255  	x119, x120 = bits.Add64(x95, x110, uint64(sm2p256Uint1(x118)))
   256  	var x121 uint64
   257  	var x122 uint64
   258  	x122, x121 = bits.Mul64(x111, 0xfffffffeffffffff)
   259  	var x123 uint64
   260  	var x124 uint64
   261  	x124, x123 = bits.Mul64(x111, 0xffffffffffffffff)
   262  	var x125 uint64
   263  	var x126 uint64
   264  	x126, x125 = bits.Mul64(x111, 0xffffffff00000000)
   265  	var x127 uint64
   266  	var x128 uint64
   267  	x128, x127 = bits.Mul64(x111, 0xffffffffffffffff)
   268  	var x129 uint64
   269  	var x130 uint64
   270  	x129, x130 = bits.Add64(x128, x125, uint64(0x0))
   271  	var x131 uint64
   272  	var x132 uint64
   273  	x131, x132 = bits.Add64(x126, x123, uint64(sm2p256Uint1(x130)))
   274  	var x133 uint64
   275  	var x134 uint64
   276  	x133, x134 = bits.Add64(x124, x121, uint64(sm2p256Uint1(x132)))
   277  	x135 := (uint64(sm2p256Uint1(x134)) + x122)
   278  	var x137 uint64
   279  	_, x137 = bits.Add64(x111, x127, uint64(0x0))
   280  	var x138 uint64
   281  	var x139 uint64
   282  	x138, x139 = bits.Add64(x113, x129, uint64(sm2p256Uint1(x137)))
   283  	var x140 uint64
   284  	var x141 uint64
   285  	x140, x141 = bits.Add64(x115, x131, uint64(sm2p256Uint1(x139)))
   286  	var x142 uint64
   287  	var x143 uint64
   288  	x142, x143 = bits.Add64(x117, x133, uint64(sm2p256Uint1(x141)))
   289  	var x144 uint64
   290  	var x145 uint64
   291  	x144, x145 = bits.Add64(x119, x135, uint64(sm2p256Uint1(x143)))
   292  	x146 := (uint64(sm2p256Uint1(x145)) + uint64(sm2p256Uint1(x120)))
   293  	var x147 uint64
   294  	var x148 uint64
   295  	x148, x147 = bits.Mul64(x3, arg2[3])
   296  	var x149 uint64
   297  	var x150 uint64
   298  	x150, x149 = bits.Mul64(x3, arg2[2])
   299  	var x151 uint64
   300  	var x152 uint64
   301  	x152, x151 = bits.Mul64(x3, arg2[1])
   302  	var x153 uint64
   303  	var x154 uint64
   304  	x154, x153 = bits.Mul64(x3, arg2[0])
   305  	var x155 uint64
   306  	var x156 uint64
   307  	x155, x156 = bits.Add64(x154, x151, uint64(0x0))
   308  	var x157 uint64
   309  	var x158 uint64
   310  	x157, x158 = bits.Add64(x152, x149, uint64(sm2p256Uint1(x156)))
   311  	var x159 uint64
   312  	var x160 uint64
   313  	x159, x160 = bits.Add64(x150, x147, uint64(sm2p256Uint1(x158)))
   314  	x161 := (uint64(sm2p256Uint1(x160)) + x148)
   315  	var x162 uint64
   316  	var x163 uint64
   317  	x162, x163 = bits.Add64(x138, x153, uint64(0x0))
   318  	var x164 uint64
   319  	var x165 uint64
   320  	x164, x165 = bits.Add64(x140, x155, uint64(sm2p256Uint1(x163)))
   321  	var x166 uint64
   322  	var x167 uint64
   323  	x166, x167 = bits.Add64(x142, x157, uint64(sm2p256Uint1(x165)))
   324  	var x168 uint64
   325  	var x169 uint64
   326  	x168, x169 = bits.Add64(x144, x159, uint64(sm2p256Uint1(x167)))
   327  	var x170 uint64
   328  	var x171 uint64
   329  	x170, x171 = bits.Add64(x146, x161, uint64(sm2p256Uint1(x169)))
   330  	var x172 uint64
   331  	var x173 uint64
   332  	x173, x172 = bits.Mul64(x162, 0xfffffffeffffffff)
   333  	var x174 uint64
   334  	var x175 uint64
   335  	x175, x174 = bits.Mul64(x162, 0xffffffffffffffff)
   336  	var x176 uint64
   337  	var x177 uint64
   338  	x177, x176 = bits.Mul64(x162, 0xffffffff00000000)
   339  	var x178 uint64
   340  	var x179 uint64
   341  	x179, x178 = bits.Mul64(x162, 0xffffffffffffffff)
   342  	var x180 uint64
   343  	var x181 uint64
   344  	x180, x181 = bits.Add64(x179, x176, uint64(0x0))
   345  	var x182 uint64
   346  	var x183 uint64
   347  	x182, x183 = bits.Add64(x177, x174, uint64(sm2p256Uint1(x181)))
   348  	var x184 uint64
   349  	var x185 uint64
   350  	x184, x185 = bits.Add64(x175, x172, uint64(sm2p256Uint1(x183)))
   351  	x186 := (uint64(sm2p256Uint1(x185)) + x173)
   352  	var x188 uint64
   353  	_, x188 = bits.Add64(x162, x178, uint64(0x0))
   354  	var x189 uint64
   355  	var x190 uint64
   356  	x189, x190 = bits.Add64(x164, x180, uint64(sm2p256Uint1(x188)))
   357  	var x191 uint64
   358  	var x192 uint64
   359  	x191, x192 = bits.Add64(x166, x182, uint64(sm2p256Uint1(x190)))
   360  	var x193 uint64
   361  	var x194 uint64
   362  	x193, x194 = bits.Add64(x168, x184, uint64(sm2p256Uint1(x192)))
   363  	var x195 uint64
   364  	var x196 uint64
   365  	x195, x196 = bits.Add64(x170, x186, uint64(sm2p256Uint1(x194)))
   366  	x197 := (uint64(sm2p256Uint1(x196)) + uint64(sm2p256Uint1(x171)))
   367  	var x198 uint64
   368  	var x199 uint64
   369  	x198, x199 = bits.Sub64(x189, 0xffffffffffffffff, uint64(0x0))
   370  	var x200 uint64
   371  	var x201 uint64
   372  	x200, x201 = bits.Sub64(x191, 0xffffffff00000000, uint64(sm2p256Uint1(x199)))
   373  	var x202 uint64
   374  	var x203 uint64
   375  	x202, x203 = bits.Sub64(x193, 0xffffffffffffffff, uint64(sm2p256Uint1(x201)))
   376  	var x204 uint64
   377  	var x205 uint64
   378  	x204, x205 = bits.Sub64(x195, 0xfffffffeffffffff, uint64(sm2p256Uint1(x203)))
   379  	var x207 uint64
   380  	_, x207 = bits.Sub64(x197, uint64(0x0), uint64(sm2p256Uint1(x205)))
   381  	var x208 uint64
   382  	sm2p256CmovznzU64(&x208, sm2p256Uint1(x207), x198, x189)
   383  	var x209 uint64
   384  	sm2p256CmovznzU64(&x209, sm2p256Uint1(x207), x200, x191)
   385  	var x210 uint64
   386  	sm2p256CmovznzU64(&x210, sm2p256Uint1(x207), x202, x193)
   387  	var x211 uint64
   388  	sm2p256CmovznzU64(&x211, sm2p256Uint1(x207), x204, x195)
   389  	out1[0] = x208
   390  	out1[1] = x209
   391  	out1[2] = x210
   392  	out1[3] = x211
   393  }
   394  
   395  // sm2p256Square squares a field element in the Montgomery domain.
   396  //
   397  // Preconditions:
   398  //   0 ≤ eval arg1 < m
   399  // Postconditions:
   400  //   eval (from_montgomery out1) mod m = (eval (from_montgomery arg1) * eval (from_montgomery arg1)) mod m
   401  //   0 ≤ eval out1 < m
   402  //
   403  func sm2p256Square(out1 *sm2p256MontgomeryDomainFieldElement, arg1 *sm2p256MontgomeryDomainFieldElement) {
   404  	x1 := arg1[1]
   405  	x2 := arg1[2]
   406  	x3 := arg1[3]
   407  	x4 := arg1[0]
   408  	var x5 uint64
   409  	var x6 uint64
   410  	x6, x5 = bits.Mul64(x4, arg1[3])
   411  	var x7 uint64
   412  	var x8 uint64
   413  	x8, x7 = bits.Mul64(x4, arg1[2])
   414  	var x9 uint64
   415  	var x10 uint64
   416  	x10, x9 = bits.Mul64(x4, arg1[1])
   417  	var x11 uint64
   418  	var x12 uint64
   419  	x12, x11 = bits.Mul64(x4, arg1[0])
   420  	var x13 uint64
   421  	var x14 uint64
   422  	x13, x14 = bits.Add64(x12, x9, uint64(0x0))
   423  	var x15 uint64
   424  	var x16 uint64
   425  	x15, x16 = bits.Add64(x10, x7, uint64(sm2p256Uint1(x14)))
   426  	var x17 uint64
   427  	var x18 uint64
   428  	x17, x18 = bits.Add64(x8, x5, uint64(sm2p256Uint1(x16)))
   429  	x19 := (uint64(sm2p256Uint1(x18)) + x6)
   430  	var x20 uint64
   431  	var x21 uint64
   432  	x21, x20 = bits.Mul64(x11, 0xfffffffeffffffff)
   433  	var x22 uint64
   434  	var x23 uint64
   435  	x23, x22 = bits.Mul64(x11, 0xffffffffffffffff)
   436  	var x24 uint64
   437  	var x25 uint64
   438  	x25, x24 = bits.Mul64(x11, 0xffffffff00000000)
   439  	var x26 uint64
   440  	var x27 uint64
   441  	x27, x26 = bits.Mul64(x11, 0xffffffffffffffff)
   442  	var x28 uint64
   443  	var x29 uint64
   444  	x28, x29 = bits.Add64(x27, x24, uint64(0x0))
   445  	var x30 uint64
   446  	var x31 uint64
   447  	x30, x31 = bits.Add64(x25, x22, uint64(sm2p256Uint1(x29)))
   448  	var x32 uint64
   449  	var x33 uint64
   450  	x32, x33 = bits.Add64(x23, x20, uint64(sm2p256Uint1(x31)))
   451  	x34 := (uint64(sm2p256Uint1(x33)) + x21)
   452  	var x36 uint64
   453  	_, x36 = bits.Add64(x11, x26, uint64(0x0))
   454  	var x37 uint64
   455  	var x38 uint64
   456  	x37, x38 = bits.Add64(x13, x28, uint64(sm2p256Uint1(x36)))
   457  	var x39 uint64
   458  	var x40 uint64
   459  	x39, x40 = bits.Add64(x15, x30, uint64(sm2p256Uint1(x38)))
   460  	var x41 uint64
   461  	var x42 uint64
   462  	x41, x42 = bits.Add64(x17, x32, uint64(sm2p256Uint1(x40)))
   463  	var x43 uint64
   464  	var x44 uint64
   465  	x43, x44 = bits.Add64(x19, x34, uint64(sm2p256Uint1(x42)))
   466  	var x45 uint64
   467  	var x46 uint64
   468  	x46, x45 = bits.Mul64(x1, arg1[3])
   469  	var x47 uint64
   470  	var x48 uint64
   471  	x48, x47 = bits.Mul64(x1, arg1[2])
   472  	var x49 uint64
   473  	var x50 uint64
   474  	x50, x49 = bits.Mul64(x1, arg1[1])
   475  	var x51 uint64
   476  	var x52 uint64
   477  	x52, x51 = bits.Mul64(x1, arg1[0])
   478  	var x53 uint64
   479  	var x54 uint64
   480  	x53, x54 = bits.Add64(x52, x49, uint64(0x0))
   481  	var x55 uint64
   482  	var x56 uint64
   483  	x55, x56 = bits.Add64(x50, x47, uint64(sm2p256Uint1(x54)))
   484  	var x57 uint64
   485  	var x58 uint64
   486  	x57, x58 = bits.Add64(x48, x45, uint64(sm2p256Uint1(x56)))
   487  	x59 := (uint64(sm2p256Uint1(x58)) + x46)
   488  	var x60 uint64
   489  	var x61 uint64
   490  	x60, x61 = bits.Add64(x37, x51, uint64(0x0))
   491  	var x62 uint64
   492  	var x63 uint64
   493  	x62, x63 = bits.Add64(x39, x53, uint64(sm2p256Uint1(x61)))
   494  	var x64 uint64
   495  	var x65 uint64
   496  	x64, x65 = bits.Add64(x41, x55, uint64(sm2p256Uint1(x63)))
   497  	var x66 uint64
   498  	var x67 uint64
   499  	x66, x67 = bits.Add64(x43, x57, uint64(sm2p256Uint1(x65)))
   500  	var x68 uint64
   501  	var x69 uint64
   502  	x68, x69 = bits.Add64(uint64(sm2p256Uint1(x44)), x59, uint64(sm2p256Uint1(x67)))
   503  	var x70 uint64
   504  	var x71 uint64
   505  	x71, x70 = bits.Mul64(x60, 0xfffffffeffffffff)
   506  	var x72 uint64
   507  	var x73 uint64
   508  	x73, x72 = bits.Mul64(x60, 0xffffffffffffffff)
   509  	var x74 uint64
   510  	var x75 uint64
   511  	x75, x74 = bits.Mul64(x60, 0xffffffff00000000)
   512  	var x76 uint64
   513  	var x77 uint64
   514  	x77, x76 = bits.Mul64(x60, 0xffffffffffffffff)
   515  	var x78 uint64
   516  	var x79 uint64
   517  	x78, x79 = bits.Add64(x77, x74, uint64(0x0))
   518  	var x80 uint64
   519  	var x81 uint64
   520  	x80, x81 = bits.Add64(x75, x72, uint64(sm2p256Uint1(x79)))
   521  	var x82 uint64
   522  	var x83 uint64
   523  	x82, x83 = bits.Add64(x73, x70, uint64(sm2p256Uint1(x81)))
   524  	x84 := (uint64(sm2p256Uint1(x83)) + x71)
   525  	var x86 uint64
   526  	_, x86 = bits.Add64(x60, x76, uint64(0x0))
   527  	var x87 uint64
   528  	var x88 uint64
   529  	x87, x88 = bits.Add64(x62, x78, uint64(sm2p256Uint1(x86)))
   530  	var x89 uint64
   531  	var x90 uint64
   532  	x89, x90 = bits.Add64(x64, x80, uint64(sm2p256Uint1(x88)))
   533  	var x91 uint64
   534  	var x92 uint64
   535  	x91, x92 = bits.Add64(x66, x82, uint64(sm2p256Uint1(x90)))
   536  	var x93 uint64
   537  	var x94 uint64
   538  	x93, x94 = bits.Add64(x68, x84, uint64(sm2p256Uint1(x92)))
   539  	x95 := (uint64(sm2p256Uint1(x94)) + uint64(sm2p256Uint1(x69)))
   540  	var x96 uint64
   541  	var x97 uint64
   542  	x97, x96 = bits.Mul64(x2, arg1[3])
   543  	var x98 uint64
   544  	var x99 uint64
   545  	x99, x98 = bits.Mul64(x2, arg1[2])
   546  	var x100 uint64
   547  	var x101 uint64
   548  	x101, x100 = bits.Mul64(x2, arg1[1])
   549  	var x102 uint64
   550  	var x103 uint64
   551  	x103, x102 = bits.Mul64(x2, arg1[0])
   552  	var x104 uint64
   553  	var x105 uint64
   554  	x104, x105 = bits.Add64(x103, x100, uint64(0x0))
   555  	var x106 uint64
   556  	var x107 uint64
   557  	x106, x107 = bits.Add64(x101, x98, uint64(sm2p256Uint1(x105)))
   558  	var x108 uint64
   559  	var x109 uint64
   560  	x108, x109 = bits.Add64(x99, x96, uint64(sm2p256Uint1(x107)))
   561  	x110 := (uint64(sm2p256Uint1(x109)) + x97)
   562  	var x111 uint64
   563  	var x112 uint64
   564  	x111, x112 = bits.Add64(x87, x102, uint64(0x0))
   565  	var x113 uint64
   566  	var x114 uint64
   567  	x113, x114 = bits.Add64(x89, x104, uint64(sm2p256Uint1(x112)))
   568  	var x115 uint64
   569  	var x116 uint64
   570  	x115, x116 = bits.Add64(x91, x106, uint64(sm2p256Uint1(x114)))
   571  	var x117 uint64
   572  	var x118 uint64
   573  	x117, x118 = bits.Add64(x93, x108, uint64(sm2p256Uint1(x116)))
   574  	var x119 uint64
   575  	var x120 uint64
   576  	x119, x120 = bits.Add64(x95, x110, uint64(sm2p256Uint1(x118)))
   577  	var x121 uint64
   578  	var x122 uint64
   579  	x122, x121 = bits.Mul64(x111, 0xfffffffeffffffff)
   580  	var x123 uint64
   581  	var x124 uint64
   582  	x124, x123 = bits.Mul64(x111, 0xffffffffffffffff)
   583  	var x125 uint64
   584  	var x126 uint64
   585  	x126, x125 = bits.Mul64(x111, 0xffffffff00000000)
   586  	var x127 uint64
   587  	var x128 uint64
   588  	x128, x127 = bits.Mul64(x111, 0xffffffffffffffff)
   589  	var x129 uint64
   590  	var x130 uint64
   591  	x129, x130 = bits.Add64(x128, x125, uint64(0x0))
   592  	var x131 uint64
   593  	var x132 uint64
   594  	x131, x132 = bits.Add64(x126, x123, uint64(sm2p256Uint1(x130)))
   595  	var x133 uint64
   596  	var x134 uint64
   597  	x133, x134 = bits.Add64(x124, x121, uint64(sm2p256Uint1(x132)))
   598  	x135 := (uint64(sm2p256Uint1(x134)) + x122)
   599  	var x137 uint64
   600  	_, x137 = bits.Add64(x111, x127, uint64(0x0))
   601  	var x138 uint64
   602  	var x139 uint64
   603  	x138, x139 = bits.Add64(x113, x129, uint64(sm2p256Uint1(x137)))
   604  	var x140 uint64
   605  	var x141 uint64
   606  	x140, x141 = bits.Add64(x115, x131, uint64(sm2p256Uint1(x139)))
   607  	var x142 uint64
   608  	var x143 uint64
   609  	x142, x143 = bits.Add64(x117, x133, uint64(sm2p256Uint1(x141)))
   610  	var x144 uint64
   611  	var x145 uint64
   612  	x144, x145 = bits.Add64(x119, x135, uint64(sm2p256Uint1(x143)))
   613  	x146 := (uint64(sm2p256Uint1(x145)) + uint64(sm2p256Uint1(x120)))
   614  	var x147 uint64
   615  	var x148 uint64
   616  	x148, x147 = bits.Mul64(x3, arg1[3])
   617  	var x149 uint64
   618  	var x150 uint64
   619  	x150, x149 = bits.Mul64(x3, arg1[2])
   620  	var x151 uint64
   621  	var x152 uint64
   622  	x152, x151 = bits.Mul64(x3, arg1[1])
   623  	var x153 uint64
   624  	var x154 uint64
   625  	x154, x153 = bits.Mul64(x3, arg1[0])
   626  	var x155 uint64
   627  	var x156 uint64
   628  	x155, x156 = bits.Add64(x154, x151, uint64(0x0))
   629  	var x157 uint64
   630  	var x158 uint64
   631  	x157, x158 = bits.Add64(x152, x149, uint64(sm2p256Uint1(x156)))
   632  	var x159 uint64
   633  	var x160 uint64
   634  	x159, x160 = bits.Add64(x150, x147, uint64(sm2p256Uint1(x158)))
   635  	x161 := (uint64(sm2p256Uint1(x160)) + x148)
   636  	var x162 uint64
   637  	var x163 uint64
   638  	x162, x163 = bits.Add64(x138, x153, uint64(0x0))
   639  	var x164 uint64
   640  	var x165 uint64
   641  	x164, x165 = bits.Add64(x140, x155, uint64(sm2p256Uint1(x163)))
   642  	var x166 uint64
   643  	var x167 uint64
   644  	x166, x167 = bits.Add64(x142, x157, uint64(sm2p256Uint1(x165)))
   645  	var x168 uint64
   646  	var x169 uint64
   647  	x168, x169 = bits.Add64(x144, x159, uint64(sm2p256Uint1(x167)))
   648  	var x170 uint64
   649  	var x171 uint64
   650  	x170, x171 = bits.Add64(x146, x161, uint64(sm2p256Uint1(x169)))
   651  	var x172 uint64
   652  	var x173 uint64
   653  	x173, x172 = bits.Mul64(x162, 0xfffffffeffffffff)
   654  	var x174 uint64
   655  	var x175 uint64
   656  	x175, x174 = bits.Mul64(x162, 0xffffffffffffffff)
   657  	var x176 uint64
   658  	var x177 uint64
   659  	x177, x176 = bits.Mul64(x162, 0xffffffff00000000)
   660  	var x178 uint64
   661  	var x179 uint64
   662  	x179, x178 = bits.Mul64(x162, 0xffffffffffffffff)
   663  	var x180 uint64
   664  	var x181 uint64
   665  	x180, x181 = bits.Add64(x179, x176, uint64(0x0))
   666  	var x182 uint64
   667  	var x183 uint64
   668  	x182, x183 = bits.Add64(x177, x174, uint64(sm2p256Uint1(x181)))
   669  	var x184 uint64
   670  	var x185 uint64
   671  	x184, x185 = bits.Add64(x175, x172, uint64(sm2p256Uint1(x183)))
   672  	x186 := (uint64(sm2p256Uint1(x185)) + x173)
   673  	var x188 uint64
   674  	_, x188 = bits.Add64(x162, x178, uint64(0x0))
   675  	var x189 uint64
   676  	var x190 uint64
   677  	x189, x190 = bits.Add64(x164, x180, uint64(sm2p256Uint1(x188)))
   678  	var x191 uint64
   679  	var x192 uint64
   680  	x191, x192 = bits.Add64(x166, x182, uint64(sm2p256Uint1(x190)))
   681  	var x193 uint64
   682  	var x194 uint64
   683  	x193, x194 = bits.Add64(x168, x184, uint64(sm2p256Uint1(x192)))
   684  	var x195 uint64
   685  	var x196 uint64
   686  	x195, x196 = bits.Add64(x170, x186, uint64(sm2p256Uint1(x194)))
   687  	x197 := (uint64(sm2p256Uint1(x196)) + uint64(sm2p256Uint1(x171)))
   688  	var x198 uint64
   689  	var x199 uint64
   690  	x198, x199 = bits.Sub64(x189, 0xffffffffffffffff, uint64(0x0))
   691  	var x200 uint64
   692  	var x201 uint64
   693  	x200, x201 = bits.Sub64(x191, 0xffffffff00000000, uint64(sm2p256Uint1(x199)))
   694  	var x202 uint64
   695  	var x203 uint64
   696  	x202, x203 = bits.Sub64(x193, 0xffffffffffffffff, uint64(sm2p256Uint1(x201)))
   697  	var x204 uint64
   698  	var x205 uint64
   699  	x204, x205 = bits.Sub64(x195, 0xfffffffeffffffff, uint64(sm2p256Uint1(x203)))
   700  	var x207 uint64
   701  	_, x207 = bits.Sub64(x197, uint64(0x0), uint64(sm2p256Uint1(x205)))
   702  	var x208 uint64
   703  	sm2p256CmovznzU64(&x208, sm2p256Uint1(x207), x198, x189)
   704  	var x209 uint64
   705  	sm2p256CmovznzU64(&x209, sm2p256Uint1(x207), x200, x191)
   706  	var x210 uint64
   707  	sm2p256CmovznzU64(&x210, sm2p256Uint1(x207), x202, x193)
   708  	var x211 uint64
   709  	sm2p256CmovznzU64(&x211, sm2p256Uint1(x207), x204, x195)
   710  	out1[0] = x208
   711  	out1[1] = x209
   712  	out1[2] = x210
   713  	out1[3] = x211
   714  }
   715  
   716  // sm2p256Add adds two field elements in the Montgomery domain.
   717  //
   718  // Preconditions:
   719  //   0 ≤ eval arg1 < m
   720  //   0 ≤ eval arg2 < m
   721  // Postconditions:
   722  //   eval (from_montgomery out1) mod m = (eval (from_montgomery arg1) + eval (from_montgomery arg2)) mod m
   723  //   0 ≤ eval out1 < m
   724  //
   725  func sm2p256Add(out1 *sm2p256MontgomeryDomainFieldElement, arg1 *sm2p256MontgomeryDomainFieldElement, arg2 *sm2p256MontgomeryDomainFieldElement) {
   726  	var x1 uint64
   727  	var x2 uint64
   728  	x1, x2 = bits.Add64(arg1[0], arg2[0], uint64(0x0))
   729  	var x3 uint64
   730  	var x4 uint64
   731  	x3, x4 = bits.Add64(arg1[1], arg2[1], uint64(sm2p256Uint1(x2)))
   732  	var x5 uint64
   733  	var x6 uint64
   734  	x5, x6 = bits.Add64(arg1[2], arg2[2], uint64(sm2p256Uint1(x4)))
   735  	var x7 uint64
   736  	var x8 uint64
   737  	x7, x8 = bits.Add64(arg1[3], arg2[3], uint64(sm2p256Uint1(x6)))
   738  	var x9 uint64
   739  	var x10 uint64
   740  	x9, x10 = bits.Sub64(x1, 0xffffffffffffffff, uint64(0x0))
   741  	var x11 uint64
   742  	var x12 uint64
   743  	x11, x12 = bits.Sub64(x3, 0xffffffff00000000, uint64(sm2p256Uint1(x10)))
   744  	var x13 uint64
   745  	var x14 uint64
   746  	x13, x14 = bits.Sub64(x5, 0xffffffffffffffff, uint64(sm2p256Uint1(x12)))
   747  	var x15 uint64
   748  	var x16 uint64
   749  	x15, x16 = bits.Sub64(x7, 0xfffffffeffffffff, uint64(sm2p256Uint1(x14)))
   750  	var x18 uint64
   751  	_, x18 = bits.Sub64(uint64(sm2p256Uint1(x8)), uint64(0x0), uint64(sm2p256Uint1(x16)))
   752  	var x19 uint64
   753  	sm2p256CmovznzU64(&x19, sm2p256Uint1(x18), x9, x1)
   754  	var x20 uint64
   755  	sm2p256CmovznzU64(&x20, sm2p256Uint1(x18), x11, x3)
   756  	var x21 uint64
   757  	sm2p256CmovznzU64(&x21, sm2p256Uint1(x18), x13, x5)
   758  	var x22 uint64
   759  	sm2p256CmovznzU64(&x22, sm2p256Uint1(x18), x15, x7)
   760  	out1[0] = x19
   761  	out1[1] = x20
   762  	out1[2] = x21
   763  	out1[3] = x22
   764  }
   765  
   766  // sm2p256Sub subtracts two field elements in the Montgomery domain.
   767  //
   768  // Preconditions:
   769  //   0 ≤ eval arg1 < m
   770  //   0 ≤ eval arg2 < m
   771  // Postconditions:
   772  //   eval (from_montgomery out1) mod m = (eval (from_montgomery arg1) - eval (from_montgomery arg2)) mod m
   773  //   0 ≤ eval out1 < m
   774  //
   775  func sm2p256Sub(out1 *sm2p256MontgomeryDomainFieldElement, arg1 *sm2p256MontgomeryDomainFieldElement, arg2 *sm2p256MontgomeryDomainFieldElement) {
   776  	var x1 uint64
   777  	var x2 uint64
   778  	x1, x2 = bits.Sub64(arg1[0], arg2[0], uint64(0x0))
   779  	var x3 uint64
   780  	var x4 uint64
   781  	x3, x4 = bits.Sub64(arg1[1], arg2[1], uint64(sm2p256Uint1(x2)))
   782  	var x5 uint64
   783  	var x6 uint64
   784  	x5, x6 = bits.Sub64(arg1[2], arg2[2], uint64(sm2p256Uint1(x4)))
   785  	var x7 uint64
   786  	var x8 uint64
   787  	x7, x8 = bits.Sub64(arg1[3], arg2[3], uint64(sm2p256Uint1(x6)))
   788  	var x9 uint64
   789  	sm2p256CmovznzU64(&x9, sm2p256Uint1(x8), uint64(0x0), 0xffffffffffffffff)
   790  	var x10 uint64
   791  	var x11 uint64
   792  	x10, x11 = bits.Add64(x1, x9, uint64(0x0))
   793  	var x12 uint64
   794  	var x13 uint64
   795  	x12, x13 = bits.Add64(x3, (x9 & 0xffffffff00000000), uint64(sm2p256Uint1(x11)))
   796  	var x14 uint64
   797  	var x15 uint64
   798  	x14, x15 = bits.Add64(x5, x9, uint64(sm2p256Uint1(x13)))
   799  	var x16 uint64
   800  	x16, _ = bits.Add64(x7, (x9 & 0xfffffffeffffffff), uint64(sm2p256Uint1(x15)))
   801  	out1[0] = x10
   802  	out1[1] = x12
   803  	out1[2] = x14
   804  	out1[3] = x16
   805  }
   806  
   807  // sm2p256SetOne returns the field element one in the Montgomery domain.
   808  //
   809  // Postconditions:
   810  //   eval (from_montgomery out1) mod m = 1 mod m
   811  //   0 ≤ eval out1 < m
   812  //
   813  func sm2p256SetOne(out1 *sm2p256MontgomeryDomainFieldElement) {
   814  	out1[0] = uint64(0x1)
   815  	out1[1] = 0xffffffff
   816  	out1[2] = uint64(0x0)
   817  	out1[3] = 0x100000000
   818  }
   819  
   820  // sm2p256FromMontgomery translates a field element out of the Montgomery domain.
   821  //
   822  // Preconditions:
   823  //   0 ≤ eval arg1 < m
   824  // Postconditions:
   825  //   eval out1 mod m = (eval arg1 * ((2^64)⁻¹ mod m)^4) mod m
   826  //   0 ≤ eval out1 < m
   827  //
   828  func sm2p256FromMontgomery(out1 *sm2p256NonMontgomeryDomainFieldElement, arg1 *sm2p256MontgomeryDomainFieldElement) {
   829  	x1 := arg1[0]
   830  	var x2 uint64
   831  	var x3 uint64
   832  	x3, x2 = bits.Mul64(x1, 0xfffffffeffffffff)
   833  	var x4 uint64
   834  	var x5 uint64
   835  	x5, x4 = bits.Mul64(x1, 0xffffffffffffffff)
   836  	var x6 uint64
   837  	var x7 uint64
   838  	x7, x6 = bits.Mul64(x1, 0xffffffff00000000)
   839  	var x8 uint64
   840  	var x9 uint64
   841  	x9, x8 = bits.Mul64(x1, 0xffffffffffffffff)
   842  	var x10 uint64
   843  	var x11 uint64
   844  	x10, x11 = bits.Add64(x9, x6, uint64(0x0))
   845  	var x12 uint64
   846  	var x13 uint64
   847  	x12, x13 = bits.Add64(x7, x4, uint64(sm2p256Uint1(x11)))
   848  	var x14 uint64
   849  	var x15 uint64
   850  	x14, x15 = bits.Add64(x5, x2, uint64(sm2p256Uint1(x13)))
   851  	var x17 uint64
   852  	_, x17 = bits.Add64(x1, x8, uint64(0x0))
   853  	var x18 uint64
   854  	var x19 uint64
   855  	x18, x19 = bits.Add64(uint64(0x0), x10, uint64(sm2p256Uint1(x17)))
   856  	var x20 uint64
   857  	var x21 uint64
   858  	x20, x21 = bits.Add64(uint64(0x0), x12, uint64(sm2p256Uint1(x19)))
   859  	var x22 uint64
   860  	var x23 uint64
   861  	x22, x23 = bits.Add64(uint64(0x0), x14, uint64(sm2p256Uint1(x21)))
   862  	var x24 uint64
   863  	var x25 uint64
   864  	x24, x25 = bits.Add64(x18, arg1[1], uint64(0x0))
   865  	var x26 uint64
   866  	var x27 uint64
   867  	x26, x27 = bits.Add64(x20, uint64(0x0), uint64(sm2p256Uint1(x25)))
   868  	var x28 uint64
   869  	var x29 uint64
   870  	x28, x29 = bits.Add64(x22, uint64(0x0), uint64(sm2p256Uint1(x27)))
   871  	var x30 uint64
   872  	var x31 uint64
   873  	x31, x30 = bits.Mul64(x24, 0xfffffffeffffffff)
   874  	var x32 uint64
   875  	var x33 uint64
   876  	x33, x32 = bits.Mul64(x24, 0xffffffffffffffff)
   877  	var x34 uint64
   878  	var x35 uint64
   879  	x35, x34 = bits.Mul64(x24, 0xffffffff00000000)
   880  	var x36 uint64
   881  	var x37 uint64
   882  	x37, x36 = bits.Mul64(x24, 0xffffffffffffffff)
   883  	var x38 uint64
   884  	var x39 uint64
   885  	x38, x39 = bits.Add64(x37, x34, uint64(0x0))
   886  	var x40 uint64
   887  	var x41 uint64
   888  	x40, x41 = bits.Add64(x35, x32, uint64(sm2p256Uint1(x39)))
   889  	var x42 uint64
   890  	var x43 uint64
   891  	x42, x43 = bits.Add64(x33, x30, uint64(sm2p256Uint1(x41)))
   892  	var x45 uint64
   893  	_, x45 = bits.Add64(x24, x36, uint64(0x0))
   894  	var x46 uint64
   895  	var x47 uint64
   896  	x46, x47 = bits.Add64(x26, x38, uint64(sm2p256Uint1(x45)))
   897  	var x48 uint64
   898  	var x49 uint64
   899  	x48, x49 = bits.Add64(x28, x40, uint64(sm2p256Uint1(x47)))
   900  	var x50 uint64
   901  	var x51 uint64
   902  	x50, x51 = bits.Add64((uint64(sm2p256Uint1(x29)) + (uint64(sm2p256Uint1(x23)) + (uint64(sm2p256Uint1(x15)) + x3))), x42, uint64(sm2p256Uint1(x49)))
   903  	var x52 uint64
   904  	var x53 uint64
   905  	x52, x53 = bits.Add64(x46, arg1[2], uint64(0x0))
   906  	var x54 uint64
   907  	var x55 uint64
   908  	x54, x55 = bits.Add64(x48, uint64(0x0), uint64(sm2p256Uint1(x53)))
   909  	var x56 uint64
   910  	var x57 uint64
   911  	x56, x57 = bits.Add64(x50, uint64(0x0), uint64(sm2p256Uint1(x55)))
   912  	var x58 uint64
   913  	var x59 uint64
   914  	x59, x58 = bits.Mul64(x52, 0xfffffffeffffffff)
   915  	var x60 uint64
   916  	var x61 uint64
   917  	x61, x60 = bits.Mul64(x52, 0xffffffffffffffff)
   918  	var x62 uint64
   919  	var x63 uint64
   920  	x63, x62 = bits.Mul64(x52, 0xffffffff00000000)
   921  	var x64 uint64
   922  	var x65 uint64
   923  	x65, x64 = bits.Mul64(x52, 0xffffffffffffffff)
   924  	var x66 uint64
   925  	var x67 uint64
   926  	x66, x67 = bits.Add64(x65, x62, uint64(0x0))
   927  	var x68 uint64
   928  	var x69 uint64
   929  	x68, x69 = bits.Add64(x63, x60, uint64(sm2p256Uint1(x67)))
   930  	var x70 uint64
   931  	var x71 uint64
   932  	x70, x71 = bits.Add64(x61, x58, uint64(sm2p256Uint1(x69)))
   933  	var x73 uint64
   934  	_, x73 = bits.Add64(x52, x64, uint64(0x0))
   935  	var x74 uint64
   936  	var x75 uint64
   937  	x74, x75 = bits.Add64(x54, x66, uint64(sm2p256Uint1(x73)))
   938  	var x76 uint64
   939  	var x77 uint64
   940  	x76, x77 = bits.Add64(x56, x68, uint64(sm2p256Uint1(x75)))
   941  	var x78 uint64
   942  	var x79 uint64
   943  	x78, x79 = bits.Add64((uint64(sm2p256Uint1(x57)) + (uint64(sm2p256Uint1(x51)) + (uint64(sm2p256Uint1(x43)) + x31))), x70, uint64(sm2p256Uint1(x77)))
   944  	var x80 uint64
   945  	var x81 uint64
   946  	x80, x81 = bits.Add64(x74, arg1[3], uint64(0x0))
   947  	var x82 uint64
   948  	var x83 uint64
   949  	x82, x83 = bits.Add64(x76, uint64(0x0), uint64(sm2p256Uint1(x81)))
   950  	var x84 uint64
   951  	var x85 uint64
   952  	x84, x85 = bits.Add64(x78, uint64(0x0), uint64(sm2p256Uint1(x83)))
   953  	var x86 uint64
   954  	var x87 uint64
   955  	x87, x86 = bits.Mul64(x80, 0xfffffffeffffffff)
   956  	var x88 uint64
   957  	var x89 uint64
   958  	x89, x88 = bits.Mul64(x80, 0xffffffffffffffff)
   959  	var x90 uint64
   960  	var x91 uint64
   961  	x91, x90 = bits.Mul64(x80, 0xffffffff00000000)
   962  	var x92 uint64
   963  	var x93 uint64
   964  	x93, x92 = bits.Mul64(x80, 0xffffffffffffffff)
   965  	var x94 uint64
   966  	var x95 uint64
   967  	x94, x95 = bits.Add64(x93, x90, uint64(0x0))
   968  	var x96 uint64
   969  	var x97 uint64
   970  	x96, x97 = bits.Add64(x91, x88, uint64(sm2p256Uint1(x95)))
   971  	var x98 uint64
   972  	var x99 uint64
   973  	x98, x99 = bits.Add64(x89, x86, uint64(sm2p256Uint1(x97)))
   974  	var x101 uint64
   975  	_, x101 = bits.Add64(x80, x92, uint64(0x0))
   976  	var x102 uint64
   977  	var x103 uint64
   978  	x102, x103 = bits.Add64(x82, x94, uint64(sm2p256Uint1(x101)))
   979  	var x104 uint64
   980  	var x105 uint64
   981  	x104, x105 = bits.Add64(x84, x96, uint64(sm2p256Uint1(x103)))
   982  	var x106 uint64
   983  	var x107 uint64
   984  	x106, x107 = bits.Add64((uint64(sm2p256Uint1(x85)) + (uint64(sm2p256Uint1(x79)) + (uint64(sm2p256Uint1(x71)) + x59))), x98, uint64(sm2p256Uint1(x105)))
   985  	x108 := (uint64(sm2p256Uint1(x107)) + (uint64(sm2p256Uint1(x99)) + x87))
   986  	var x109 uint64
   987  	var x110 uint64
   988  	x109, x110 = bits.Sub64(x102, 0xffffffffffffffff, uint64(0x0))
   989  	var x111 uint64
   990  	var x112 uint64
   991  	x111, x112 = bits.Sub64(x104, 0xffffffff00000000, uint64(sm2p256Uint1(x110)))
   992  	var x113 uint64
   993  	var x114 uint64
   994  	x113, x114 = bits.Sub64(x106, 0xffffffffffffffff, uint64(sm2p256Uint1(x112)))
   995  	var x115 uint64
   996  	var x116 uint64
   997  	x115, x116 = bits.Sub64(x108, 0xfffffffeffffffff, uint64(sm2p256Uint1(x114)))
   998  	var x118 uint64
   999  	_, x118 = bits.Sub64(uint64(0x0), uint64(0x0), uint64(sm2p256Uint1(x116)))
  1000  	var x119 uint64
  1001  	sm2p256CmovznzU64(&x119, sm2p256Uint1(x118), x109, x102)
  1002  	var x120 uint64
  1003  	sm2p256CmovznzU64(&x120, sm2p256Uint1(x118), x111, x104)
  1004  	var x121 uint64
  1005  	sm2p256CmovznzU64(&x121, sm2p256Uint1(x118), x113, x106)
  1006  	var x122 uint64
  1007  	sm2p256CmovznzU64(&x122, sm2p256Uint1(x118), x115, x108)
  1008  	out1[0] = x119
  1009  	out1[1] = x120
  1010  	out1[2] = x121
  1011  	out1[3] = x122
  1012  }
  1013  
  1014  // sm2p256ToMontgomery translates a field element into the Montgomery domain.
  1015  //
  1016  // Preconditions:
  1017  //   0 ≤ eval arg1 < m
  1018  // Postconditions:
  1019  //   eval (from_montgomery out1) mod m = eval arg1 mod m
  1020  //   0 ≤ eval out1 < m
  1021  //
  1022  func sm2p256ToMontgomery(out1 *sm2p256MontgomeryDomainFieldElement, arg1 *sm2p256NonMontgomeryDomainFieldElement) {
  1023  	x1 := arg1[1]
  1024  	x2 := arg1[2]
  1025  	x3 := arg1[3]
  1026  	x4 := arg1[0]
  1027  	var x5 uint64
  1028  	var x6 uint64
  1029  	x6, x5 = bits.Mul64(x4, 0x400000002)
  1030  	var x7 uint64
  1031  	var x8 uint64
  1032  	x8, x7 = bits.Mul64(x4, 0x100000001)
  1033  	var x9 uint64
  1034  	var x10 uint64
  1035  	x10, x9 = bits.Mul64(x4, 0x2ffffffff)
  1036  	var x11 uint64
  1037  	var x12 uint64
  1038  	x12, x11 = bits.Mul64(x4, 0x200000003)
  1039  	var x13 uint64
  1040  	var x14 uint64
  1041  	x13, x14 = bits.Add64(x12, x9, uint64(0x0))
  1042  	var x15 uint64
  1043  	var x16 uint64
  1044  	x15, x16 = bits.Add64(x10, x7, uint64(sm2p256Uint1(x14)))
  1045  	var x17 uint64
  1046  	var x18 uint64
  1047  	x17, x18 = bits.Add64(x8, x5, uint64(sm2p256Uint1(x16)))
  1048  	var x19 uint64
  1049  	var x20 uint64
  1050  	x20, x19 = bits.Mul64(x11, 0xfffffffeffffffff)
  1051  	var x21 uint64
  1052  	var x22 uint64
  1053  	x22, x21 = bits.Mul64(x11, 0xffffffffffffffff)
  1054  	var x23 uint64
  1055  	var x24 uint64
  1056  	x24, x23 = bits.Mul64(x11, 0xffffffff00000000)
  1057  	var x25 uint64
  1058  	var x26 uint64
  1059  	x26, x25 = bits.Mul64(x11, 0xffffffffffffffff)
  1060  	var x27 uint64
  1061  	var x28 uint64
  1062  	x27, x28 = bits.Add64(x26, x23, uint64(0x0))
  1063  	var x29 uint64
  1064  	var x30 uint64
  1065  	x29, x30 = bits.Add64(x24, x21, uint64(sm2p256Uint1(x28)))
  1066  	var x31 uint64
  1067  	var x32 uint64
  1068  	x31, x32 = bits.Add64(x22, x19, uint64(sm2p256Uint1(x30)))
  1069  	var x34 uint64
  1070  	_, x34 = bits.Add64(x11, x25, uint64(0x0))
  1071  	var x35 uint64
  1072  	var x36 uint64
  1073  	x35, x36 = bits.Add64(x13, x27, uint64(sm2p256Uint1(x34)))
  1074  	var x37 uint64
  1075  	var x38 uint64
  1076  	x37, x38 = bits.Add64(x15, x29, uint64(sm2p256Uint1(x36)))
  1077  	var x39 uint64
  1078  	var x40 uint64
  1079  	x39, x40 = bits.Add64(x17, x31, uint64(sm2p256Uint1(x38)))
  1080  	var x41 uint64
  1081  	var x42 uint64
  1082  	x41, x42 = bits.Add64((uint64(sm2p256Uint1(x18)) + x6), (uint64(sm2p256Uint1(x32)) + x20), uint64(sm2p256Uint1(x40)))
  1083  	var x43 uint64
  1084  	var x44 uint64
  1085  	x44, x43 = bits.Mul64(x1, 0x400000002)
  1086  	var x45 uint64
  1087  	var x46 uint64
  1088  	x46, x45 = bits.Mul64(x1, 0x100000001)
  1089  	var x47 uint64
  1090  	var x48 uint64
  1091  	x48, x47 = bits.Mul64(x1, 0x2ffffffff)
  1092  	var x49 uint64
  1093  	var x50 uint64
  1094  	x50, x49 = bits.Mul64(x1, 0x200000003)
  1095  	var x51 uint64
  1096  	var x52 uint64
  1097  	x51, x52 = bits.Add64(x50, x47, uint64(0x0))
  1098  	var x53 uint64
  1099  	var x54 uint64
  1100  	x53, x54 = bits.Add64(x48, x45, uint64(sm2p256Uint1(x52)))
  1101  	var x55 uint64
  1102  	var x56 uint64
  1103  	x55, x56 = bits.Add64(x46, x43, uint64(sm2p256Uint1(x54)))
  1104  	var x57 uint64
  1105  	var x58 uint64
  1106  	x57, x58 = bits.Add64(x35, x49, uint64(0x0))
  1107  	var x59 uint64
  1108  	var x60 uint64
  1109  	x59, x60 = bits.Add64(x37, x51, uint64(sm2p256Uint1(x58)))
  1110  	var x61 uint64
  1111  	var x62 uint64
  1112  	x61, x62 = bits.Add64(x39, x53, uint64(sm2p256Uint1(x60)))
  1113  	var x63 uint64
  1114  	var x64 uint64
  1115  	x63, x64 = bits.Add64(x41, x55, uint64(sm2p256Uint1(x62)))
  1116  	var x65 uint64
  1117  	var x66 uint64
  1118  	x66, x65 = bits.Mul64(x57, 0xfffffffeffffffff)
  1119  	var x67 uint64
  1120  	var x68 uint64
  1121  	x68, x67 = bits.Mul64(x57, 0xffffffffffffffff)
  1122  	var x69 uint64
  1123  	var x70 uint64
  1124  	x70, x69 = bits.Mul64(x57, 0xffffffff00000000)
  1125  	var x71 uint64
  1126  	var x72 uint64
  1127  	x72, x71 = bits.Mul64(x57, 0xffffffffffffffff)
  1128  	var x73 uint64
  1129  	var x74 uint64
  1130  	x73, x74 = bits.Add64(x72, x69, uint64(0x0))
  1131  	var x75 uint64
  1132  	var x76 uint64
  1133  	x75, x76 = bits.Add64(x70, x67, uint64(sm2p256Uint1(x74)))
  1134  	var x77 uint64
  1135  	var x78 uint64
  1136  	x77, x78 = bits.Add64(x68, x65, uint64(sm2p256Uint1(x76)))
  1137  	var x80 uint64
  1138  	_, x80 = bits.Add64(x57, x71, uint64(0x0))
  1139  	var x81 uint64
  1140  	var x82 uint64
  1141  	x81, x82 = bits.Add64(x59, x73, uint64(sm2p256Uint1(x80)))
  1142  	var x83 uint64
  1143  	var x84 uint64
  1144  	x83, x84 = bits.Add64(x61, x75, uint64(sm2p256Uint1(x82)))
  1145  	var x85 uint64
  1146  	var x86 uint64
  1147  	x85, x86 = bits.Add64(x63, x77, uint64(sm2p256Uint1(x84)))
  1148  	var x87 uint64
  1149  	var x88 uint64
  1150  	x87, x88 = bits.Add64(((uint64(sm2p256Uint1(x64)) + uint64(sm2p256Uint1(x42))) + (uint64(sm2p256Uint1(x56)) + x44)), (uint64(sm2p256Uint1(x78)) + x66), uint64(sm2p256Uint1(x86)))
  1151  	var x89 uint64
  1152  	var x90 uint64
  1153  	x90, x89 = bits.Mul64(x2, 0x400000002)
  1154  	var x91 uint64
  1155  	var x92 uint64
  1156  	x92, x91 = bits.Mul64(x2, 0x100000001)
  1157  	var x93 uint64
  1158  	var x94 uint64
  1159  	x94, x93 = bits.Mul64(x2, 0x2ffffffff)
  1160  	var x95 uint64
  1161  	var x96 uint64
  1162  	x96, x95 = bits.Mul64(x2, 0x200000003)
  1163  	var x97 uint64
  1164  	var x98 uint64
  1165  	x97, x98 = bits.Add64(x96, x93, uint64(0x0))
  1166  	var x99 uint64
  1167  	var x100 uint64
  1168  	x99, x100 = bits.Add64(x94, x91, uint64(sm2p256Uint1(x98)))
  1169  	var x101 uint64
  1170  	var x102 uint64
  1171  	x101, x102 = bits.Add64(x92, x89, uint64(sm2p256Uint1(x100)))
  1172  	var x103 uint64
  1173  	var x104 uint64
  1174  	x103, x104 = bits.Add64(x81, x95, uint64(0x0))
  1175  	var x105 uint64
  1176  	var x106 uint64
  1177  	x105, x106 = bits.Add64(x83, x97, uint64(sm2p256Uint1(x104)))
  1178  	var x107 uint64
  1179  	var x108 uint64
  1180  	x107, x108 = bits.Add64(x85, x99, uint64(sm2p256Uint1(x106)))
  1181  	var x109 uint64
  1182  	var x110 uint64
  1183  	x109, x110 = bits.Add64(x87, x101, uint64(sm2p256Uint1(x108)))
  1184  	var x111 uint64
  1185  	var x112 uint64
  1186  	x112, x111 = bits.Mul64(x103, 0xfffffffeffffffff)
  1187  	var x113 uint64
  1188  	var x114 uint64
  1189  	x114, x113 = bits.Mul64(x103, 0xffffffffffffffff)
  1190  	var x115 uint64
  1191  	var x116 uint64
  1192  	x116, x115 = bits.Mul64(x103, 0xffffffff00000000)
  1193  	var x117 uint64
  1194  	var x118 uint64
  1195  	x118, x117 = bits.Mul64(x103, 0xffffffffffffffff)
  1196  	var x119 uint64
  1197  	var x120 uint64
  1198  	x119, x120 = bits.Add64(x118, x115, uint64(0x0))
  1199  	var x121 uint64
  1200  	var x122 uint64
  1201  	x121, x122 = bits.Add64(x116, x113, uint64(sm2p256Uint1(x120)))
  1202  	var x123 uint64
  1203  	var x124 uint64
  1204  	x123, x124 = bits.Add64(x114, x111, uint64(sm2p256Uint1(x122)))
  1205  	var x126 uint64
  1206  	_, x126 = bits.Add64(x103, x117, uint64(0x0))
  1207  	var x127 uint64
  1208  	var x128 uint64
  1209  	x127, x128 = bits.Add64(x105, x119, uint64(sm2p256Uint1(x126)))
  1210  	var x129 uint64
  1211  	var x130 uint64
  1212  	x129, x130 = bits.Add64(x107, x121, uint64(sm2p256Uint1(x128)))
  1213  	var x131 uint64
  1214  	var x132 uint64
  1215  	x131, x132 = bits.Add64(x109, x123, uint64(sm2p256Uint1(x130)))
  1216  	var x133 uint64
  1217  	var x134 uint64
  1218  	x133, x134 = bits.Add64(((uint64(sm2p256Uint1(x110)) + uint64(sm2p256Uint1(x88))) + (uint64(sm2p256Uint1(x102)) + x90)), (uint64(sm2p256Uint1(x124)) + x112), uint64(sm2p256Uint1(x132)))
  1219  	var x135 uint64
  1220  	var x136 uint64
  1221  	x136, x135 = bits.Mul64(x3, 0x400000002)
  1222  	var x137 uint64
  1223  	var x138 uint64
  1224  	x138, x137 = bits.Mul64(x3, 0x100000001)
  1225  	var x139 uint64
  1226  	var x140 uint64
  1227  	x140, x139 = bits.Mul64(x3, 0x2ffffffff)
  1228  	var x141 uint64
  1229  	var x142 uint64
  1230  	x142, x141 = bits.Mul64(x3, 0x200000003)
  1231  	var x143 uint64
  1232  	var x144 uint64
  1233  	x143, x144 = bits.Add64(x142, x139, uint64(0x0))
  1234  	var x145 uint64
  1235  	var x146 uint64
  1236  	x145, x146 = bits.Add64(x140, x137, uint64(sm2p256Uint1(x144)))
  1237  	var x147 uint64
  1238  	var x148 uint64
  1239  	x147, x148 = bits.Add64(x138, x135, uint64(sm2p256Uint1(x146)))
  1240  	var x149 uint64
  1241  	var x150 uint64
  1242  	x149, x150 = bits.Add64(x127, x141, uint64(0x0))
  1243  	var x151 uint64
  1244  	var x152 uint64
  1245  	x151, x152 = bits.Add64(x129, x143, uint64(sm2p256Uint1(x150)))
  1246  	var x153 uint64
  1247  	var x154 uint64
  1248  	x153, x154 = bits.Add64(x131, x145, uint64(sm2p256Uint1(x152)))
  1249  	var x155 uint64
  1250  	var x156 uint64
  1251  	x155, x156 = bits.Add64(x133, x147, uint64(sm2p256Uint1(x154)))
  1252  	var x157 uint64
  1253  	var x158 uint64
  1254  	x158, x157 = bits.Mul64(x149, 0xfffffffeffffffff)
  1255  	var x159 uint64
  1256  	var x160 uint64
  1257  	x160, x159 = bits.Mul64(x149, 0xffffffffffffffff)
  1258  	var x161 uint64
  1259  	var x162 uint64
  1260  	x162, x161 = bits.Mul64(x149, 0xffffffff00000000)
  1261  	var x163 uint64
  1262  	var x164 uint64
  1263  	x164, x163 = bits.Mul64(x149, 0xffffffffffffffff)
  1264  	var x165 uint64
  1265  	var x166 uint64
  1266  	x165, x166 = bits.Add64(x164, x161, uint64(0x0))
  1267  	var x167 uint64
  1268  	var x168 uint64
  1269  	x167, x168 = bits.Add64(x162, x159, uint64(sm2p256Uint1(x166)))
  1270  	var x169 uint64
  1271  	var x170 uint64
  1272  	x169, x170 = bits.Add64(x160, x157, uint64(sm2p256Uint1(x168)))
  1273  	var x172 uint64
  1274  	_, x172 = bits.Add64(x149, x163, uint64(0x0))
  1275  	var x173 uint64
  1276  	var x174 uint64
  1277  	x173, x174 = bits.Add64(x151, x165, uint64(sm2p256Uint1(x172)))
  1278  	var x175 uint64
  1279  	var x176 uint64
  1280  	x175, x176 = bits.Add64(x153, x167, uint64(sm2p256Uint1(x174)))
  1281  	var x177 uint64
  1282  	var x178 uint64
  1283  	x177, x178 = bits.Add64(x155, x169, uint64(sm2p256Uint1(x176)))
  1284  	var x179 uint64
  1285  	var x180 uint64
  1286  	x179, x180 = bits.Add64(((uint64(sm2p256Uint1(x156)) + uint64(sm2p256Uint1(x134))) + (uint64(sm2p256Uint1(x148)) + x136)), (uint64(sm2p256Uint1(x170)) + x158), uint64(sm2p256Uint1(x178)))
  1287  	var x181 uint64
  1288  	var x182 uint64
  1289  	x181, x182 = bits.Sub64(x173, 0xffffffffffffffff, uint64(0x0))
  1290  	var x183 uint64
  1291  	var x184 uint64
  1292  	x183, x184 = bits.Sub64(x175, 0xffffffff00000000, uint64(sm2p256Uint1(x182)))
  1293  	var x185 uint64
  1294  	var x186 uint64
  1295  	x185, x186 = bits.Sub64(x177, 0xffffffffffffffff, uint64(sm2p256Uint1(x184)))
  1296  	var x187 uint64
  1297  	var x188 uint64
  1298  	x187, x188 = bits.Sub64(x179, 0xfffffffeffffffff, uint64(sm2p256Uint1(x186)))
  1299  	var x190 uint64
  1300  	_, x190 = bits.Sub64(uint64(sm2p256Uint1(x180)), uint64(0x0), uint64(sm2p256Uint1(x188)))
  1301  	var x191 uint64
  1302  	sm2p256CmovznzU64(&x191, sm2p256Uint1(x190), x181, x173)
  1303  	var x192 uint64
  1304  	sm2p256CmovznzU64(&x192, sm2p256Uint1(x190), x183, x175)
  1305  	var x193 uint64
  1306  	sm2p256CmovznzU64(&x193, sm2p256Uint1(x190), x185, x177)
  1307  	var x194 uint64
  1308  	sm2p256CmovznzU64(&x194, sm2p256Uint1(x190), x187, x179)
  1309  	out1[0] = x191
  1310  	out1[1] = x192
  1311  	out1[2] = x193
  1312  	out1[3] = x194
  1313  }
  1314  
  1315  // sm2p256Selectznz is a multi-limb conditional select.
  1316  //
  1317  // Postconditions:
  1318  //   out1 = (if arg1 = 0 then arg2 else arg3)
  1319  //
  1320  // Input Bounds:
  1321  //   arg1: [0x0 ~> 0x1]
  1322  //   arg2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
  1323  //   arg3: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
  1324  // Output Bounds:
  1325  //   out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
  1326  func sm2p256Selectznz(out1 *[4]uint64, arg1 sm2p256Uint1, arg2 *[4]uint64, arg3 *[4]uint64) {
  1327  	var x1 uint64
  1328  	sm2p256CmovznzU64(&x1, arg1, arg2[0], arg3[0])
  1329  	var x2 uint64
  1330  	sm2p256CmovznzU64(&x2, arg1, arg2[1], arg3[1])
  1331  	var x3 uint64
  1332  	sm2p256CmovznzU64(&x3, arg1, arg2[2], arg3[2])
  1333  	var x4 uint64
  1334  	sm2p256CmovznzU64(&x4, arg1, arg2[3], arg3[3])
  1335  	out1[0] = x1
  1336  	out1[1] = x2
  1337  	out1[2] = x3
  1338  	out1[3] = x4
  1339  }
  1340  
  1341  // sm2p256ToBytes serializes a field element NOT in the Montgomery domain to bytes in little-endian order.
  1342  //
  1343  // Preconditions:
  1344  //   0 ≤ eval arg1 < m
  1345  // Postconditions:
  1346  //   out1 = map (λ x, ⌊((eval arg1 mod m) mod 2^(8 * (x + 1))) / 2^(8 * x)⌋) [0..31]
  1347  //
  1348  // Input Bounds:
  1349  //   arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
  1350  // Output Bounds:
  1351  //   out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]
  1352  func sm2p256ToBytes(out1 *[32]uint8, arg1 *[4]uint64) {
  1353  	x1 := arg1[3]
  1354  	x2 := arg1[2]
  1355  	x3 := arg1[1]
  1356  	x4 := arg1[0]
  1357  	x5 := (uint8(x4) & 0xff)
  1358  	x6 := (x4 >> 8)
  1359  	x7 := (uint8(x6) & 0xff)
  1360  	x8 := (x6 >> 8)
  1361  	x9 := (uint8(x8) & 0xff)
  1362  	x10 := (x8 >> 8)
  1363  	x11 := (uint8(x10) & 0xff)
  1364  	x12 := (x10 >> 8)
  1365  	x13 := (uint8(x12) & 0xff)
  1366  	x14 := (x12 >> 8)
  1367  	x15 := (uint8(x14) & 0xff)
  1368  	x16 := (x14 >> 8)
  1369  	x17 := (uint8(x16) & 0xff)
  1370  	x18 := uint8((x16 >> 8))
  1371  	x19 := (uint8(x3) & 0xff)
  1372  	x20 := (x3 >> 8)
  1373  	x21 := (uint8(x20) & 0xff)
  1374  	x22 := (x20 >> 8)
  1375  	x23 := (uint8(x22) & 0xff)
  1376  	x24 := (x22 >> 8)
  1377  	x25 := (uint8(x24) & 0xff)
  1378  	x26 := (x24 >> 8)
  1379  	x27 := (uint8(x26) & 0xff)
  1380  	x28 := (x26 >> 8)
  1381  	x29 := (uint8(x28) & 0xff)
  1382  	x30 := (x28 >> 8)
  1383  	x31 := (uint8(x30) & 0xff)
  1384  	x32 := uint8((x30 >> 8))
  1385  	x33 := (uint8(x2) & 0xff)
  1386  	x34 := (x2 >> 8)
  1387  	x35 := (uint8(x34) & 0xff)
  1388  	x36 := (x34 >> 8)
  1389  	x37 := (uint8(x36) & 0xff)
  1390  	x38 := (x36 >> 8)
  1391  	x39 := (uint8(x38) & 0xff)
  1392  	x40 := (x38 >> 8)
  1393  	x41 := (uint8(x40) & 0xff)
  1394  	x42 := (x40 >> 8)
  1395  	x43 := (uint8(x42) & 0xff)
  1396  	x44 := (x42 >> 8)
  1397  	x45 := (uint8(x44) & 0xff)
  1398  	x46 := uint8((x44 >> 8))
  1399  	x47 := (uint8(x1) & 0xff)
  1400  	x48 := (x1 >> 8)
  1401  	x49 := (uint8(x48) & 0xff)
  1402  	x50 := (x48 >> 8)
  1403  	x51 := (uint8(x50) & 0xff)
  1404  	x52 := (x50 >> 8)
  1405  	x53 := (uint8(x52) & 0xff)
  1406  	x54 := (x52 >> 8)
  1407  	x55 := (uint8(x54) & 0xff)
  1408  	x56 := (x54 >> 8)
  1409  	x57 := (uint8(x56) & 0xff)
  1410  	x58 := (x56 >> 8)
  1411  	x59 := (uint8(x58) & 0xff)
  1412  	x60 := uint8((x58 >> 8))
  1413  	out1[0] = x5
  1414  	out1[1] = x7
  1415  	out1[2] = x9
  1416  	out1[3] = x11
  1417  	out1[4] = x13
  1418  	out1[5] = x15
  1419  	out1[6] = x17
  1420  	out1[7] = x18
  1421  	out1[8] = x19
  1422  	out1[9] = x21
  1423  	out1[10] = x23
  1424  	out1[11] = x25
  1425  	out1[12] = x27
  1426  	out1[13] = x29
  1427  	out1[14] = x31
  1428  	out1[15] = x32
  1429  	out1[16] = x33
  1430  	out1[17] = x35
  1431  	out1[18] = x37
  1432  	out1[19] = x39
  1433  	out1[20] = x41
  1434  	out1[21] = x43
  1435  	out1[22] = x45
  1436  	out1[23] = x46
  1437  	out1[24] = x47
  1438  	out1[25] = x49
  1439  	out1[26] = x51
  1440  	out1[27] = x53
  1441  	out1[28] = x55
  1442  	out1[29] = x57
  1443  	out1[30] = x59
  1444  	out1[31] = x60
  1445  }
  1446  
  1447  // sm2p256FromBytes deserializes a field element NOT in the Montgomery domain from bytes in little-endian order.
  1448  //
  1449  // Preconditions:
  1450  //   0 ≤ bytes_eval arg1 < m
  1451  // Postconditions:
  1452  //   eval out1 mod m = bytes_eval arg1 mod m
  1453  //   0 ≤ eval out1 < m
  1454  //
  1455  // Input Bounds:
  1456  //   arg1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]]
  1457  // Output Bounds:
  1458  //   out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
  1459  func sm2p256FromBytes(out1 *[4]uint64, arg1 *[32]uint8) {
  1460  	x1 := (uint64(arg1[31]) << 56)
  1461  	x2 := (uint64(arg1[30]) << 48)
  1462  	x3 := (uint64(arg1[29]) << 40)
  1463  	x4 := (uint64(arg1[28]) << 32)
  1464  	x5 := (uint64(arg1[27]) << 24)
  1465  	x6 := (uint64(arg1[26]) << 16)
  1466  	x7 := (uint64(arg1[25]) << 8)
  1467  	x8 := arg1[24]
  1468  	x9 := (uint64(arg1[23]) << 56)
  1469  	x10 := (uint64(arg1[22]) << 48)
  1470  	x11 := (uint64(arg1[21]) << 40)
  1471  	x12 := (uint64(arg1[20]) << 32)
  1472  	x13 := (uint64(arg1[19]) << 24)
  1473  	x14 := (uint64(arg1[18]) << 16)
  1474  	x15 := (uint64(arg1[17]) << 8)
  1475  	x16 := arg1[16]
  1476  	x17 := (uint64(arg1[15]) << 56)
  1477  	x18 := (uint64(arg1[14]) << 48)
  1478  	x19 := (uint64(arg1[13]) << 40)
  1479  	x20 := (uint64(arg1[12]) << 32)
  1480  	x21 := (uint64(arg1[11]) << 24)
  1481  	x22 := (uint64(arg1[10]) << 16)
  1482  	x23 := (uint64(arg1[9]) << 8)
  1483  	x24 := arg1[8]
  1484  	x25 := (uint64(arg1[7]) << 56)
  1485  	x26 := (uint64(arg1[6]) << 48)
  1486  	x27 := (uint64(arg1[5]) << 40)
  1487  	x28 := (uint64(arg1[4]) << 32)
  1488  	x29 := (uint64(arg1[3]) << 24)
  1489  	x30 := (uint64(arg1[2]) << 16)
  1490  	x31 := (uint64(arg1[1]) << 8)
  1491  	x32 := arg1[0]
  1492  	x33 := (x31 + uint64(x32))
  1493  	x34 := (x30 + x33)
  1494  	x35 := (x29 + x34)
  1495  	x36 := (x28 + x35)
  1496  	x37 := (x27 + x36)
  1497  	x38 := (x26 + x37)
  1498  	x39 := (x25 + x38)
  1499  	x40 := (x23 + uint64(x24))
  1500  	x41 := (x22 + x40)
  1501  	x42 := (x21 + x41)
  1502  	x43 := (x20 + x42)
  1503  	x44 := (x19 + x43)
  1504  	x45 := (x18 + x44)
  1505  	x46 := (x17 + x45)
  1506  	x47 := (x15 + uint64(x16))
  1507  	x48 := (x14 + x47)
  1508  	x49 := (x13 + x48)
  1509  	x50 := (x12 + x49)
  1510  	x51 := (x11 + x50)
  1511  	x52 := (x10 + x51)
  1512  	x53 := (x9 + x52)
  1513  	x54 := (x7 + uint64(x8))
  1514  	x55 := (x6 + x54)
  1515  	x56 := (x5 + x55)
  1516  	x57 := (x4 + x56)
  1517  	x58 := (x3 + x57)
  1518  	x59 := (x2 + x58)
  1519  	x60 := (x1 + x59)
  1520  	out1[0] = x39
  1521  	out1[1] = x46
  1522  	out1[2] = x53
  1523  	out1[3] = x60
  1524  }
  1525  
  1526  // sm2p256Nonzero outputs a single non-zero word if the input is non-zero and zero otherwise.
  1527  //
  1528  // Preconditions:
  1529  //   0 ≤ eval arg1 < m
  1530  // Postconditions:
  1531  //   out1 = 0 ↔ eval (from_montgomery arg1) mod m = 0
  1532  //
  1533  // Input Bounds:
  1534  //   arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
  1535  // Output Bounds:
  1536  //   out1: [0x0 ~> 0xffffffffffffffff]
  1537  func sm2p256Nonzero(out1 *uint64, arg1 *[4]uint64) {
  1538  	x1 := (arg1[0] | (arg1[1] | (arg1[2] | arg1[3])))
  1539  	*out1 = x1
  1540  }
  1541  
  1542  // sm2p256Opp negates a field element in the Montgomery domain.
  1543  //
  1544  // Preconditions:
  1545  //   0 ≤ eval arg1 < m
  1546  // Postconditions:
  1547  //   eval (from_montgomery out1) mod m = -eval (from_montgomery arg1) mod m
  1548  //   0 ≤ eval out1 < m
  1549  //
  1550  func sm2p256Opp(out1 *sm2p256MontgomeryDomainFieldElement, arg1 *sm2p256MontgomeryDomainFieldElement) {
  1551  	var x1 uint64
  1552  	var x2 uint64
  1553  	x1, x2 = bits.Sub64(uint64(0x0), arg1[0], uint64(0x0))
  1554  	var x3 uint64
  1555  	var x4 uint64
  1556  	x3, x4 = bits.Sub64(uint64(0x0), arg1[1], uint64(sm2p256Uint1(x2)))
  1557  	var x5 uint64
  1558  	var x6 uint64
  1559  	x5, x6 = bits.Sub64(uint64(0x0), arg1[2], uint64(sm2p256Uint1(x4)))
  1560  	var x7 uint64
  1561  	var x8 uint64
  1562  	x7, x8 = bits.Sub64(uint64(0x0), arg1[3], uint64(sm2p256Uint1(x6)))
  1563  	var x9 uint64
  1564  	sm2p256CmovznzU64(&x9, sm2p256Uint1(x8), uint64(0x0), 0xffffffffffffffff)
  1565  	var x10 uint64
  1566  	var x11 uint64
  1567  	x10, x11 = bits.Add64(x1, x9, uint64(0x0))
  1568  	var x12 uint64
  1569  	var x13 uint64
  1570  	x12, x13 = bits.Add64(x3, (x9 & 0xffffffff00000000), uint64(sm2p256Uint1(x11)))
  1571  	var x14 uint64
  1572  	var x15 uint64
  1573  	x14, x15 = bits.Add64(x5, x9, uint64(sm2p256Uint1(x13)))
  1574  	var x16 uint64
  1575  	x16, _ = bits.Add64(x7, (x9 & 0xfffffffeffffffff), uint64(sm2p256Uint1(x15)))
  1576  	out1[0] = x10
  1577  	out1[1] = x12
  1578  	out1[2] = x14
  1579  	out1[3] = x16
  1580  }
  1581  
  1582  // sm2p256Msat returns the saturated representation of the prime modulus.
  1583  //
  1584  // Postconditions:
  1585  //   twos_complement_eval out1 = m
  1586  //   0 ≤ eval out1 < m
  1587  //
  1588  // Output Bounds:
  1589  //   out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
  1590  func sm2p256Msat(out1 *[5]uint64) {
  1591  	out1[0] = 0xffffffffffffffff
  1592  	out1[1] = 0xffffffff00000000
  1593  	out1[2] = 0xffffffffffffffff
  1594  	out1[3] = 0xfffffffeffffffff
  1595  	out1[4] = uint64(0x0)
  1596  }
  1597  
  1598  // sm2p256Divstep computes a divstep.
  1599  //
  1600  // Preconditions:
  1601  //   0 ≤ eval arg4 < m
  1602  //   0 ≤ eval arg5 < m
  1603  // Postconditions:
  1604  //   out1 = (if 0 < arg1 ∧ (twos_complement_eval arg3) is odd then 1 - arg1 else 1 + arg1)
  1605  //   twos_complement_eval out2 = (if 0 < arg1 ∧ (twos_complement_eval arg3) is odd then twos_complement_eval arg3 else twos_complement_eval arg2)
  1606  //   twos_complement_eval out3 = (if 0 < arg1 ∧ (twos_complement_eval arg3) is odd then ⌊(twos_complement_eval arg3 - twos_complement_eval arg2) / 2⌋ else ⌊(twos_complement_eval arg3 + (twos_complement_eval arg3 mod 2) * twos_complement_eval arg2) / 2⌋)
  1607  //   eval (from_montgomery out4) mod m = (if 0 < arg1 ∧ (twos_complement_eval arg3) is odd then (2 * eval (from_montgomery arg5)) mod m else (2 * eval (from_montgomery arg4)) mod m)
  1608  //   eval (from_montgomery out5) mod m = (if 0 < arg1 ∧ (twos_complement_eval arg3) is odd then (eval (from_montgomery arg4) - eval (from_montgomery arg4)) mod m else (eval (from_montgomery arg5) + (twos_complement_eval arg3 mod 2) * eval (from_montgomery arg4)) mod m)
  1609  //   0 ≤ eval out5 < m
  1610  //   0 ≤ eval out5 < m
  1611  //   0 ≤ eval out2 < m
  1612  //   0 ≤ eval out3 < m
  1613  //
  1614  // Input Bounds:
  1615  //   arg1: [0x0 ~> 0xffffffffffffffff]
  1616  //   arg2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
  1617  //   arg3: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
  1618  //   arg4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
  1619  //   arg5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
  1620  // Output Bounds:
  1621  //   out1: [0x0 ~> 0xffffffffffffffff]
  1622  //   out2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
  1623  //   out3: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
  1624  //   out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
  1625  //   out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
  1626  func sm2p256Divstep(out1 *uint64, out2 *[5]uint64, out3 *[5]uint64, out4 *[4]uint64, out5 *[4]uint64, arg1 uint64, arg2 *[5]uint64, arg3 *[5]uint64, arg4 *[4]uint64, arg5 *[4]uint64) {
  1627  	var x1 uint64
  1628  	x1, _ = bits.Add64((^arg1), uint64(0x1), uint64(0x0))
  1629  	x3 := (sm2p256Uint1((x1 >> 63)) & (sm2p256Uint1(arg3[0]) & 0x1))
  1630  	var x4 uint64
  1631  	x4, _ = bits.Add64((^arg1), uint64(0x1), uint64(0x0))
  1632  	var x6 uint64
  1633  	sm2p256CmovznzU64(&x6, x3, arg1, x4)
  1634  	var x7 uint64
  1635  	sm2p256CmovznzU64(&x7, x3, arg2[0], arg3[0])
  1636  	var x8 uint64
  1637  	sm2p256CmovznzU64(&x8, x3, arg2[1], arg3[1])
  1638  	var x9 uint64
  1639  	sm2p256CmovznzU64(&x9, x3, arg2[2], arg3[2])
  1640  	var x10 uint64
  1641  	sm2p256CmovznzU64(&x10, x3, arg2[3], arg3[3])
  1642  	var x11 uint64
  1643  	sm2p256CmovznzU64(&x11, x3, arg2[4], arg3[4])
  1644  	var x12 uint64
  1645  	var x13 uint64
  1646  	x12, x13 = bits.Add64(uint64(0x1), (^arg2[0]), uint64(0x0))
  1647  	var x14 uint64
  1648  	var x15 uint64
  1649  	x14, x15 = bits.Add64(uint64(0x0), (^arg2[1]), uint64(sm2p256Uint1(x13)))
  1650  	var x16 uint64
  1651  	var x17 uint64
  1652  	x16, x17 = bits.Add64(uint64(0x0), (^arg2[2]), uint64(sm2p256Uint1(x15)))
  1653  	var x18 uint64
  1654  	var x19 uint64
  1655  	x18, x19 = bits.Add64(uint64(0x0), (^arg2[3]), uint64(sm2p256Uint1(x17)))
  1656  	var x20 uint64
  1657  	x20, _ = bits.Add64(uint64(0x0), (^arg2[4]), uint64(sm2p256Uint1(x19)))
  1658  	var x22 uint64
  1659  	sm2p256CmovznzU64(&x22, x3, arg3[0], x12)
  1660  	var x23 uint64
  1661  	sm2p256CmovznzU64(&x23, x3, arg3[1], x14)
  1662  	var x24 uint64
  1663  	sm2p256CmovznzU64(&x24, x3, arg3[2], x16)
  1664  	var x25 uint64
  1665  	sm2p256CmovznzU64(&x25, x3, arg3[3], x18)
  1666  	var x26 uint64
  1667  	sm2p256CmovznzU64(&x26, x3, arg3[4], x20)
  1668  	var x27 uint64
  1669  	sm2p256CmovznzU64(&x27, x3, arg4[0], arg5[0])
  1670  	var x28 uint64
  1671  	sm2p256CmovznzU64(&x28, x3, arg4[1], arg5[1])
  1672  	var x29 uint64
  1673  	sm2p256CmovznzU64(&x29, x3, arg4[2], arg5[2])
  1674  	var x30 uint64
  1675  	sm2p256CmovznzU64(&x30, x3, arg4[3], arg5[3])
  1676  	var x31 uint64
  1677  	var x32 uint64
  1678  	x31, x32 = bits.Add64(x27, x27, uint64(0x0))
  1679  	var x33 uint64
  1680  	var x34 uint64
  1681  	x33, x34 = bits.Add64(x28, x28, uint64(sm2p256Uint1(x32)))
  1682  	var x35 uint64
  1683  	var x36 uint64
  1684  	x35, x36 = bits.Add64(x29, x29, uint64(sm2p256Uint1(x34)))
  1685  	var x37 uint64
  1686  	var x38 uint64
  1687  	x37, x38 = bits.Add64(x30, x30, uint64(sm2p256Uint1(x36)))
  1688  	var x39 uint64
  1689  	var x40 uint64
  1690  	x39, x40 = bits.Sub64(x31, 0xffffffffffffffff, uint64(0x0))
  1691  	var x41 uint64
  1692  	var x42 uint64
  1693  	x41, x42 = bits.Sub64(x33, 0xffffffff00000000, uint64(sm2p256Uint1(x40)))
  1694  	var x43 uint64
  1695  	var x44 uint64
  1696  	x43, x44 = bits.Sub64(x35, 0xffffffffffffffff, uint64(sm2p256Uint1(x42)))
  1697  	var x45 uint64
  1698  	var x46 uint64
  1699  	x45, x46 = bits.Sub64(x37, 0xfffffffeffffffff, uint64(sm2p256Uint1(x44)))
  1700  	var x48 uint64
  1701  	_, x48 = bits.Sub64(uint64(sm2p256Uint1(x38)), uint64(0x0), uint64(sm2p256Uint1(x46)))
  1702  	x49 := arg4[3]
  1703  	x50 := arg4[2]
  1704  	x51 := arg4[1]
  1705  	x52 := arg4[0]
  1706  	var x53 uint64
  1707  	var x54 uint64
  1708  	x53, x54 = bits.Sub64(uint64(0x0), x52, uint64(0x0))
  1709  	var x55 uint64
  1710  	var x56 uint64
  1711  	x55, x56 = bits.Sub64(uint64(0x0), x51, uint64(sm2p256Uint1(x54)))
  1712  	var x57 uint64
  1713  	var x58 uint64
  1714  	x57, x58 = bits.Sub64(uint64(0x0), x50, uint64(sm2p256Uint1(x56)))
  1715  	var x59 uint64
  1716  	var x60 uint64
  1717  	x59, x60 = bits.Sub64(uint64(0x0), x49, uint64(sm2p256Uint1(x58)))
  1718  	var x61 uint64
  1719  	sm2p256CmovznzU64(&x61, sm2p256Uint1(x60), uint64(0x0), 0xffffffffffffffff)
  1720  	var x62 uint64
  1721  	var x63 uint64
  1722  	x62, x63 = bits.Add64(x53, x61, uint64(0x0))
  1723  	var x64 uint64
  1724  	var x65 uint64
  1725  	x64, x65 = bits.Add64(x55, (x61 & 0xffffffff00000000), uint64(sm2p256Uint1(x63)))
  1726  	var x66 uint64
  1727  	var x67 uint64
  1728  	x66, x67 = bits.Add64(x57, x61, uint64(sm2p256Uint1(x65)))
  1729  	var x68 uint64
  1730  	x68, _ = bits.Add64(x59, (x61 & 0xfffffffeffffffff), uint64(sm2p256Uint1(x67)))
  1731  	var x70 uint64
  1732  	sm2p256CmovznzU64(&x70, x3, arg5[0], x62)
  1733  	var x71 uint64
  1734  	sm2p256CmovznzU64(&x71, x3, arg5[1], x64)
  1735  	var x72 uint64
  1736  	sm2p256CmovznzU64(&x72, x3, arg5[2], x66)
  1737  	var x73 uint64
  1738  	sm2p256CmovznzU64(&x73, x3, arg5[3], x68)
  1739  	x74 := (sm2p256Uint1(x22) & 0x1)
  1740  	var x75 uint64
  1741  	sm2p256CmovznzU64(&x75, x74, uint64(0x0), x7)
  1742  	var x76 uint64
  1743  	sm2p256CmovznzU64(&x76, x74, uint64(0x0), x8)
  1744  	var x77 uint64
  1745  	sm2p256CmovznzU64(&x77, x74, uint64(0x0), x9)
  1746  	var x78 uint64
  1747  	sm2p256CmovznzU64(&x78, x74, uint64(0x0), x10)
  1748  	var x79 uint64
  1749  	sm2p256CmovznzU64(&x79, x74, uint64(0x0), x11)
  1750  	var x80 uint64
  1751  	var x81 uint64
  1752  	x80, x81 = bits.Add64(x22, x75, uint64(0x0))
  1753  	var x82 uint64
  1754  	var x83 uint64
  1755  	x82, x83 = bits.Add64(x23, x76, uint64(sm2p256Uint1(x81)))
  1756  	var x84 uint64
  1757  	var x85 uint64
  1758  	x84, x85 = bits.Add64(x24, x77, uint64(sm2p256Uint1(x83)))
  1759  	var x86 uint64
  1760  	var x87 uint64
  1761  	x86, x87 = bits.Add64(x25, x78, uint64(sm2p256Uint1(x85)))
  1762  	var x88 uint64
  1763  	x88, _ = bits.Add64(x26, x79, uint64(sm2p256Uint1(x87)))
  1764  	var x90 uint64
  1765  	sm2p256CmovznzU64(&x90, x74, uint64(0x0), x27)
  1766  	var x91 uint64
  1767  	sm2p256CmovznzU64(&x91, x74, uint64(0x0), x28)
  1768  	var x92 uint64
  1769  	sm2p256CmovznzU64(&x92, x74, uint64(0x0), x29)
  1770  	var x93 uint64
  1771  	sm2p256CmovznzU64(&x93, x74, uint64(0x0), x30)
  1772  	var x94 uint64
  1773  	var x95 uint64
  1774  	x94, x95 = bits.Add64(x70, x90, uint64(0x0))
  1775  	var x96 uint64
  1776  	var x97 uint64
  1777  	x96, x97 = bits.Add64(x71, x91, uint64(sm2p256Uint1(x95)))
  1778  	var x98 uint64
  1779  	var x99 uint64
  1780  	x98, x99 = bits.Add64(x72, x92, uint64(sm2p256Uint1(x97)))
  1781  	var x100 uint64
  1782  	var x101 uint64
  1783  	x100, x101 = bits.Add64(x73, x93, uint64(sm2p256Uint1(x99)))
  1784  	var x102 uint64
  1785  	var x103 uint64
  1786  	x102, x103 = bits.Sub64(x94, 0xffffffffffffffff, uint64(0x0))
  1787  	var x104 uint64
  1788  	var x105 uint64
  1789  	x104, x105 = bits.Sub64(x96, 0xffffffff00000000, uint64(sm2p256Uint1(x103)))
  1790  	var x106 uint64
  1791  	var x107 uint64
  1792  	x106, x107 = bits.Sub64(x98, 0xffffffffffffffff, uint64(sm2p256Uint1(x105)))
  1793  	var x108 uint64
  1794  	var x109 uint64
  1795  	x108, x109 = bits.Sub64(x100, 0xfffffffeffffffff, uint64(sm2p256Uint1(x107)))
  1796  	var x111 uint64
  1797  	_, x111 = bits.Sub64(uint64(sm2p256Uint1(x101)), uint64(0x0), uint64(sm2p256Uint1(x109)))
  1798  	var x112 uint64
  1799  	x112, _ = bits.Add64(x6, uint64(0x1), uint64(0x0))
  1800  	x114 := ((x80 >> 1) | ((x82 << 63) & 0xffffffffffffffff))
  1801  	x115 := ((x82 >> 1) | ((x84 << 63) & 0xffffffffffffffff))
  1802  	x116 := ((x84 >> 1) | ((x86 << 63) & 0xffffffffffffffff))
  1803  	x117 := ((x86 >> 1) | ((x88 << 63) & 0xffffffffffffffff))
  1804  	x118 := ((x88 & 0x8000000000000000) | (x88 >> 1))
  1805  	var x119 uint64
  1806  	sm2p256CmovznzU64(&x119, sm2p256Uint1(x48), x39, x31)
  1807  	var x120 uint64
  1808  	sm2p256CmovznzU64(&x120, sm2p256Uint1(x48), x41, x33)
  1809  	var x121 uint64
  1810  	sm2p256CmovznzU64(&x121, sm2p256Uint1(x48), x43, x35)
  1811  	var x122 uint64
  1812  	sm2p256CmovznzU64(&x122, sm2p256Uint1(x48), x45, x37)
  1813  	var x123 uint64
  1814  	sm2p256CmovznzU64(&x123, sm2p256Uint1(x111), x102, x94)
  1815  	var x124 uint64
  1816  	sm2p256CmovznzU64(&x124, sm2p256Uint1(x111), x104, x96)
  1817  	var x125 uint64
  1818  	sm2p256CmovznzU64(&x125, sm2p256Uint1(x111), x106, x98)
  1819  	var x126 uint64
  1820  	sm2p256CmovznzU64(&x126, sm2p256Uint1(x111), x108, x100)
  1821  	*out1 = x112
  1822  	out2[0] = x7
  1823  	out2[1] = x8
  1824  	out2[2] = x9
  1825  	out2[3] = x10
  1826  	out2[4] = x11
  1827  	out3[0] = x114
  1828  	out3[1] = x115
  1829  	out3[2] = x116
  1830  	out3[3] = x117
  1831  	out3[4] = x118
  1832  	out4[0] = x119
  1833  	out4[1] = x120
  1834  	out4[2] = x121
  1835  	out4[3] = x122
  1836  	out5[0] = x123
  1837  	out5[1] = x124
  1838  	out5[2] = x125
  1839  	out5[3] = x126
  1840  }
  1841  
  1842  // sm2p256DivstepPrecomp returns the precomputed value for Bernstein-Yang-inversion (in montgomery form).
  1843  //
  1844  // Postconditions:
  1845  //   eval (from_montgomery out1) = ⌊(m - 1) / 2⌋^(if ⌊log2 m⌋ + 1 < 46 then ⌊(49 * (⌊log2 m⌋ + 1) + 80) / 17⌋ else ⌊(49 * (⌊log2 m⌋ + 1) + 57) / 17⌋)
  1846  //   0 ≤ eval out1 < m
  1847  //
  1848  // Output Bounds:
  1849  //   out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
  1850  func sm2p256DivstepPrecomp(out1 *[4]uint64) {
  1851  	out1[0] = 0x500000028ffffffe
  1852  	out1[1] = 0xe80000009ffffffe
  1853  	out1[2] = 0xd00000018ffffffe
  1854  	out1[3] = 0x280000011ffffffd
  1855  }