github.com/consensys/gnark-crypto@v0.14.0/ecc/bls12-381/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, 39f6d3a994cebea4199cec0404d0ec02a9ded2017fff2dff7fffffff)
    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  	//	_110      = _10 + _100
    28  	//	_1100     = 2*_110
    29  	//	_10010    = _110 + _1100
    30  	//	_10011    = 1 + _10010
    31  	//	_10110    = _100 + _10010
    32  	//	_11000    = _10 + _10110
    33  	//	_11010    = _10 + _11000
    34  	//	_100010   = _1100 + _10110
    35  	//	_110101   = _10011 + _100010
    36  	//	_111011   = _110 + _110101
    37  	//	_1001011  = _10110 + _110101
    38  	//	_1001101  = _10 + _1001011
    39  	//	_1010101  = _11010 + _111011
    40  	//	_1100111  = _10010 + _1010101
    41  	//	_1101001  = _10 + _1100111
    42  	//	_10000011 = _11010 + _1101001
    43  	//	_10011001 = _10110 + _10000011
    44  	//	_10011101 = _100 + _10011001
    45  	//	_10111111 = _100010 + _10011101
    46  	//	_11010111 = _11000 + _10111111
    47  	//	_11011011 = _100 + _11010111
    48  	//	_11100111 = _1100 + _11011011
    49  	//	_11101111 = _11000 + _11010111
    50  	//	_11111111 = _11000 + _11100111
    51  	//	i54       = ((_11100111 << 8 + _11011011) << 9 + _10011101) << 9
    52  	//	i74       = ((_10011001 + i54) << 9 + _10011001) << 8 + _11010111
    53  	//	i101      = ((i74 << 6 + _110101) << 10 + _10000011) << 9
    54  	//	i120      = ((_1100111 + i101) << 8 + _111011) << 8 + 1
    55  	//	i161      = ((i120 << 14 + _1001101) << 10 + _111011) << 15
    56  	//	i182      = ((_1010101 + i161) << 10 + _11101111) << 8 + _1101001
    57  	//	i215      = ((i182 << 16 + _10111111) << 8 + _11111111) << 7
    58  	//	i235      = ((_1001011 + i215) << 9 + _11111111) << 8 + _10111111
    59  	//	i261      = ((i235 << 8 + _11111111) << 8 + _11111111) << 8
    60  	//	return      2*(_11111111 + i261) + 1
    61  	//
    62  	// Operations: 217 squares 47 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  	)
    82  
    83  	// var t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14 Element
    84  	// Step 1: t2 = x^0x2
    85  	t2.Square(&x)
    86  
    87  	// Step 2: t13 = x^0x4
    88  	t13.Square(t2)
    89  
    90  	// Step 3: t1 = x^0x6
    91  	t1.Mul(t2, t13)
    92  
    93  	// Step 4: t3 = x^0xc
    94  	t3.Square(t1)
    95  
    96  	// Step 5: t7 = x^0x12
    97  	t7.Mul(t1, t3)
    98  
    99  	// Step 6: t4 = x^0x13
   100  	t4.Mul(&x, t7)
   101  
   102  	// Step 7: t10 = x^0x16
   103  	t10.Mul(t13, t7)
   104  
   105  	// Step 8: z = x^0x18
   106  	z.Mul(t2, t10)
   107  
   108  	// Step 9: t8 = x^0x1a
   109  	t8.Mul(t2, z)
   110  
   111  	// Step 10: t0 = x^0x22
   112  	t0.Mul(t3, t10)
   113  
   114  	// Step 11: t9 = x^0x35
   115  	t9.Mul(t4, t0)
   116  
   117  	// Step 12: t5 = x^0x3b
   118  	t5.Mul(t1, t9)
   119  
   120  	// Step 13: t1 = x^0x4b
   121  	t1.Mul(t10, t9)
   122  
   123  	// Step 14: t6 = x^0x4d
   124  	t6.Mul(t2, t1)
   125  
   126  	// Step 15: t4 = x^0x55
   127  	t4.Mul(t8, t5)
   128  
   129  	// Step 16: t7 = x^0x67
   130  	t7.Mul(t7, t4)
   131  
   132  	// Step 17: t2 = x^0x69
   133  	t2.Mul(t2, t7)
   134  
   135  	// Step 18: t8 = x^0x83
   136  	t8.Mul(t8, t2)
   137  
   138  	// Step 19: t11 = x^0x99
   139  	t11.Mul(t10, t8)
   140  
   141  	// Step 20: t12 = x^0x9d
   142  	t12.Mul(t13, t11)
   143  
   144  	// Step 21: t0 = x^0xbf
   145  	t0.Mul(t0, t12)
   146  
   147  	// Step 22: t10 = x^0xd7
   148  	t10.Mul(z, t0)
   149  
   150  	// Step 23: t13 = x^0xdb
   151  	t13.Mul(t13, t10)
   152  
   153  	// Step 24: t14 = x^0xe7
   154  	t14.Mul(t3, t13)
   155  
   156  	// Step 25: t3 = x^0xef
   157  	t3.Mul(z, t10)
   158  
   159  	// Step 26: z = x^0xff
   160  	z.Mul(z, t14)
   161  
   162  	// Step 34: t14 = x^0xe700
   163  	for s := 0; s < 8; s++ {
   164  		t14.Square(t14)
   165  	}
   166  
   167  	// Step 35: t13 = x^0xe7db
   168  	t13.Mul(t13, t14)
   169  
   170  	// Step 44: t13 = x^0x1cfb600
   171  	for s := 0; s < 9; s++ {
   172  		t13.Square(t13)
   173  	}
   174  
   175  	// Step 45: t12 = x^0x1cfb69d
   176  	t12.Mul(t12, t13)
   177  
   178  	// Step 54: t12 = x^0x39f6d3a00
   179  	for s := 0; s < 9; s++ {
   180  		t12.Square(t12)
   181  	}
   182  
   183  	// Step 55: t12 = x^0x39f6d3a99
   184  	t12.Mul(t11, t12)
   185  
   186  	// Step 64: t12 = x^0x73eda753200
   187  	for s := 0; s < 9; s++ {
   188  		t12.Square(t12)
   189  	}
   190  
   191  	// Step 65: t11 = x^0x73eda753299
   192  	t11.Mul(t11, t12)
   193  
   194  	// Step 73: t11 = x^0x73eda75329900
   195  	for s := 0; s < 8; s++ {
   196  		t11.Square(t11)
   197  	}
   198  
   199  	// Step 74: t10 = x^0x73eda753299d7
   200  	t10.Mul(t10, t11)
   201  
   202  	// Step 80: t10 = x^0x1cfb69d4ca675c0
   203  	for s := 0; s < 6; s++ {
   204  		t10.Square(t10)
   205  	}
   206  
   207  	// Step 81: t9 = x^0x1cfb69d4ca675f5
   208  	t9.Mul(t9, t10)
   209  
   210  	// Step 91: t9 = x^0x73eda753299d7d400
   211  	for s := 0; s < 10; s++ {
   212  		t9.Square(t9)
   213  	}
   214  
   215  	// Step 92: t8 = x^0x73eda753299d7d483
   216  	t8.Mul(t8, t9)
   217  
   218  	// Step 101: t8 = x^0xe7db4ea6533afa90600
   219  	for s := 0; s < 9; s++ {
   220  		t8.Square(t8)
   221  	}
   222  
   223  	// Step 102: t7 = x^0xe7db4ea6533afa90667
   224  	t7.Mul(t7, t8)
   225  
   226  	// Step 110: t7 = x^0xe7db4ea6533afa9066700
   227  	for s := 0; s < 8; s++ {
   228  		t7.Square(t7)
   229  	}
   230  
   231  	// Step 111: t7 = x^0xe7db4ea6533afa906673b
   232  	t7.Mul(t5, t7)
   233  
   234  	// Step 119: t7 = x^0xe7db4ea6533afa906673b00
   235  	for s := 0; s < 8; s++ {
   236  		t7.Square(t7)
   237  	}
   238  
   239  	// Step 120: t7 = x^0xe7db4ea6533afa906673b01
   240  	t7.Mul(&x, t7)
   241  
   242  	// Step 134: t7 = x^0x39f6d3a994cebea4199cec04000
   243  	for s := 0; s < 14; s++ {
   244  		t7.Square(t7)
   245  	}
   246  
   247  	// Step 135: t6 = x^0x39f6d3a994cebea4199cec0404d
   248  	t6.Mul(t6, t7)
   249  
   250  	// Step 145: t6 = x^0xe7db4ea6533afa906673b01013400
   251  	for s := 0; s < 10; s++ {
   252  		t6.Square(t6)
   253  	}
   254  
   255  	// Step 146: t5 = x^0xe7db4ea6533afa906673b0101343b
   256  	t5.Mul(t5, t6)
   257  
   258  	// Step 161: t5 = x^0x73eda753299d7d483339d80809a1d8000
   259  	for s := 0; s < 15; s++ {
   260  		t5.Square(t5)
   261  	}
   262  
   263  	// Step 162: t4 = x^0x73eda753299d7d483339d80809a1d8055
   264  	t4.Mul(t4, t5)
   265  
   266  	// Step 172: t4 = x^0x1cfb69d4ca675f520cce7602026876015400
   267  	for s := 0; s < 10; s++ {
   268  		t4.Square(t4)
   269  	}
   270  
   271  	// Step 173: t3 = x^0x1cfb69d4ca675f520cce76020268760154ef
   272  	t3.Mul(t3, t4)
   273  
   274  	// Step 181: t3 = x^0x1cfb69d4ca675f520cce76020268760154ef00
   275  	for s := 0; s < 8; s++ {
   276  		t3.Square(t3)
   277  	}
   278  
   279  	// Step 182: t2 = x^0x1cfb69d4ca675f520cce76020268760154ef69
   280  	t2.Mul(t2, t3)
   281  
   282  	// Step 198: t2 = x^0x1cfb69d4ca675f520cce76020268760154ef690000
   283  	for s := 0; s < 16; s++ {
   284  		t2.Square(t2)
   285  	}
   286  
   287  	// Step 199: t2 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bf
   288  	t2.Mul(t0, t2)
   289  
   290  	// Step 207: t2 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bf00
   291  	for s := 0; s < 8; s++ {
   292  		t2.Square(t2)
   293  	}
   294  
   295  	// Step 208: t2 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff
   296  	t2.Mul(z, t2)
   297  
   298  	// Step 215: t2 = x^0xe7db4ea6533afa906673b0101343b00aa77b4805fff80
   299  	for s := 0; s < 7; s++ {
   300  		t2.Square(t2)
   301  	}
   302  
   303  	// Step 216: t1 = x^0xe7db4ea6533afa906673b0101343b00aa77b4805fffcb
   304  	t1.Mul(t1, t2)
   305  
   306  	// Step 225: t1 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff9600
   307  	for s := 0; s < 9; s++ {
   308  		t1.Square(t1)
   309  	}
   310  
   311  	// Step 226: t1 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ff
   312  	t1.Mul(z, t1)
   313  
   314  	// Step 234: t1 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ff00
   315  	for s := 0; s < 8; s++ {
   316  		t1.Square(t1)
   317  	}
   318  
   319  	// Step 235: t0 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbf
   320  	t0.Mul(t0, t1)
   321  
   322  	// Step 243: t0 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbf00
   323  	for s := 0; s < 8; s++ {
   324  		t0.Square(t0)
   325  	}
   326  
   327  	// Step 244: t0 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbfff
   328  	t0.Mul(z, t0)
   329  
   330  	// Step 252: t0 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbfff00
   331  	for s := 0; s < 8; s++ {
   332  		t0.Square(t0)
   333  	}
   334  
   335  	// Step 253: t0 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbfffff
   336  	t0.Mul(z, t0)
   337  
   338  	// Step 261: t0 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbfffff00
   339  	for s := 0; s < 8; s++ {
   340  		t0.Square(t0)
   341  	}
   342  
   343  	// Step 262: z = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbfffffff
   344  	z.Mul(z, t0)
   345  
   346  	// Step 263: z = x^0x39f6d3a994cebea4199cec0404d0ec02a9ded2017fff2dff7ffffffe
   347  	z.Square(z)
   348  
   349  	// Step 264: z = x^0x39f6d3a994cebea4199cec0404d0ec02a9ded2017fff2dff7fffffff
   350  	z.Mul(&x, z)
   351  
   352  	return z
   353  }
   354  
   355  // expByLegendreExp is equivalent to z.Exp(x, 39f6d3a994cebea4199cec0404d0ec02a9ded2017fff2dff7fffffff80000000)
   356  //
   357  // uses github.com/mmcloughlin/addchain v0.4.0 to generate a shorter addition chain
   358  func (z *Element) expByLegendreExp(x Element) *Element {
   359  	// addition chain:
   360  	//
   361  	//	_10       = 2*1
   362  	//	_11       = 1 + _10
   363  	//	_100      = 1 + _11
   364  	//	_110      = _10 + _100
   365  	//	_1100     = 2*_110
   366  	//	_10010    = _110 + _1100
   367  	//	_10011    = 1 + _10010
   368  	//	_10110    = _11 + _10011
   369  	//	_11000    = _10 + _10110
   370  	//	_11010    = _10 + _11000
   371  	//	_100010   = _1100 + _10110
   372  	//	_110101   = _10011 + _100010
   373  	//	_111011   = _110 + _110101
   374  	//	_1001011  = _10110 + _110101
   375  	//	_1001101  = _10 + _1001011
   376  	//	_1010101  = _11010 + _111011
   377  	//	_1100111  = _10010 + _1010101
   378  	//	_1101001  = _10 + _1100111
   379  	//	_10000011 = _11010 + _1101001
   380  	//	_10011001 = _10110 + _10000011
   381  	//	_10011101 = _100 + _10011001
   382  	//	_10111111 = _100010 + _10011101
   383  	//	_11010111 = _11000 + _10111111
   384  	//	_11011011 = _100 + _11010111
   385  	//	_11100111 = _1100 + _11011011
   386  	//	_11101111 = _11000 + _11010111
   387  	//	_11111111 = _11000 + _11100111
   388  	//	i55       = ((_11100111 << 8 + _11011011) << 9 + _10011101) << 9
   389  	//	i75       = ((_10011001 + i55) << 9 + _10011001) << 8 + _11010111
   390  	//	i102      = ((i75 << 6 + _110101) << 10 + _10000011) << 9
   391  	//	i121      = ((_1100111 + i102) << 8 + _111011) << 8 + 1
   392  	//	i162      = ((i121 << 14 + _1001101) << 10 + _111011) << 15
   393  	//	i183      = ((_1010101 + i162) << 10 + _11101111) << 8 + _1101001
   394  	//	i216      = ((i183 << 16 + _10111111) << 8 + _11111111) << 7
   395  	//	i236      = ((_1001011 + i216) << 9 + _11111111) << 8 + _10111111
   396  	//	i262      = ((i236 << 8 + _11111111) << 8 + _11111111) << 8
   397  	//	return      ((_11111111 + i262) << 2 + _11) << 31
   398  	//
   399  	// Operations: 248 squares 49 multiplies
   400  
   401  	// Allocate Temporaries.
   402  	var (
   403  		t0  = new(Element)
   404  		t1  = new(Element)
   405  		t2  = new(Element)
   406  		t3  = new(Element)
   407  		t4  = new(Element)
   408  		t5  = new(Element)
   409  		t6  = new(Element)
   410  		t7  = new(Element)
   411  		t8  = new(Element)
   412  		t9  = new(Element)
   413  		t10 = new(Element)
   414  		t11 = new(Element)
   415  		t12 = new(Element)
   416  		t13 = new(Element)
   417  		t14 = new(Element)
   418  		t15 = new(Element)
   419  	)
   420  
   421  	// var t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15 Element
   422  	// Step 1: t3 = x^0x2
   423  	t3.Square(&x)
   424  
   425  	// Step 2: z = x^0x3
   426  	z.Mul(&x, t3)
   427  
   428  	// Step 3: t14 = x^0x4
   429  	t14.Mul(&x, z)
   430  
   431  	// Step 4: t2 = x^0x6
   432  	t2.Mul(t3, t14)
   433  
   434  	// Step 5: t4 = x^0xc
   435  	t4.Square(t2)
   436  
   437  	// Step 6: t8 = x^0x12
   438  	t8.Mul(t2, t4)
   439  
   440  	// Step 7: t5 = x^0x13
   441  	t5.Mul(&x, t8)
   442  
   443  	// Step 8: t11 = x^0x16
   444  	t11.Mul(z, t5)
   445  
   446  	// Step 9: t0 = x^0x18
   447  	t0.Mul(t3, t11)
   448  
   449  	// Step 10: t9 = x^0x1a
   450  	t9.Mul(t3, t0)
   451  
   452  	// Step 11: t1 = x^0x22
   453  	t1.Mul(t4, t11)
   454  
   455  	// Step 12: t10 = x^0x35
   456  	t10.Mul(t5, t1)
   457  
   458  	// Step 13: t6 = x^0x3b
   459  	t6.Mul(t2, t10)
   460  
   461  	// Step 14: t2 = x^0x4b
   462  	t2.Mul(t11, t10)
   463  
   464  	// Step 15: t7 = x^0x4d
   465  	t7.Mul(t3, t2)
   466  
   467  	// Step 16: t5 = x^0x55
   468  	t5.Mul(t9, t6)
   469  
   470  	// Step 17: t8 = x^0x67
   471  	t8.Mul(t8, t5)
   472  
   473  	// Step 18: t3 = x^0x69
   474  	t3.Mul(t3, t8)
   475  
   476  	// Step 19: t9 = x^0x83
   477  	t9.Mul(t9, t3)
   478  
   479  	// Step 20: t12 = x^0x99
   480  	t12.Mul(t11, t9)
   481  
   482  	// Step 21: t13 = x^0x9d
   483  	t13.Mul(t14, t12)
   484  
   485  	// Step 22: t1 = x^0xbf
   486  	t1.Mul(t1, t13)
   487  
   488  	// Step 23: t11 = x^0xd7
   489  	t11.Mul(t0, t1)
   490  
   491  	// Step 24: t14 = x^0xdb
   492  	t14.Mul(t14, t11)
   493  
   494  	// Step 25: t15 = x^0xe7
   495  	t15.Mul(t4, t14)
   496  
   497  	// Step 26: t4 = x^0xef
   498  	t4.Mul(t0, t11)
   499  
   500  	// Step 27: t0 = x^0xff
   501  	t0.Mul(t0, t15)
   502  
   503  	// Step 35: t15 = x^0xe700
   504  	for s := 0; s < 8; s++ {
   505  		t15.Square(t15)
   506  	}
   507  
   508  	// Step 36: t14 = x^0xe7db
   509  	t14.Mul(t14, t15)
   510  
   511  	// Step 45: t14 = x^0x1cfb600
   512  	for s := 0; s < 9; s++ {
   513  		t14.Square(t14)
   514  	}
   515  
   516  	// Step 46: t13 = x^0x1cfb69d
   517  	t13.Mul(t13, t14)
   518  
   519  	// Step 55: t13 = x^0x39f6d3a00
   520  	for s := 0; s < 9; s++ {
   521  		t13.Square(t13)
   522  	}
   523  
   524  	// Step 56: t13 = x^0x39f6d3a99
   525  	t13.Mul(t12, t13)
   526  
   527  	// Step 65: t13 = x^0x73eda753200
   528  	for s := 0; s < 9; s++ {
   529  		t13.Square(t13)
   530  	}
   531  
   532  	// Step 66: t12 = x^0x73eda753299
   533  	t12.Mul(t12, t13)
   534  
   535  	// Step 74: t12 = x^0x73eda75329900
   536  	for s := 0; s < 8; s++ {
   537  		t12.Square(t12)
   538  	}
   539  
   540  	// Step 75: t11 = x^0x73eda753299d7
   541  	t11.Mul(t11, t12)
   542  
   543  	// Step 81: t11 = x^0x1cfb69d4ca675c0
   544  	for s := 0; s < 6; s++ {
   545  		t11.Square(t11)
   546  	}
   547  
   548  	// Step 82: t10 = x^0x1cfb69d4ca675f5
   549  	t10.Mul(t10, t11)
   550  
   551  	// Step 92: t10 = x^0x73eda753299d7d400
   552  	for s := 0; s < 10; s++ {
   553  		t10.Square(t10)
   554  	}
   555  
   556  	// Step 93: t9 = x^0x73eda753299d7d483
   557  	t9.Mul(t9, t10)
   558  
   559  	// Step 102: t9 = x^0xe7db4ea6533afa90600
   560  	for s := 0; s < 9; s++ {
   561  		t9.Square(t9)
   562  	}
   563  
   564  	// Step 103: t8 = x^0xe7db4ea6533afa90667
   565  	t8.Mul(t8, t9)
   566  
   567  	// Step 111: t8 = x^0xe7db4ea6533afa9066700
   568  	for s := 0; s < 8; s++ {
   569  		t8.Square(t8)
   570  	}
   571  
   572  	// Step 112: t8 = x^0xe7db4ea6533afa906673b
   573  	t8.Mul(t6, t8)
   574  
   575  	// Step 120: t8 = x^0xe7db4ea6533afa906673b00
   576  	for s := 0; s < 8; s++ {
   577  		t8.Square(t8)
   578  	}
   579  
   580  	// Step 121: t8 = x^0xe7db4ea6533afa906673b01
   581  	t8.Mul(&x, t8)
   582  
   583  	// Step 135: t8 = x^0x39f6d3a994cebea4199cec04000
   584  	for s := 0; s < 14; s++ {
   585  		t8.Square(t8)
   586  	}
   587  
   588  	// Step 136: t7 = x^0x39f6d3a994cebea4199cec0404d
   589  	t7.Mul(t7, t8)
   590  
   591  	// Step 146: t7 = x^0xe7db4ea6533afa906673b01013400
   592  	for s := 0; s < 10; s++ {
   593  		t7.Square(t7)
   594  	}
   595  
   596  	// Step 147: t6 = x^0xe7db4ea6533afa906673b0101343b
   597  	t6.Mul(t6, t7)
   598  
   599  	// Step 162: t6 = x^0x73eda753299d7d483339d80809a1d8000
   600  	for s := 0; s < 15; s++ {
   601  		t6.Square(t6)
   602  	}
   603  
   604  	// Step 163: t5 = x^0x73eda753299d7d483339d80809a1d8055
   605  	t5.Mul(t5, t6)
   606  
   607  	// Step 173: t5 = x^0x1cfb69d4ca675f520cce7602026876015400
   608  	for s := 0; s < 10; s++ {
   609  		t5.Square(t5)
   610  	}
   611  
   612  	// Step 174: t4 = x^0x1cfb69d4ca675f520cce76020268760154ef
   613  	t4.Mul(t4, t5)
   614  
   615  	// Step 182: t4 = x^0x1cfb69d4ca675f520cce76020268760154ef00
   616  	for s := 0; s < 8; s++ {
   617  		t4.Square(t4)
   618  	}
   619  
   620  	// Step 183: t3 = x^0x1cfb69d4ca675f520cce76020268760154ef69
   621  	t3.Mul(t3, t4)
   622  
   623  	// Step 199: t3 = x^0x1cfb69d4ca675f520cce76020268760154ef690000
   624  	for s := 0; s < 16; s++ {
   625  		t3.Square(t3)
   626  	}
   627  
   628  	// Step 200: t3 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bf
   629  	t3.Mul(t1, t3)
   630  
   631  	// Step 208: t3 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bf00
   632  	for s := 0; s < 8; s++ {
   633  		t3.Square(t3)
   634  	}
   635  
   636  	// Step 209: t3 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff
   637  	t3.Mul(t0, t3)
   638  
   639  	// Step 216: t3 = x^0xe7db4ea6533afa906673b0101343b00aa77b4805fff80
   640  	for s := 0; s < 7; s++ {
   641  		t3.Square(t3)
   642  	}
   643  
   644  	// Step 217: t2 = x^0xe7db4ea6533afa906673b0101343b00aa77b4805fffcb
   645  	t2.Mul(t2, t3)
   646  
   647  	// Step 226: t2 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff9600
   648  	for s := 0; s < 9; s++ {
   649  		t2.Square(t2)
   650  	}
   651  
   652  	// Step 227: t2 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ff
   653  	t2.Mul(t0, t2)
   654  
   655  	// Step 235: t2 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ff00
   656  	for s := 0; s < 8; s++ {
   657  		t2.Square(t2)
   658  	}
   659  
   660  	// Step 236: t1 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbf
   661  	t1.Mul(t1, t2)
   662  
   663  	// Step 244: t1 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbf00
   664  	for s := 0; s < 8; s++ {
   665  		t1.Square(t1)
   666  	}
   667  
   668  	// Step 245: t1 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbfff
   669  	t1.Mul(t0, t1)
   670  
   671  	// Step 253: t1 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbfff00
   672  	for s := 0; s < 8; s++ {
   673  		t1.Square(t1)
   674  	}
   675  
   676  	// Step 254: t1 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbfffff
   677  	t1.Mul(t0, t1)
   678  
   679  	// Step 262: t1 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbfffff00
   680  	for s := 0; s < 8; s++ {
   681  		t1.Square(t1)
   682  	}
   683  
   684  	// Step 263: t0 = x^0x1cfb69d4ca675f520cce76020268760154ef6900bfff96ffbfffffff
   685  	t0.Mul(t0, t1)
   686  
   687  	// Step 265: t0 = x^0x73eda753299d7d483339d80809a1d80553bda402fffe5bfefffffffc
   688  	for s := 0; s < 2; s++ {
   689  		t0.Square(t0)
   690  	}
   691  
   692  	// Step 266: z = x^0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff
   693  	z.Mul(z, t0)
   694  
   695  	// Step 297: z = x^0x39f6d3a994cebea4199cec0404d0ec02a9ded2017fff2dff7fffffff80000000
   696  	for s := 0; s < 31; s++ {
   697  		z.Square(z)
   698  	}
   699  
   700  	return z
   701  }