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