github.com/consensys/gnark-crypto@v0.14.0/ecc/bn254/fp/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 fp
    18  
    19  // expBySqrtExp is equivalent to z.Exp(x, c19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f52)
    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  	//	_110     = 1 + _101
    29  	//	_111     = 1 + _110
    30  	//	_1011    = _101 + _110
    31  	//	_1100    = 1 + _1011
    32  	//	_1101    = 1 + _1100
    33  	//	_1111    = _10 + _1101
    34  	//	_10001   = _10 + _1111
    35  	//	_10011   = _10 + _10001
    36  	//	_10111   = _110 + _10001
    37  	//	_11001   = _10 + _10111
    38  	//	_11011   = _10 + _11001
    39  	//	_11111   = _110 + _11001
    40  	//	_100011  = _1100 + _10111
    41  	//	_100111  = _1100 + _11011
    42  	//	_101001  = _10 + _100111
    43  	//	_101011  = _10 + _101001
    44  	//	_101101  = _10 + _101011
    45  	//	_111001  = _1100 + _101101
    46  	//	_1100000 = _100111 + _111001
    47  	//	i46      = ((_1100000 << 5 + _11001) << 9 + _100111) << 8
    48  	//	i62      = ((_111001 + i46) << 4 + _111) << 9 + _10011
    49  	//	i89      = ((i62 << 7 + _1101) << 13 + _101001) << 5
    50  	//	i109     = ((_10111 + i89) << 7 + _101) << 10 + _10001
    51  	//	i130     = ((i109 << 6 + _11011) << 5 + _1101) << 8
    52  	//	i154     = ((_11 + i130) << 12 + _101011) << 9 + _10111
    53  	//	i179     = ((i154 << 6 + _11001) << 5 + _1111) << 12
    54  	//	i198     = ((_101101 + i179) << 7 + _101001) << 9 + _101101
    55  	//	i220     = ((i198 << 7 + _111) << 9 + _111001) << 4
    56  	//	i236     = ((_101 + i220) << 7 + _1101) << 6 + _1111
    57  	//	i265     = ((i236 << 5 + 1) << 11 + _100011) << 11
    58  	//	i281     = ((_101101 + i265) << 4 + _1011) << 9 + _11111
    59  	//	i299     = (i281 << 8 + _110 + _111001) << 7 + _101001
    60  	//	return     2*i299
    61  	//
    62  	// Operations: 246 squares 54 multiplies
    63  
    64  	// Allocate Temporaries.
    65  	var (
    66  		t0  = new(Element)
    67  		t1  = new(Element)
    68  		t2  = new(Element)
    69  		t3  = new(Element)
    70  		t4  = new(Element)
    71  		t5  = new(Element)
    72  		t6  = new(Element)
    73  		t7  = new(Element)
    74  		t8  = new(Element)
    75  		t9  = new(Element)
    76  		t10 = new(Element)
    77  		t11 = new(Element)
    78  		t12 = new(Element)
    79  		t13 = new(Element)
    80  		t14 = new(Element)
    81  		t15 = new(Element)
    82  		t16 = new(Element)
    83  		t17 = new(Element)
    84  		t18 = new(Element)
    85  	)
    86  
    87  	// var t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18 Element
    88  	// Step 1: t4 = x^0x2
    89  	t4.Square(&x)
    90  
    91  	// Step 2: t13 = x^0x3
    92  	t13.Mul(&x, t4)
    93  
    94  	// Step 3: t8 = x^0x5
    95  	t8.Mul(t4, t13)
    96  
    97  	// Step 4: t1 = x^0x6
    98  	t1.Mul(&x, t8)
    99  
   100  	// Step 5: t9 = x^0x7
   101  	t9.Mul(&x, t1)
   102  
   103  	// Step 6: t3 = x^0xb
   104  	t3.Mul(t8, t1)
   105  
   106  	// Step 7: t0 = x^0xc
   107  	t0.Mul(&x, t3)
   108  
   109  	// Step 8: t7 = x^0xd
   110  	t7.Mul(&x, t0)
   111  
   112  	// Step 9: t6 = x^0xf
   113  	t6.Mul(t4, t7)
   114  
   115  	// Step 10: t15 = x^0x11
   116  	t15.Mul(t4, t6)
   117  
   118  	// Step 11: t16 = x^0x13
   119  	t16.Mul(t4, t15)
   120  
   121  	// Step 12: t11 = x^0x17
   122  	t11.Mul(t1, t15)
   123  
   124  	// Step 13: t10 = x^0x19
   125  	t10.Mul(t4, t11)
   126  
   127  	// Step 14: t14 = x^0x1b
   128  	t14.Mul(t4, t10)
   129  
   130  	// Step 15: t2 = x^0x1f
   131  	t2.Mul(t1, t10)
   132  
   133  	// Step 16: t5 = x^0x23
   134  	t5.Mul(t0, t11)
   135  
   136  	// Step 17: t17 = x^0x27
   137  	t17.Mul(t0, t14)
   138  
   139  	// Step 18: z = x^0x29
   140  	z.Mul(t4, t17)
   141  
   142  	// Step 19: t12 = x^0x2b
   143  	t12.Mul(t4, z)
   144  
   145  	// Step 20: t4 = x^0x2d
   146  	t4.Mul(t4, t12)
   147  
   148  	// Step 21: t0 = x^0x39
   149  	t0.Mul(t0, t4)
   150  
   151  	// Step 22: t18 = x^0x60
   152  	t18.Mul(t17, t0)
   153  
   154  	// Step 27: t18 = x^0xc00
   155  	for s := 0; s < 5; s++ {
   156  		t18.Square(t18)
   157  	}
   158  
   159  	// Step 28: t18 = x^0xc19
   160  	t18.Mul(t10, t18)
   161  
   162  	// Step 37: t18 = x^0x183200
   163  	for s := 0; s < 9; s++ {
   164  		t18.Square(t18)
   165  	}
   166  
   167  	// Step 38: t17 = x^0x183227
   168  	t17.Mul(t17, t18)
   169  
   170  	// Step 46: t17 = x^0x18322700
   171  	for s := 0; s < 8; s++ {
   172  		t17.Square(t17)
   173  	}
   174  
   175  	// Step 47: t17 = x^0x18322739
   176  	t17.Mul(t0, t17)
   177  
   178  	// Step 51: t17 = x^0x183227390
   179  	for s := 0; s < 4; s++ {
   180  		t17.Square(t17)
   181  	}
   182  
   183  	// Step 52: t17 = x^0x183227397
   184  	t17.Mul(t9, t17)
   185  
   186  	// Step 61: t17 = x^0x30644e72e00
   187  	for s := 0; s < 9; s++ {
   188  		t17.Square(t17)
   189  	}
   190  
   191  	// Step 62: t16 = x^0x30644e72e13
   192  	t16.Mul(t16, t17)
   193  
   194  	// Step 69: t16 = x^0x1832273970980
   195  	for s := 0; s < 7; s++ {
   196  		t16.Square(t16)
   197  	}
   198  
   199  	// Step 70: t16 = x^0x183227397098d
   200  	t16.Mul(t7, t16)
   201  
   202  	// Step 83: t16 = x^0x30644e72e131a000
   203  	for s := 0; s < 13; s++ {
   204  		t16.Square(t16)
   205  	}
   206  
   207  	// Step 84: t16 = x^0x30644e72e131a029
   208  	t16.Mul(z, t16)
   209  
   210  	// Step 89: t16 = x^0x60c89ce5c26340520
   211  	for s := 0; s < 5; s++ {
   212  		t16.Square(t16)
   213  	}
   214  
   215  	// Step 90: t16 = x^0x60c89ce5c26340537
   216  	t16.Mul(t11, t16)
   217  
   218  	// Step 97: t16 = x^0x30644e72e131a029b80
   219  	for s := 0; s < 7; s++ {
   220  		t16.Square(t16)
   221  	}
   222  
   223  	// Step 98: t16 = x^0x30644e72e131a029b85
   224  	t16.Mul(t8, t16)
   225  
   226  	// Step 108: t16 = x^0xc19139cb84c680a6e1400
   227  	for s := 0; s < 10; s++ {
   228  		t16.Square(t16)
   229  	}
   230  
   231  	// Step 109: t15 = x^0xc19139cb84c680a6e1411
   232  	t15.Mul(t15, t16)
   233  
   234  	// Step 115: t15 = x^0x30644e72e131a029b850440
   235  	for s := 0; s < 6; s++ {
   236  		t15.Square(t15)
   237  	}
   238  
   239  	// Step 116: t14 = x^0x30644e72e131a029b85045b
   240  	t14.Mul(t14, t15)
   241  
   242  	// Step 121: t14 = x^0x60c89ce5c263405370a08b60
   243  	for s := 0; s < 5; s++ {
   244  		t14.Square(t14)
   245  	}
   246  
   247  	// Step 122: t14 = x^0x60c89ce5c263405370a08b6d
   248  	t14.Mul(t7, t14)
   249  
   250  	// Step 130: t14 = x^0x60c89ce5c263405370a08b6d00
   251  	for s := 0; s < 8; s++ {
   252  		t14.Square(t14)
   253  	}
   254  
   255  	// Step 131: t13 = x^0x60c89ce5c263405370a08b6d03
   256  	t13.Mul(t13, t14)
   257  
   258  	// Step 143: t13 = x^0x60c89ce5c263405370a08b6d03000
   259  	for s := 0; s < 12; s++ {
   260  		t13.Square(t13)
   261  	}
   262  
   263  	// Step 144: t12 = x^0x60c89ce5c263405370a08b6d0302b
   264  	t12.Mul(t12, t13)
   265  
   266  	// Step 153: t12 = x^0xc19139cb84c680a6e14116da0605600
   267  	for s := 0; s < 9; s++ {
   268  		t12.Square(t12)
   269  	}
   270  
   271  	// Step 154: t11 = x^0xc19139cb84c680a6e14116da0605617
   272  	t11.Mul(t11, t12)
   273  
   274  	// Step 160: t11 = x^0x30644e72e131a029b85045b68181585c0
   275  	for s := 0; s < 6; s++ {
   276  		t11.Square(t11)
   277  	}
   278  
   279  	// Step 161: t10 = x^0x30644e72e131a029b85045b68181585d9
   280  	t10.Mul(t10, t11)
   281  
   282  	// Step 166: t10 = x^0x60c89ce5c263405370a08b6d0302b0bb20
   283  	for s := 0; s < 5; s++ {
   284  		t10.Square(t10)
   285  	}
   286  
   287  	// Step 167: t10 = x^0x60c89ce5c263405370a08b6d0302b0bb2f
   288  	t10.Mul(t6, t10)
   289  
   290  	// Step 179: t10 = x^0x60c89ce5c263405370a08b6d0302b0bb2f000
   291  	for s := 0; s < 12; s++ {
   292  		t10.Square(t10)
   293  	}
   294  
   295  	// Step 180: t10 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d
   296  	t10.Mul(t4, t10)
   297  
   298  	// Step 187: t10 = x^0x30644e72e131a029b85045b68181585d9781680
   299  	for s := 0; s < 7; s++ {
   300  		t10.Square(t10)
   301  	}
   302  
   303  	// Step 188: t10 = x^0x30644e72e131a029b85045b68181585d97816a9
   304  	t10.Mul(z, t10)
   305  
   306  	// Step 197: t10 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d5200
   307  	for s := 0; s < 9; s++ {
   308  		t10.Square(t10)
   309  	}
   310  
   311  	// Step 198: t10 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d
   312  	t10.Mul(t4, t10)
   313  
   314  	// Step 205: t10 = x^0x30644e72e131a029b85045b68181585d97816a91680
   315  	for s := 0; s < 7; s++ {
   316  		t10.Square(t10)
   317  	}
   318  
   319  	// Step 206: t9 = x^0x30644e72e131a029b85045b68181585d97816a91687
   320  	t9.Mul(t9, t10)
   321  
   322  	// Step 215: t9 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d0e00
   323  	for s := 0; s < 9; s++ {
   324  		t9.Square(t9)
   325  	}
   326  
   327  	// Step 216: t9 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d0e39
   328  	t9.Mul(t0, t9)
   329  
   330  	// Step 220: t9 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d0e390
   331  	for s := 0; s < 4; s++ {
   332  		t9.Square(t9)
   333  	}
   334  
   335  	// Step 221: t8 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d0e395
   336  	t8.Mul(t8, t9)
   337  
   338  	// Step 228: t8 = x^0x30644e72e131a029b85045b68181585d97816a916871ca80
   339  	for s := 0; s < 7; s++ {
   340  		t8.Square(t8)
   341  	}
   342  
   343  	// Step 229: t7 = x^0x30644e72e131a029b85045b68181585d97816a916871ca8d
   344  	t7.Mul(t7, t8)
   345  
   346  	// Step 235: t7 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a340
   347  	for s := 0; s < 6; s++ {
   348  		t7.Square(t7)
   349  	}
   350  
   351  	// Step 236: t6 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f
   352  	t6.Mul(t6, t7)
   353  
   354  	// Step 241: t6 = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e0
   355  	for s := 0; s < 5; s++ {
   356  		t6.Square(t6)
   357  	}
   358  
   359  	// Step 242: t6 = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e1
   360  	t6.Mul(&x, t6)
   361  
   362  	// Step 253: t6 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f0800
   363  	for s := 0; s < 11; s++ {
   364  		t6.Square(t6)
   365  	}
   366  
   367  	// Step 254: t5 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f0823
   368  	t5.Mul(t5, t6)
   369  
   370  	// Step 265: t5 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d0e3951a78411800
   371  	for s := 0; s < 11; s++ {
   372  		t5.Square(t5)
   373  	}
   374  
   375  	// Step 266: t4 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d0e3951a7841182d
   376  	t4.Mul(t4, t5)
   377  
   378  	// Step 270: t4 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d0e3951a7841182d0
   379  	for s := 0; s < 4; s++ {
   380  		t4.Square(t4)
   381  	}
   382  
   383  	// Step 271: t3 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d0e3951a7841182db
   384  	t3.Mul(t3, t4)
   385  
   386  	// Step 280: t3 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b600
   387  	for s := 0; s < 9; s++ {
   388  		t3.Square(t3)
   389  	}
   390  
   391  	// Step 281: t2 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f
   392  	t2.Mul(t2, t3)
   393  
   394  	// Step 289: t2 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f00
   395  	for s := 0; s < 8; s++ {
   396  		t2.Square(t2)
   397  	}
   398  
   399  	// Step 290: t1 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f06
   400  	t1.Mul(t1, t2)
   401  
   402  	// Step 291: t0 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f
   403  	t0.Mul(t0, t1)
   404  
   405  	// Step 298: t0 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d0e3951a7841182db0f9f80
   406  	for s := 0; s < 7; s++ {
   407  		t0.Square(t0)
   408  	}
   409  
   410  	// Step 299: z = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d0e3951a7841182db0f9fa9
   411  	z.Mul(z, t0)
   412  
   413  	// Step 300: z = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f52
   414  	z.Square(z)
   415  
   416  	return z
   417  }
   418  
   419  // expByLegendreExp is equivalent to z.Exp(x, 183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7ea3)
   420  //
   421  // uses github.com/mmcloughlin/addchain v0.4.0 to generate a shorter addition chain
   422  func (z *Element) expByLegendreExp(x Element) *Element {
   423  	// addition chain:
   424  	//
   425  	//	_10       = 2*1
   426  	//	_11       = 1 + _10
   427  	//	_101      = _10 + _11
   428  	//	_110      = 1 + _101
   429  	//	_1000     = _10 + _110
   430  	//	_1101     = _101 + _1000
   431  	//	_10010    = _101 + _1101
   432  	//	_10011    = 1 + _10010
   433  	//	_10100    = 1 + _10011
   434  	//	_10111    = _11 + _10100
   435  	//	_11100    = _101 + _10111
   436  	//	_100000   = _1101 + _10011
   437  	//	_100011   = _11 + _100000
   438  	//	_101011   = _1000 + _100011
   439  	//	_101111   = _10011 + _11100
   440  	//	_1000001  = _10010 + _101111
   441  	//	_1010011  = _10010 + _1000001
   442  	//	_1011011  = _1000 + _1010011
   443  	//	_1100001  = _110 + _1011011
   444  	//	_1110101  = _10100 + _1100001
   445  	//	_10010001 = _11100 + _1110101
   446  	//	_10010101 = _100000 + _1110101
   447  	//	_10110101 = _100000 + _10010101
   448  	//	_10111011 = _110 + _10110101
   449  	//	_11000001 = _110 + _10111011
   450  	//	_11000011 = _10 + _11000001
   451  	//	_11010011 = _10010 + _11000001
   452  	//	_11100001 = _100000 + _11000001
   453  	//	_11100011 = _10 + _11100001
   454  	//	_11100111 = _110 + _11100001
   455  	//	i57       = ((_11000001 << 8 + _10010001) << 10 + _11100111) << 7
   456  	//	i76       = ((_10111 + i57) << 9 + _10011) << 7 + _1101
   457  	//	i109      = ((i76 << 14 + _1010011) << 9 + _11100001) << 8
   458  	//	i127      = ((_1000001 + i109) << 10 + _1011011) << 5 + _1101
   459  	//	i161      = ((i127 << 8 + _11) << 12 + _101011) << 12
   460  	//	i186      = ((_10111011 + i161) << 8 + _101111) << 14 + _10110101
   461  	//	i214      = ((i186 << 9 + _10010001) << 5 + _1101) << 12
   462  	//	i236      = ((_11100011 + i214) << 8 + _10010101) << 11 + _11010011
   463  	//	i268      = ((i236 << 7 + _1100001) << 11 + _100011) << 12
   464  	//	i288      = ((_1011011 + i268) << 9 + _11000011) << 8 + _11100111
   465  	//	return      (i288 << 7 + _1110101) << 5 + _11
   466  	//
   467  	// Operations: 246 squares 56 multiplies
   468  
   469  	// Allocate Temporaries.
   470  	var (
   471  		t0  = new(Element)
   472  		t1  = new(Element)
   473  		t2  = new(Element)
   474  		t3  = new(Element)
   475  		t4  = new(Element)
   476  		t5  = new(Element)
   477  		t6  = new(Element)
   478  		t7  = new(Element)
   479  		t8  = new(Element)
   480  		t9  = new(Element)
   481  		t10 = new(Element)
   482  		t11 = new(Element)
   483  		t12 = new(Element)
   484  		t13 = new(Element)
   485  		t14 = new(Element)
   486  		t15 = new(Element)
   487  		t16 = new(Element)
   488  		t17 = new(Element)
   489  		t18 = new(Element)
   490  		t19 = new(Element)
   491  		t20 = new(Element)
   492  	)
   493  
   494  	// var t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20 Element
   495  	// Step 1: t8 = x^0x2
   496  	t8.Square(&x)
   497  
   498  	// Step 2: z = x^0x3
   499  	z.Mul(&x, t8)
   500  
   501  	// Step 3: t2 = x^0x5
   502  	t2.Mul(t8, z)
   503  
   504  	// Step 4: t1 = x^0x6
   505  	t1.Mul(&x, t2)
   506  
   507  	// Step 5: t3 = x^0x8
   508  	t3.Mul(t8, t1)
   509  
   510  	// Step 6: t9 = x^0xd
   511  	t9.Mul(t2, t3)
   512  
   513  	// Step 7: t6 = x^0x12
   514  	t6.Mul(t2, t9)
   515  
   516  	// Step 8: t18 = x^0x13
   517  	t18.Mul(&x, t6)
   518  
   519  	// Step 9: t0 = x^0x14
   520  	t0.Mul(&x, t18)
   521  
   522  	// Step 10: t19 = x^0x17
   523  	t19.Mul(z, t0)
   524  
   525  	// Step 11: t2 = x^0x1c
   526  	t2.Mul(t2, t19)
   527  
   528  	// Step 12: t16 = x^0x20
   529  	t16.Mul(t9, t18)
   530  
   531  	// Step 13: t4 = x^0x23
   532  	t4.Mul(z, t16)
   533  
   534  	// Step 14: t14 = x^0x2b
   535  	t14.Mul(t3, t4)
   536  
   537  	// Step 15: t12 = x^0x2f
   538  	t12.Mul(t18, t2)
   539  
   540  	// Step 16: t15 = x^0x41
   541  	t15.Mul(t6, t12)
   542  
   543  	// Step 17: t17 = x^0x53
   544  	t17.Mul(t6, t15)
   545  
   546  	// Step 18: t3 = x^0x5b
   547  	t3.Mul(t3, t17)
   548  
   549  	// Step 19: t5 = x^0x61
   550  	t5.Mul(t1, t3)
   551  
   552  	// Step 20: t0 = x^0x75
   553  	t0.Mul(t0, t5)
   554  
   555  	// Step 21: t10 = x^0x91
   556  	t10.Mul(t2, t0)
   557  
   558  	// Step 22: t7 = x^0x95
   559  	t7.Mul(t16, t0)
   560  
   561  	// Step 23: t11 = x^0xb5
   562  	t11.Mul(t16, t7)
   563  
   564  	// Step 24: t13 = x^0xbb
   565  	t13.Mul(t1, t11)
   566  
   567  	// Step 25: t20 = x^0xc1
   568  	t20.Mul(t1, t13)
   569  
   570  	// Step 26: t2 = x^0xc3
   571  	t2.Mul(t8, t20)
   572  
   573  	// Step 27: t6 = x^0xd3
   574  	t6.Mul(t6, t20)
   575  
   576  	// Step 28: t16 = x^0xe1
   577  	t16.Mul(t16, t20)
   578  
   579  	// Step 29: t8 = x^0xe3
   580  	t8.Mul(t8, t16)
   581  
   582  	// Step 30: t1 = x^0xe7
   583  	t1.Mul(t1, t16)
   584  
   585  	// Step 38: t20 = x^0xc100
   586  	for s := 0; s < 8; s++ {
   587  		t20.Square(t20)
   588  	}
   589  
   590  	// Step 39: t20 = x^0xc191
   591  	t20.Mul(t10, t20)
   592  
   593  	// Step 49: t20 = x^0x3064400
   594  	for s := 0; s < 10; s++ {
   595  		t20.Square(t20)
   596  	}
   597  
   598  	// Step 50: t20 = x^0x30644e7
   599  	t20.Mul(t1, t20)
   600  
   601  	// Step 57: t20 = x^0x183227380
   602  	for s := 0; s < 7; s++ {
   603  		t20.Square(t20)
   604  	}
   605  
   606  	// Step 58: t19 = x^0x183227397
   607  	t19.Mul(t19, t20)
   608  
   609  	// Step 67: t19 = x^0x30644e72e00
   610  	for s := 0; s < 9; s++ {
   611  		t19.Square(t19)
   612  	}
   613  
   614  	// Step 68: t18 = x^0x30644e72e13
   615  	t18.Mul(t18, t19)
   616  
   617  	// Step 75: t18 = x^0x1832273970980
   618  	for s := 0; s < 7; s++ {
   619  		t18.Square(t18)
   620  	}
   621  
   622  	// Step 76: t18 = x^0x183227397098d
   623  	t18.Mul(t9, t18)
   624  
   625  	// Step 90: t18 = x^0x60c89ce5c2634000
   626  	for s := 0; s < 14; s++ {
   627  		t18.Square(t18)
   628  	}
   629  
   630  	// Step 91: t17 = x^0x60c89ce5c2634053
   631  	t17.Mul(t17, t18)
   632  
   633  	// Step 100: t17 = x^0xc19139cb84c680a600
   634  	for s := 0; s < 9; s++ {
   635  		t17.Square(t17)
   636  	}
   637  
   638  	// Step 101: t16 = x^0xc19139cb84c680a6e1
   639  	t16.Mul(t16, t17)
   640  
   641  	// Step 109: t16 = x^0xc19139cb84c680a6e100
   642  	for s := 0; s < 8; s++ {
   643  		t16.Square(t16)
   644  	}
   645  
   646  	// Step 110: t15 = x^0xc19139cb84c680a6e141
   647  	t15.Mul(t15, t16)
   648  
   649  	// Step 120: t15 = x^0x30644e72e131a029b850400
   650  	for s := 0; s < 10; s++ {
   651  		t15.Square(t15)
   652  	}
   653  
   654  	// Step 121: t15 = x^0x30644e72e131a029b85045b
   655  	t15.Mul(t3, t15)
   656  
   657  	// Step 126: t15 = x^0x60c89ce5c263405370a08b60
   658  	for s := 0; s < 5; s++ {
   659  		t15.Square(t15)
   660  	}
   661  
   662  	// Step 127: t15 = x^0x60c89ce5c263405370a08b6d
   663  	t15.Mul(t9, t15)
   664  
   665  	// Step 135: t15 = x^0x60c89ce5c263405370a08b6d00
   666  	for s := 0; s < 8; s++ {
   667  		t15.Square(t15)
   668  	}
   669  
   670  	// Step 136: t15 = x^0x60c89ce5c263405370a08b6d03
   671  	t15.Mul(z, t15)
   672  
   673  	// Step 148: t15 = x^0x60c89ce5c263405370a08b6d03000
   674  	for s := 0; s < 12; s++ {
   675  		t15.Square(t15)
   676  	}
   677  
   678  	// Step 149: t14 = x^0x60c89ce5c263405370a08b6d0302b
   679  	t14.Mul(t14, t15)
   680  
   681  	// Step 161: t14 = x^0x60c89ce5c263405370a08b6d0302b000
   682  	for s := 0; s < 12; s++ {
   683  		t14.Square(t14)
   684  	}
   685  
   686  	// Step 162: t13 = x^0x60c89ce5c263405370a08b6d0302b0bb
   687  	t13.Mul(t13, t14)
   688  
   689  	// Step 170: t13 = x^0x60c89ce5c263405370a08b6d0302b0bb00
   690  	for s := 0; s < 8; s++ {
   691  		t13.Square(t13)
   692  	}
   693  
   694  	// Step 171: t12 = x^0x60c89ce5c263405370a08b6d0302b0bb2f
   695  	t12.Mul(t12, t13)
   696  
   697  	// Step 185: t12 = x^0x183227397098d014dc2822db40c0ac2ecbc000
   698  	for s := 0; s < 14; s++ {
   699  		t12.Square(t12)
   700  	}
   701  
   702  	// Step 186: t11 = x^0x183227397098d014dc2822db40c0ac2ecbc0b5
   703  	t11.Mul(t11, t12)
   704  
   705  	// Step 195: t11 = x^0x30644e72e131a029b85045b68181585d97816a00
   706  	for s := 0; s < 9; s++ {
   707  		t11.Square(t11)
   708  	}
   709  
   710  	// Step 196: t10 = x^0x30644e72e131a029b85045b68181585d97816a91
   711  	t10.Mul(t10, t11)
   712  
   713  	// Step 201: t10 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d5220
   714  	for s := 0; s < 5; s++ {
   715  		t10.Square(t10)
   716  	}
   717  
   718  	// Step 202: t9 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d
   719  	t9.Mul(t9, t10)
   720  
   721  	// Step 214: t9 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d000
   722  	for s := 0; s < 12; s++ {
   723  		t9.Square(t9)
   724  	}
   725  
   726  	// Step 215: t8 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d0e3
   727  	t8.Mul(t8, t9)
   728  
   729  	// Step 223: t8 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d0e300
   730  	for s := 0; s < 8; s++ {
   731  		t8.Square(t8)
   732  	}
   733  
   734  	// Step 224: t7 = x^0x60c89ce5c263405370a08b6d0302b0bb2f02d522d0e395
   735  	t7.Mul(t7, t8)
   736  
   737  	// Step 235: t7 = x^0x30644e72e131a029b85045b68181585d97816a916871ca800
   738  	for s := 0; s < 11; s++ {
   739  		t7.Square(t7)
   740  	}
   741  
   742  	// Step 236: t6 = x^0x30644e72e131a029b85045b68181585d97816a916871ca8d3
   743  	t6.Mul(t6, t7)
   744  
   745  	// Step 243: t6 = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e546980
   746  	for s := 0; s < 7; s++ {
   747  		t6.Square(t6)
   748  	}
   749  
   750  	// Step 244: t5 = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e1
   751  	t5.Mul(t5, t6)
   752  
   753  	// Step 255: t5 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f0800
   754  	for s := 0; s < 11; s++ {
   755  		t5.Square(t5)
   756  	}
   757  
   758  	// Step 256: t4 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f0823
   759  	t4.Mul(t4, t5)
   760  
   761  	// Step 268: t4 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f0823000
   762  	for s := 0; s < 12; s++ {
   763  		t4.Square(t4)
   764  	}
   765  
   766  	// Step 269: t3 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b
   767  	t3.Mul(t3, t4)
   768  
   769  	// Step 278: t3 = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b600
   770  	for s := 0; s < 9; s++ {
   771  		t3.Square(t3)
   772  	}
   773  
   774  	// Step 279: t2 = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3
   775  	t2.Mul(t2, t3)
   776  
   777  	// Step 287: t2 = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c300
   778  	for s := 0; s < 8; s++ {
   779  		t2.Square(t2)
   780  	}
   781  
   782  	// Step 288: t1 = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7
   783  	t1.Mul(t1, t2)
   784  
   785  	// Step 295: t1 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f380
   786  	for s := 0; s < 7; s++ {
   787  		t1.Square(t1)
   788  	}
   789  
   790  	// Step 296: t0 = x^0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f5
   791  	t0.Mul(t0, t1)
   792  
   793  	// Step 301: t0 = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7ea0
   794  	for s := 0; s < 5; s++ {
   795  		t0.Square(t0)
   796  	}
   797  
   798  	// Step 302: z = x^0x183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7ea3
   799  	z.Mul(z, t0)
   800  
   801  	return z
   802  }