-
Notifications
You must be signed in to change notification settings - Fork 6
/
2023-02-05_ESXiArgs_decompiled
2023 lines (1992 loc) · 98.6 KB
/
2023-02-05_ESXiArgs_decompiled
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
#include <dlfcn.h>
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
// ---------------- Integer Types Definitions -----------------
typedef int64_t int128_t;
// ----------------- Float Types Definitions ------------------
typedef double float64_t;
// ------------------------ Structures ------------------------
struct _IO_FILE {
int32_t e0;
};
// ------------------- Function Prototypes --------------------
int64_t create_rsa_obj(int64_t a1, int64_t * a2);
int64_t decode32le(int64_t * a1);
int64_t encode32le(int64_t a1, uint32_t a2);
int64_t encrypt_file(int64_t a1, int64_t a2, int64_t a3, int64_t a4, int64_t a5);
int64_t encrypt_simple(int32_t fd, int64_t a2, int64_t a3, int64_t * a4, int64_t a5, int64_t a6);
int64_t gen_stream_key(int64_t * a1, int64_t a2);
int64_t get_file_curr_size(int32_t fd, int64_t * a2);
int64_t get_pk_data(int64_t a1, int64_t * a2);
int64_t init_libssl(void);
int64_t open_read(int64_t path);
int64_t open_read_write(int64_t path);
int64_t print_error(char * a1, int64_t a2);
int64_t print_error_ex(char * a1, int64_t a2);
int64_t rsa_encrypt(int64_t a1, int64_t * a2, int64_t a3, int64_t * a4, int64_t * a5);
int64_t sosemanuk_encrypt(int64_t * a1, int64_t a2, int64_t a3, uint64_t a4);
int64_t sosemanuk_init(int64_t * a1, int64_t * a2, int64_t a3, uint64_t a4);
int64_t sosemanuk_internal(int64_t a1);
int64_t sosemanuk_schedule(int64_t * a1, int64_t a2, uint64_t a3);
int64_t xorbuf(int64_t a1, int64_t a2, int64_t a3, int64_t a4);
// --------------------- Global Variables ---------------------
// Detected cryptographic pattern: SOSEMANUK_mul_a (32-bit, little endian)
int32_t SOSEMANUK_mul_a_at_6092e0[256] = {0, -0x1e6030ed, 0x6b973726, -0x75f707cb, -0x297891b4, 0x3718a15f, -0x42efa696, 0x5c8f9679, 0x5a7dc98, -0x1bc7ec75, 0x6e30ebbe, -0x7050db53, -0x2cdf4d2c, 0x32bf7dc7, -0x47487a0e, 0x59284ae1, 0xae71199, -0x14872176, 0x617026bf, -0x7f101654, -0x239f802b, 0x3dffb0c6, -0x4808b70d, 0x566887e0, 0xf40cd01, -0x1120fdee, 0x64d7fa27, -0x7ab7cacc, -0x26385cb3, 0x38586c5e, -0x4daf6b95, 0x53cf5b78, 0x1467229b, -0xa071278, 0x7ff015bd, -0x61902552, -0x3d1fb329, 0x237f83c4, -0x5688840f, 0x48e8b4e2, 0x11c0fe03, -0xfa0cef0, 0x7a57c925, -0x6437f9ca, -0x38b86fb1, 0x26d85f5c, -0x532f5897, 0x4d4f687a, 0x1e803302, -0xe003ef, 0x75170424, -0x6b7734c9, -0x37f8a2b2, 0x2998925d, -0x5c6f9598, 0x420fa57b, 0x1b27ef9a, -0x547df77, 0x70b0d8bc, -0x6ed0e851, -0x325f7e2a, 0x2c3f4ec5, -0x59c84910, 0x47a879e3, 0x28ce449f, -0x36ae7474, 0x435973b9, -0x5d394356, -0x1b6d52d, 0x1fd6e5c0, -0x6a21e20b, 0x7441d2e6, 0x2d699807, -0x3309a8ec, 0x46feaf21, -0x589e9fce, -0x41109b5, 0x1a713958, -0x6f863e93, 0x71e60e7e, 0x22295506, -0x3c4965eb, 0x49be6220, -0x57de52cd, -0xb51c4b6, 0x1531f459, -0x60c6f394, 0x7ea6c37f, 0x278e899e, -0x39eeb973, 0x4c19beb8, -0x52798e55, -0xef6182e, 0x109628c1, -0x65612f0c, 0x7b011fe7, 0x3ca96604, -0x22c956e9, 0x573e5122, -0x495e61cf, -0x15d1f7b8, 0xbb1c75b, -0x7e46c092, 0x6026f07d, 0x390eba9c, -0x276e8a71, 0x52998dba, -0x4cf9bd57, -0x10762b30, 0xe161bc3, -0x7be11c0a, 0x65812ce5, 0x364e779d, -0x282e4772, 0x5dd940bb, -0x43b97058, -0x1f36e62f, 0x156d6c2, -0x74a1d109, 0x6ac1e1e4, 0x33e9ab05, -0x2d899bea, 0x587e9c23, -0x461eacd0, -0x1a913ab7, 0x4f10a5a, -0x71060d91, 0x6f663d7c, 0x50358897, -0x4e55b87c, 0x3ba2bfb1, -0x25c28f5e, -0x794d1925, 0x672d29c8, -0x12da2e03, 0xcba1eee, 0x5592540f, -0x4bf264e4, 0x3e056329, -0x206553c6, -0x7ceac5bd, 0x628af550, -0x177df29b, 0x91dc276, 0x5ad2990e, -0x44b2a9e3, 0x3145ae28, -0x2f259ec5, -0x73aa08be, 0x6dca3851, -0x183d3f9c, 0x65d0f77, 0x5f754596, -0x4115757b, 0x34e272b0, -0x2a82425d, -0x760dd426, 0x686de4c9, -0x1d9ae304, 0x3fad3ef, 0x4452aa0c, -0x5a329ae1, 0x2fc59d2a, -0x31a5adc7, -0x6d2a3bc0, 0x734a0b53, -0x6bd0c9a, 0x18dd3c75, 0x41f57694, -0x5f954679, 0x2a6241b2, -0x3402715f, -0x688de728, 0x76edd7cb, -0x31ad002, 0x1d7ae0ed, 0x4eb5bb95, -0x50d58b7a, 0x25228cb3, -0x3b42bc60, -0x67cd2a27, 0x79ad1aca, -0xc5a1d01, 0x123a2dec, 0x4b12670d, -0x557257e2, 0x2085502b, -0x3ee560c8, -0x626af6bf, 0x7c0ac652, -0x9fdc199, 0x179df174, 0x78fbcc08, -0x669bfce5, 0x136cfb2e, -0xd0ccbc3, -0x51835dbc, 0x4fe36d57, -0x3a146a9e, 0x24745a71, 0x7d5c1090, -0x633c207d, 0x16cb27b6, -0x8ab175b, -0x54248124, 0x4a44b1cf, -0x3fb3b606, 0x21d386e9, 0x721cdd91, -0x6c7ced7e, 0x198beab7, -0x7ebda5c, -0x5b644c23, 0x45047cce, -0x30f37b05, 0x2e934be8, 0x77bb0109, -0x69db31e6, 0x1c2c362f, -0x24c06c4, -0x5ec390bb, 0x40a3a056, -0x3554a79d, 0x2b349770, 0x6c9cee93, -0x72fcde80, 0x70bd9b5, -0x196be95a, -0x45e47f21, 0x5b844fcc, -0x2e734807, 0x301378ea, 0x693b320b, -0x775b02e8, 0x2ac052d, -0x1ccc35c2, -0x4043a3b9, 0x5e239354, -0x2bd4949f, 0x35b4a472, 0x667bff0a, -0x781bcfe7, 0xdecc82c, -0x138cf8c1, -0x4f036eba, 0x51635e55, -0x249459a0, 0x3af46973, 0x63dc2392, -0x7dbc137f, 0x84b14b4, -0x162b2459, -0x4aa4b222, 0x54c482cd, -0x21338508, 0x3f53b5eb}; // 0x6092e0
// Detected cryptographic pattern: SOSEMANUK_mul_ia (32-bit, little endian)
int32_t SOSEMANUK_mul_ia_at_6096e0[256] = {0, 0x180f40cd, 0x301e8033, 0x2811c0fe, 0x603ca966, 0x7833e9ab, 0x50222955, 0x482d6998, -0x3f870434, -0x278844ff, -0xf998401, -0x1796c4ce, -0x5fbbad56, -0x47b4ed99, -0x6fa52d67, -0x77aa6dac, 0x29f05f31, 0x31ff1ffc, 0x19eedf02, 0x1e19fcf, 0x49ccf657, 0x51c3b69a, 0x79d27664, 0x61dd36a9, -0x16775b03, -0xe781bd0, -0x2669db32, -0x3e669bfd, -0x764bf265, -0x6e44b2aa, -0x46557258, -0x5e5a329b, 0x5249be62, 0x4a46feaf, 0x62573e51, 0x7a587e9c, 0x32751704, 0x2a7a57c9, 0x26b9737, 0x1a64d7fa, -0x6dceba52, -0x75c1fa9d, -0x5dd03a63, -0x45df7ab0, -0xdf21338, -0x15fd53fb, -0x3dec9305, -0x25e3d3ca, 0x7bb9e153, 0x63b6a19e, 0x4ba76160, 0x53a821ad, 0x1b854835, 0x38a08f8, 0x2b9bc806, 0x339488cb, -0x443ee561, -0x5c31a5ae, -0x74206554, -0x6c2f259f, -0x24024c07, -0x3c0d0ccc, -0x141ccc36, -0xc138cf9, -0x5b6d2a3c, -0x43626af7, -0x6b73aa09, -0x737ceac6, -0x3b51835e, -0x235ec391, -0xb4f036f, -0x134043a4, 0x64ea2e08, 0x7ce56ec5, 0x54f4ae3b, 0x4cfbeef6, 0x4d6876e, 0x1cd9c7a3, 0x34c8075d, 0x2cc74790, -0x729d750b, -0x6a9235c8, -0x4283f53a, -0x5a8cb5f5, -0x12a1dc6d, -0xaae9ca2, -0x22bf5c60, -0x3ab01c93, 0x4d1a7139, 0x551531f4, 0x7d04f10a, 0x650bb1c7, 0x2d26d85f, 0x35299892, 0x1d38586c, 0x53718a1, -0x924945a, -0x112bd495, -0x393a146b, -0x213554a8, -0x69183d40, -0x71177df3, -0x5906bd0d, -0x4109fdc2, 0x36a3906a, 0x2eacd0a7, 0x6bd1059, 0x1eb25094, 0x569f390c, 0x4e9079c1, 0x6681b93f, 0x7e8ef9f2, -0x20d4cb69, -0x38db8ba6, -0x10ca4b5c, -0x8c50b97, -0x40e8620f, -0x58e722c4, -0x70f6e23e, -0x68f9a2f1, 0x1f53cf5b, 0x75c8f96, 0x2f4d4f68, 0x37420fa5, 0x7f6f663d, 0x676026f0, 0x4f71e60e, 0x577ea6c3, -0x1e72fcdf, -0x67dbc14, -0x2e6c7cee, -0x36633c21, -0x7e4e55b9, -0x66411576, -0x4e50d58c, -0x565f9547, 0x21f5f8ed, 0x39fab820, 0x11eb78de, 0x9e43813, 0x41c9518b, 0x59c61146, 0x71d7d1b8, 0x69d89175, -0x3782a3f0, -0x2f8de323, -0x79c23dd, -0x1f936312, -0x57be0a8a, -0x4fb14a45, -0x67a08abb, -0x7fafca78, 0x805a7dc, 0x100ae711, 0x381b27ef, 0x20146722, 0x68390eba, 0x70364e77, 0x58278e89, 0x4028ce44, -0x4c3b42bd, -0x54340272, -0x7c25c290, -0x642a8243, -0x2c07ebdb, -0x3408ab18, -0x1c196bea, -0x4162b25, 0x73bc468f, 0x6bb30642, 0x43a2c6bc, 0x5bad8671, 0x1380efe9, 0xb8faf24, 0x239e6fda, 0x3b912f17, -0x65cb1d8e, -0x7dc45d41, -0x55d59dbf, -0x4ddadd74, -0x5f7b4ec, -0x1df8f427, -0x35e934d9, -0x2de67416, 0x5a4c19be, 0x42435973, 0x6a52998d, 0x725dd940, 0x3a70b0d8, 0x227ff015, 0xa6e30eb, 0x12617026, 0x451fd6e5, 0x5d109628, 0x750156d6, 0x6d0e161b, 0x25237f83, 0x3d2c3f4e, 0x153dffb0, 0xd32bf7d, -0x7a98d2d7, -0x6297921c, -0x4a8652e6, -0x52891229, -0x1aa47bb1, -0x2ab3b7e, -0x2abafb84, -0x32b5bb4f, 0x6cef89d4, 0x74e0c919, 0x5cf109e7, 0x44fe492a, 0xcd320b2, 0x14dc607f, 0x3ccda081, 0x24c2e04c, -0x53688de8, -0x4b67cd2b, -0x63760dd5, -0x7b794d1a, -0x33542482, -0x2b5b644d, -0x34aa4b3, -0x1b45e480, 0x17566887, 0xf59284a, 0x2748e8b4, 0x3f47a879, 0x776ac1e1, 0x6f65812c, 0x477441d2, 0x5f7b011f, -0x28d16cb5, -0x30de2c7a, -0x18cfec88, -0xc0ac4b, -0x48edc5d3, -0x50e28520, -0x78f345e2, -0x60fc052d, 0x3ea637b6, 0x26a9777b, 0xeb8b785, 0x16b7f748, 0x5e9a9ed0, 0x4695de1d, 0x6e841ee3, 0x768b5e2e, -0x1213386, -0x192e7349, -0x313fb3b7, -0x2930f37c, -0x611d9ae4, -0x7912da2f, -0x51031ad1, -0x490c5a1e}; // 0x6096e0
struct _IO_FILE * g1 = NULL; // 0x609ae0
int64_t g2 = 0; // 0x609af0
int32_t g3 = 0; // 0x609af8
int32_t g4 = 0; // 0x609b00
int64_t g5 = 0; // 0x609b08
int64_t g6 = 0; // 0x609b10
int64_t g7 = 0; // 0x609b18
int64_t g8 = 0; // 0x609b20
int64_t g9 = 0; // 0x609b28
int64_t g10 = 0; // 0x609b30
int64_t g11 = 0; // 0x609b38
int32_t g12;
// ------------------------ Functions -------------------------
// Address range: 0x400b98 - 0x400dfa
int64_t init_libssl(void) {
int64_t v1 = __readfsqword(40); // 0x400ba0
int64_t * v2 = dlopen("libssl.so", RTLD_NOW); // 0x400bb9
int64_t v3 = (int64_t)v2; // 0x400bb9
g2 = v3;
int64_t v4 = v3; // 0x400bcf
int64_t v5; // 0x400b98
if (v2 != NULL) {
goto lab_0x400c33;
} else {
int64_t v6 = 0;
int64_t str; // bp-56, 0x400b98
sprintf((char *)&str, "libssl.so.%d", v6);
int64_t * v7 = dlopen((char *)&str, RTLD_NOW); // 0x400bf9
v4 = (int64_t)v7;
g2 = v4;
v6++;
while (v6 < 16 == v7 == NULL) {
// 0x400bda
sprintf((char *)&str, "libssl.so.%d", v6);
v7 = dlopen((char *)&str, RTLD_NOW);
v4 = (int64_t)v7;
g2 = v4;
v6++;
}
// 0x400c1b
v5 = 1;
if (v7 != NULL) {
goto lab_0x400c33;
} else {
goto lab_0x400de1;
}
}
lab_0x400c33:;
int64_t * v8 = dlsym((int64_t *)v4, "BIO_new_mem_buf"); // 0x400c3f
g11 = (int64_t)v8;
v5 = 2;
if (v8 != NULL) {
int64_t * v9 = dlsym((int64_t *)g2, "ERR_get_error"); // 0x400c6f
g9 = (int64_t)v9;
v5 = 3;
if (v9 != NULL) {
int64_t * v10 = dlsym((int64_t *)g2, "ERR_error_string"); // 0x400c9f
g7 = (int64_t)v10;
v5 = 4;
if (v10 != NULL) {
int64_t * v11 = dlsym((int64_t *)g2, "PEM_read_bio_RSA_PUBKEY"); // 0x400ccf
g10 = (int64_t)v11;
v5 = 5;
if (v11 != NULL) {
int64_t * v12 = dlsym((int64_t *)g2, "PEM_read_bio_RSAPrivateKey"); // 0x400cff
g5 = (int64_t)v12;
v5 = 6;
if (v12 != NULL) {
int64_t v13 = (int64_t)dlsym((int64_t *)g2, "RAND_pseudo_bytes"); // 0x400d2f
g3 = v13;
v5 = 7;
if ((v13 & 0xffffffff) != 0) {
int64_t * v14 = dlsym((int64_t *)g2, "RSA_public_encrypt"); // 0x400d5f
g6 = (int64_t)v14;
v5 = 8;
if (v14 != NULL) {
int64_t * v15 = dlsym((int64_t *)g2, "RSA_private_decrypt"); // 0x400d8c
g8 = (int64_t)v15;
v5 = 9;
if (v15 != NULL) {
int64_t v16 = (int64_t)dlsym((int64_t *)g2, "RSA_size"); // 0x400db9
g4 = v16;
v5 = (v16 & 0xffffffff) != 0 ? 0 : 10;
}
}
}
}
}
}
}
}
goto lab_0x400de1;
lab_0x400de1:;
int64_t result = v5; // 0x400df1
if (v1 != __readfsqword(40)) {
// 0x400df3
__stack_chk_fail();
result = &g12;
}
// 0x400df8
return result;
}
// Address range: 0x400dfa - 0x400e40
int64_t print_error(char * a1, int64_t a2) {
int32_t chars_printed; // 0x400dfa
if ((int32_t)a2 == 0) {
// 0x400e2b
chars_printed = printf("[ %s ] - FAIL\n", a1);
} else {
// 0x400e0f
chars_printed = printf("[ %s ] - FAIL { Errno: %d }\n", a1, (int64_t)*__errno_location());
}
// 0x400e3e
return chars_printed;
}
// Address range: 0x400e40 - 0x400ee2
int64_t print_error_ex(char * a1, int64_t a2) {
int64_t v1 = __readfsqword(40); // 0x400e58
if ((int32_t)a2 == 0) {
// 0x400eb6
printf("[ %s ] - FAIL\n", a1);
} else {
// 0x400e70
int64_t v2; // bp-152, 0x400e40
printf("[ %s ] - FAIL { %s }\n", a1, &v2);
}
int64_t result = 0; // 0x400ed9
if (v1 != __readfsqword(40)) {
// 0x400edb
__stack_chk_fail();
result = &g12;
}
// 0x400ee0
return result;
}
// Address range: 0x400ee2 - 0x400f1e
int64_t open_read(int64_t path) {
uint32_t fd = open((char *)path, O_RDONLY); // 0x400efc
if (fd == -1) {
// 0x400f0a
print_error("open", 1);
}
// 0x400f19
return fd;
}
// Address range: 0x400f5f - 0x400fa0
int64_t open_read_write(int64_t path) {
uint32_t fd = open((char *)path, O_RDWR); // 0x400f7e
if (fd == -1) {
// 0x400f8c
print_error("open", 1);
}
// 0x400f9b
return fd;
}
// Address range: 0x400fa0 - 0x400ffb
int64_t get_file_curr_size(int32_t fd, int64_t * a2) {
int32_t v1 = lseek(fd, 0, SEEK_END); // 0x400fbc
int64_t result; // 0x400fa0
if (v1 != -1) {
// 0x400fe4
*a2 = (int64_t)v1;
result = 0;
} else {
// 0x400fcc
print_error("lseek [end]", 1);
result = 1;
}
// 0x400ff6
return result;
}
// Address range: 0x400ffb - 0x401126
int64_t get_pk_data(int64_t a1, int64_t * a2) {
int32_t fd = open_read(a1); // 0x401014
if (fd == -1) {
// 0x40101d
print_error("open_pk_file", 0);
// 0x401121
return 1;
}
int32_t nbyte = lseek(fd, 0, SEEK_END); // 0x401045
if (nbyte == -1) {
// 0x401055
print_error("lseek [end]", 1);
// 0x401121
return 2;
}
if (nbyte == 0) {
// 0x401077
puts("get_pk_data: key file is empty!");
// 0x401121
return 3;
}
// 0x40108d
*a2 = (int64_t)calloc(nbyte + 1, 1);
if (lseek(fd, 0, SEEK_SET) == -1) {
// 0x4010c9
print_error("lseek [start]", 1);
// 0x401121
return 4;
}
// 0x4010e1
int64_t result; // 0x400ffb
if (read(fd, NULL, nbyte) != -1) {
// 0x401112
close(fd);
result = 0;
} else {
// 0x4010fa
print_error("read", 1);
result = 5;
}
// 0x401121
return result;
}
// Address range: 0x401128 - 0x4011c2
int64_t create_rsa_obj(int64_t a1, int64_t * a2) {
// 0x401128
if (g11 == 0) {
// 0x401155
print_error_ex("BIO_new_mem_buf", 1);
// 0x4011bd
return 1;
}
// 0x40116d
*a2 = 0;
int64_t result = 0; // 0x40119c
if (g10 == 0) {
// 0x40119e
print_error_ex("PEM_read_bio_RSA_PUBKEY", 1);
result = 2;
}
// 0x4011bd
return result;
}
// Address range: 0x4011c2 - 0x401209
int64_t gen_stream_key(int64_t * a1, int64_t a2) {
int64_t result = 0; // 0x4011e3
if (g3 == 0) {
// 0x4011e5
print_error_ex("RAND_pseudo_bytes", 1);
result = 1;
}
// 0x401204
return result;
}
// Address range: 0x401209 - 0x4012c5
int64_t rsa_encrypt(int64_t a1, int64_t * a2, int64_t a3, int64_t * a4, int64_t * a5) {
uint32_t nmemb = g4; // 0x401224
if (nmemb <= (int32_t)a3) {
// 0x401236
puts("encrypt_bytes: too big data");
// 0x4012c0
return 1;
}
// 0x401249
*a4 = (int64_t)calloc(nmemb, 1);
int32_t v1 = (int64_t)a4; // 0x40128f
int64_t result; // 0x401209
if (v1 != -1) {
// 0x4012b0
*(int32_t *)a5 = v1;
result = 0;
} else {
// 0x401298
print_error_ex("RSA_public_encrypt", 1);
result = 2;
}
// 0x4012c0
return result;
}
// Address range: 0x401346 - 0x40186a
int64_t encrypt_simple(int32_t fd, int64_t a2, int64_t a3, int64_t * a4, int64_t a5, int64_t a6) {
int64_t v1 = __readfsqword(40); // 0x40137b
int64_t v2; // bp-632, 0x401346
sosemanuk_schedule(&v2, (int64_t)a4, 0x100000000 * a5 / 0x100000000);
int64_t v3; // bp-168, 0x401346
sosemanuk_init(&v3, &v2, 0, 0);
int64_t v4; // bp-192, 0x401346
int64_t v5; // 0x401346
int64_t * mem; // 0x401435
if ((int32_t)get_file_curr_size(fd, &v4) == 0) {
int64_t v6 = v4; // 0x401405
if (v4 > a6) {
// 0x401407
v4 = a6;
v6 = a6;
}
// 0x401415
v5 = 0;
if (v6 != 0) {
// 0x401430
mem = malloc(0x100000);
if (mem != NULL) {
// 0x401469
if (lseek(fd, 0, SEEK_SET) != -1) {
int64_t v7 = (int64_t)mem; // 0x401435
int64_t offset = 0x100000 * a2; // 0x4014b5
int64_t v8 = 0; // 0x4014c8
int64_t v9 = 0; // 0x4014c8
while (true) {
int64_t v10 = v8;
int64_t v11 = 0;
int64_t v12 = v11; // 0x4015f1
while (v11 < 0x100000 * a3) {
int32_t nbyte = read(fd, mem, 0x100000); // 0x4014f5
if (nbyte == -1) {
// break (via goto) -> 0x40150b
goto lab_0x40150b;
}
int64_t v13 = nbyte; // 0x401529
sosemanuk_encrypt(&v3, v7, v7, v13);
if (lseek(fd, -nbyte, SEEK_CUR) == -1) {
// 0x40156d
print_error("lseek", 1);
v5 = 4;
goto lab_0x401846;
}
// 0x40158b
if (write(fd, mem, nbyte) == -1) {
// 0x4015aa
print_error("write", 1);
v5 = 5;
goto lab_0x401846;
}
int64_t v14 = v11 + v13; // 0x4015cf
v12 = v14;
if (nbyte < 0x100000) {
// break -> 0x4015f7
break;
}
v11 = v14;
v12 = v11;
}
int64_t v15 = v9 + offset + v12; // 0x40160f
if (v15 >= v4) {
goto lab_0x401826_2;
}
// 0x401626
if (lseek(fd, (int32_t)offset, SEEK_CUR) == -1) {
// 0x401643
print_error("lseek", 1);
v5 = 6;
goto lab_0x401846;
}
if (-10 * ((int64_t)(0x66666667 * (int128_t)v10 / 0x8000000000000000) / 4 - (v10 >> 63)) == -v10) {
// 0x4016dc
int64_t v16; // 0x401346
if (v15 < 0) {
// branch -> 0x401733
} else {
// 0x4016f4
v16 = __asm_movsd(__asm_cvtsi2sd(0x100000000 * v15 / 0x100000000));
}
int64_t v17 = __asm_movsd(__asm_mulsd(__asm_movsd_1(0x4059000000000000), v16)); // 0x401743
int64_t v18 = v4; // 0x40174b
int64_t v19; // 0x401346
int64_t v20; // 0x401346
if (v18 < 0) {
int64_t v21 = v18 / 2 | v18 % 2; // 0x40178a
int128_t v22 = __asm_cvtsi2sd(v21); // 0x40178d
v20 = v21;
v19 = __asm_movsd(__asm_addsd(__asm_movapd(v22), v22));
} else {
int128_t v23 = __asm_cvtsi2sd(v18); // 0x401763
v20 = v18;
v19 = __asm_movsd(v23);
}
int64_t v24 = __asm_movsd(__asm_divsd(__asm_movsd_1(v17), v19)); // 0x4017b2
__asm_ucomisd(__asm_movsd_1(v24), 0x4059000000000000);
if (v10 != 0) {
// 0x4017e9
putchar(13);
}
int64_t v25 = v20 == 0 ? v24 : 0x4059000000000000;
printf("Progress: %f", (float64_t)(int64_t)__asm_movsd_1(v25));
}
// 0x40180a
v8 = v10 + 1;
v9 = v15;
if (v15 >= v4) {
goto lab_0x401826_2;
}
}
lab_0x40150b:
// 0x40150b
print_error("fstat", 1);
v5 = 3;
} else {
// 0x40148f
print_error("lseek [start]", 1);
v5 = 10;
}
} else {
// 0x40144b
print_error("malloc", 1);
v5 = 2;
}
}
} else {
// 0x4013d9
print_error("fstat", 1);
v5 = 1;
}
goto lab_0x401846;
lab_0x401826_2:
// 0x401826
putchar(10);
free(mem);
v5 = 0;
goto lab_0x401846;
lab_0x401846:;
int64_t result = v5; // 0x401859
if (v1 != __readfsqword(40)) {
// 0x40185b
__stack_chk_fail();
result = &g12;
}
// 0x401860
return result;
}
// Address range: 0x40186a - 0x4019e8
int64_t encrypt_file(int64_t a1, int64_t a2, int64_t a3, int64_t a4, int64_t a5) {
int64_t v1 = __readfsqword(40); // 0x401886
int32_t fd = open_read_write(a1); // 0x40189e
int64_t v2; // 0x40186a
if (fd != -1) {
// 0x4018c2
int64_t v3; // bp-56, 0x40186a
if ((int32_t)gen_stream_key(&v3, 32) == 0) {
// 0x4018ef
int32_t nbyte; // bp-64, 0x40186a
int64_t buf; // bp-72, 0x40186a
int64_t v4 = rsa_encrypt(a2, &v3, 32, &buf, (int64_t *)&nbyte); // 0x401907
if ((int32_t)v4 == 0) {
// 0x40192b
if ((int32_t)encrypt_simple(fd, a3, a4, &v3, 32, a5) == 0) {
// 0x401968
if (lseek(fd, 0, SEEK_END) != -1) {
// 0x401998
v2 = 0;
if (write(fd, (int64_t *)buf, nbyte) == -1) {
// 0x4019b0
print_error("write", 1);
v2 = 6;
}
} else {
// 0x401980
print_error("lseek", 1);
v2 = 5;
}
} else {
// 0x401950
print_error("encrypt_simple", 0);
v2 = 4;
}
} else {
// 0x401910
print_error("rsa_encrypt", 0);
v2 = 3;
}
} else {
// 0x4018d4
print_error("get_pk_data", 0);
v2 = 2;
}
} else {
// 0x4018a7
print_error("open_read", 1);
v2 = 1;
}
int64_t result = v2; // 0x4019df
if (v1 != __readfsqword(40)) {
// 0x4019e1
__stack_chk_fail();
result = &g12;
}
// 0x4019e6
return result;
}
// Address range: 0x4019e8 - 0x401b6d
int main(int argc, char ** argv) {
uint32_t v1 = (int32_t)argc;
if (v1 <= 2) {
// 0x4019fd
puts("usage: encrypt <public_key> <file_to_encrypt> [<enc_step>] [<enc_size>] [<file_size>]");
puts(" enc_step - number of MB to skip while encryption");
puts(" enc_size - number of MB in encryption block");
puts(" file_size - file size in bytes (for sparse files)\n");
// 0x401b68
return 1;
}
int64_t v2 = 1; // 0x401a4d
int64_t v3 = 0; // 0x401a4d
int64_t str_as_i3 = 0; // 0x401a4d
if (v1 != 3) {
int64_t v4 = (int64_t)argv;
int64_t str_as_i = atoi((char *)*(int64_t *)(v4 + 24)); // 0x401a5f
v2 = 1;
v3 = str_as_i;
str_as_i3 = 0;
if (v1 != 4) {
int64_t str_as_i2 = atoi((char *)*(int64_t *)(v4 + 32)); // 0x401a7b
v2 = str_as_i2;
v3 = str_as_i;
str_as_i3 = 0;
if (v1 >= 6) {
// 0x401a87
v2 = str_as_i2;
v3 = str_as_i;
str_as_i3 = atoi((char *)*(int64_t *)(v4 + 40));
}
}
}
int64_t v5 = init_libssl(); // 0x401a9d
if ((int32_t)v5 != 0) {
// 0x401aab
printf("init_libssl returned %d\n", v5 & 0xffffffff);
// 0x401b68
return 2;
}
int64_t v6 = (int64_t)argv; // 0x401ac9
int64_t v7; // bp-24, 0x4019e8
if ((int32_t)get_pk_data(*(int64_t *)(v6 + 8), &v7) != 0) {
// 0x401ae1
print_error("get_pk_data", 0);
// 0x401b68
return 3;
}
// 0x401af9
int64_t v8; // bp-32, 0x4019e8
if ((int32_t)create_rsa_obj(v7, &v8) != 0) {
// 0x401b0a
print_error("create_rsa_obj", 0);
// 0x401b68
return 4;
}
int64_t v9 = *(int64_t *)(v6 + 16); // 0x401b2e
int64_t result = 0; // 0x401b47
if ((int32_t)encrypt_file(v9, v8, v3, v2, str_as_i3) != 0) {
// 0x401b49
print_error("encrypt_file", 0);
result = 5;
}
// 0x401b68
return result;
}
// Address range: 0x401b70 - 0x4053d1
int64_t sosemanuk_schedule(int64_t * a1, int64_t a2, uint64_t a3) {
int64_t v1 = __readfsqword(40); // 0x401b90
if (a3 >= 33) {
// 0x401bba
fprintf(g1, "invalid key size: %lu\n", (int32_t)a3);
exit(1);
// UNREACHABLE
}
int32_t v2 = a3; // 0x401bf3
int64_t v3; // bp-56, 0x401b70
memcpy(&v3, (int64_t *)a2, v2);
if (a3 < 32) {
// 0x401c02
int64_t v4; // bp-8, 0x401b70
*(char *)(a3 - 48 + (int64_t)&v4) = 1;
if (a3 != 31) {
// 0x401c18
memset((int64_t *)(a3 + 1 + (int64_t)&v3), 0, 31 - v2);
}
}
int64_t v5 = (int64_t)a1;
int64_t v6 = decode32le(&v3); // 0x401c4a
int64_t v7; // bp-52, 0x401b70
int64_t v8 = decode32le(&v7); // 0x401c5d
int64_t v9; // bp-48, 0x401b70
int64_t v10 = decode32le(&v9); // 0x401c70
int64_t v11; // bp-44, 0x401b70
int64_t v12 = decode32le(&v11); // 0x401c83
int64_t v13; // bp-40, 0x401b70
int64_t v14 = decode32le(&v13); // 0x401c96
int64_t v15; // bp-36, 0x401b70
int64_t v16 = decode32le(&v15); // 0x401ca9
int64_t v17; // bp-32, 0x401b70
int64_t v18 = decode32le(&v17); // 0x401cbc
int64_t v19; // bp-28, 0x401b70
int64_t v20 = decode32le(&v19); // 0x401ccf
int64_t v21 = v20 ^ v16;
uint32_t v22 = (int32_t)(v12 ^ v6 ^ v21) ^ -0x61c88647; // 0x401cf2
int32_t v23 = v22 / 0x200000 | 2048 * v22; // 0x401cff
uint32_t v24 = (int32_t)(v14 ^ v8 ^ v18) ^ -0x61c88648 ^ v23; // 0x401d20
int32_t v25 = v24 / 0x200000 | 2048 * v24; // 0x401d2d
uint32_t v26 = (int32_t)(v21 ^ v10) ^ -0x61c88645 ^ v25; // 0x401d4e
int32_t v27 = v26 / 0x200000 | 2048 * v26; // 0x401d5b
int32_t v28 = v27 ^ v23;
uint32_t v29 = (int32_t)(v18 ^ v12) ^ -0x61c88646 ^ v28; // 0x401d7c
int32_t v30 = v29 / 0x200000 | 2048 * v29; // 0x401d89
int32_t v31 = v30 | v23; // 0x401dbf
int32_t v32 = v30 ^ v25;
int32_t v33 = v25 & v23; // 0x401dcb
int32_t v34 = v32 ^ v27; // 0x401dd7
int32_t v35 = v32 & v31 ^ (v28 | v33); // 0x401de9
int32_t v36 = v31 ^ v33; // 0x401def
int32_t v37 = (v35 ^ v33 | v36) ^ v34; // 0x401e0d
*(int32_t *)a1 = v37 & -1 - v35 ^ v36;
*(int32_t *)(v5 + 4) = v37;
*(int32_t *)(v5 + 8) = v35;
*(int32_t *)(v5 + 12) = v36 & v28 ^ v34;
uint32_t v38 = (int32_t)(v20 ^ v14) ^ -0x61c88643 ^ v32; // 0x401e9c
int32_t v39 = v38 / 0x200000 | 2048 * v38; // 0x401ea9
uint32_t v40 = (int32_t)v16 ^ -0x61c88644 ^ v28 ^ v39; // 0x401eca
int32_t v41 = v40 / 0x200000 | 2048 * v40; // 0x401ed7
uint32_t v42 = (int32_t)v18 ^ -0x61c88641 ^ v32 ^ v41; // 0x401ef8
int32_t v43 = v42 / 0x200000 | 2048 * v42; // 0x401f05
int32_t v44 = v43 ^ v39;
uint32_t v45 = v44 ^ -0x61c88642 ^ (int32_t)v20 ^ v27; // 0x401f26
int32_t v46 = v45 / 0x200000 | 2048 * v45; // 0x401f33
int32_t v47 = v43 & v39 ^ v46; // 0x401f6f
int32_t v48 = v43 ^ v41 ^ v47; // 0x401f7b
int32_t v49 = (v46 | v39) ^ v41; // 0x401f87
int32_t v50 = v48 ^ v39; // 0x401f8d
int32_t v51 = (v50 | v49) ^ v47; // 0x401f9f
int32_t v52 = v50 ^ v49 & v47; // 0x401fab
*(int32_t *)(v5 + 16) = v48;
*(int32_t *)(v5 + 20) = v51;
*(int32_t *)(v5 + 24) = v52 ^ v49 ^ v51;
*(int32_t *)(v5 + 28) = -1 - v52;
int32_t v53 = v46 ^ v41;
uint32_t v54 = v53 ^ -0x61c8864f ^ v23 ^ v30; // 0x402031
int32_t v55 = v54 / 0x200000 | 2048 * v54; // 0x40203e
uint32_t v56 = v44 ^ -0x61c88650 ^ v25 ^ v55; // 0x40205f
int32_t v57 = v56 / 0x200000 | 2048 * v56; // 0x402072
uint32_t v58 = v53 ^ -0x61c8864d ^ v27 ^ v57; // 0x402093
int32_t v59 = v58 / 0x200000 | 2048 * v58; // 0x4020a6
uint32_t v60 = v55 ^ v43 ^ -0x61c8864e ^ v30 ^ v59; // 0x4020c7
int32_t v61 = v60 / 0x200000 | 2048 * v60; // 0x4020da
int32_t v62 = -1 - v55;
int32_t v63 = v57 & v62; // 0x402131
int32_t v64 = v59 ^ -1 - v63; // 0x40213d
int32_t v65 = v61 | v63; // 0x402149
int32_t v66 = v61 ^ v64; // 0x402155
int32_t v67 = v65 ^ v57; // 0x402161
int32_t v68 = v65 ^ v62; // 0x40216d
int32_t v69 = v67 | v62; // 0x402179
int32_t v70 = v67 ^ v66; // 0x402185
int32_t v71 = (v68 | v64) & v69; // 0x40219d
int32_t v72 = v70 ^ v68; // 0x4021a9
*(int32_t *)(v5 + 32) = v71;
*(int32_t *)(v5 + 36) = v72 & v71 ^ v69;
*(int32_t *)(v5 + 40) = v66;
*(int32_t *)(v5 + 44) = v71 & v70 ^ v72;
uint32_t v73 = v57 ^ v46 ^ -0x61c8864b ^ v39 ^ v61; // 0x40225f
int32_t v74 = v73 / 0x200000 | 2048 * v73; // 0x402272
uint32_t v75 = v59 ^ v55 ^ -0x61c8864c ^ v41 ^ v74; // 0x402293
int32_t v76 = v75 / 0x200000 | 2048 * v75; // 0x4022a6
uint32_t v77 = v61 ^ v57 ^ -0x61c88649 ^ v43 ^ v76; // 0x4022c7
int32_t v78 = v77 / 0x200000 | 2048 * v77; // 0x4022da
uint32_t v79 = v74 ^ v59 ^ -0x61c8864a ^ v46 ^ v78; // 0x4022fb
int32_t v80 = v79 / 0x200000 | 2048 * v79; // 0x40230e
int32_t v81 = v80 ^ v74; // 0x40234d
int32_t v82 = v78 ^ v76; // 0x402371
int32_t v83 = v81 & v76 ^ v74; // 0x40237d
int32_t v84 = (v80 | v74) ^ v82; // 0x402395
int32_t v85 = v81 ^ v82; // 0x4023a1
int32_t v86 = v81 ^ v78; // 0x4023ad
int32_t v87 = (v83 | -1 - v85) ^ (v86 | v84);
*(int32_t *)(v5 + 48) = v83 ^ v86 ^ v87;
*(int32_t *)(v5 + 52) = v87;
*(int32_t *)(v5 + 56) = (v83 | v78) ^ v85;
*(int32_t *)(v5 + 60) = v84;
uint32_t v88 = v76 ^ v61 ^ -0x61c88657 ^ v55 ^ v80; // 0x402499
int32_t v89 = v88 / 0x200000 | 2048 * v88; // 0x4024ac
uint32_t v90 = v78 ^ v74 ^ -0x61c88658 ^ v57 ^ v89; // 0x4024cd
int32_t v91 = v90 / 0x200000 | 2048 * v90; // 0x4024e0
uint32_t v92 = v80 ^ v76 ^ -0x61c88655 ^ v59 ^ v91; // 0x402501
int32_t v93 = v92 / 0x200000 | 2048 * v92; // 0x402514
uint32_t v94 = v89 ^ v78 ^ -0x61c88656 ^ v61 ^ v93; // 0x402535
int32_t v95 = v94 / 0x200000 | 2048 * v94; // 0x402548
int32_t v96 = v95 ^ (v93 | v91); // 0x40259f
int32_t v97 = v96 ^ v93; // 0x4025b7
int32_t v98 = v96 ^ v91; // 0x4025db
int32_t v99 = (v98 | v89) ^ v97; // 0x402617
int32_t v100 = v98 ^ v89 ^ (v96 | v91); // 0x402623
*(int32_t *)(v5 + 64) = (v100 ^ -1 - v97 | v99) ^ v98;
*(int32_t *)(v5 + 68) = (v95 | v93 ^ v91) & v89 ^ v96;
*(int32_t *)(v5 + 72) = v100 & v99 ^ v98;
*(int32_t *)(v5 + 76) = v99;
int32_t v101 = v95 ^ v91;
uint32_t v102 = v81 ^ -0x61c88653 ^ v101; // 0x4026eb
int32_t v103 = v102 / 0x200000 | 2048 * v102; // 0x4026fe
uint32_t v104 = v93 ^ v89 ^ -0x61c88654 ^ v76 ^ v103; // 0x40271f
int32_t v105 = v104 / 0x200000 | 2048 * v104; // 0x402732
uint32_t v106 = v78 ^ -0x61c88651 ^ v101 ^ v105; // 0x402753
int32_t v107 = v106 / 0x200000 | 2048 * v106; // 0x402766
uint32_t v108 = v103 ^ v93 ^ -0x61c88652 ^ v80 ^ v107; // 0x402787
int32_t v109 = v108 / 0x200000 | 2048 * v108; // 0x40279a
int32_t v110 = -1 - v107;
int32_t v111 = v109 & v103; // 0x4027eb
int32_t v112 = v109 ^ v103; // 0x4027f7
int32_t v113 = v111 ^ v110; // 0x402803
int32_t v114 = v113 ^ v105; // 0x40281b
int32_t v115 = v114 | v112; // 0x402833
int32_t v116 = (v109 | v110) ^ v112 ^ v114; // 0x40283f
int32_t v117 = (v115 | v113) ^ v116; // 0x402863
int32_t v118 = v113 ^ v109 ^ v115 ^ v117; // 0x40287b
*(int32_t *)(v5 + 80) = v117;
*(int32_t *)(v5 + 84) = v114;
*(int32_t *)(v5 + 88) = v118;
*(int32_t *)(v5 + 92) = v111 ^ v107 ^ v118 & v116;
int32_t v119 = v109 ^ v105;
uint32_t v120 = v119 ^ -0x61c8865f ^ v89 ^ v95; // 0x40291f
int32_t v121 = v120 / 0x200000 | 2048 * v120; // 0x402932
uint32_t v122 = v107 ^ v103 ^ -0x61c88660 ^ v91 ^ v121; // 0x402953
int32_t v123 = v122 / 0x200000 | 2048 * v122; // 0x402966
uint32_t v124 = v119 ^ -0x61c8865d ^ v93 ^ v123; // 0x402987
int32_t v125 = v124 / 0x200000 | 2048 * v124; // 0x40299a
uint32_t v126 = v121 ^ v107 ^ -0x61c8865e ^ v95 ^ v125; // 0x4029bb
int32_t v127 = v126 / 0x200000 | 2048 * v126; // 0x4029ce
int32_t v128 = v123 ^ v121; // 0x402a0d
int32_t v129 = v127 ^ v123;
int32_t v130 = -1 - v127;
int32_t v131 = v125 ^ v130; // 0x402a43
int32_t v132 = v129 & v128 ^ v131; // 0x402a4f
int32_t v133 = v132 & v130 ^ v128; // 0x402a7f
int32_t v134 = -1 - (v131 | v129);
int32_t v135 = v123 ^ v134 ^ v132; // 0x402a97
*(int32_t *)(v5 + 96) = v132;
*(int32_t *)(v5 + 100) = v133;
*(int32_t *)(v5 + 104) = v133 & v128 ^ v135;
*(int32_t *)(v5 + 108) = v128 ^ v134 ^ (v133 | v135);
uint32_t v136 = v112 ^ -0x61c8865b ^ v129; // 0x402b5f
int32_t v137 = v136 / 0x200000 | 2048 * v136; // 0x402b72
uint32_t v138 = v125 ^ v121 ^ -0x61c8865c ^ v105 ^ v137; // 0x402b93
int32_t v139 = v138 / 0x200000 | 2048 * v138; // 0x402ba6
uint32_t v140 = v107 ^ -0x61c88659 ^ v129 ^ v139; // 0x402bc7
int32_t v141 = v140 / 0x200000 | 2048 * v140; // 0x402bda
uint32_t v142 = v137 ^ v125 ^ -0x61c8865a ^ v109 ^ v141; // 0x402bfb
int32_t v143 = v142 / 0x200000 | 2048 * v142; // 0x402c0e
int32_t v144 = v143 ^ v139;
int32_t v145 = -1 - v143;
int32_t v146 = v141 ^ v145; // 0x402c5f
int32_t v147 = v137 ^ v145; // 0x402c6b
int32_t v148 = v144 & v147 ^ v146; // 0x402c8f
int32_t v149 = v144 ^ v147; // 0x402c9b
int32_t v150 = -1 - v139;
int32_t v151 = v149 & v146; // 0x402cb3
int32_t v152 = v148 & v150; // 0x402ccb
int32_t v153 = v152 ^ v147; // 0x402cd7
*(int32_t *)(v5 + 112) = v148;
*(int32_t *)(v5 + 116) = (v148 | v149) ^ v152 ^ v153 & (v151 ^ v150);
*(int32_t *)(v5 + 120) = v151 ^ v139 ^ (v152 | v147);
*(int32_t *)(v5 + 124) = v153;
uint32_t v154 = v121 ^ -0x61c88667 ^ v127 ^ v144; // 0x402dab
int32_t v155 = v154 / 0x200000 | 2048 * v154; // 0x402dbe
uint32_t v156 = v141 ^ v137 ^ -0x61c88668 ^ v123 ^ v155; // 0x402ddf
int32_t v157 = v156 / 0x200000 | 2048 * v156; // 0x402df2
uint32_t v158 = v125 ^ -0x61c88665 ^ v144 ^ v157; // 0x402e13
int32_t v159 = v158 / 0x200000 | 2048 * v158; // 0x402e26
int32_t v160 = v159 ^ v155;
uint32_t v161 = v127 ^ -0x61c88666 ^ v141 ^ v160; // 0x402e47
int32_t v162 = v161 / 0x200000 | 2048 * v161; // 0x402e5a
int32_t v163 = v162 | v155; // 0x402ea5
int32_t v164 = v162 ^ v157;
int32_t v165 = v157 & v155; // 0x402ebd
int32_t v166 = v164 ^ v159; // 0x402ed5
int32_t v167 = v164 & v163 ^ (v160 | v165); // 0x402ef9
int32_t v168 = v163 ^ v165; // 0x402f05
int32_t v169 = (v167 ^ v165 | v168) ^ v166; // 0x402f41
*(int32_t *)(v5 + 128) = v169 & -1 - v167 ^ v168;
*(int32_t *)(v5 + 132) = v169;
*(int32_t *)(v5 + 136) = v167;
*(int32_t *)(v5 + 140) = v168 & v160 ^ v166;
uint32_t v170 = v137 ^ -0x61c88663 ^ v143 ^ v164; // 0x402ff7
int32_t v171 = v170 / 0x200000 | 2048 * v170; // 0x40300a
uint32_t v172 = v139 ^ -0x61c88664 ^ v160 ^ v171; // 0x40302b
int32_t v173 = v172 / 0x200000 | 2048 * v172; // 0x40303e
uint32_t v174 = v141 ^ -0x61c88661 ^ v164 ^ v173; // 0x40305f
int32_t v175 = v174 / 0x200000 | 2048 * v174; // 0x403072
int32_t v176 = v175 ^ v171;
uint32_t v177 = v176 ^ -0x61c88662 ^ v143 ^ v159; // 0x403093
int32_t v178 = v177 / 0x200000 | 2048 * v177; // 0x4030a6
int32_t v179 = v175 & v171 ^ v178; // 0x4030fd
int32_t v180 = v175 ^ v173 ^ v179; // 0x403115
int32_t v181 = (v178 | v171) ^ v173; // 0x40312d
int32_t v182 = v180 ^ v171; // 0x403139
int32_t v183 = (v182 | v181) ^ v179; // 0x40315d
int32_t v184 = v182 ^ v181 & v179; // 0x403175
*(int32_t *)(v5 + 144) = v180;
*(int32_t *)(v5 + 148) = v183;
*(int32_t *)(v5 + 152) = v184 ^ v181 ^ v183;
*(int32_t *)(v5 + 156) = -1 - v184;
int32_t v185 = v178 ^ v173;
uint32_t v186 = v185 ^ -0x61c8866f ^ v155 ^ v162; // 0x403219
int32_t v187 = v186 / 0x200000 | 2048 * v186; // 0x40322c
uint32_t v188 = v176 ^ -0x61c88670 ^ v157 ^ v187; // 0x40324d
int32_t v189 = v188 / 0x200000 | 2048 * v188; // 0x403260
uint32_t v190 = v185 ^ -0x61c8866d ^ v159 ^ v189; // 0x403281
int32_t v191 = v190 / 0x200000 | 2048 * v190; // 0x403294
uint32_t v192 = v187 ^ v175 ^ -0x61c8866e ^ v162 ^ v191; // 0x4032b5
int32_t v193 = v192 / 0x200000 | 2048 * v192; // 0x4032c8
int32_t v194 = -1 - v187;
int32_t v195 = v189 & v194; // 0x40331f
int32_t v196 = v191 ^ -1 - v195; // 0x40332b
int32_t v197 = v193 | v195; // 0x403337
int32_t v198 = v193 ^ v196; // 0x403343
int32_t v199 = v197 ^ v189; // 0x40334f
int32_t v200 = v197 ^ v194; // 0x40335b
int32_t v201 = v199 | v194; // 0x403367
int32_t v202 = v199 ^ v198; // 0x403373
int32_t v203 = (v200 | v196) & v201; // 0x40338b
int32_t v204 = v202 ^ v200; // 0x403397
*(int32_t *)(v5 + 160) = v203;
*(int32_t *)(v5 + 164) = v204 & v203 ^ v201;
*(int32_t *)(v5 + 168) = v198;
*(int32_t *)(v5 + 172) = v203 & v202 ^ v204;
uint32_t v205 = v189 ^ v178 ^ -0x61c8866b ^ v171 ^ v193; // 0x40344d
int32_t v206 = v205 / 0x200000 | 2048 * v205; // 0x403460
uint32_t v207 = v191 ^ v187 ^ -0x61c8866c ^ v173 ^ v206; // 0x403481
int32_t v208 = v207 / 0x200000 | 2048 * v207; // 0x403494
uint32_t v209 = v193 ^ v189 ^ -0x61c88669 ^ v175 ^ v208; // 0x4034b5
int32_t v210 = v209 / 0x200000 | 2048 * v209; // 0x4034c8
uint32_t v211 = v206 ^ v191 ^ -0x61c8866a ^ v178 ^ v210; // 0x4034e9
int32_t v212 = v211 / 0x200000 | 2048 * v211; // 0x4034fc
int32_t v213 = v212 ^ v206; // 0x40353b
int32_t v214 = v210 ^ v208; // 0x40355f
int32_t v215 = v213 & v208 ^ v206; // 0x40356b
int32_t v216 = (v212 | v206) ^ v214; // 0x403583
int32_t v217 = v213 ^ v214; // 0x40358f
int32_t v218 = v213 ^ v210; // 0x40359b
int32_t v219 = (v215 | -1 - v217) ^ (v218 | v216);
*(int32_t *)(v5 + 176) = v215 ^ v218 ^ v219;
*(int32_t *)(v5 + 180) = v219;
*(int32_t *)(v5 + 184) = (v215 | v210) ^ v217;
*(int32_t *)(v5 + 188) = v216;
uint32_t v220 = v208 ^ v193 ^ -0x61c88677 ^ v187 ^ v212; // 0x403687
int32_t v221 = v220 / 0x200000 | 2048 * v220; // 0x40369a
uint32_t v222 = v210 ^ v206 ^ -0x61c88678 ^ v189 ^ v221; // 0x4036bb
int32_t v223 = v222 / 0x200000 | 2048 * v222; // 0x4036ce
uint32_t v224 = v212 ^ v208 ^ -0x61c88675 ^ v191 ^ v223; // 0x4036ef
int32_t v225 = v224 / 0x200000 | 2048 * v224; // 0x403702
uint32_t v226 = v221 ^ v210 ^ -0x61c88676 ^ v193 ^ v225; // 0x403723
int32_t v227 = v226 / 0x200000 | 2048 * v226; // 0x403736
int32_t v228 = v227 ^ (v225 | v223); // 0x40378d
int32_t v229 = v228 ^ v225; // 0x4037a5
int32_t v230 = v228 ^ v223; // 0x4037c9
int32_t v231 = (v230 | v221) ^ v229; // 0x403805
int32_t v232 = v230 ^ v221 ^ (v228 | v223); // 0x403811
*(int32_t *)(v5 + 192) = (v232 ^ -1 - v229 | v231) ^ v230;
*(int32_t *)(v5 + 196) = (v227 | v225 ^ v223) & v221 ^ v228;
*(int32_t *)(v5 + 200) = v232 & v231 ^ v230;
*(int32_t *)(v5 + 204) = v231;
int32_t v233 = v227 ^ v223;
uint32_t v234 = v213 ^ -0x61c88673 ^ v233; // 0x4038d9
int32_t v235 = v234 / 0x200000 | 2048 * v234; // 0x4038ec
uint32_t v236 = v225 ^ v221 ^ -0x61c88674 ^ v208 ^ v235; // 0x40390d
int32_t v237 = v236 / 0x200000 | 2048 * v236; // 0x403920
uint32_t v238 = v210 ^ -0x61c88671 ^ v233 ^ v237; // 0x403941
int32_t v239 = v238 / 0x200000 | 2048 * v238; // 0x403954
uint32_t v240 = v235 ^ v225 ^ -0x61c88672 ^ v212 ^ v239; // 0x403975
int32_t v241 = v240 / 0x200000 | 2048 * v240; // 0x403988
int32_t v242 = -1 - v239;
int32_t v243 = v241 & v235; // 0x4039d9
int32_t v244 = v241 ^ v235; // 0x4039e5
int32_t v245 = v243 ^ v242; // 0x4039f1
int32_t v246 = v245 ^ v237; // 0x403a09
int32_t v247 = v246 | v244; // 0x403a21
int32_t v248 = (v241 | v242) ^ v244 ^ v246; // 0x403a2d
int32_t v249 = (v247 | v245) ^ v248; // 0x403a51
int32_t v250 = v245 ^ v241 ^ v247 ^ v249; // 0x403a69
*(int32_t *)(v5 + 208) = v249;
*(int32_t *)(v5 + 212) = v246;
*(int32_t *)(v5 + 216) = v250;
*(int32_t *)(v5 + 220) = v243 ^ v239 ^ v250 & v248;
int32_t v251 = v241 ^ v237;
uint32_t v252 = v251 ^ -0x61c8867f ^ v221 ^ v227; // 0x403b0d
int32_t v253 = v252 / 0x200000 | 2048 * v252; // 0x403b20
uint32_t v254 = v239 ^ v235 ^ -0x61c88680 ^ v223 ^ v253; // 0x403b41
int32_t v255 = v254 / 0x200000 | 2048 * v254; // 0x403b54
uint32_t v256 = v251 ^ -0x61c8867d ^ v225 ^ v255; // 0x403b75
int32_t v257 = v256 / 0x200000 | 2048 * v256; // 0x403b88
uint32_t v258 = v253 ^ v239 ^ -0x61c8867e ^ v227 ^ v257; // 0x403ba9
int32_t v259 = v258 / 0x200000 | 2048 * v258; // 0x403bbc
int32_t v260 = v255 ^ v253; // 0x403bfb
int32_t v261 = v259 ^ v255;
int32_t v262 = -1 - v259;
int32_t v263 = v257 ^ v262; // 0x403c31
int32_t v264 = v261 & v260 ^ v263; // 0x403c3d
int32_t v265 = v264 & v262 ^ v260; // 0x403c6d
int32_t v266 = -1 - (v263 | v261);
int32_t v267 = v255 ^ v266 ^ v264; // 0x403c85
*(int32_t *)(v5 + 224) = v264;
*(int32_t *)(v5 + 228) = v265;
*(int32_t *)(v5 + 232) = v265 & v260 ^ v267;
*(int32_t *)(v5 + 236) = v260 ^ v266 ^ (v265 | v267);
uint32_t v268 = v244 ^ -0x61c8867b ^ v261; // 0x403d4d
int32_t v269 = v268 / 0x200000 | 2048 * v268; // 0x403d60
uint32_t v270 = v257 ^ v253 ^ -0x61c8867c ^ v237 ^ v269; // 0x403d81
int32_t v271 = v270 / 0x200000 | 2048 * v270; // 0x403d94
uint32_t v272 = v239 ^ -0x61c88679 ^ v261 ^ v271; // 0x403db5
int32_t v273 = v272 / 0x200000 | 2048 * v272; // 0x403dc8
uint32_t v274 = v269 ^ v257 ^ -0x61c8867a ^ v241 ^ v273; // 0x403de9
int32_t v275 = v274 / 0x200000 | 2048 * v274; // 0x403dfc
int32_t v276 = v275 ^ v271;
int32_t v277 = -1 - v275;
int32_t v278 = v273 ^ v277; // 0x403e4d
int32_t v279 = v269 ^ v277; // 0x403e59
int32_t v280 = v276 & v279 ^ v278; // 0x403e7d
int32_t v281 = v276 ^ v279; // 0x403e89
int32_t v282 = -1 - v271;
int32_t v283 = v281 & v278; // 0x403ea1
int32_t v284 = v280 & v282; // 0x403eb9
int32_t v285 = v284 ^ v279; // 0x403ec5
*(int32_t *)(v5 + 240) = v280;
*(int32_t *)(v5 + 244) = (v280 | v281) ^ v284 ^ v285 & (v283 ^ v282);
*(int32_t *)(v5 + 248) = v283 ^ v271 ^ (v284 | v279);
*(int32_t *)(v5 + 252) = v285;
uint32_t v286 = v253 ^ -0x61c88607 ^ v259 ^ v276; // 0x403f99
int32_t v287 = v286 / 0x200000 | 2048 * v286; // 0x403fac
uint32_t v288 = v273 ^ v269 ^ -0x61c88608 ^ v255 ^ v287; // 0x403fcd
int32_t v289 = v288 / 0x200000 | 2048 * v288; // 0x403fe0
uint32_t v290 = v257 ^ -0x61c88605 ^ v276 ^ v289; // 0x404001
int32_t v291 = v290 / 0x200000 | 2048 * v290; // 0x404014
int32_t v292 = v291 ^ v287;
uint32_t v293 = v259 ^ -0x61c88606 ^ v273 ^ v292; // 0x404035
int32_t v294 = v293 / 0x200000 | 2048 * v293; // 0x404048
int32_t v295 = v294 | v287; // 0x404093
int32_t v296 = v294 ^ v289;
int32_t v297 = v289 & v287; // 0x4040ab
int32_t v298 = v296 ^ v291; // 0x4040c3
int32_t v299 = v296 & v295 ^ (v292 | v297); // 0x4040e7
int32_t v300 = v295 ^ v297; // 0x4040f3
int32_t v301 = (v299 ^ v297 | v300) ^ v298; // 0x40412f
*(int32_t *)(v5 + 256) = v301 & -1 - v299 ^ v300;
*(int32_t *)(v5 + 260) = v301;
*(int32_t *)(v5 + 264) = v299;
*(int32_t *)(v5 + 268) = v300 & v292 ^ v298;