amaru-uplc 0.1.0

A UPLC Evaluator as a CEK machine
Documentation
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
use crate::{
    builtin::DefaultFunction,
    machine::{
        cost_model::{
            builtin_costs::BuiltinCostModel,
            cost_map::CostMap,
            costing::{
                Cost, OneArgumentCosting, SixArgumentsCosting, ThreeArgumentsCosting,
                TwoArgumentsCosting,
            },
        },
        ExBudget,
    },
};

#[derive(Debug, PartialEq)]
pub struct BuiltinCostsV3 {
    add_integer: TwoArgumentsCosting,
    subtract_integer: TwoArgumentsCosting,
    multiply_integer: TwoArgumentsCosting,
    divide_integer: TwoArgumentsCosting,
    quotient_integer: TwoArgumentsCosting,
    remainder_integer: TwoArgumentsCosting,
    mod_integer: TwoArgumentsCosting,
    equals_integer: TwoArgumentsCosting,
    less_than_integer: TwoArgumentsCosting,
    less_than_equals_integer: TwoArgumentsCosting,
    // Bytestrings
    append_byte_string: TwoArgumentsCosting,
    cons_byte_string: TwoArgumentsCosting,
    slice_byte_string: ThreeArgumentsCosting,
    length_of_byte_string: OneArgumentCosting,
    index_byte_string: TwoArgumentsCosting,
    equals_byte_string: TwoArgumentsCosting,
    less_than_byte_string: TwoArgumentsCosting,
    less_than_equals_byte_string: TwoArgumentsCosting,
    // Cryptography and hashes
    sha2_256: OneArgumentCosting,
    sha3_256: OneArgumentCosting,
    blake2b_224: OneArgumentCosting,
    blake2b_256: OneArgumentCosting,
    keccak_256: OneArgumentCosting,
    verify_ed25519_signature: ThreeArgumentsCosting,
    verify_ecdsa_secp256k1_signature: ThreeArgumentsCosting,
    verify_schnorr_secp256k1_signature: ThreeArgumentsCosting,
    // Strings
    append_string: TwoArgumentsCosting,
    equals_string: TwoArgumentsCosting,
    encode_utf8: OneArgumentCosting,
    decode_utf8: OneArgumentCosting,
    // Bool
    if_then_else: ThreeArgumentsCosting,
    // Unit
    choose_unit: TwoArgumentsCosting,
    // Tracing
    trace: TwoArgumentsCosting,
    // Pairs
    fst_pair: OneArgumentCosting,
    snd_pair: OneArgumentCosting,
    // Lists
    choose_list: ThreeArgumentsCosting,
    mk_cons: TwoArgumentsCosting,
    head_list: OneArgumentCosting,
    tail_list: OneArgumentCosting,
    null_list: OneArgumentCosting,
    // Data
    choose_data: SixArgumentsCosting,
    constr_data: TwoArgumentsCosting,
    map_data: OneArgumentCosting,
    list_data: OneArgumentCosting,
    i_data: OneArgumentCosting,
    b_data: OneArgumentCosting,
    un_constr_data: OneArgumentCosting,
    un_map_data: OneArgumentCosting,
    un_list_data: OneArgumentCosting,
    un_i_data: OneArgumentCosting,
    un_b_data: OneArgumentCosting,
    equals_data: TwoArgumentsCosting,
    // Misc constructors
    mk_pair_data: TwoArgumentsCosting,
    mk_nil_data: OneArgumentCosting,
    mk_nil_pair_data: OneArgumentCosting,
    serialise_data: OneArgumentCosting,
    // BLST
    bls12_381_g1_add: TwoArgumentsCosting,
    bls12_381_g1_neg: OneArgumentCosting,
    bls12_381_g1_scalar_mul: TwoArgumentsCosting,
    bls12_381_g1_equal: TwoArgumentsCosting,
    bls12_381_g1_compress: OneArgumentCosting,
    bls12_381_g1_uncompress: OneArgumentCosting,
    bls12_381_g1_hash_to_group: TwoArgumentsCosting,
    bls12_381_g2_add: TwoArgumentsCosting,
    bls12_381_g2_neg: OneArgumentCosting,
    bls12_381_g2_scalar_mul: TwoArgumentsCosting,
    bls12_381_g2_equal: TwoArgumentsCosting,
    bls12_381_g2_compress: OneArgumentCosting,
    bls12_381_g2_uncompress: OneArgumentCosting,
    bls12_381_g2_hash_to_group: TwoArgumentsCosting,
    bls12_381_miller_loop: TwoArgumentsCosting,
    bls12_381_mul_ml_result: TwoArgumentsCosting,
    bls12_381_final_verify: TwoArgumentsCosting,
    // bitwise
    integer_to_byte_string: ThreeArgumentsCosting,
    byte_string_to_integer: TwoArgumentsCosting,
    and_byte_string: ThreeArgumentsCosting,
    or_byte_string: ThreeArgumentsCosting,
    xor_byte_string: ThreeArgumentsCosting,
    complement_byte_string: OneArgumentCosting,
    read_bit: TwoArgumentsCosting,
    write_bits: ThreeArgumentsCosting,
    replicate_byte: TwoArgumentsCosting,
    shift_byte_string: TwoArgumentsCosting,
    rotate_byte_string: TwoArgumentsCosting,
    count_set_bits: OneArgumentCosting,
    find_first_set_bit: OneArgumentCosting,
    ripemd_160: OneArgumentCosting,

    exp_mod_integer: ThreeArgumentsCosting,
    drop_list: TwoArgumentsCosting,
    length_of_array: OneArgumentCosting,
    list_to_array: TwoArgumentsCosting,
    index_array: TwoArgumentsCosting,
}

impl Default for BuiltinCostsV3 {
    fn default() -> Self {
        Self {
            add_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::max_size(1, 1),
                TwoArgumentsCosting::max_size(100788, 420),
            ),
            subtract_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::max_size(1, 1),
                TwoArgumentsCosting::max_size(100788, 420),
            ),

            multiply_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::added_sizes(0, 1),
                TwoArgumentsCosting::multiplied_sizes(90434, 519),
            ),
            divide_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::subtracted_sizes(0, 1, 1),
                TwoArgumentsCosting::const_above_diagonal_into_quadratic_x_and_y(
                    85848, 85848, 123203, 7305, -900, 1716, 549, 57,
                ),
            ),
            quotient_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::subtracted_sizes(0, 1, 1),
                TwoArgumentsCosting::const_above_diagonal_into_quadratic_x_and_y(
                    85848, 85848, 123203, 7305, -900, 1716, 549, 57,
                ),
            ),
            remainder_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::linear_in_y(0, 1),
                TwoArgumentsCosting::const_above_diagonal_into_quadratic_x_and_y(
                    85848, 85848, 123203, 7305, -900, 1716, 549, 57,
                ),
            ),
            mod_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::linear_in_y(0, 1),
                TwoArgumentsCosting::const_above_diagonal_into_quadratic_x_and_y(
                    85848, 85848, 123203, 7305, -900, 1716, 549, 57,
                ),
            ),
            equals_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(1),
                TwoArgumentsCosting::min_size(51775, 558),
            ),
            less_than_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(1),
                TwoArgumentsCosting::min_size(44749, 541),
            ),
            less_than_equals_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(1),
                TwoArgumentsCosting::min_size(43285, 552),
            ),
            append_byte_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::added_sizes(0, 1),
                TwoArgumentsCosting::added_sizes(1000, 173),
            ),
            cons_byte_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::added_sizes(0, 1),
                TwoArgumentsCosting::linear_in_y(72010, 178),
            ),
            slice_byte_string: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::linear_in_z(4, 0),
                ThreeArgumentsCosting::linear_in_z(20467, 1),
            ),
            length_of_byte_string: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(10),
                OneArgumentCosting::constant_cost(22100),
            ),
            index_byte_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(4),
                TwoArgumentsCosting::constant_cost(13169),
            ),
            equals_byte_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(1),
                TwoArgumentsCosting::linear_on_diagonal(24548, 29498, 38),
            ),
            less_than_byte_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(1),
                TwoArgumentsCosting::min_size(28999, 74),
            ),
            less_than_equals_byte_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(1),
                TwoArgumentsCosting::min_size(28999, 74),
            ),
            sha2_256: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(4),
                OneArgumentCosting::linear_cost(270652, 22588),
            ),
            sha3_256: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(4),
                OneArgumentCosting::linear_cost(1457325, 64566),
            ),
            blake2b_256: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(4),
                OneArgumentCosting::linear_cost(201305, 8356),
            ),
            verify_ed25519_signature: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::constant_cost(10),
                ThreeArgumentsCosting::linear_in_y(53384111, 14333),
            ),
            verify_ecdsa_secp256k1_signature: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::constant_cost(10),
                ThreeArgumentsCosting::constant_cost(43053543),
            ),
            verify_schnorr_secp256k1_signature: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::constant_cost(10),
                ThreeArgumentsCosting::linear_in_y(43574283, 26308),
            ),
            append_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::added_sizes(4, 1),
                TwoArgumentsCosting::added_sizes(1000, 59957),
            ),
            equals_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(1),
                TwoArgumentsCosting::linear_on_diagonal(39184, 1000, 60594),
            ),
            encode_utf8: OneArgumentCosting::new(
                OneArgumentCosting::linear_cost(4, 2),
                OneArgumentCosting::linear_cost(1000, 42921),
            ),
            decode_utf8: OneArgumentCosting::new(
                OneArgumentCosting::linear_cost(4, 2),
                OneArgumentCosting::linear_cost(91189, 769),
            ),
            if_then_else: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::constant_cost(1),
                ThreeArgumentsCosting::constant_cost(76049),
            ),
            choose_unit: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(4),
                TwoArgumentsCosting::constant_cost(61462),
            ),
            trace: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(32),
                TwoArgumentsCosting::constant_cost(59498),
            ),
            fst_pair: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(32),
                OneArgumentCosting::constant_cost(141895),
            ),
            snd_pair: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(32),
                OneArgumentCosting::constant_cost(141992),
            ),
            choose_list: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::constant_cost(32),
                ThreeArgumentsCosting::constant_cost(132994),
            ),
            mk_cons: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(32),
                TwoArgumentsCosting::constant_cost(72362),
            ),
            head_list: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(32),
                OneArgumentCosting::constant_cost(83150),
            ),
            tail_list: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(32),
                OneArgumentCosting::constant_cost(81663),
            ),
            null_list: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(32),
                OneArgumentCosting::constant_cost(74433),
            ),
            choose_data: SixArgumentsCosting::new(
                SixArgumentsCosting::constant_cost(32),
                SixArgumentsCosting::constant_cost(94375),
            ),
            constr_data: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(32),
                TwoArgumentsCosting::constant_cost(22151),
            ),
            map_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(32),
                OneArgumentCosting::constant_cost(68246),
            ),
            list_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(32),
                OneArgumentCosting::constant_cost(33852),
            ),
            i_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(32),
                OneArgumentCosting::constant_cost(15299),
            ),
            b_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(32),
                OneArgumentCosting::constant_cost(11183),
            ),
            un_constr_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(32),
                OneArgumentCosting::constant_cost(24588),
            ),
            un_map_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(32),
                OneArgumentCosting::constant_cost(24623),
            ),
            un_list_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(32),
                OneArgumentCosting::constant_cost(25933),
            ),
            un_i_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(32),
                OneArgumentCosting::constant_cost(20744),
            ),
            un_b_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(32),
                OneArgumentCosting::constant_cost(20142),
            ),
            equals_data: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(1),
                TwoArgumentsCosting::min_size(898148, 27279),
            ),
            mk_pair_data: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(32),
                TwoArgumentsCosting::constant_cost(11546),
            ),
            mk_nil_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(32),
                OneArgumentCosting::constant_cost(7243),
            ),
            mk_nil_pair_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(32),
                OneArgumentCosting::constant_cost(7391),
            ),

            serialise_data: OneArgumentCosting::new(
                OneArgumentCosting::linear_cost(0, 2),
                OneArgumentCosting::linear_cost(955506, 213312),
            ),
            blake2b_224: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(4),
                OneArgumentCosting::linear_cost(207616, 8310),
            ),
            keccak_256: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(4),
                OneArgumentCosting::linear_cost(2261318, 64571),
            ),
            bls12_381_g1_add: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(18),
                TwoArgumentsCosting::constant_cost(962335),
            ),
            bls12_381_g1_neg: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(18),
                OneArgumentCosting::constant_cost(267929),
            ),
            bls12_381_g1_scalar_mul: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(18),
                TwoArgumentsCosting::linear_in_x(76433006, 8868),
            ),
            bls12_381_g1_equal: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(1),
                TwoArgumentsCosting::constant_cost(442008),
            ),
            bls12_381_g1_compress: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(6),
                OneArgumentCosting::constant_cost(2780678),
            ),
            bls12_381_g1_uncompress: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(18),
                OneArgumentCosting::constant_cost(52948122),
            ),
            bls12_381_g1_hash_to_group: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(18),
                TwoArgumentsCosting::linear_in_x(52538055, 3756),
            ),
            bls12_381_g2_add: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(36),
                TwoArgumentsCosting::constant_cost(1995836),
            ),
            bls12_381_g2_neg: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(36),
                OneArgumentCosting::constant_cost(284546),
            ),
            bls12_381_g2_scalar_mul: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(36),
                TwoArgumentsCosting::linear_in_x(158_221_314, 26_549),
            ),
            bls12_381_g2_equal: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(1),
                TwoArgumentsCosting::constant_cost(901_022),
            ),
            bls12_381_g2_compress: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(12),
                OneArgumentCosting::constant_cost(3_227_919),
            ),
            bls12_381_g2_uncompress: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(36),
                OneArgumentCosting::constant_cost(74_698_472),
            ),
            bls12_381_g2_hash_to_group: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(36),
                TwoArgumentsCosting::linear_in_x(166_917_843, 4_307),
            ),
            bls12_381_miller_loop: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(72),
                TwoArgumentsCosting::constant_cost(254006273),
            ),
            bls12_381_mul_ml_result: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(72),
                TwoArgumentsCosting::constant_cost(2174038),
            ),
            bls12_381_final_verify: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(1),
                TwoArgumentsCosting::constant_cost(333849714),
            ),
            integer_to_byte_string: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::literal_in_y_or_linear_in_z(0, 1),
                ThreeArgumentsCosting::quadratic_in_z(1293828, 28716, 63),
            ),
            byte_string_to_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::linear_in_y(0, 1),
                TwoArgumentsCosting::quadratic_in_y(1006041, 43623, 251),
            ),
            and_byte_string: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::linear_in_max_y_z(0, 1),
                ThreeArgumentsCosting::linear_in_y_and_z(100181, 726, 719),
            ),
            or_byte_string: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::linear_in_max_y_z(0, 1),
                ThreeArgumentsCosting::linear_in_y_and_z(100181, 726, 719),
            ),
            xor_byte_string: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::linear_in_max_y_z(0, 1),
                ThreeArgumentsCosting::linear_in_y_and_z(100181, 726, 719),
            ),
            complement_byte_string: OneArgumentCosting::new(
                OneArgumentCosting::linear_cost(0, 1),
                OneArgumentCosting::linear_cost(107878, 680),
            ),
            read_bit: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(1),
                TwoArgumentsCosting::constant_cost(95336),
            ),
            write_bits: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::linear_in_x(0, 1),
                ThreeArgumentsCosting::linear_in_y(281145, 18848),
            ),
            replicate_byte: TwoArgumentsCosting::new(
                TwoArgumentsCosting::linear_in_x(1, 1),
                TwoArgumentsCosting::linear_in_x(180194, 159),
            ),
            shift_byte_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::linear_in_x(0, 1),
                TwoArgumentsCosting::linear_in_x(158519, 8942),
            ),
            rotate_byte_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::linear_in_x(0, 1),
                TwoArgumentsCosting::linear_in_x(159378, 8813),
            ),
            count_set_bits: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(1),
                OneArgumentCosting::linear_cost(107490, 3298),
            ),
            find_first_set_bit: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(1),
                OneArgumentCosting::linear_cost(106057, 655),
            ),
            ripemd_160: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(3),
                OneArgumentCosting::linear_cost(1964219, 24520),
            ),
            exp_mod_integer: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::linear_in_z(0, 1),
                ThreeArgumentsCosting::exp_mod_cost(607153, 231697, 53144),
            ),
            drop_list: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(4),
                TwoArgumentsCosting::linear_in_x(116711, 1957),
            ),
            length_of_array: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(10),
                OneArgumentCosting::constant_cost(198994),
            ),
            list_to_array: TwoArgumentsCosting::new(
                TwoArgumentsCosting::linear_in_x(7, 1),
                TwoArgumentsCosting::linear_in_x(307802, 8496),
            ),
            index_array: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(32),
                TwoArgumentsCosting::constant_cost(194922),
            ),
        }
    }
}

impl BuiltinCostModel for BuiltinCostsV3 {
    fn initialize(cost_map: &CostMap) -> Self {
        Self {
            add_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::max_size(
                    cost_map["add_integer-mem-arguments-intercept"],
                    cost_map["add_integer-mem-arguments-slope"],
                ),
                TwoArgumentsCosting::max_size(
                    cost_map["add_integer-cpu-arguments-intercept"],
                    cost_map["add_integer-cpu-arguments-slope"],
                ),
            ),

            append_byte_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::added_sizes(
                    cost_map["append_byte_string-mem-arguments-intercept"],
                    cost_map["append_byte_string-mem-arguments-slope"],
                ),
                TwoArgumentsCosting::added_sizes(
                    cost_map["append_byte_string-cpu-arguments-intercept"],
                    cost_map["append_byte_string-cpu-arguments-slope"],
                ),
            ),

            append_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::added_sizes(
                    cost_map["append_string-mem-arguments-intercept"],
                    cost_map["append_string-mem-arguments-slope"],
                ),
                TwoArgumentsCosting::added_sizes(
                    cost_map["append_string-cpu-arguments-intercept"],
                    cost_map["append_string-cpu-arguments-slope"],
                ),
            ),

            b_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["b_data-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["b_data-cpu-arguments"]),
            ),

            blake2b_256: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["blake2b_256-mem-arguments"]),
                OneArgumentCosting::linear_cost(
                    cost_map["blake2b_256-cpu-arguments-intercept"],
                    cost_map["blake2b_256-cpu-arguments-slope"],
                ),
            ),
            choose_data: SixArgumentsCosting::new(
                SixArgumentsCosting::constant_cost(cost_map["choose_data-mem-arguments"]),
                SixArgumentsCosting::constant_cost(cost_map["choose_data-cpu-arguments"]),
            ),
            choose_list: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::constant_cost(cost_map["choose_list-mem-arguments"]),
                ThreeArgumentsCosting::constant_cost(cost_map["choose_list-cpu-arguments"]),
            ),
            choose_unit: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["choose_unit-mem-arguments"]),
                TwoArgumentsCosting::constant_cost(cost_map["choose_unit-cpu-arguments"]),
            ),
            cons_byte_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::added_sizes(
                    cost_map["cons_byte_string-mem-arguments-intercept"],
                    cost_map["cons_byte_string-mem-arguments-slope"],
                ),
                TwoArgumentsCosting::linear_in_y(
                    cost_map["cons_byte_string-cpu-arguments-intercept"],
                    cost_map["cons_byte_string-cpu-arguments-slope"],
                ),
            ),
            constr_data: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["constr_data-mem-arguments"]),
                TwoArgumentsCosting::constant_cost(cost_map["constr_data-cpu-arguments"]),
            ),
            decode_utf8: OneArgumentCosting::new(
                OneArgumentCosting::linear_cost(
                    cost_map["decode_utf8-mem-arguments-intercept"],
                    cost_map["decode_utf8-mem-arguments-slope"],
                ),
                OneArgumentCosting::linear_cost(
                    cost_map["decode_utf8-cpu-arguments-intercept"],
                    cost_map["decode_utf8-cpu-arguments-slope"],
                ),
            ),
            divide_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::subtracted_sizes(
                    cost_map["divide_integer-mem-arguments-intercept"],
                    cost_map["divide_integer-mem-arguments-minimum"],
                    cost_map["divide_integer-mem-arguments-slope"],
                ),
                TwoArgumentsCosting::const_above_diagonal_into_quadratic_x_and_y(
                    cost_map["divide_integer-cpu-arguments-constant"],
                    cost_map["divide_integer-cpu-arguments-minimum"],
                    cost_map["divide_integer-cpu-arguments-c00"],
                    cost_map["divide_integer-cpu-arguments-c01"],
                    cost_map["divide_integer-cpu-arguments-c02"],
                    cost_map["divide_integer-cpu-arguments-c10"],
                    cost_map["divide_integer-cpu-arguments-c11"],
                    cost_map["divide_integer-cpu-arguments-c20"],
                ),
            ),
            encode_utf8: OneArgumentCosting::new(
                OneArgumentCosting::linear_cost(
                    cost_map["encode_utf8-mem-arguments-intercept"],
                    cost_map["encode_utf8-mem-arguments-slope"],
                ),
                OneArgumentCosting::linear_cost(
                    cost_map["encode_utf8-cpu-arguments-intercept"],
                    cost_map["encode_utf8-cpu-arguments-slope"],
                ),
            ),
            equals_byte_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["equals_byte_string-mem-arguments"]),
                TwoArgumentsCosting::linear_on_diagonal(
                    cost_map["equals_byte_string-cpu-arguments-constant"],
                    cost_map["equals_byte_string-cpu-arguments-intercept"],
                    cost_map["equals_byte_string-cpu-arguments-slope"],
                ),
            ),
            equals_data: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["equals_data-mem-arguments"]),
                TwoArgumentsCosting::min_size(
                    cost_map["equals_data-cpu-arguments-intercept"],
                    cost_map["equals_data-cpu-arguments-slope"],
                ),
            ),
            equals_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["equals_integer-mem-arguments"]),
                TwoArgumentsCosting::min_size(
                    cost_map["equals_integer-cpu-arguments-intercept"],
                    cost_map["equals_integer-cpu-arguments-slope"],
                ),
            ),
            equals_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["equals_string-mem-arguments"]),
                TwoArgumentsCosting::linear_on_diagonal(
                    cost_map["equals_string-cpu-arguments-constant"],
                    cost_map["equals_string-cpu-arguments-intercept"],
                    cost_map["equals_string-cpu-arguments-slope"],
                ),
            ),
            fst_pair: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["fst_pair-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["fst_pair-cpu-arguments"]),
            ),
            head_list: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["head_list-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["head_list-cpu-arguments"]),
            ),
            i_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["i_data-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["i_data-cpu-arguments"]),
            ),
            if_then_else: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::constant_cost(cost_map["if_then_else-mem-arguments"]),
                ThreeArgumentsCosting::constant_cost(cost_map["if_then_else-cpu-arguments"]),
            ),
            index_byte_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["index_byte_string-mem-arguments"]),
                TwoArgumentsCosting::constant_cost(cost_map["index_byte_string-cpu-arguments"]),
            ),
            length_of_byte_string: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["length_of_byte_string-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["length_of_byte_string-cpu-arguments"]),
            ),
            less_than_byte_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["less_than_byte_string-mem-arguments"]),
                TwoArgumentsCosting::min_size(
                    cost_map["less_than_byte_string-cpu-arguments-intercept"],
                    cost_map["less_than_byte_string-cpu-arguments-slope"],
                ),
            ),
            less_than_equals_byte_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(
                    cost_map["less_than_equals_byte_string-mem-arguments"],
                ),
                TwoArgumentsCosting::min_size(
                    cost_map["less_than_equals_byte_string-cpu-arguments-intercept"],
                    cost_map["less_than_equals_byte_string-cpu-arguments-slope"],
                ),
            ),
            less_than_equals_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(
                    cost_map["less_than_equals_integer-mem-arguments"],
                ),
                TwoArgumentsCosting::min_size(
                    cost_map["less_than_equals_integer-cpu-arguments-intercept"],
                    cost_map["less_than_equals_integer-cpu-arguments-slope"],
                ),
            ),
            less_than_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["less_than_integer-mem-arguments"]),
                TwoArgumentsCosting::min_size(
                    cost_map["less_than_integer-cpu-arguments-intercept"],
                    cost_map["less_than_integer-cpu-arguments-slope"],
                ),
            ),
            list_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["list_data-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["list_data-cpu-arguments"]),
            ),
            map_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["map_data-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["map_data-cpu-arguments"]),
            ),
            mk_cons: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["mk_cons-mem-arguments"]),
                TwoArgumentsCosting::constant_cost(cost_map["mk_cons-cpu-arguments"]),
            ),
            mk_nil_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["mk_nil_data-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["mk_nil_data-cpu-arguments"]),
            ),
            mk_nil_pair_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["mk_nil_pair_data-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["mk_nil_pair_data-cpu-arguments"]),
            ),
            mk_pair_data: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["mk_pair_data-mem-arguments"]),
                TwoArgumentsCosting::constant_cost(cost_map["mk_pair_data-cpu-arguments"]),
            ),
            mod_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::linear_in_y(
                    cost_map["mod_integer-mem-arguments-intercept"],
                    cost_map["mod_integer-mem-arguments-slope"],
                ),
                TwoArgumentsCosting::const_above_diagonal_into_quadratic_x_and_y(
                    cost_map["mod_integer-cpu-arguments-constant"],
                    cost_map["mod_integer-cpu-arguments-minimum"],
                    cost_map["mod_integer-cpu-arguments-c00"],
                    cost_map["mod_integer-cpu-arguments-c01"],
                    cost_map["mod_integer-cpu-arguments-c02"],
                    cost_map["mod_integer-cpu-arguments-c10"],
                    cost_map["mod_integer-cpu-arguments-c11"],
                    cost_map["mod_integer-cpu-arguments-c20"],
                ),
            ),
            multiply_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::added_sizes(
                    cost_map["multiply_integer-mem-arguments-intercept"],
                    cost_map["multiply_integer-mem-arguments-slope"],
                ),
                TwoArgumentsCosting::multiplied_sizes(
                    cost_map["multiply_integer-cpu-arguments-intercept"],
                    cost_map["multiply_integer-cpu-arguments-slope"],
                ),
            ),
            null_list: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["null_list-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["null_list-cpu-arguments"]),
            ),
            quotient_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::subtracted_sizes(
                    cost_map["quotient_integer-mem-arguments-intercept"],
                    cost_map["quotient_integer-mem-arguments-slope"],
                    cost_map["quotient_integer-mem-arguments-minimum"],
                ),
                TwoArgumentsCosting::const_above_diagonal_into_quadratic_x_and_y(
                    cost_map["quotient_integer-cpu-arguments-constant"],
                    cost_map["quotient_integer-cpu-arguments-minimum"],
                    cost_map["quotient_integer-cpu-arguments-c00"],
                    cost_map["quotient_integer-cpu-arguments-c01"],
                    cost_map["quotient_integer-cpu-arguments-c02"],
                    cost_map["quotient_integer-cpu-arguments-c10"],
                    cost_map["quotient_integer-cpu-arguments-c11"],
                    cost_map["quotient_integer-cpu-arguments-c20"],
                ),
            ),
            remainder_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::linear_in_y(
                    cost_map["remainder_integer-mem-arguments-intercept"],
                    cost_map["remainder_integer-mem-arguments-slope"],
                ),
                TwoArgumentsCosting::const_above_diagonal_into_quadratic_x_and_y(
                    cost_map["remainder_integer-cpu-arguments-constant"],
                    cost_map["remainder_integer-cpu-arguments-minimum"],
                    cost_map["remainder_integer-cpu-arguments-c00"],
                    cost_map["remainder_integer-cpu-arguments-c01"],
                    cost_map["remainder_integer-cpu-arguments-c02"],
                    cost_map["remainder_integer-cpu-arguments-c10"],
                    cost_map["remainder_integer-cpu-arguments-c11"],
                    cost_map["remainder_integer-cpu-arguments-c20"],
                ),
            ),
            serialise_data: OneArgumentCosting::new(
                OneArgumentCosting::linear_cost(
                    cost_map["serialise_data-mem-arguments-intercept"],
                    cost_map["serialise_data-mem-arguments-slope"],
                ),
                OneArgumentCosting::linear_cost(
                    cost_map["serialise_data-cpu-arguments-intercept"],
                    cost_map["serialise_data-cpu-arguments-slope"],
                ),
            ),

            sha2_256: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["sha2_256-mem-arguments"]),
                OneArgumentCosting::linear_cost(
                    cost_map["sha2_256-cpu-arguments-intercept"],
                    cost_map["sha2_256-cpu-arguments-slope"],
                ),
            ),
            sha3_256: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["sha3_256-mem-arguments"]),
                OneArgumentCosting::linear_cost(
                    cost_map["sha3_256-cpu-arguments-intercept"],
                    cost_map["sha3_256-cpu-arguments-slope"],
                ),
            ),
            slice_byte_string: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::linear_in_z(
                    cost_map["slice_byte_string-mem-arguments-intercept"],
                    cost_map["slice_byte_string-mem-arguments-slope"],
                ),
                ThreeArgumentsCosting::linear_in_z(
                    cost_map["slice_byte_string-cpu-arguments-intercept"],
                    cost_map["slice_byte_string-cpu-arguments-slope"],
                ),
            ),
            snd_pair: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["snd_pair-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["snd_pair-cpu-arguments"]),
            ),
            subtract_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::max_size(
                    cost_map["subtract_integer-mem-arguments-intercept"],
                    cost_map["subtract_integer-mem-arguments-slope"],
                ),
                TwoArgumentsCosting::max_size(
                    cost_map["subtract_integer-cpu-arguments-intercept"],
                    cost_map["subtract_integer-cpu-arguments-slope"],
                ),
            ),
            tail_list: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["tail_list-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["tail_list-cpu-arguments"]),
            ),
            trace: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["trace-mem-arguments"]),
                TwoArgumentsCosting::constant_cost(cost_map["trace-cpu-arguments"]),
            ),
            un_b_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["un_b_data-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["un_b_data-cpu-arguments"]),
            ),
            un_constr_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["un_constr_data-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["un_constr_data-cpu-arguments"]),
            ),
            un_i_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["un_i_data-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["un_i_data-cpu-arguments"]),
            ),
            un_list_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["un_list_data-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["un_list_data-cpu-arguments"]),
            ),
            un_map_data: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["un_map_data-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["un_map_data-cpu-arguments"]),
            ),
            verify_ecdsa_secp256k1_signature: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::constant_cost(
                    cost_map["verify_ecdsa_secp256k1_signature-mem-arguments"],
                ),
                ThreeArgumentsCosting::constant_cost(
                    cost_map["verify_ecdsa_secp256k1_signature-cpu-arguments"],
                ),
            ),
            verify_ed25519_signature: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::constant_cost(
                    cost_map["verify_ed25519_signature-mem-arguments"],
                ),
                ThreeArgumentsCosting::linear_in_y(
                    cost_map["verify_ed25519_signature-cpu-arguments-intercept"],
                    cost_map["verify_ed25519_signature-cpu-arguments-slope"],
                ),
            ),
            verify_schnorr_secp256k1_signature: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::constant_cost(
                    cost_map["verify_schnorr_secp256k1_signature-mem-arguments"],
                ),
                ThreeArgumentsCosting::linear_in_y(
                    cost_map["verify_schnorr_secp256k1_signature-cpu-arguments-intercept"],
                    cost_map["verify_schnorr_secp256k1_signature-cpu-arguments-slope"],
                ),
            ),

            bls12_381_g1_add: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["bls12_381_G1_add-mem-arguments"]),
                TwoArgumentsCosting::constant_cost(cost_map["bls12_381_G1_add-cpu-arguments"]),
            ),

            bls12_381_g1_compress: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["bls12_381_G1_compress-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["bls12_381_G1_compress-cpu-arguments"]),
            ),

            bls12_381_g1_equal: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["bls12_381_G1_equal-mem-arguments"]),
                TwoArgumentsCosting::constant_cost(cost_map["bls12_381_G1_equal-cpu-arguments"]),
            ),

            bls12_381_g1_hash_to_group: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(
                    cost_map["bls12_381_G1_hashToGroup-mem-arguments"],
                ),
                TwoArgumentsCosting::linear_in_x(
                    cost_map["bls12_381_G1_hashToGroup-cpu-arguments-intercept"],
                    cost_map["bls12_381_G1_hashToGroup-cpu-arguments-slope"],
                ),
            ),

            bls12_381_g1_neg: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["bls12_381_G1_neg-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["bls12_381_G1_neg-cpu-arguments"]),
            ),

            bls12_381_g1_scalar_mul: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(
                    cost_map["bls12_381_G1_scalarMul-mem-arguments"],
                ),
                TwoArgumentsCosting::linear_in_x(
                    cost_map["bls12_381_G1_scalarMul-cpu-arguments-intercept"],
                    cost_map["bls12_381_G1_scalarMul-cpu-arguments-slope"],
                ),
            ),

            bls12_381_g1_uncompress: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(
                    cost_map["bls12_381_G1_uncompress-mem-arguments"],
                ),
                OneArgumentCosting::constant_cost(
                    cost_map["bls12_381_G1_uncompress-cpu-arguments"],
                ),
            ),

            bls12_381_g2_add: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["bls12_381_G2_add-mem-arguments"]),
                TwoArgumentsCosting::constant_cost(cost_map["bls12_381_G2_add-cpu-arguments"]),
            ),

            bls12_381_g2_compress: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["bls12_381_G2_compress-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["bls12_381_G2_compress-cpu-arguments"]),
            ),

            bls12_381_g2_equal: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["bls12_381_G2_equal-mem-arguments"]),
                TwoArgumentsCosting::constant_cost(cost_map["bls12_381_G2_equal-cpu-arguments"]),
            ),

            bls12_381_g2_hash_to_group: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(
                    cost_map["bls12_381_G2_hashToGroup-mem-arguments"],
                ),
                TwoArgumentsCosting::linear_in_x(
                    cost_map["bls12_381_G2_hashToGroup-cpu-arguments-intercept"],
                    cost_map["bls12_381_G2_hashToGroup-cpu-arguments-slope"],
                ),
            ),

            bls12_381_g2_neg: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["bls12_381_G2_neg-mem-arguments"]),
                OneArgumentCosting::constant_cost(cost_map["bls12_381_G2_neg-cpu-arguments"]),
            ),

            bls12_381_g2_scalar_mul: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(
                    cost_map["bls12_381_G2_scalarMul-mem-arguments"],
                ),
                TwoArgumentsCosting::linear_in_x(
                    cost_map["bls12_381_G2_scalarMul-cpu-arguments-intercept"],
                    cost_map["bls12_381_G2_scalarMul-cpu-arguments-slope"],
                ),
            ),

            bls12_381_g2_uncompress: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(
                    cost_map["bls12_381_G2_uncompress-mem-arguments"],
                ),
                OneArgumentCosting::constant_cost(
                    cost_map["bls12_381_G2_uncompress-cpu-arguments"],
                ),
            ),

            bls12_381_final_verify: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["bls12_381_finalVerify-mem-arguments"]),
                TwoArgumentsCosting::constant_cost(cost_map["bls12_381_finalVerify-cpu-arguments"]),
            ),

            bls12_381_miller_loop: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["bls12_381_millerLoop-mem-arguments"]),
                TwoArgumentsCosting::constant_cost(cost_map["bls12_381_millerLoop-cpu-arguments"]),
            ),

            bls12_381_mul_ml_result: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["bls12_381_mulMlResult-mem-arguments"]),
                TwoArgumentsCosting::constant_cost(cost_map["bls12_381_mulMlResult-cpu-arguments"]),
            ),

            keccak_256: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["keccak_256-mem-arguments"]),
                OneArgumentCosting::linear_cost(
                    cost_map["keccak_256-cpu-arguments-intercept"],
                    cost_map["keccak_256-cpu-arguments-slope"],
                ),
            ),

            blake2b_224: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["blake2b_224-mem-arguments-slope"]),
                OneArgumentCosting::linear_cost(
                    cost_map["blake2b_224-cpu-arguments-intercept"],
                    cost_map["blake2b_224-cpu-arguments-slope"],
                ),
            ),

            integer_to_byte_string: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::literal_in_y_or_linear_in_z(
                    cost_map["integerToByteString-mem-arguments-intercept"],
                    cost_map["integerToByteString-mem-arguments-slope"],
                ),
                ThreeArgumentsCosting::quadratic_in_z(
                    cost_map["integerToByteString-cpu-arguments-c0"],
                    cost_map["integerToByteString-cpu-arguments-c1"],
                    cost_map["integerToByteString-cpu-arguments-c2"],
                ),
            ),

            byte_string_to_integer: TwoArgumentsCosting::new(
                TwoArgumentsCosting::linear_in_y(
                    cost_map["byteStringToInteger-mem-arguments-intercept"],
                    cost_map["byteStringToInteger-mem-arguments-slope"],
                ),
                TwoArgumentsCosting::quadratic_in_y(
                    cost_map["byteStringToInteger-cpu-arguments-c0"],
                    cost_map["byteStringToInteger-cpu-arguments-c1"],
                    cost_map["byteStringToInteger-cpu-arguments-c2"],
                ),
            ),

            and_byte_string: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::linear_in_max_y_z(
                    cost_map["andByteString-memory-arguments-intercept"],
                    cost_map["andByteString-memory-arguments-slope"],
                ),
                ThreeArgumentsCosting::linear_in_y_and_z(
                    cost_map["andByteString-cpu-arguments-intercept"],
                    cost_map["andByteString-cpu-arguments-slope1"],
                    cost_map["andByteString-cpu-arguments-slope2"],
                ),
            ),

            or_byte_string: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::linear_in_max_y_z(
                    cost_map["orByteString-memory-arguments-intercept"],
                    cost_map["orByteString-memory-arguments-slope"],
                ),
                ThreeArgumentsCosting::linear_in_y_and_z(
                    cost_map["orByteString-cpu-arguments-intercept"],
                    cost_map["orByteString-cpu-arguments-slope1"],
                    cost_map["orByteString-cpu-arguments-slope2"],
                ),
            ),

            xor_byte_string: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::linear_in_max_y_z(
                    cost_map["xorByteString-memory-arguments-intercept"],
                    cost_map["xorByteString-memory-arguments-slope"],
                ),
                ThreeArgumentsCosting::linear_in_y_and_z(
                    cost_map["xorByteString-cpu-arguments-intercept"],
                    cost_map["xorByteString-cpu-arguments-slope1"],
                    cost_map["xorByteString-cpu-arguments-slope2"],
                ),
            ),

            complement_byte_string: OneArgumentCosting::new(
                OneArgumentCosting::linear_cost(
                    cost_map["complementByteString-memory-arguments-intercept"],
                    cost_map["complementByteString-memory-arguments-slope"],
                ),
                OneArgumentCosting::linear_cost(
                    cost_map["complementByteString-cpu-arguments-intercept"],
                    cost_map["complementByteString-cpu-arguments-slope"],
                ),
            ),

            read_bit: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(cost_map["readBit-memory-arguments"]),
                TwoArgumentsCosting::constant_cost(cost_map["readBit-cpu-arguments"]),
            ),

            write_bits: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::linear_in_x(
                    cost_map["writeBits-memory-arguments-intercept"],
                    cost_map["writeBits-memory-arguments-slope"],
                ),
                ThreeArgumentsCosting::linear_in_y(
                    cost_map["writeBits-cpu-arguments-intercept"],
                    cost_map["writeBits-cpu-arguments-slope"],
                ),
            ),

            replicate_byte: TwoArgumentsCosting::new(
                TwoArgumentsCosting::linear_in_x(
                    cost_map["replicateByte-memory-arguments-intercept"],
                    cost_map["replicateByte-memory-arguments-slope"],
                ),
                TwoArgumentsCosting::linear_in_x(
                    cost_map["replicateByte-cpu-arguments-intercept"],
                    cost_map["replicateByte-cpu-arguments-slope"],
                ),
            ),

            shift_byte_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::linear_in_x(
                    cost_map["shiftByteString-memory-arguments-intercept"],
                    cost_map["shiftByteString-memory-arguments-slope"],
                ),
                TwoArgumentsCosting::linear_in_x(
                    cost_map["shiftByteString-cpu-arguments-intercept"],
                    cost_map["shiftByteString-cpu-arguments-slope"],
                ),
            ),

            rotate_byte_string: TwoArgumentsCosting::new(
                TwoArgumentsCosting::linear_in_x(
                    cost_map["rotateByteString-memory-arguments-intercept"],
                    cost_map["rotateByteString-memory-arguments-slope"],
                ),
                TwoArgumentsCosting::linear_in_x(
                    cost_map["rotateByteString-cpu-arguments-intercept"],
                    cost_map["rotateByteString-cpu-arguments-slope"],
                ),
            ),

            count_set_bits: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["countSetBits-memory-arguments"]),
                OneArgumentCosting::linear_cost(
                    cost_map["countSetBits-cpu-arguments-intercept"],
                    cost_map["countSetBits-cpu-arguments-slope"],
                ),
            ),

            find_first_set_bit: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["findFirstSetBit-memory-arguments"]),
                OneArgumentCosting::linear_cost(
                    cost_map["findFirstSetBit-cpu-arguments-intercept"],
                    cost_map["findFirstSetBit-cpu-arguments-slope"],
                ),
            ),

            ripemd_160: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(cost_map["ripemd_160-memory-arguments"]),
                OneArgumentCosting::linear_cost(
                    cost_map["ripemd_160-cpu-arguments-intercept"],
                    cost_map["ripemd_160-cpu-arguments-slope"],
                ),
            ),

            exp_mod_integer: ThreeArgumentsCosting::new(
                ThreeArgumentsCosting::linear_in_z(0, 1),
                ThreeArgumentsCosting::exp_mod_cost(607153, 231697, 53144),
            ),

            drop_list: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(4),
                TwoArgumentsCosting::linear_in_x(116711, 1957),
            ),
            length_of_array: OneArgumentCosting::new(
                OneArgumentCosting::constant_cost(10),
                OneArgumentCosting::constant_cost(198994),
            ),
            list_to_array: TwoArgumentsCosting::new(
                TwoArgumentsCosting::linear_in_x(7, 1),
                TwoArgumentsCosting::linear_in_x(307802, 8496),
            ),
            index_array: TwoArgumentsCosting::new(
                TwoArgumentsCosting::constant_cost(32),
                TwoArgumentsCosting::constant_cost(194922),
            ),
        }
    }

    fn get_cost(&self, builtin: DefaultFunction, args: &[i64]) -> Option<ExBudget> {
        match builtin {
            DefaultFunction::AddInteger => Some(ExBudget::new(
                self.add_integer.mem.cost([args[0], args[1]]),
                self.add_integer.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::SubtractInteger => Some(ExBudget::new(
                self.subtract_integer.mem.cost([args[0], args[1]]),
                self.subtract_integer.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::MultiplyInteger => Some(ExBudget::new(
                self.multiply_integer.mem.cost([args[0], args[1]]),
                self.multiply_integer.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::DivideInteger => Some(ExBudget::new(
                self.divide_integer.mem.cost([args[0], args[1]]),
                self.divide_integer.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::QuotientInteger => Some(ExBudget::new(
                self.quotient_integer.mem.cost([args[0], args[1]]),
                self.quotient_integer.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::RemainderInteger => Some(ExBudget::new(
                self.remainder_integer.mem.cost([args[0], args[1]]),
                self.remainder_integer.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::ModInteger => Some(ExBudget::new(
                self.mod_integer.mem.cost([args[0], args[1]]),
                self.mod_integer.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::EqualsInteger => Some(ExBudget::new(
                self.equals_integer.mem.cost([args[0], args[1]]),
                self.equals_integer.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::LessThanInteger => Some(ExBudget::new(
                self.less_than_integer.mem.cost([args[0], args[1]]),
                self.less_than_integer.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::LessThanEqualsInteger => Some(ExBudget::new(
                self.less_than_equals_integer.mem.cost([args[0], args[1]]),
                self.less_than_equals_integer.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::AppendByteString => Some(ExBudget::new(
                self.append_byte_string.mem.cost([args[0], args[1]]),
                self.append_byte_string.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::ConsByteString => Some(ExBudget::new(
                self.cons_byte_string.mem.cost([args[0], args[1]]),
                self.cons_byte_string.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::SliceByteString => Some(ExBudget::new(
                self.slice_byte_string.mem.cost([args[0], args[1], args[2]]),
                self.slice_byte_string.cpu.cost([args[0], args[1], args[2]]),
            )),
            DefaultFunction::LengthOfByteString => Some(ExBudget::new(
                self.length_of_byte_string.mem.cost([args[0]]),
                self.length_of_byte_string.cpu.cost([args[0]]),
            )),
            DefaultFunction::IndexByteString => Some(ExBudget::new(
                self.index_byte_string.mem.cost([args[0], args[1]]),
                self.index_byte_string.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::EqualsByteString => Some(ExBudget::new(
                self.equals_byte_string.mem.cost([args[0], args[1]]),
                self.equals_byte_string.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::LessThanByteString => Some(ExBudget::new(
                self.less_than_byte_string.mem.cost([args[0], args[1]]),
                self.less_than_byte_string.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::LessThanEqualsByteString => Some(ExBudget::new(
                self.less_than_equals_byte_string
                    .mem
                    .cost([args[0], args[1]]),
                self.less_than_equals_byte_string
                    .cpu
                    .cost([args[0], args[1]]),
            )),
            DefaultFunction::Sha2_256 => Some(ExBudget::new(
                self.sha2_256.mem.cost([args[0]]),
                self.sha2_256.cpu.cost([args[0]]),
            )),
            DefaultFunction::Sha3_256 => Some(ExBudget::new(
                self.sha3_256.mem.cost([args[0]]),
                self.sha3_256.cpu.cost([args[0]]),
            )),
            DefaultFunction::Blake2b_224 => Some(ExBudget::new(
                self.blake2b_224.mem.cost([args[0]]),
                self.blake2b_224.cpu.cost([args[0]]),
            )),
            DefaultFunction::Blake2b_256 => Some(ExBudget::new(
                self.blake2b_256.mem.cost([args[0]]),
                self.blake2b_256.cpu.cost([args[0]]),
            )),
            DefaultFunction::Keccak_256 => Some(ExBudget::new(
                self.keccak_256.mem.cost([args[0]]),
                self.keccak_256.cpu.cost([args[0]]),
            )),
            DefaultFunction::VerifyEd25519Signature => Some(ExBudget::new(
                self.verify_ed25519_signature
                    .mem
                    .cost([args[0], args[1], args[2]]),
                self.verify_ed25519_signature
                    .cpu
                    .cost([args[0], args[1], args[2]]),
            )),
            DefaultFunction::VerifyEcdsaSecp256k1Signature => Some(ExBudget::new(
                self.verify_ecdsa_secp256k1_signature
                    .mem
                    .cost([args[0], args[1], args[2]]),
                self.verify_ecdsa_secp256k1_signature
                    .cpu
                    .cost([args[0], args[1], args[2]]),
            )),
            DefaultFunction::VerifySchnorrSecp256k1Signature => Some(ExBudget::new(
                self.verify_schnorr_secp256k1_signature
                    .mem
                    .cost([args[0], args[1], args[2]]),
                self.verify_schnorr_secp256k1_signature
                    .cpu
                    .cost([args[0], args[1], args[2]]),
            )),
            DefaultFunction::AppendString => Some(ExBudget::new(
                self.append_string.mem.cost([args[0], args[1]]),
                self.append_string.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::EqualsString => Some(ExBudget::new(
                self.equals_string.mem.cost([args[0], args[1]]),
                self.equals_string.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::EncodeUtf8 => Some(ExBudget::new(
                self.encode_utf8.mem.cost([args[0]]),
                self.encode_utf8.cpu.cost([args[0]]),
            )),
            DefaultFunction::DecodeUtf8 => Some(ExBudget::new(
                self.decode_utf8.mem.cost([args[0]]),
                self.decode_utf8.cpu.cost([args[0]]),
            )),
            DefaultFunction::IfThenElse => Some(ExBudget::new(
                self.if_then_else.mem.cost([args[0], args[1], args[2]]),
                self.if_then_else.cpu.cost([args[0], args[1], args[2]]),
            )),
            DefaultFunction::ChooseUnit => Some(ExBudget::new(
                self.choose_unit.mem.cost([args[0], args[1]]),
                self.choose_unit.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::Trace => Some(ExBudget::new(
                self.trace.mem.cost([args[0], args[1]]),
                self.trace.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::FstPair => Some(ExBudget::new(
                self.fst_pair.mem.cost([args[0]]),
                self.fst_pair.cpu.cost([args[0]]),
            )),
            DefaultFunction::SndPair => Some(ExBudget::new(
                self.snd_pair.mem.cost([args[0]]),
                self.snd_pair.cpu.cost([args[0]]),
            )),
            DefaultFunction::ChooseList => Some(ExBudget::new(
                self.choose_list.mem.cost([args[0], args[1], args[2]]),
                self.choose_list.cpu.cost([args[0], args[1], args[2]]),
            )),
            DefaultFunction::MkCons => Some(ExBudget::new(
                self.mk_cons.mem.cost([args[0], args[1]]),
                self.mk_cons.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::HeadList => Some(ExBudget::new(
                self.head_list.mem.cost([args[0]]),
                self.head_list.cpu.cost([args[0]]),
            )),
            DefaultFunction::TailList => Some(ExBudget::new(
                self.tail_list.mem.cost([args[0]]),
                self.tail_list.cpu.cost([args[0]]),
            )),
            DefaultFunction::NullList => Some(ExBudget::new(
                self.null_list.mem.cost([args[0]]),
                self.null_list.cpu.cost([args[0]]),
            )),
            DefaultFunction::ChooseData => Some(ExBudget::new(
                self.choose_data
                    .mem
                    .cost([args[0], args[1], args[2], args[3], args[4], args[5]]),
                self.choose_data
                    .cpu
                    .cost([args[0], args[1], args[2], args[3], args[4], args[5]]),
            )),
            DefaultFunction::ConstrData => Some(ExBudget::new(
                self.constr_data.mem.cost([args[0], args[1]]),
                self.constr_data.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::MapData => Some(ExBudget::new(
                self.map_data.mem.cost([args[0]]),
                self.map_data.cpu.cost([args[0]]),
            )),
            DefaultFunction::ListData => Some(ExBudget::new(
                self.list_data.mem.cost([args[0]]),
                self.list_data.cpu.cost([args[0]]),
            )),
            DefaultFunction::IData => Some(ExBudget::new(
                self.i_data.mem.cost([args[0]]),
                self.i_data.cpu.cost([args[0]]),
            )),
            DefaultFunction::BData => Some(ExBudget::new(
                self.b_data.mem.cost([args[0]]),
                self.b_data.cpu.cost([args[0]]),
            )),
            DefaultFunction::UnConstrData => Some(ExBudget::new(
                self.un_constr_data.mem.cost([args[0]]),
                self.un_constr_data.cpu.cost([args[0]]),
            )),
            DefaultFunction::UnMapData => Some(ExBudget::new(
                self.un_map_data.mem.cost([args[0]]),
                self.un_map_data.cpu.cost([args[0]]),
            )),
            DefaultFunction::UnListData => Some(ExBudget::new(
                self.un_list_data.mem.cost([args[0]]),
                self.un_list_data.cpu.cost([args[0]]),
            )),
            DefaultFunction::UnIData => Some(ExBudget::new(
                self.un_i_data.mem.cost([args[0]]),
                self.un_i_data.cpu.cost([args[0]]),
            )),
            DefaultFunction::UnBData => Some(ExBudget::new(
                self.un_b_data.mem.cost([args[0]]),
                self.un_b_data.cpu.cost([args[0]]),
            )),
            DefaultFunction::EqualsData => Some(ExBudget::new(
                self.equals_data.mem.cost([args[0], args[1]]),
                self.equals_data.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::MkPairData => Some(ExBudget::new(
                self.mk_pair_data.mem.cost([args[0], args[1]]),
                self.mk_pair_data.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::MkNilData => Some(ExBudget::new(
                self.mk_nil_data.mem.cost([args[0]]),
                self.mk_nil_data.cpu.cost([args[0]]),
            )),
            DefaultFunction::MkNilPairData => Some(ExBudget::new(
                self.mk_nil_pair_data.mem.cost([args[0]]),
                self.mk_nil_pair_data.cpu.cost([args[0]]),
            )),
            DefaultFunction::SerialiseData => Some(ExBudget::new(
                self.serialise_data.mem.cost([args[0]]),
                self.serialise_data.cpu.cost([args[0]]),
            )),
            DefaultFunction::Bls12_381_G1_Add => Some(ExBudget::new(
                self.bls12_381_g1_add.mem.cost([args[0], args[1]]),
                self.bls12_381_g1_add.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::Bls12_381_G1_Neg => Some(ExBudget::new(
                self.bls12_381_g1_neg.mem.cost([args[0]]),
                self.bls12_381_g1_neg.cpu.cost([args[0]]),
            )),
            DefaultFunction::Bls12_381_G1_ScalarMul => Some(ExBudget::new(
                self.bls12_381_g1_scalar_mul.mem.cost([args[0], args[1]]),
                self.bls12_381_g1_scalar_mul.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::Bls12_381_G1_Equal => Some(ExBudget::new(
                self.bls12_381_g1_equal.mem.cost([args[0], args[1]]),
                self.bls12_381_g1_equal.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::Bls12_381_G1_Compress => Some(ExBudget::new(
                self.bls12_381_g1_compress.mem.cost([args[0]]),
                self.bls12_381_g1_compress.cpu.cost([args[0]]),
            )),
            DefaultFunction::Bls12_381_G1_Uncompress => Some(ExBudget::new(
                self.bls12_381_g1_uncompress.mem.cost([args[0]]),
                self.bls12_381_g1_uncompress.cpu.cost([args[0]]),
            )),
            DefaultFunction::Bls12_381_G1_HashToGroup => Some(ExBudget::new(
                self.bls12_381_g1_hash_to_group.mem.cost([args[0], args[1]]),
                self.bls12_381_g1_hash_to_group.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::Bls12_381_G2_Add => Some(ExBudget::new(
                self.bls12_381_g2_add.mem.cost([args[0], args[1]]),
                self.bls12_381_g2_add.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::Bls12_381_G2_Neg => Some(ExBudget::new(
                self.bls12_381_g2_neg.mem.cost([args[0]]),
                self.bls12_381_g2_neg.cpu.cost([args[0]]),
            )),
            DefaultFunction::Bls12_381_G2_ScalarMul => Some(ExBudget::new(
                self.bls12_381_g2_scalar_mul.mem.cost([args[0], args[1]]),
                self.bls12_381_g2_scalar_mul.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::Bls12_381_G2_Equal => Some(ExBudget::new(
                self.bls12_381_g2_equal.mem.cost([args[0], args[1]]),
                self.bls12_381_g2_equal.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::Bls12_381_G2_Compress => Some(ExBudget::new(
                self.bls12_381_g2_compress.mem.cost([args[0]]),
                self.bls12_381_g2_compress.cpu.cost([args[0]]),
            )),
            DefaultFunction::Bls12_381_G2_Uncompress => Some(ExBudget::new(
                self.bls12_381_g2_uncompress.mem.cost([args[0]]),
                self.bls12_381_g2_uncompress.cpu.cost([args[0]]),
            )),
            DefaultFunction::Bls12_381_G2_HashToGroup => Some(ExBudget::new(
                self.bls12_381_g2_hash_to_group.mem.cost([args[0], args[1]]),
                self.bls12_381_g2_hash_to_group.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::Bls12_381_MillerLoop => Some(ExBudget::new(
                self.bls12_381_miller_loop.mem.cost([args[0], args[1]]),
                self.bls12_381_miller_loop.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::Bls12_381_MulMlResult => Some(ExBudget::new(
                self.bls12_381_mul_ml_result.mem.cost([args[0], args[1]]),
                self.bls12_381_mul_ml_result.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::Bls12_381_FinalVerify => Some(ExBudget::new(
                self.bls12_381_final_verify.mem.cost([args[0], args[1]]),
                self.bls12_381_final_verify.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::IntegerToByteString => Some(ExBudget::new(
                self.integer_to_byte_string
                    .mem
                    .cost([args[0], args[1], args[2]]),
                self.integer_to_byte_string
                    .cpu
                    .cost([args[0], args[1], args[2]]),
            )),
            DefaultFunction::ByteStringToInteger => Some(ExBudget::new(
                self.byte_string_to_integer.mem.cost([args[0], args[1]]),
                self.byte_string_to_integer.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::AndByteString => Some(ExBudget::new(
                self.and_byte_string.mem.cost([args[0], args[1], args[2]]),
                self.and_byte_string.cpu.cost([args[0], args[1], args[2]]),
            )),
            DefaultFunction::OrByteString => Some(ExBudget::new(
                self.or_byte_string.mem.cost([args[0], args[1], args[2]]),
                self.or_byte_string.cpu.cost([args[0], args[1], args[2]]),
            )),
            DefaultFunction::XorByteString => Some(ExBudget::new(
                self.xor_byte_string.mem.cost([args[0], args[1], args[2]]),
                self.xor_byte_string.cpu.cost([args[0], args[1], args[2]]),
            )),
            DefaultFunction::ComplementByteString => Some(ExBudget::new(
                self.complement_byte_string.mem.cost([args[0]]),
                self.complement_byte_string.cpu.cost([args[0]]),
            )),
            DefaultFunction::ReadBit => Some(ExBudget::new(
                self.read_bit.mem.cost([args[0], args[1]]),
                self.read_bit.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::WriteBits => Some(ExBudget::new(
                self.write_bits.mem.cost([args[0], args[1], args[2]]),
                self.write_bits.cpu.cost([args[0], args[1], args[2]]),
            )),
            DefaultFunction::ReplicateByte => Some(ExBudget::new(
                self.replicate_byte.mem.cost([args[0], args[1]]),
                self.replicate_byte.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::ShiftByteString => Some(ExBudget::new(
                self.shift_byte_string.mem.cost([args[0], args[1]]),
                self.shift_byte_string.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::RotateByteString => Some(ExBudget::new(
                self.rotate_byte_string.mem.cost([args[0], args[1]]),
                self.rotate_byte_string.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::CountSetBits => Some(ExBudget::new(
                self.count_set_bits.mem.cost([args[0]]),
                self.count_set_bits.cpu.cost([args[0]]),
            )),
            DefaultFunction::FindFirstSetBit => Some(ExBudget::new(
                self.find_first_set_bit.mem.cost([args[0]]),
                self.find_first_set_bit.cpu.cost([args[0]]),
            )),
            DefaultFunction::Ripemd_160 => Some(ExBudget::new(
                self.ripemd_160.mem.cost([args[0]]),
                self.ripemd_160.cpu.cost([args[0]]),
            )),
            DefaultFunction::ExpModInteger => Some(ExBudget::new(
                self.exp_mod_integer.mem.cost([args[0], args[1], args[2]]),
                self.exp_mod_integer.cpu.cost([args[0], args[1], args[2]]),
            )),
            DefaultFunction::DropList => Some(ExBudget::new(
                self.drop_list.mem.cost([args[0], args[1]]),
                self.drop_list.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::LengthOfArray => Some(ExBudget::new(
                self.length_of_array.mem.cost([args[0]]),
                self.length_of_array.cpu.cost([args[0]]),
            )),
            DefaultFunction::ListToArray => Some(ExBudget::new(
                self.list_to_array.mem.cost([args[0], args[1]]),
                self.list_to_array.cpu.cost([args[0], args[1]]),
            )),
            DefaultFunction::IndexArray => Some(ExBudget::new(
                self.index_array.mem.cost([args[0], args[1]]),
                self.index_array.cpu.cost([args[0], args[1]]),
            )),
        }
    }
}