github.com/consensys/gnark-crypto@v0.14.0/ecc/bn254/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, 183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f0fac9f)
    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  	//	_11    = 1 + _10
    27  	//	_101   = _10 + _11
    28  	//	_111   = _10 + _101
    29  	//	_1001  = _10 + _111
    30  	//	_1011  = _10 + _1001
    31  	//	_1101  = _10 + _1011
    32  	//	_1111  = _10 + _1101
    33  	//	_11000 = _1001 + _1111
    34  	//	_11111 = _111 + _11000
    35  	//	i26    = ((_11000 << 4 + _11) << 3 + 1) << 7
    36  	//	i36    = ((_1001 + i26) << 2 + _11) << 5 + _111
    37  	//	i53    = (2*(i36 << 6 + _1011) + 1) << 8
    38  	//	i64    = (2*(_1001 + i53) + 1) << 7 + _1101
    39  	//	i84    = ((i64 << 10 + _101) << 6 + _1101) << 2
    40  	//	i100   = ((_11 + i84) << 7 + _101) << 6 + 1
    41  	//	i117   = ((i100 << 7 + _1011) << 5 + _1101) << 3
    42  	//	i137   = ((_101 + i117) << 8 + _11) << 9 + _101
    43  	//	i153   = ((i137 << 3 + _11) << 8 + _1011) << 3
    44  	//	i168   = ((_101 + i153) << 5 + _101) << 7 + _11
    45  	//	i187   = ((i168 << 7 + _11111) << 2 + 1) << 8
    46  	//	i204   = ((_1001 + i187) << 8 + _1111) << 6 + _1101
    47  	//	i215   = 2*((i204 << 2 + _11) << 6 + _1011)
    48  	//	i232   = ((1 + i215) << 8 + _1001) << 6 + _101
    49  	//	i257   = ((i232 << 9 + _11111) << 9 + _11111) << 5
    50  	//	return   ((_1011 + i257) << 3 + 1) << 7 + _11111
    51  	//
    52  	// Operations: 221 squares 49 multiplies
    53  
    54  	// Allocate Temporaries.
    55  	var (
    56  		t0 = new(Element)
    57  		t1 = new(Element)
    58  		t2 = new(Element)
    59  		t3 = new(Element)
    60  		t4 = new(Element)
    61  		t5 = new(Element)
    62  		t6 = new(Element)
    63  		t7 = new(Element)
    64  	)
    65  
    66  	// var t0,t1,t2,t3,t4,t5,t6,t7 Element
    67  	// Step 1: z = x^0x2
    68  	z.Square(&x)
    69  
    70  	// Step 2: t3 = x^0x3
    71  	t3.Mul(&x, z)
    72  
    73  	// Step 3: t1 = x^0x5
    74  	t1.Mul(z, t3)
    75  
    76  	// Step 4: t6 = x^0x7
    77  	t6.Mul(z, t1)
    78  
    79  	// Step 5: t2 = x^0x9
    80  	t2.Mul(z, t6)
    81  
    82  	// Step 6: t0 = x^0xb
    83  	t0.Mul(z, t2)
    84  
    85  	// Step 7: t4 = x^0xd
    86  	t4.Mul(z, t0)
    87  
    88  	// Step 8: t5 = x^0xf
    89  	t5.Mul(z, t4)
    90  
    91  	// Step 9: t7 = x^0x18
    92  	t7.Mul(t2, t5)
    93  
    94  	// Step 10: z = x^0x1f
    95  	z.Mul(t6, t7)
    96  
    97  	// Step 14: t7 = x^0x180
    98  	for s := 0; s < 4; s++ {
    99  		t7.Square(t7)
   100  	}
   101  
   102  	// Step 15: t7 = x^0x183
   103  	t7.Mul(t3, t7)
   104  
   105  	// Step 18: t7 = x^0xc18
   106  	for s := 0; s < 3; s++ {
   107  		t7.Square(t7)
   108  	}
   109  
   110  	// Step 19: t7 = x^0xc19
   111  	t7.Mul(&x, t7)
   112  
   113  	// Step 26: t7 = x^0x60c80
   114  	for s := 0; s < 7; s++ {
   115  		t7.Square(t7)
   116  	}
   117  
   118  	// Step 27: t7 = x^0x60c89
   119  	t7.Mul(t2, t7)
   120  
   121  	// Step 29: t7 = x^0x183224
   122  	for s := 0; s < 2; s++ {
   123  		t7.Square(t7)
   124  	}
   125  
   126  	// Step 30: t7 = x^0x183227
   127  	t7.Mul(t3, t7)
   128  
   129  	// Step 35: t7 = x^0x30644e0
   130  	for s := 0; s < 5; s++ {
   131  		t7.Square(t7)
   132  	}
   133  
   134  	// Step 36: t6 = x^0x30644e7
   135  	t6.Mul(t6, t7)
   136  
   137  	// Step 42: t6 = x^0xc19139c0
   138  	for s := 0; s < 6; s++ {
   139  		t6.Square(t6)
   140  	}
   141  
   142  	// Step 43: t6 = x^0xc19139cb
   143  	t6.Mul(t0, t6)
   144  
   145  	// Step 44: t6 = x^0x183227396
   146  	t6.Square(t6)
   147  
   148  	// Step 45: t6 = x^0x183227397
   149  	t6.Mul(&x, t6)
   150  
   151  	// Step 53: t6 = x^0x18322739700
   152  	for s := 0; s < 8; s++ {
   153  		t6.Square(t6)
   154  	}
   155  
   156  	// Step 54: t6 = x^0x18322739709
   157  	t6.Mul(t2, t6)
   158  
   159  	// Step 55: t6 = x^0x30644e72e12
   160  	t6.Square(t6)
   161  
   162  	// Step 56: t6 = x^0x30644e72e13
   163  	t6.Mul(&x, t6)
   164  
   165  	// Step 63: t6 = x^0x1832273970980
   166  	for s := 0; s < 7; s++ {
   167  		t6.Square(t6)
   168  	}
   169  
   170  	// Step 64: t6 = x^0x183227397098d
   171  	t6.Mul(t4, t6)
   172  
   173  	// Step 74: t6 = x^0x60c89ce5c263400
   174  	for s := 0; s < 10; s++ {
   175  		t6.Square(t6)
   176  	}
   177  
   178  	// Step 75: t6 = x^0x60c89ce5c263405
   179  	t6.Mul(t1, t6)
   180  
   181  	// Step 81: t6 = x^0x183227397098d0140
   182  	for s := 0; s < 6; s++ {
   183  		t6.Square(t6)
   184  	}
   185  
   186  	// Step 82: t6 = x^0x183227397098d014d
   187  	t6.Mul(t4, t6)
   188  
   189  	// Step 84: t6 = x^0x60c89ce5c26340534
   190  	for s := 0; s < 2; s++ {
   191  		t6.Square(t6)
   192  	}
   193  
   194  	// Step 85: t6 = x^0x60c89ce5c26340537
   195  	t6.Mul(t3, t6)
   196  
   197  	// Step 92: t6 = x^0x30644e72e131a029b80
   198  	for s := 0; s < 7; s++ {
   199  		t6.Square(t6)
   200  	}
   201  
   202  	// Step 93: t6 = x^0x30644e72e131a029b85
   203  	t6.Mul(t1, t6)
   204  
   205  	// Step 99: t6 = x^0xc19139cb84c680a6e140
   206  	for s := 0; s < 6; s++ {
   207  		t6.Square(t6)
   208  	}
   209  
   210  	// Step 100: t6 = x^0xc19139cb84c680a6e141
   211  	t6.Mul(&x, t6)
   212  
   213  	// Step 107: t6 = x^0x60c89ce5c263405370a080
   214  	for s := 0; s < 7; s++ {
   215  		t6.Square(t6)
   216  	}
   217  
   218  	// Step 108: t6 = x^0x60c89ce5c263405370a08b
   219  	t6.Mul(t0, t6)
   220  
   221  	// Step 113: t6 = x^0xc19139cb84c680a6e141160
   222  	for s := 0; s < 5; s++ {
   223  		t6.Square(t6)
   224  	}
   225  
   226  	// Step 114: t6 = x^0xc19139cb84c680a6e14116d
   227  	t6.Mul(t4, t6)
   228  
   229  	// Step 117: t6 = x^0x60c89ce5c263405370a08b68
   230  	for s := 0; s < 3; s++ {
   231  		t6.Square(t6)
   232  	}
   233  
   234  	// Step 118: t6 = x^0x60c89ce5c263405370a08b6d
   235  	t6.Mul(t1, t6)
   236  
   237  	// Step 126: t6 = x^0x60c89ce5c263405370a08b6d00
   238  	for s := 0; s < 8; s++ {
   239  		t6.Square(t6)
   240  	}
   241  
   242  	// Step 127: t6 = x^0x60c89ce5c263405370a08b6d03
   243  	t6.Mul(t3, t6)
   244  
   245  	// Step 136: t6 = x^0xc19139cb84c680a6e14116da0600
   246  	for s := 0; s < 9; s++ {
   247  		t6.Square(t6)
   248  	}
   249  
   250  	// Step 137: t6 = x^0xc19139cb84c680a6e14116da0605
   251  	t6.Mul(t1, t6)
   252  
   253  	// Step 140: t6 = x^0x60c89ce5c263405370a08b6d03028
   254  	for s := 0; s < 3; s++ {
   255  		t6.Square(t6)
   256  	}
   257  
   258  	// Step 141: t6 = x^0x60c89ce5c263405370a08b6d0302b
   259  	t6.Mul(t3, t6)
   260  
   261  	// Step 149: t6 = x^0x60c89ce5c263405370a08b6d0302b00
   262  	for s := 0; s < 8; s++ {
   263  		t6.Square(t6)
   264  	}
   265  
   266  	// Step 150: t6 = x^0x60c89ce5c263405370a08b6d0302b0b
   267  	t6.Mul(t0, t6)
   268  
   269  	// Step 153: t6 = x^0x30644e72e131a029b85045b681815858
   270  	for s := 0; s < 3; s++ {
   271  		t6.Square(t6)
   272  	}
   273  
   274  	// Step 154: t6 = x^0x30644e72e131a029b85045b68181585d
   275  	t6.Mul(t1, t6)
   276  
   277  	// Step 159: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba0
   278  	for s := 0; s < 5; s++ {
   279  		t6.Square(t6)
   280  	}
   281  
   282  	// Step 160: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5
   283  	t6.Mul(t1, t6)
   284  
   285  	// Step 167: t6 = x^0x30644e72e131a029b85045b68181585d280
   286  	for s := 0; s < 7; s++ {
   287  		t6.Square(t6)
   288  	}
   289  
   290  	// Step 168: t6 = x^0x30644e72e131a029b85045b68181585d283
   291  	t6.Mul(t3, t6)
   292  
   293  	// Step 175: t6 = x^0x183227397098d014dc2822db40c0ac2e94180
   294  	for s := 0; s < 7; s++ {
   295  		t6.Square(t6)
   296  	}
   297  
   298  	// Step 176: t6 = x^0x183227397098d014dc2822db40c0ac2e9419f
   299  	t6.Mul(z, t6)
   300  
   301  	// Step 178: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5067c
   302  	for s := 0; s < 2; s++ {
   303  		t6.Square(t6)
   304  	}
   305  
   306  	// Step 179: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d
   307  	t6.Mul(&x, t6)
   308  
   309  	// Step 187: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d00
   310  	for s := 0; s < 8; s++ {
   311  		t6.Square(t6)
   312  	}
   313  
   314  	// Step 188: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d09
   315  	t6.Mul(t2, t6)
   316  
   317  	// Step 196: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d0900
   318  	for s := 0; s < 8; s++ {
   319  		t6.Square(t6)
   320  	}
   321  
   322  	// Step 197: t5 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d090f
   323  	t5.Mul(t5, t6)
   324  
   325  	// Step 203: t5 = x^0x183227397098d014dc2822db40c0ac2e9419f4243c0
   326  	for s := 0; s < 6; s++ {
   327  		t5.Square(t5)
   328  	}
   329  
   330  	// Step 204: t4 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cd
   331  	t4.Mul(t4, t5)
   332  
   333  	// Step 206: t4 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d090f34
   334  	for s := 0; s < 2; s++ {
   335  		t4.Square(t4)
   336  	}
   337  
   338  	// Step 207: t3 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d090f37
   339  	t3.Mul(t3, t4)
   340  
   341  	// Step 213: t3 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdc0
   342  	for s := 0; s < 6; s++ {
   343  		t3.Square(t3)
   344  	}
   345  
   346  	// Step 214: t3 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdcb
   347  	t3.Mul(t0, t3)
   348  
   349  	// Step 215: t3 = x^0x30644e72e131a029b85045b68181585d2833e84879b96
   350  	t3.Square(t3)
   351  
   352  	// Step 216: t3 = x^0x30644e72e131a029b85045b68181585d2833e84879b97
   353  	t3.Mul(&x, t3)
   354  
   355  	// Step 224: t3 = x^0x30644e72e131a029b85045b68181585d2833e84879b9700
   356  	for s := 0; s < 8; s++ {
   357  		t3.Square(t3)
   358  	}
   359  
   360  	// Step 225: t2 = x^0x30644e72e131a029b85045b68181585d2833e84879b9709
   361  	t2.Mul(t2, t3)
   362  
   363  	// Step 231: t2 = x^0xc19139cb84c680a6e14116da06056174a0cfa121e6e5c240
   364  	for s := 0; s < 6; s++ {
   365  		t2.Square(t2)
   366  	}
   367  
   368  	// Step 232: t1 = x^0xc19139cb84c680a6e14116da06056174a0cfa121e6e5c245
   369  	t1.Mul(t1, t2)
   370  
   371  	// Step 241: t1 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdcb848a00
   372  	for s := 0; s < 9; s++ {
   373  		t1.Square(t1)
   374  	}
   375  
   376  	// Step 242: t1 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f
   377  	t1.Mul(z, t1)
   378  
   379  	// Step 251: t1 = x^0x30644e72e131a029b85045b68181585d2833e84879b9709143e00
   380  	for s := 0; s < 9; s++ {
   381  		t1.Square(t1)
   382  	}
   383  
   384  	// Step 252: t1 = x^0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f
   385  	t1.Mul(z, t1)
   386  
   387  	// Step 257: t1 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d090f372e12287c3e0
   388  	for s := 0; s < 5; s++ {
   389  		t1.Square(t1)
   390  	}
   391  
   392  	// Step 258: t0 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d090f372e12287c3eb
   393  	t0.Mul(t0, t1)
   394  
   395  	// Step 261: t0 = x^0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f58
   396  	for s := 0; s < 3; s++ {
   397  		t0.Square(t0)
   398  	}
   399  
   400  	// Step 262: t0 = x^0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f59
   401  	t0.Mul(&x, t0)
   402  
   403  	// Step 269: t0 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f0fac80
   404  	for s := 0; s < 7; s++ {
   405  		t0.Square(t0)
   406  	}
   407  
   408  	// Step 270: z = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f0fac9f
   409  	z.Mul(z, t0)
   410  
   411  	return z
   412  }
   413  
   414  // expByLegendreExp is equivalent to z.Exp(x, 183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f0fac9f8000000)
   415  //
   416  // uses github.com/mmcloughlin/addchain v0.4.0 to generate a shorter addition chain
   417  func (z *Element) expByLegendreExp(x Element) *Element {
   418  	// addition chain:
   419  	//
   420  	//	_10    = 2*1
   421  	//	_11    = 1 + _10
   422  	//	_101   = _10 + _11
   423  	//	_111   = _10 + _101
   424  	//	_1001  = _10 + _111
   425  	//	_1011  = _10 + _1001
   426  	//	_1101  = _10 + _1011
   427  	//	_1111  = _10 + _1101
   428  	//	_11000 = _1001 + _1111
   429  	//	_11111 = _111 + _11000
   430  	//	i26    = ((_11000 << 4 + _11) << 3 + 1) << 7
   431  	//	i36    = ((_1001 + i26) << 2 + _11) << 5 + _111
   432  	//	i53    = (2*(i36 << 6 + _1011) + 1) << 8
   433  	//	i64    = (2*(_1001 + i53) + 1) << 7 + _1101
   434  	//	i84    = ((i64 << 10 + _101) << 6 + _1101) << 2
   435  	//	i100   = ((_11 + i84) << 7 + _101) << 6 + 1
   436  	//	i117   = ((i100 << 7 + _1011) << 5 + _1101) << 3
   437  	//	i137   = ((_101 + i117) << 8 + _11) << 9 + _101
   438  	//	i153   = ((i137 << 3 + _11) << 8 + _1011) << 3
   439  	//	i168   = ((_101 + i153) << 5 + _101) << 7 + _11
   440  	//	i187   = ((i168 << 7 + _11111) << 2 + 1) << 8
   441  	//	i204   = ((_1001 + i187) << 8 + _1111) << 6 + _1101
   442  	//	i215   = 2*((i204 << 2 + _11) << 6 + _1011)
   443  	//	i232   = ((1 + i215) << 8 + _1001) << 6 + _101
   444  	//	i257   = ((i232 << 9 + _11111) << 9 + _11111) << 5
   445  	//	i270   = ((_1011 + i257) << 3 + 1) << 7 + _11111
   446  	//	return   (2*i270 + 1) << 27
   447  	//
   448  	// Operations: 249 squares 50 multiplies
   449  
   450  	// Allocate Temporaries.
   451  	var (
   452  		t0 = new(Element)
   453  		t1 = new(Element)
   454  		t2 = new(Element)
   455  		t3 = new(Element)
   456  		t4 = new(Element)
   457  		t5 = new(Element)
   458  		t6 = new(Element)
   459  		t7 = new(Element)
   460  	)
   461  
   462  	// var t0,t1,t2,t3,t4,t5,t6,t7 Element
   463  	// Step 1: z = x^0x2
   464  	z.Square(&x)
   465  
   466  	// Step 2: t3 = x^0x3
   467  	t3.Mul(&x, z)
   468  
   469  	// Step 3: t1 = x^0x5
   470  	t1.Mul(z, t3)
   471  
   472  	// Step 4: t6 = x^0x7
   473  	t6.Mul(z, t1)
   474  
   475  	// Step 5: t2 = x^0x9
   476  	t2.Mul(z, t6)
   477  
   478  	// Step 6: t0 = x^0xb
   479  	t0.Mul(z, t2)
   480  
   481  	// Step 7: t4 = x^0xd
   482  	t4.Mul(z, t0)
   483  
   484  	// Step 8: t5 = x^0xf
   485  	t5.Mul(z, t4)
   486  
   487  	// Step 9: t7 = x^0x18
   488  	t7.Mul(t2, t5)
   489  
   490  	// Step 10: z = x^0x1f
   491  	z.Mul(t6, t7)
   492  
   493  	// Step 14: t7 = x^0x180
   494  	for s := 0; s < 4; s++ {
   495  		t7.Square(t7)
   496  	}
   497  
   498  	// Step 15: t7 = x^0x183
   499  	t7.Mul(t3, t7)
   500  
   501  	// Step 18: t7 = x^0xc18
   502  	for s := 0; s < 3; s++ {
   503  		t7.Square(t7)
   504  	}
   505  
   506  	// Step 19: t7 = x^0xc19
   507  	t7.Mul(&x, t7)
   508  
   509  	// Step 26: t7 = x^0x60c80
   510  	for s := 0; s < 7; s++ {
   511  		t7.Square(t7)
   512  	}
   513  
   514  	// Step 27: t7 = x^0x60c89
   515  	t7.Mul(t2, t7)
   516  
   517  	// Step 29: t7 = x^0x183224
   518  	for s := 0; s < 2; s++ {
   519  		t7.Square(t7)
   520  	}
   521  
   522  	// Step 30: t7 = x^0x183227
   523  	t7.Mul(t3, t7)
   524  
   525  	// Step 35: t7 = x^0x30644e0
   526  	for s := 0; s < 5; s++ {
   527  		t7.Square(t7)
   528  	}
   529  
   530  	// Step 36: t6 = x^0x30644e7
   531  	t6.Mul(t6, t7)
   532  
   533  	// Step 42: t6 = x^0xc19139c0
   534  	for s := 0; s < 6; s++ {
   535  		t6.Square(t6)
   536  	}
   537  
   538  	// Step 43: t6 = x^0xc19139cb
   539  	t6.Mul(t0, t6)
   540  
   541  	// Step 44: t6 = x^0x183227396
   542  	t6.Square(t6)
   543  
   544  	// Step 45: t6 = x^0x183227397
   545  	t6.Mul(&x, t6)
   546  
   547  	// Step 53: t6 = x^0x18322739700
   548  	for s := 0; s < 8; s++ {
   549  		t6.Square(t6)
   550  	}
   551  
   552  	// Step 54: t6 = x^0x18322739709
   553  	t6.Mul(t2, t6)
   554  
   555  	// Step 55: t6 = x^0x30644e72e12
   556  	t6.Square(t6)
   557  
   558  	// Step 56: t6 = x^0x30644e72e13
   559  	t6.Mul(&x, t6)
   560  
   561  	// Step 63: t6 = x^0x1832273970980
   562  	for s := 0; s < 7; s++ {
   563  		t6.Square(t6)
   564  	}
   565  
   566  	// Step 64: t6 = x^0x183227397098d
   567  	t6.Mul(t4, t6)
   568  
   569  	// Step 74: t6 = x^0x60c89ce5c263400
   570  	for s := 0; s < 10; s++ {
   571  		t6.Square(t6)
   572  	}
   573  
   574  	// Step 75: t6 = x^0x60c89ce5c263405
   575  	t6.Mul(t1, t6)
   576  
   577  	// Step 81: t6 = x^0x183227397098d0140
   578  	for s := 0; s < 6; s++ {
   579  		t6.Square(t6)
   580  	}
   581  
   582  	// Step 82: t6 = x^0x183227397098d014d
   583  	t6.Mul(t4, t6)
   584  
   585  	// Step 84: t6 = x^0x60c89ce5c26340534
   586  	for s := 0; s < 2; s++ {
   587  		t6.Square(t6)
   588  	}
   589  
   590  	// Step 85: t6 = x^0x60c89ce5c26340537
   591  	t6.Mul(t3, t6)
   592  
   593  	// Step 92: t6 = x^0x30644e72e131a029b80
   594  	for s := 0; s < 7; s++ {
   595  		t6.Square(t6)
   596  	}
   597  
   598  	// Step 93: t6 = x^0x30644e72e131a029b85
   599  	t6.Mul(t1, t6)
   600  
   601  	// Step 99: t6 = x^0xc19139cb84c680a6e140
   602  	for s := 0; s < 6; s++ {
   603  		t6.Square(t6)
   604  	}
   605  
   606  	// Step 100: t6 = x^0xc19139cb84c680a6e141
   607  	t6.Mul(&x, t6)
   608  
   609  	// Step 107: t6 = x^0x60c89ce5c263405370a080
   610  	for s := 0; s < 7; s++ {
   611  		t6.Square(t6)
   612  	}
   613  
   614  	// Step 108: t6 = x^0x60c89ce5c263405370a08b
   615  	t6.Mul(t0, t6)
   616  
   617  	// Step 113: t6 = x^0xc19139cb84c680a6e141160
   618  	for s := 0; s < 5; s++ {
   619  		t6.Square(t6)
   620  	}
   621  
   622  	// Step 114: t6 = x^0xc19139cb84c680a6e14116d
   623  	t6.Mul(t4, t6)
   624  
   625  	// Step 117: t6 = x^0x60c89ce5c263405370a08b68
   626  	for s := 0; s < 3; s++ {
   627  		t6.Square(t6)
   628  	}
   629  
   630  	// Step 118: t6 = x^0x60c89ce5c263405370a08b6d
   631  	t6.Mul(t1, t6)
   632  
   633  	// Step 126: t6 = x^0x60c89ce5c263405370a08b6d00
   634  	for s := 0; s < 8; s++ {
   635  		t6.Square(t6)
   636  	}
   637  
   638  	// Step 127: t6 = x^0x60c89ce5c263405370a08b6d03
   639  	t6.Mul(t3, t6)
   640  
   641  	// Step 136: t6 = x^0xc19139cb84c680a6e14116da0600
   642  	for s := 0; s < 9; s++ {
   643  		t6.Square(t6)
   644  	}
   645  
   646  	// Step 137: t6 = x^0xc19139cb84c680a6e14116da0605
   647  	t6.Mul(t1, t6)
   648  
   649  	// Step 140: t6 = x^0x60c89ce5c263405370a08b6d03028
   650  	for s := 0; s < 3; s++ {
   651  		t6.Square(t6)
   652  	}
   653  
   654  	// Step 141: t6 = x^0x60c89ce5c263405370a08b6d0302b
   655  	t6.Mul(t3, t6)
   656  
   657  	// Step 149: t6 = x^0x60c89ce5c263405370a08b6d0302b00
   658  	for s := 0; s < 8; s++ {
   659  		t6.Square(t6)
   660  	}
   661  
   662  	// Step 150: t6 = x^0x60c89ce5c263405370a08b6d0302b0b
   663  	t6.Mul(t0, t6)
   664  
   665  	// Step 153: t6 = x^0x30644e72e131a029b85045b681815858
   666  	for s := 0; s < 3; s++ {
   667  		t6.Square(t6)
   668  	}
   669  
   670  	// Step 154: t6 = x^0x30644e72e131a029b85045b68181585d
   671  	t6.Mul(t1, t6)
   672  
   673  	// Step 159: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba0
   674  	for s := 0; s < 5; s++ {
   675  		t6.Square(t6)
   676  	}
   677  
   678  	// Step 160: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5
   679  	t6.Mul(t1, t6)
   680  
   681  	// Step 167: t6 = x^0x30644e72e131a029b85045b68181585d280
   682  	for s := 0; s < 7; s++ {
   683  		t6.Square(t6)
   684  	}
   685  
   686  	// Step 168: t6 = x^0x30644e72e131a029b85045b68181585d283
   687  	t6.Mul(t3, t6)
   688  
   689  	// Step 175: t6 = x^0x183227397098d014dc2822db40c0ac2e94180
   690  	for s := 0; s < 7; s++ {
   691  		t6.Square(t6)
   692  	}
   693  
   694  	// Step 176: t6 = x^0x183227397098d014dc2822db40c0ac2e9419f
   695  	t6.Mul(z, t6)
   696  
   697  	// Step 178: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5067c
   698  	for s := 0; s < 2; s++ {
   699  		t6.Square(t6)
   700  	}
   701  
   702  	// Step 179: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d
   703  	t6.Mul(&x, t6)
   704  
   705  	// Step 187: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d00
   706  	for s := 0; s < 8; s++ {
   707  		t6.Square(t6)
   708  	}
   709  
   710  	// Step 188: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d09
   711  	t6.Mul(t2, t6)
   712  
   713  	// Step 196: t6 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d0900
   714  	for s := 0; s < 8; s++ {
   715  		t6.Square(t6)
   716  	}
   717  
   718  	// Step 197: t5 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d090f
   719  	t5.Mul(t5, t6)
   720  
   721  	// Step 203: t5 = x^0x183227397098d014dc2822db40c0ac2e9419f4243c0
   722  	for s := 0; s < 6; s++ {
   723  		t5.Square(t5)
   724  	}
   725  
   726  	// Step 204: t4 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cd
   727  	t4.Mul(t4, t5)
   728  
   729  	// Step 206: t4 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d090f34
   730  	for s := 0; s < 2; s++ {
   731  		t4.Square(t4)
   732  	}
   733  
   734  	// Step 207: t3 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d090f37
   735  	t3.Mul(t3, t4)
   736  
   737  	// Step 213: t3 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdc0
   738  	for s := 0; s < 6; s++ {
   739  		t3.Square(t3)
   740  	}
   741  
   742  	// Step 214: t3 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdcb
   743  	t3.Mul(t0, t3)
   744  
   745  	// Step 215: t3 = x^0x30644e72e131a029b85045b68181585d2833e84879b96
   746  	t3.Square(t3)
   747  
   748  	// Step 216: t3 = x^0x30644e72e131a029b85045b68181585d2833e84879b97
   749  	t3.Mul(&x, t3)
   750  
   751  	// Step 224: t3 = x^0x30644e72e131a029b85045b68181585d2833e84879b9700
   752  	for s := 0; s < 8; s++ {
   753  		t3.Square(t3)
   754  	}
   755  
   756  	// Step 225: t2 = x^0x30644e72e131a029b85045b68181585d2833e84879b9709
   757  	t2.Mul(t2, t3)
   758  
   759  	// Step 231: t2 = x^0xc19139cb84c680a6e14116da06056174a0cfa121e6e5c240
   760  	for s := 0; s < 6; s++ {
   761  		t2.Square(t2)
   762  	}
   763  
   764  	// Step 232: t1 = x^0xc19139cb84c680a6e14116da06056174a0cfa121e6e5c245
   765  	t1.Mul(t1, t2)
   766  
   767  	// Step 241: t1 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdcb848a00
   768  	for s := 0; s < 9; s++ {
   769  		t1.Square(t1)
   770  	}
   771  
   772  	// Step 242: t1 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f
   773  	t1.Mul(z, t1)
   774  
   775  	// Step 251: t1 = x^0x30644e72e131a029b85045b68181585d2833e84879b9709143e00
   776  	for s := 0; s < 9; s++ {
   777  		t1.Square(t1)
   778  	}
   779  
   780  	// Step 252: t1 = x^0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f
   781  	t1.Mul(z, t1)
   782  
   783  	// Step 257: t1 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d090f372e12287c3e0
   784  	for s := 0; s < 5; s++ {
   785  		t1.Square(t1)
   786  	}
   787  
   788  	// Step 258: t0 = x^0x60c89ce5c263405370a08b6d0302b0ba5067d090f372e12287c3eb
   789  	t0.Mul(t0, t1)
   790  
   791  	// Step 261: t0 = x^0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f58
   792  	for s := 0; s < 3; s++ {
   793  		t0.Square(t0)
   794  	}
   795  
   796  	// Step 262: t0 = x^0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f59
   797  	t0.Mul(&x, t0)
   798  
   799  	// Step 269: t0 = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f0fac80
   800  	for s := 0; s < 7; s++ {
   801  		t0.Square(t0)
   802  	}
   803  
   804  	// Step 270: z = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f0fac9f
   805  	z.Mul(z, t0)
   806  
   807  	// Step 271: z = x^0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593e
   808  	z.Square(z)
   809  
   810  	// Step 272: z = x^0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f
   811  	z.Mul(&x, z)
   812  
   813  	// Step 299: z = x^0x183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f0fac9f8000000
   814  	for s := 0; s < 27; s++ {
   815  		z.Square(z)
   816  	}
   817  
   818  	return z
   819  }