Skip to content

Instantly share code, notes, and snippets.

@olomix
Created July 8, 2025 10:05
Show Gist options
  • Select an option

  • Save olomix/fc45279887d4a9a324048b18c19eea4f to your computer and use it in GitHub Desktop.

Select an option

Save olomix/fc45279887d4a9a324048b18c19eea4f to your computer and use it in GitHub Desktop.
;; Prime value
%%prime 21888242871839275222246405745257275088548364400416034343698204186575808495617
;; Memory of signals
%%signals 5
;; Heap of components
%%components_heap 3
;; Types (for each field we store name type offset size nDims dims)
;; Main template
%%start Pos_0
;; Component creation mode (implicit/explicit)
%%components implicit
;; Witness (signal list)
%%witness 0 1 2 3 4
%%function f1_0 [] [ i64 0 i64 0 ff 0 ff 2 2 2]
x_0 = i64.26
x_1 = i64.load i64.0
x_2 = i64.load i64.1
;; store bucket in function
;;line 6
;; getting dest
ff.store i64.5 ff.0
;; end of store bucket
;; store bucket in function
;;line 7
;; getting dest
ff.store i64.6 ff.0
;; end of store bucket
;; loop bucket. Line 7
loop
;; compute bucket
;; load bucket
x_3 = ff.load i64.6
;; end of load bucket
;; OP(LESSER)
x_4 = ff.lt x_3 ff.2
;; end of compute bucket
ff.if x_4
;; store bucket in function
;;line 8
;; getting dest
ff.store i64.7 ff.0
;; end of store bucket
;; loop bucket. Line 8
loop
;; compute bucket
;; load bucket
x_5 = ff.load i64.7
;; end of load bucket
;; OP(LESSER)
x_6 = ff.lt x_5 ff.2
;; end of compute bucket
ff.if x_6
;; store bucket in function
;;line 9
;; compute bucket
;; load bucket
x_7 = ff.load i64.5
;; end of load bucket
;; load bucket
;; compute bucket
;; compute bucket
;; compute bucket
;; compute bucket
;; load bucket
x_8 = ff.load i64.6
;; end of load bucket
;; OP(TO_ADDRESS)
x_9 = i64.wrap_ff x_8
;; end of compute bucket
;; OP(MUL_ADDRESS)
;;line 0
x_10 = i64.mul i64.2 x_9
;; end of compute bucket
;; compute bucket
;; compute bucket
;; load bucket
;;line 9
x_11 = ff.load i64.7
;; end of load bucket
;; OP(TO_ADDRESS)
x_12 = i64.wrap_ff x_11
;; end of compute bucket
;; OP(MUL_ADDRESS)
;;line 0
x_13 = i64.mul i64.1 x_12
;; end of compute bucket
;; OP(ADD_ADDRESS)
x_14 = i64.add x_10 x_13
;; end of compute bucket
;; OP(ADD_ADDRESS)
x_15 = i64.add x_14 i64.1
;; end of compute bucket
x_16 = ff.load x_15
;; end of load bucket
;; OP(ADD)
;;line 9
x_17 = ff.add x_7 x_16
;; end of compute bucket
;; getting dest
ff.store i64.5 x_17
;; end of store bucket
;; store bucket in function
;;line 8
;; compute bucket
;; load bucket
x_18 = ff.load i64.7
;; end of load bucket
;; OP(ADD)
x_19 = ff.add x_18 ff.1
;; end of compute bucket
;; getting dest
ff.store i64.7 x_19
;; end of store bucket
continue
end
end
;; end of loop bucket
;; store bucket in function
;;line 7
;; compute bucket
;; load bucket
x_20 = ff.load i64.6
;; end of load bucket
;; OP(ADD)
x_21 = ff.add x_20 ff.1
;; end of compute bucket
;; getting dest
ff.store i64.6 x_21
;; end of store bucket
continue
end
end
;; end of loop bucket
;; branch bucket
;; compute bucket
;; load bucket
;;line 12
x_22 = ff.load i64.0
;; end of load bucket
;; OP(EQ(Single(1)))
x_23 = ff.eq x_22 ff.2
;; end of compute bucket
ff.if x_23
;; store bucket in function
;;line 15
;; getting dest
ff.store i64.6 ff.2910766817845651019878574839501801340070030115151021261302834310722729507541
;; end of store bucket
;; store bucket in function
;; getting dest
ff.store i64.7 ff.5776684794125549462448597414050232243778680302179439492664047328281728356345
;; end of store bucket
;; store bucket in function
;;line 19
;; getting dest
ff.store i64.8 ff.19727366863391167538122140361473584127147630672623100827934084310230022599144
;; end of store bucket
;; store bucket in function
;; getting dest
ff.store i64.9 ff.8348174920934122550483593999453880006756108121341067172388445916328941978568
;; end of store bucket
;; store bucket in function
;;line 13
x_24 = i64.6
x_25 = i64.10
x_26 = i64.2
loop
i64.if x_26
x_27 = ff.load x_24
ff.store x_25 x_27
x_24 = i64.add x_24 i64.1
x_25 = i64.add x_25 i64.1
x_26 = i64.sub x_26 i64.1
continue
end
break
end
;; end of store bucket
;; store bucket in function
x_28 = i64.8
x_29 = i64.12
x_30 = i64.2
loop
i64.if x_30
x_31 = ff.load x_28
ff.store x_29 x_31
x_28 = i64.add x_28 i64.1
x_29 = i64.add x_29 i64.1
x_30 = i64.sub x_30 i64.1
continue
end
break
end
;; end of store bucket
;; return bucket
x_32 = i64.le i64.4 x_2
i64.if x_32
x_33 = i64.4
else
x_33 = x_2
end
ff.mreturn x_1 i64.10 x_33
;;line 12
else
;; branch bucket
;; compute bucket
;; load bucket
;;line 24
x_34 = ff.load i64.0
;; end of load bucket
;; OP(EQ(Single(1)))
x_35 = ff.eq x_34 ff.3
;; end of compute bucket
ff.if x_35
;; store bucket in function
;;line 27
;; getting dest
ff.store i64.6 ff.7511745149465107256748700652201246547602992235352608707588321460060273774987
;; end of store bucket
;; store bucket in function
;; getting dest
ff.store i64.7 ff.18732019378264290557468133440468564866454307626475683536618613112504878618481
;; end of store bucket
;; store bucket in function
;; getting dest
ff.store i64.8 ff.9131299761947733513298312097611845208338517739621853568979632113419485819303
;; end of store bucket
;; store bucket in function
;;line 32
;; getting dest
ff.store i64.9 ff.10370080108974718697676803824769673834027675643658433702224577712625900127200
;; end of store bucket
;; store bucket in function
;; getting dest
ff.store i64.10 ff.20870176810702568768751421378473869562658540583882454726129544628203806653987
;; end of store bucket
;; store bucket in function
;; getting dest
ff.store i64.11 ff.10595341252162738537912664445405114076324478519622938027420701542910180337937
;; end of store bucket
;; store bucket in function
;;line 37
;; getting dest
ff.store i64.12 ff.19705173408229649878903981084052839426532978878058043055305024233888854471533
;; end of store bucket
;; store bucket in function
;; getting dest
ff.store i64.13 ff.7266061498423634438633389053804536045105766754026813321943009179476902321146
;; end of store bucket
;; store bucket in function
;; getting dest
ff.store i64.14 ff.11597556804922396090267472882856054602429588299176362916247939723151043581408
;; end of store bucket
;; store bucket in function
;;line 25
x_36 = i64.6
x_37 = i64.15
x_38 = i64.3
loop
i64.if x_38
x_39 = ff.load x_36
ff.store x_37 x_39
x_36 = i64.add x_36 i64.1
x_37 = i64.add x_37 i64.1
x_38 = i64.sub x_38 i64.1
continue
end
break
end
;; end of store bucket
;; store bucket in function
x_40 = i64.9
x_41 = i64.18
x_42 = i64.3
loop
i64.if x_42
x_43 = ff.load x_40
ff.store x_41 x_43
x_40 = i64.add x_40 i64.1
x_41 = i64.add x_41 i64.1
x_42 = i64.sub x_42 i64.1
continue
end
break
end
;; end of store bucket
;; store bucket in function
x_44 = i64.12
x_45 = i64.21
x_46 = i64.3
loop
i64.if x_46
x_47 = ff.load x_44
ff.store x_45 x_47
x_44 = i64.add x_44 i64.1
x_45 = i64.add x_45 i64.1
x_46 = i64.sub x_46 i64.1
continue
end
break
end
;; end of store bucket
;; return bucket
x_48 = i64.le i64.9 x_2
i64.if x_48
x_49 = i64.9
else
x_49 = x_2
end
ff.mreturn x_1 i64.15 x_49
;;line 24
else
;; assert bucket
;;line 44
x_50 = ff.eqz ff.0
ff.if x_50
error i64.0
end
;; end of assert bucket
;; store bucket in function
;;line 45
;; getting dest
ff.store i64.6 ff.0
;; end of store bucket
;; store bucket in function
;; load bucket
x_51 = ff.load i64.6
;; end of load bucket
;; getting dest
ff.store i64.7 x_51
;; end of store bucket
;; return bucket
x_52 = i64.le i64.1 x_2
i64.if x_52
x_53 = i64.1
else
x_53 = x_2
end
ff.mreturn x_1 i64.7 x_53
end
;; end of branch bucket
end
;; end of branch bucket
%%template Pos_0 [ ff 0 ff 0 ] [ ff 0 ff 0 ] [4] [ ]
x_54 = i64.18
;;line 0
;; getting dest
ff.store i64.0 ff.2
;; end of store bucket
;;line 59
;; getting dest
ff.store i64.15 ff.0
;; end of store bucket
;; getting dest
ff.store i64.16 ff.0
;; end of store bucket
;; getting dest
ff.store i64.17 ff.0
;; end of store bucket
x_55 = i64.15
x_56 = i64.6
x_57 = i64.3
loop
i64.if x_57
x_58 = ff.load x_55
ff.store x_56 x_58
x_55 = i64.add x_55 i64.1
x_56 = i64.add x_56 i64.1
x_57 = i64.sub x_57 i64.1
continue
end
break
end
;; end of store bucket
x_59 = i64.15
x_60 = i64.9
x_61 = i64.3
loop
i64.if x_61
x_62 = ff.load x_59
ff.store x_60 x_62
x_59 = i64.add x_59 i64.1
x_60 = i64.add x_60 i64.1
x_61 = i64.sub x_61 i64.1
continue
end
break
end
;; end of store bucket
x_63 = i64.15
x_64 = i64.12
x_65 = i64.3
loop
i64.if x_65
x_66 = ff.load x_63
ff.store x_64 x_66
x_63 = i64.add x_63 i64.1
x_64 = i64.add x_64 i64.1
x_65 = i64.sub x_65 i64.1
continue
end
break
end
;; end of store bucket
;; start of call bucket
;; end copying argument 0
;; end copying argument 1
ff.mcall $f1_0 i64.6 i64.9 ff.3 ff.memory(i64.2,i64.4)
;; end call bucket
;;line 61
;; compute bucket
;; compute bucket
;; load bucket
x_69 = get_signal i64.2
;; end of load bucket
;; OP(MUL)
x_70 = ff.mul x_69 ff.7511745149465107256748700652201246547602992235352608707588321460060273774987
;; end of compute bucket
;; load bucket
x_71 = get_signal i64.3
;; end of load bucket
;; OP(MUL)
x_72 = ff.mul x_70 x_71
;; end of compute bucket
;; getting dest
set_signal i64.0 x_72
;; end of store bucket
;;line 62
;; compute bucket
;; load bucket
x_73 = get_signal i64.0
;; end of load bucket
;; OP(ADD)
x_74 = ff.add x_73 ff.11597556804922396090267472882856054602429588299176362916247939723151043581408
;; end of compute bucket
;; getting dest
set_signal i64.1 x_74
;; end of store bucket
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment