github.com/consensys/gnark-crypto@v0.14.0/ecc/bls24-315/fr/element_exp.go (about)

     1  // Copyright 2020 ConsenSys Software Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // Code generated by consensys/gnark-crypto DO NOT EDIT
    16  
    17  package fr
    18  
    19  // expBySqrtExp is equivalent to z.Exp(x, 32dbd584953b42564bf8fd939f24f531918901d9cc89c6c833a18bfa01)
    20  //
    21  // uses github.com/mmcloughlin/addchain v0.4.0 to generate a shorter addition chain
    22  func (z *Element) expBySqrtExp(x Element) *Element {
    23  	// addition chain:
    24  	//
    25  	//	_10      = 2*1
    26  	//	_100     = 2*_10
    27  	//	_101     = 1 + _100
    28  	//	_110     = 1 + _101
    29  	//	_1001    = _100 + _101
    30  	//	_1011    = _10 + _1001
    31  	//	_1111    = _100 + _1011
    32  	//	_10011   = _100 + _1111
    33  	//	_10101   = _10 + _10011
    34  	//	_11001   = _100 + _10101
    35  	//	_11011   = _10 + _11001
    36  	//	_100001  = _110 + _11011
    37  	//	_100111  = _110 + _100001
    38  	//	_101011  = _100 + _100111
    39  	//	_110001  = _110 + _101011
    40  	//	_110011  = _10 + _110001
    41  	//	_111001  = _110 + _110011
    42  	//	_111011  = _10 + _111001
    43  	//	_111101  = _10 + _111011
    44  	//	_111111  = _10 + _111101
    45  	//	_1100100 = _100111 + _111101
    46  	//	_1111111 = _11011 + _1100100
    47  	//	i40      = ((_1100100 << 4 + _11011) << 7 + _111101) << 5
    48  	//	i58      = ((_1011 + i40) << 8 + _1001) << 7 + _10101
    49  	//	i83      = ((i58 << 8 + _111011) << 7 + _100001) << 8
    50  	//	i100     = ((_101011 + i83) << 6 + _1001) << 8 + _1111111
    51  	//	i125     = ((i100 << 9 + _111111) << 6 + _11001) << 8
    52  	//	i138     = ((_111001 + i125) << 4 + _1111) << 6 + _1001
    53  	//	i162     = ((i138 << 8 + _111101) << 6 + _10011) << 8
    54  	//	i177     = ((_11001 + i162) << 9 + _110001) << 3 + 1
    55  	//	i204     = ((i177 << 13 + _111011) << 8 + _111001) << 4
    56  	//	i224     = ((_1001 + i204) << 9 + _100111) << 8 + _11011
    57  	//	i243     = ((i224 << 3 + 1) << 11 + _110011) << 3
    58  	//	i264     = ((_101 + i243) << 10 + _110001) << 8 + _1111111
    59  	//	return     (i264 << 2 + 1) << 9 + 1
    60  	//
    61  	// Operations: 225 squares 52 multiplies
    62  
    63  	// Allocate Temporaries.
    64  	var (
    65  		t0  = new(Element)
    66  		t1  = new(Element)
    67  		t2  = new(Element)
    68  		t3  = new(Element)
    69  		t4  = new(Element)
    70  		t5  = new(Element)
    71  		t6  = new(Element)
    72  		t7  = new(Element)
    73  		t8  = new(Element)
    74  		t9  = new(Element)
    75  		t10 = new(Element)
    76  		t11 = new(Element)
    77  		t12 = new(Element)
    78  		t13 = new(Element)
    79  		t14 = new(Element)
    80  		t15 = new(Element)
    81  		t16 = new(Element)
    82  		t17 = new(Element)
    83  	)
    84  
    85  	// var t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17 Element
    86  	// Step 1: z = x^0x2
    87  	z.Square(&x)
    88  
    89  	// Step 2: t0 = x^0x4
    90  	t0.Square(z)
    91  
    92  	// Step 3: t1 = x^0x5
    93  	t1.Mul(&x, t0)
    94  
    95  	// Step 4: t6 = x^0x6
    96  	t6.Mul(&x, t1)
    97  
    98  	// Step 5: t5 = x^0x9
    99  	t5.Mul(t0, t1)
   100  
   101  	// Step 6: t16 = x^0xb
   102  	t16.Mul(z, t5)
   103  
   104  	// Step 7: t11 = x^0xf
   105  	t11.Mul(t0, t16)
   106  
   107  	// Step 8: t9 = x^0x13
   108  	t9.Mul(t0, t11)
   109  
   110  	// Step 9: t15 = x^0x15
   111  	t15.Mul(z, t9)
   112  
   113  	// Step 10: t8 = x^0x19
   114  	t8.Mul(t0, t15)
   115  
   116  	// Step 11: t3 = x^0x1b
   117  	t3.Mul(z, t8)
   118  
   119  	// Step 12: t14 = x^0x21
   120  	t14.Mul(t6, t3)
   121  
   122  	// Step 13: t4 = x^0x27
   123  	t4.Mul(t6, t14)
   124  
   125  	// Step 14: t13 = x^0x2b
   126  	t13.Mul(t0, t4)
   127  
   128  	// Step 15: t0 = x^0x31
   129  	t0.Mul(t6, t13)
   130  
   131  	// Step 16: t2 = x^0x33
   132  	t2.Mul(z, t0)
   133  
   134  	// Step 17: t6 = x^0x39
   135  	t6.Mul(t6, t2)
   136  
   137  	// Step 18: t7 = x^0x3b
   138  	t7.Mul(z, t6)
   139  
   140  	// Step 19: t10 = x^0x3d
   141  	t10.Mul(z, t7)
   142  
   143  	// Step 20: t12 = x^0x3f
   144  	t12.Mul(z, t10)
   145  
   146  	// Step 21: t17 = x^0x64
   147  	t17.Mul(t4, t10)
   148  
   149  	// Step 22: z = x^0x7f
   150  	z.Mul(t3, t17)
   151  
   152  	// Step 26: t17 = x^0x640
   153  	for s := 0; s < 4; s++ {
   154  		t17.Square(t17)
   155  	}
   156  
   157  	// Step 27: t17 = x^0x65b
   158  	t17.Mul(t3, t17)
   159  
   160  	// Step 34: t17 = x^0x32d80
   161  	for s := 0; s < 7; s++ {
   162  		t17.Square(t17)
   163  	}
   164  
   165  	// Step 35: t17 = x^0x32dbd
   166  	t17.Mul(t10, t17)
   167  
   168  	// Step 40: t17 = x^0x65b7a0
   169  	for s := 0; s < 5; s++ {
   170  		t17.Square(t17)
   171  	}
   172  
   173  	// Step 41: t16 = x^0x65b7ab
   174  	t16.Mul(t16, t17)
   175  
   176  	// Step 49: t16 = x^0x65b7ab00
   177  	for s := 0; s < 8; s++ {
   178  		t16.Square(t16)
   179  	}
   180  
   181  	// Step 50: t16 = x^0x65b7ab09
   182  	t16.Mul(t5, t16)
   183  
   184  	// Step 57: t16 = x^0x32dbd58480
   185  	for s := 0; s < 7; s++ {
   186  		t16.Square(t16)
   187  	}
   188  
   189  	// Step 58: t15 = x^0x32dbd58495
   190  	t15.Mul(t15, t16)
   191  
   192  	// Step 66: t15 = x^0x32dbd5849500
   193  	for s := 0; s < 8; s++ {
   194  		t15.Square(t15)
   195  	}
   196  
   197  	// Step 67: t15 = x^0x32dbd584953b
   198  	t15.Mul(t7, t15)
   199  
   200  	// Step 74: t15 = x^0x196deac24a9d80
   201  	for s := 0; s < 7; s++ {
   202  		t15.Square(t15)
   203  	}
   204  
   205  	// Step 75: t14 = x^0x196deac24a9da1
   206  	t14.Mul(t14, t15)
   207  
   208  	// Step 83: t14 = x^0x196deac24a9da100
   209  	for s := 0; s < 8; s++ {
   210  		t14.Square(t14)
   211  	}
   212  
   213  	// Step 84: t13 = x^0x196deac24a9da12b
   214  	t13.Mul(t13, t14)
   215  
   216  	// Step 90: t13 = x^0x65b7ab092a7684ac0
   217  	for s := 0; s < 6; s++ {
   218  		t13.Square(t13)
   219  	}
   220  
   221  	// Step 91: t13 = x^0x65b7ab092a7684ac9
   222  	t13.Mul(t5, t13)
   223  
   224  	// Step 99: t13 = x^0x65b7ab092a7684ac900
   225  	for s := 0; s < 8; s++ {
   226  		t13.Square(t13)
   227  	}
   228  
   229  	// Step 100: t13 = x^0x65b7ab092a7684ac97f
   230  	t13.Mul(z, t13)
   231  
   232  	// Step 109: t13 = x^0xcb6f561254ed09592fe00
   233  	for s := 0; s < 9; s++ {
   234  		t13.Square(t13)
   235  	}
   236  
   237  	// Step 110: t12 = x^0xcb6f561254ed09592fe3f
   238  	t12.Mul(t12, t13)
   239  
   240  	// Step 116: t12 = x^0x32dbd584953b42564bf8fc0
   241  	for s := 0; s < 6; s++ {
   242  		t12.Square(t12)
   243  	}
   244  
   245  	// Step 117: t12 = x^0x32dbd584953b42564bf8fd9
   246  	t12.Mul(t8, t12)
   247  
   248  	// Step 125: t12 = x^0x32dbd584953b42564bf8fd900
   249  	for s := 0; s < 8; s++ {
   250  		t12.Square(t12)
   251  	}
   252  
   253  	// Step 126: t12 = x^0x32dbd584953b42564bf8fd939
   254  	t12.Mul(t6, t12)
   255  
   256  	// Step 130: t12 = x^0x32dbd584953b42564bf8fd9390
   257  	for s := 0; s < 4; s++ {
   258  		t12.Square(t12)
   259  	}
   260  
   261  	// Step 131: t11 = x^0x32dbd584953b42564bf8fd939f
   262  	t11.Mul(t11, t12)
   263  
   264  	// Step 137: t11 = x^0xcb6f561254ed09592fe3f64e7c0
   265  	for s := 0; s < 6; s++ {
   266  		t11.Square(t11)
   267  	}
   268  
   269  	// Step 138: t11 = x^0xcb6f561254ed09592fe3f64e7c9
   270  	t11.Mul(t5, t11)
   271  
   272  	// Step 146: t11 = x^0xcb6f561254ed09592fe3f64e7c900
   273  	for s := 0; s < 8; s++ {
   274  		t11.Square(t11)
   275  	}
   276  
   277  	// Step 147: t10 = x^0xcb6f561254ed09592fe3f64e7c93d
   278  	t10.Mul(t10, t11)
   279  
   280  	// Step 153: t10 = x^0x32dbd584953b42564bf8fd939f24f40
   281  	for s := 0; s < 6; s++ {
   282  		t10.Square(t10)
   283  	}
   284  
   285  	// Step 154: t9 = x^0x32dbd584953b42564bf8fd939f24f53
   286  	t9.Mul(t9, t10)
   287  
   288  	// Step 162: t9 = x^0x32dbd584953b42564bf8fd939f24f5300
   289  	for s := 0; s < 8; s++ {
   290  		t9.Square(t9)
   291  	}
   292  
   293  	// Step 163: t8 = x^0x32dbd584953b42564bf8fd939f24f5319
   294  	t8.Mul(t8, t9)
   295  
   296  	// Step 172: t8 = x^0x65b7ab092a7684ac97f1fb273e49ea63200
   297  	for s := 0; s < 9; s++ {
   298  		t8.Square(t8)
   299  	}
   300  
   301  	// Step 173: t8 = x^0x65b7ab092a7684ac97f1fb273e49ea63231
   302  	t8.Mul(t0, t8)
   303  
   304  	// Step 176: t8 = x^0x32dbd584953b42564bf8fd939f24f5319188
   305  	for s := 0; s < 3; s++ {
   306  		t8.Square(t8)
   307  	}
   308  
   309  	// Step 177: t8 = x^0x32dbd584953b42564bf8fd939f24f5319189
   310  	t8.Mul(&x, t8)
   311  
   312  	// Step 190: t8 = x^0x65b7ab092a7684ac97f1fb273e49ea632312000
   313  	for s := 0; s < 13; s++ {
   314  		t8.Square(t8)
   315  	}
   316  
   317  	// Step 191: t7 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b
   318  	t7.Mul(t7, t8)
   319  
   320  	// Step 199: t7 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b00
   321  	for s := 0; s < 8; s++ {
   322  		t7.Square(t7)
   323  	}
   324  
   325  	// Step 200: t6 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b39
   326  	t6.Mul(t6, t7)
   327  
   328  	// Step 204: t6 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b390
   329  	for s := 0; s < 4; s++ {
   330  		t6.Square(t6)
   331  	}
   332  
   333  	// Step 205: t5 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b399
   334  	t5.Mul(t5, t6)
   335  
   336  	// Step 214: t5 = x^0xcb6f561254ed09592fe3f64e7c93d4c6462407673200
   337  	for s := 0; s < 9; s++ {
   338  		t5.Square(t5)
   339  	}
   340  
   341  	// Step 215: t4 = x^0xcb6f561254ed09592fe3f64e7c93d4c6462407673227
   342  	t4.Mul(t4, t5)
   343  
   344  	// Step 223: t4 = x^0xcb6f561254ed09592fe3f64e7c93d4c646240767322700
   345  	for s := 0; s < 8; s++ {
   346  		t4.Square(t4)
   347  	}
   348  
   349  	// Step 224: t3 = x^0xcb6f561254ed09592fe3f64e7c93d4c64624076732271b
   350  	t3.Mul(t3, t4)
   351  
   352  	// Step 227: t3 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b399138d8
   353  	for s := 0; s < 3; s++ {
   354  		t3.Square(t3)
   355  	}
   356  
   357  	// Step 228: t3 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b399138d9
   358  	t3.Mul(&x, t3)
   359  
   360  	// Step 239: t3 = x^0x32dbd584953b42564bf8fd939f24f531918901d9cc89c6c800
   361  	for s := 0; s < 11; s++ {
   362  		t3.Square(t3)
   363  	}
   364  
   365  	// Step 240: t2 = x^0x32dbd584953b42564bf8fd939f24f531918901d9cc89c6c833
   366  	t2.Mul(t2, t3)
   367  
   368  	// Step 243: t2 = x^0x196deac24a9da12b25fc7ec9cf927a98c8c480ece644e364198
   369  	for s := 0; s < 3; s++ {
   370  		t2.Square(t2)
   371  	}
   372  
   373  	// Step 244: t1 = x^0x196deac24a9da12b25fc7ec9cf927a98c8c480ece644e36419d
   374  	t1.Mul(t1, t2)
   375  
   376  	// Step 254: t1 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b399138d9067400
   377  	for s := 0; s < 10; s++ {
   378  		t1.Square(t1)
   379  	}
   380  
   381  	// Step 255: t0 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b399138d9067431
   382  	t0.Mul(t0, t1)
   383  
   384  	// Step 263: t0 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b399138d906743100
   385  	for s := 0; s < 8; s++ {
   386  		t0.Square(t0)
   387  	}
   388  
   389  	// Step 264: z = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b399138d90674317f
   390  	z.Mul(z, t0)
   391  
   392  	// Step 266: z = x^0x196deac24a9da12b25fc7ec9cf927a98c8c480ece644e36419d0c5fc
   393  	for s := 0; s < 2; s++ {
   394  		z.Square(z)
   395  	}
   396  
   397  	// Step 267: z = x^0x196deac24a9da12b25fc7ec9cf927a98c8c480ece644e36419d0c5fd
   398  	z.Mul(&x, z)
   399  
   400  	// Step 276: z = x^0x32dbd584953b42564bf8fd939f24f531918901d9cc89c6c833a18bfa00
   401  	for s := 0; s < 9; s++ {
   402  		z.Square(z)
   403  	}
   404  
   405  	// Step 277: z = x^0x32dbd584953b42564bf8fd939f24f531918901d9cc89c6c833a18bfa01
   406  	z.Mul(&x, z)
   407  
   408  	return z
   409  }
   410  
   411  // expByLegendreExp is equivalent to z.Exp(x, cb6f561254ed09592fe3f64e7c93d4c64624076732271b20ce862fe80600000)
   412  //
   413  // uses github.com/mmcloughlin/addchain v0.4.0 to generate a shorter addition chain
   414  func (z *Element) expByLegendreExp(x Element) *Element {
   415  	// addition chain:
   416  	//
   417  	//	_10      = 2*1
   418  	//	_11      = 1 + _10
   419  	//	_100     = 1 + _11
   420  	//	_101     = 1 + _100
   421  	//	_110     = 1 + _101
   422  	//	_1001    = _11 + _110
   423  	//	_1011    = _10 + _1001
   424  	//	_1111    = _100 + _1011
   425  	//	_10011   = _100 + _1111
   426  	//	_10101   = _10 + _10011
   427  	//	_11001   = _100 + _10101
   428  	//	_11011   = _10 + _11001
   429  	//	_100001  = _110 + _11011
   430  	//	_100111  = _110 + _100001
   431  	//	_101011  = _100 + _100111
   432  	//	_110001  = _110 + _101011
   433  	//	_110011  = _10 + _110001
   434  	//	_111001  = _110 + _110011
   435  	//	_111011  = _10 + _111001
   436  	//	_111101  = _10 + _111011
   437  	//	_111111  = _10 + _111101
   438  	//	_1100100 = _100111 + _111101
   439  	//	_1111111 = _11011 + _1100100
   440  	//	i41      = ((_1100100 << 4 + _11011) << 7 + _111101) << 5
   441  	//	i59      = ((_1011 + i41) << 8 + _1001) << 7 + _10101
   442  	//	i84      = ((i59 << 8 + _111011) << 7 + _100001) << 8
   443  	//	i101     = ((_101011 + i84) << 6 + _1001) << 8 + _1111111
   444  	//	i126     = ((i101 << 9 + _111111) << 6 + _11001) << 8
   445  	//	i139     = ((_111001 + i126) << 4 + _1111) << 6 + _1001
   446  	//	i163     = ((i139 << 8 + _111101) << 6 + _10011) << 8
   447  	//	i178     = ((_11001 + i163) << 9 + _110001) << 3 + 1
   448  	//	i205     = ((i178 << 13 + _111011) << 8 + _111001) << 4
   449  	//	i225     = ((_1001 + i205) << 9 + _100111) << 8 + _11011
   450  	//	i244     = ((i225 << 3 + 1) << 11 + _110011) << 3
   451  	//	i265     = ((_101 + i244) << 10 + _110001) << 8 + _1111111
   452  	//	return     ((i265 << 2 + 1) << 10 + _11) << 21
   453  	//
   454  	// Operations: 246 squares 54 multiplies
   455  
   456  	// Allocate Temporaries.
   457  	var (
   458  		t0  = new(Element)
   459  		t1  = new(Element)
   460  		t2  = new(Element)
   461  		t3  = new(Element)
   462  		t4  = new(Element)
   463  		t5  = new(Element)
   464  		t6  = new(Element)
   465  		t7  = new(Element)
   466  		t8  = new(Element)
   467  		t9  = new(Element)
   468  		t10 = new(Element)
   469  		t11 = new(Element)
   470  		t12 = new(Element)
   471  		t13 = new(Element)
   472  		t14 = new(Element)
   473  		t15 = new(Element)
   474  		t16 = new(Element)
   475  		t17 = new(Element)
   476  		t18 = new(Element)
   477  	)
   478  
   479  	// var t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18 Element
   480  	// Step 1: t0 = x^0x2
   481  	t0.Square(&x)
   482  
   483  	// Step 2: z = x^0x3
   484  	z.Mul(&x, t0)
   485  
   486  	// Step 3: t1 = x^0x4
   487  	t1.Mul(&x, z)
   488  
   489  	// Step 4: t2 = x^0x5
   490  	t2.Mul(&x, t1)
   491  
   492  	// Step 5: t7 = x^0x6
   493  	t7.Mul(&x, t2)
   494  
   495  	// Step 6: t6 = x^0x9
   496  	t6.Mul(z, t7)
   497  
   498  	// Step 7: t17 = x^0xb
   499  	t17.Mul(t0, t6)
   500  
   501  	// Step 8: t12 = x^0xf
   502  	t12.Mul(t1, t17)
   503  
   504  	// Step 9: t10 = x^0x13
   505  	t10.Mul(t1, t12)
   506  
   507  	// Step 10: t16 = x^0x15
   508  	t16.Mul(t0, t10)
   509  
   510  	// Step 11: t9 = x^0x19
   511  	t9.Mul(t1, t16)
   512  
   513  	// Step 12: t4 = x^0x1b
   514  	t4.Mul(t0, t9)
   515  
   516  	// Step 13: t15 = x^0x21
   517  	t15.Mul(t7, t4)
   518  
   519  	// Step 14: t5 = x^0x27
   520  	t5.Mul(t7, t15)
   521  
   522  	// Step 15: t14 = x^0x2b
   523  	t14.Mul(t1, t5)
   524  
   525  	// Step 16: t1 = x^0x31
   526  	t1.Mul(t7, t14)
   527  
   528  	// Step 17: t3 = x^0x33
   529  	t3.Mul(t0, t1)
   530  
   531  	// Step 18: t7 = x^0x39
   532  	t7.Mul(t7, t3)
   533  
   534  	// Step 19: t8 = x^0x3b
   535  	t8.Mul(t0, t7)
   536  
   537  	// Step 20: t11 = x^0x3d
   538  	t11.Mul(t0, t8)
   539  
   540  	// Step 21: t13 = x^0x3f
   541  	t13.Mul(t0, t11)
   542  
   543  	// Step 22: t18 = x^0x64
   544  	t18.Mul(t5, t11)
   545  
   546  	// Step 23: t0 = x^0x7f
   547  	t0.Mul(t4, t18)
   548  
   549  	// Step 27: t18 = x^0x640
   550  	for s := 0; s < 4; s++ {
   551  		t18.Square(t18)
   552  	}
   553  
   554  	// Step 28: t18 = x^0x65b
   555  	t18.Mul(t4, t18)
   556  
   557  	// Step 35: t18 = x^0x32d80
   558  	for s := 0; s < 7; s++ {
   559  		t18.Square(t18)
   560  	}
   561  
   562  	// Step 36: t18 = x^0x32dbd
   563  	t18.Mul(t11, t18)
   564  
   565  	// Step 41: t18 = x^0x65b7a0
   566  	for s := 0; s < 5; s++ {
   567  		t18.Square(t18)
   568  	}
   569  
   570  	// Step 42: t17 = x^0x65b7ab
   571  	t17.Mul(t17, t18)
   572  
   573  	// Step 50: t17 = x^0x65b7ab00
   574  	for s := 0; s < 8; s++ {
   575  		t17.Square(t17)
   576  	}
   577  
   578  	// Step 51: t17 = x^0x65b7ab09
   579  	t17.Mul(t6, t17)
   580  
   581  	// Step 58: t17 = x^0x32dbd58480
   582  	for s := 0; s < 7; s++ {
   583  		t17.Square(t17)
   584  	}
   585  
   586  	// Step 59: t16 = x^0x32dbd58495
   587  	t16.Mul(t16, t17)
   588  
   589  	// Step 67: t16 = x^0x32dbd5849500
   590  	for s := 0; s < 8; s++ {
   591  		t16.Square(t16)
   592  	}
   593  
   594  	// Step 68: t16 = x^0x32dbd584953b
   595  	t16.Mul(t8, t16)
   596  
   597  	// Step 75: t16 = x^0x196deac24a9d80
   598  	for s := 0; s < 7; s++ {
   599  		t16.Square(t16)
   600  	}
   601  
   602  	// Step 76: t15 = x^0x196deac24a9da1
   603  	t15.Mul(t15, t16)
   604  
   605  	// Step 84: t15 = x^0x196deac24a9da100
   606  	for s := 0; s < 8; s++ {
   607  		t15.Square(t15)
   608  	}
   609  
   610  	// Step 85: t14 = x^0x196deac24a9da12b
   611  	t14.Mul(t14, t15)
   612  
   613  	// Step 91: t14 = x^0x65b7ab092a7684ac0
   614  	for s := 0; s < 6; s++ {
   615  		t14.Square(t14)
   616  	}
   617  
   618  	// Step 92: t14 = x^0x65b7ab092a7684ac9
   619  	t14.Mul(t6, t14)
   620  
   621  	// Step 100: t14 = x^0x65b7ab092a7684ac900
   622  	for s := 0; s < 8; s++ {
   623  		t14.Square(t14)
   624  	}
   625  
   626  	// Step 101: t14 = x^0x65b7ab092a7684ac97f
   627  	t14.Mul(t0, t14)
   628  
   629  	// Step 110: t14 = x^0xcb6f561254ed09592fe00
   630  	for s := 0; s < 9; s++ {
   631  		t14.Square(t14)
   632  	}
   633  
   634  	// Step 111: t13 = x^0xcb6f561254ed09592fe3f
   635  	t13.Mul(t13, t14)
   636  
   637  	// Step 117: t13 = x^0x32dbd584953b42564bf8fc0
   638  	for s := 0; s < 6; s++ {
   639  		t13.Square(t13)
   640  	}
   641  
   642  	// Step 118: t13 = x^0x32dbd584953b42564bf8fd9
   643  	t13.Mul(t9, t13)
   644  
   645  	// Step 126: t13 = x^0x32dbd584953b42564bf8fd900
   646  	for s := 0; s < 8; s++ {
   647  		t13.Square(t13)
   648  	}
   649  
   650  	// Step 127: t13 = x^0x32dbd584953b42564bf8fd939
   651  	t13.Mul(t7, t13)
   652  
   653  	// Step 131: t13 = x^0x32dbd584953b42564bf8fd9390
   654  	for s := 0; s < 4; s++ {
   655  		t13.Square(t13)
   656  	}
   657  
   658  	// Step 132: t12 = x^0x32dbd584953b42564bf8fd939f
   659  	t12.Mul(t12, t13)
   660  
   661  	// Step 138: t12 = x^0xcb6f561254ed09592fe3f64e7c0
   662  	for s := 0; s < 6; s++ {
   663  		t12.Square(t12)
   664  	}
   665  
   666  	// Step 139: t12 = x^0xcb6f561254ed09592fe3f64e7c9
   667  	t12.Mul(t6, t12)
   668  
   669  	// Step 147: t12 = x^0xcb6f561254ed09592fe3f64e7c900
   670  	for s := 0; s < 8; s++ {
   671  		t12.Square(t12)
   672  	}
   673  
   674  	// Step 148: t11 = x^0xcb6f561254ed09592fe3f64e7c93d
   675  	t11.Mul(t11, t12)
   676  
   677  	// Step 154: t11 = x^0x32dbd584953b42564bf8fd939f24f40
   678  	for s := 0; s < 6; s++ {
   679  		t11.Square(t11)
   680  	}
   681  
   682  	// Step 155: t10 = x^0x32dbd584953b42564bf8fd939f24f53
   683  	t10.Mul(t10, t11)
   684  
   685  	// Step 163: t10 = x^0x32dbd584953b42564bf8fd939f24f5300
   686  	for s := 0; s < 8; s++ {
   687  		t10.Square(t10)
   688  	}
   689  
   690  	// Step 164: t9 = x^0x32dbd584953b42564bf8fd939f24f5319
   691  	t9.Mul(t9, t10)
   692  
   693  	// Step 173: t9 = x^0x65b7ab092a7684ac97f1fb273e49ea63200
   694  	for s := 0; s < 9; s++ {
   695  		t9.Square(t9)
   696  	}
   697  
   698  	// Step 174: t9 = x^0x65b7ab092a7684ac97f1fb273e49ea63231
   699  	t9.Mul(t1, t9)
   700  
   701  	// Step 177: t9 = x^0x32dbd584953b42564bf8fd939f24f5319188
   702  	for s := 0; s < 3; s++ {
   703  		t9.Square(t9)
   704  	}
   705  
   706  	// Step 178: t9 = x^0x32dbd584953b42564bf8fd939f24f5319189
   707  	t9.Mul(&x, t9)
   708  
   709  	// Step 191: t9 = x^0x65b7ab092a7684ac97f1fb273e49ea632312000
   710  	for s := 0; s < 13; s++ {
   711  		t9.Square(t9)
   712  	}
   713  
   714  	// Step 192: t8 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b
   715  	t8.Mul(t8, t9)
   716  
   717  	// Step 200: t8 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b00
   718  	for s := 0; s < 8; s++ {
   719  		t8.Square(t8)
   720  	}
   721  
   722  	// Step 201: t7 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b39
   723  	t7.Mul(t7, t8)
   724  
   725  	// Step 205: t7 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b390
   726  	for s := 0; s < 4; s++ {
   727  		t7.Square(t7)
   728  	}
   729  
   730  	// Step 206: t6 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b399
   731  	t6.Mul(t6, t7)
   732  
   733  	// Step 215: t6 = x^0xcb6f561254ed09592fe3f64e7c93d4c6462407673200
   734  	for s := 0; s < 9; s++ {
   735  		t6.Square(t6)
   736  	}
   737  
   738  	// Step 216: t5 = x^0xcb6f561254ed09592fe3f64e7c93d4c6462407673227
   739  	t5.Mul(t5, t6)
   740  
   741  	// Step 224: t5 = x^0xcb6f561254ed09592fe3f64e7c93d4c646240767322700
   742  	for s := 0; s < 8; s++ {
   743  		t5.Square(t5)
   744  	}
   745  
   746  	// Step 225: t4 = x^0xcb6f561254ed09592fe3f64e7c93d4c64624076732271b
   747  	t4.Mul(t4, t5)
   748  
   749  	// Step 228: t4 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b399138d8
   750  	for s := 0; s < 3; s++ {
   751  		t4.Square(t4)
   752  	}
   753  
   754  	// Step 229: t4 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b399138d9
   755  	t4.Mul(&x, t4)
   756  
   757  	// Step 240: t4 = x^0x32dbd584953b42564bf8fd939f24f531918901d9cc89c6c800
   758  	for s := 0; s < 11; s++ {
   759  		t4.Square(t4)
   760  	}
   761  
   762  	// Step 241: t3 = x^0x32dbd584953b42564bf8fd939f24f531918901d9cc89c6c833
   763  	t3.Mul(t3, t4)
   764  
   765  	// Step 244: t3 = x^0x196deac24a9da12b25fc7ec9cf927a98c8c480ece644e364198
   766  	for s := 0; s < 3; s++ {
   767  		t3.Square(t3)
   768  	}
   769  
   770  	// Step 245: t2 = x^0x196deac24a9da12b25fc7ec9cf927a98c8c480ece644e36419d
   771  	t2.Mul(t2, t3)
   772  
   773  	// Step 255: t2 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b399138d9067400
   774  	for s := 0; s < 10; s++ {
   775  		t2.Square(t2)
   776  	}
   777  
   778  	// Step 256: t1 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b399138d9067431
   779  	t1.Mul(t1, t2)
   780  
   781  	// Step 264: t1 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b399138d906743100
   782  	for s := 0; s < 8; s++ {
   783  		t1.Square(t1)
   784  	}
   785  
   786  	// Step 265: t0 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b399138d90674317f
   787  	t0.Mul(t0, t1)
   788  
   789  	// Step 267: t0 = x^0x196deac24a9da12b25fc7ec9cf927a98c8c480ece644e36419d0c5fc
   790  	for s := 0; s < 2; s++ {
   791  		t0.Square(t0)
   792  	}
   793  
   794  	// Step 268: t0 = x^0x196deac24a9da12b25fc7ec9cf927a98c8c480ece644e36419d0c5fd
   795  	t0.Mul(&x, t0)
   796  
   797  	// Step 278: t0 = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b399138d90674317f400
   798  	for s := 0; s < 10; s++ {
   799  		t0.Square(t0)
   800  	}
   801  
   802  	// Step 279: z = x^0x65b7ab092a7684ac97f1fb273e49ea63231203b399138d90674317f403
   803  	z.Mul(z, t0)
   804  
   805  	// Step 300: z = x^0xcb6f561254ed09592fe3f64e7c93d4c64624076732271b20ce862fe80600000
   806  	for s := 0; s < 21; s++ {
   807  		z.Square(z)
   808  	}
   809  
   810  	return z
   811  }