-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcircuit.cpp
141 lines (140 loc) · 5.45 KB
/
circuit.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#include "circom.hpp"
#include "calcwit.hpp"
#define NSignals 20
#define NComponents 1
#define NOutputs 1
#define NInputs 9
#define NVars 11
#define NPublic 10
#define __P__ "21888242871839275222246405745257275088548364400416034343698204186575808495617"
/*
operation
k=9
*/
void operation_d6c1bd8047f9cc9b(Circom_CalcWit *ctx, int __cIdx) {
FrElement _sigValue[1];
FrElement _tmp[1];
FrElement _tmp_1[1];
FrElement _tmp_2[1];
FrElement _tmp_3[1];
FrElement temp[1];
FrElement _sigValue_1[1];
FrElement _sigValue_2[1];
FrElement _sigValue_3[1];
FrElement _tmp_4[1];
FrElement _sigValue_4[1];
FrElement _sigValue_5[1];
FrElement _tmp_5[1];
FrElement _sigValue_6[1];
FrElement _sigValue_7[1];
FrElement _tmp_6[1];
FrElement _sigValue_8[1];
FrElement _sigValue_9[1];
FrElement _tmp_7[1];
FrElement _sigValue_10[1];
FrElement _tmp_8[1];
FrElement _sigValue_11[1];
FrElement _tmp_9[1];
FrElement _sigValue_12[1];
FrElement _sigValue_13[1];
int _arr_sigIdx_;
int _offset_1;
int _offset_4;
int _result_sigIdx_;
int _offset_5;
int _offset_6;
int _offset_7;
int _offset_8;
int _offset_9;
int _offset_10;
int _offset_11;
int _offset_12;
int _offset_13;
int _offset_14;
int _offset_15;
int _offset_16;
int _offset_17;
int _offset_18;
int _offset_20;
int _offset_22;
int _offset_24;
int _out_sigIdx_;
Circom_Sizes _sigSizes_arr;
Circom_Sizes _sigSizes_result;
_arr_sigIdx_ = ctx->getSignalOffset(__cIdx, 0xe756b1190570b338LL /* arr */);
_result_sigIdx_ = ctx->getSignalOffset(__cIdx, 0x9b51cd7cd76778c4LL /* result */);
_out_sigIdx_ = ctx->getSignalOffset(__cIdx, 0x19f79b1921bbcfffLL /* out */);
_sigSizes_arr = ctx->getSignalSizes(__cIdx, 0xe756b1190570b338LL /* arr */);
_sigSizes_result = ctx->getSignalSizes(__cIdx, 0x9b51cd7cd76778c4LL /* result */);
/* signal input arr[k] */
/* signal output out */
/* var temp = (((arr[0] + 3) * 5) -6) * 4 */
_offset_1 = _arr_sigIdx_;
ctx->multiGetSignal(__cIdx, __cIdx, _offset_1, _sigValue, 1);
Fr_add(_tmp, _sigValue, (ctx->circuit->constants + 2));
Fr_mul(_tmp_1, _tmp, (ctx->circuit->constants + 3));
Fr_sub(_tmp_2, _tmp_1, (ctx->circuit->constants + 4));
Fr_mul(_tmp_3, _tmp_2, (ctx->circuit->constants + 5));
Fr_copyn(temp, _tmp_3, 1);
/* signal result[k] */
/* result[0] <-- arr[0] */
_offset_4 = _arr_sigIdx_;
ctx->multiGetSignal(__cIdx, __cIdx, _offset_4, _sigValue_1, 1);
_offset_5 = _result_sigIdx_;
ctx->setSignal(__cIdx, __cIdx, _offset_5, _sigValue_1);
/* result[1] <-- result[0] + arr[2] */
_offset_6 = _result_sigIdx_;
ctx->multiGetSignal(__cIdx, __cIdx, _offset_6, _sigValue_2, 1);
_offset_7 = _arr_sigIdx_ + 2*_sigSizes_arr[1];
ctx->multiGetSignal(__cIdx, __cIdx, _offset_7, _sigValue_3, 1);
Fr_add(_tmp_4, _sigValue_2, _sigValue_3);
_offset_8 = _result_sigIdx_ + 1*_sigSizes_result[1];
ctx->setSignal(__cIdx, __cIdx, _offset_8, _tmp_4);
/* result[2] <-- result[1] * arr[4] */
_offset_9 = _result_sigIdx_ + 1*_sigSizes_result[1];
ctx->multiGetSignal(__cIdx, __cIdx, _offset_9, _sigValue_4, 1);
_offset_10 = _arr_sigIdx_ + 4*_sigSizes_arr[1];
ctx->multiGetSignal(__cIdx, __cIdx, _offset_10, _sigValue_5, 1);
Fr_mul(_tmp_5, _sigValue_4, _sigValue_5);
_offset_11 = _result_sigIdx_ + 2*_sigSizes_result[1];
ctx->setSignal(__cIdx, __cIdx, _offset_11, _tmp_5);
/* result[3] <-- result[2] - arr[6] */
_offset_12 = _result_sigIdx_ + 2*_sigSizes_result[1];
ctx->multiGetSignal(__cIdx, __cIdx, _offset_12, _sigValue_6, 1);
_offset_13 = _arr_sigIdx_ + 6*_sigSizes_arr[1];
ctx->multiGetSignal(__cIdx, __cIdx, _offset_13, _sigValue_7, 1);
Fr_sub(_tmp_6, _sigValue_6, _sigValue_7);
_offset_14 = _result_sigIdx_ + 3*_sigSizes_result[1];
ctx->setSignal(__cIdx, __cIdx, _offset_14, _tmp_6);
/* result[4] <-- result[3] * arr[8] */
_offset_15 = _result_sigIdx_ + 3*_sigSizes_result[1];
ctx->multiGetSignal(__cIdx, __cIdx, _offset_15, _sigValue_8, 1);
_offset_16 = _arr_sigIdx_ + 8*_sigSizes_arr[1];
ctx->multiGetSignal(__cIdx, __cIdx, _offset_16, _sigValue_9, 1);
Fr_mul(_tmp_7, _sigValue_8, _sigValue_9);
_offset_17 = _result_sigIdx_ + 4*_sigSizes_result[1];
ctx->setSignal(__cIdx, __cIdx, _offset_17, _tmp_7);
/* log(result[4] - temp) */
_offset_18 = _result_sigIdx_ + 4*_sigSizes_result[1];
ctx->multiGetSignal(__cIdx, __cIdx, _offset_18, _sigValue_10, 1);
Fr_sub(_tmp_8, _sigValue_10, temp);
ctx->log(_tmp_8);
/* assert(result[4] - temp) */
_offset_20 = _result_sigIdx_ + 4*_sigSizes_result[1];
ctx->multiGetSignal(__cIdx, __cIdx, _offset_20, _sigValue_11, 1);
Fr_sub(_tmp_9, _sigValue_11, temp);
ctx->checkAssert(__cIdx, _tmp_9, "/Users/chihaolu/Desktop/circom/circuit.circom:57:4");
/* result[4] === temp */
_offset_22 = _result_sigIdx_ + 4*_sigSizes_result[1];
ctx->multiGetSignal(__cIdx, __cIdx, _offset_22, _sigValue_12, 1);
ctx->checkConstraint(__cIdx, _sigValue_12, temp, "/Users/chihaolu/Desktop/circom/circuit.circom:58:4");
/* out <== result[4] */
_offset_24 = _result_sigIdx_ + 4*_sigSizes_result[1];
ctx->multiGetSignal(__cIdx, __cIdx, _offset_24, _sigValue_13, 1);
ctx->setSignal(__cIdx, __cIdx, _out_sigIdx_, _sigValue_13);
ctx->finished(__cIdx);
}
// Function Table
Circom_ComponentFunction _functionTable[1] = {
operation_d6c1bd8047f9cc9b
};