This repository has been archived by the owner on Dec 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
atof_binary.cpp
1731 lines (1544 loc) · 32.4 KB
/
atof_binary.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
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 "atof_binary.h"
DWORD dwPowerTable1[] = {
0x00000000, 0x00000000, 0x4002A000, 0x00000000,
0x00000000, 0x4005C800, 0x00000000, 0x00000000,
0x4008FA00, 0x00000000, 0x00000000, 0x400C9C40,
0x00000000, 0x00000000, 0x400FC350, 0x00000000,
0x00000000, 0x4012F424, 0x00000000, 0x80000000,
0x40169896, 0x00000000, 0x20000000, 0x4019BEBC,
0x00000000, 0xC9BF0400, 0x40348E1B, 0xA1000000,
0x1BCECCED, 0x404ED3C2, 0xB59EF020, 0xADA82B70,
0x40699DC5, 0x25FD5DD0, 0x4F8E1AE5, 0x4083EB19,
0x95D79671, 0x8D050E43, 0x409EAF29, 0x44A0BFF9,
0x8F1281ED, 0x40B98281, 0xA6D53CBF, 0x1F49FFCF,
0x40D3C278, 0x8CE0C66F, 0x47C980E9, 0x41A893BA,
0x556B85BC, 0xF78D3927, 0x427CE070, 0xDE8EDDBC,
0xEBFB9DF9, 0x4351AA7E, 0xE376E6A1, 0x2F29F2CC,
0x44268184, 0xAA171028, 0xE310AEF8, 0x44FAC4C5,
0xF3D4A7EB, 0x4AE1EBF7, 0x45CF957A, 0x91C7CC65,
0xA0AEA60E, 0x46A3E319, 0x0C17650D, 0x75868175,
0x4D48C976, 0xA7E44258, 0x353B3993, 0x53EDB2B8,
0x5DE5A74D, 0x3B5DC53D, 0x5A929E8B, 0xF0A65DFF,
0x54C020A1, 0x61378CA5, 0x5A8BFDD1, 0x5D25D88B,
0x67DBF989, 0xF3F895AA, 0xC8A2BF27, 0x6E80DD5D,
0x979BC94C, 0x52028A20, 0x7525C460
};
DWORD dwPowerTable2[] = {
0xCCCDCCCD, 0xCCCCCCCC, 0x3FFBCCCC, 0xD70A3D71,
0x0A3D70A3, 0x3FF8A3D7, 0xDF3B645A, 0x6E978D4F,
0x3FF58312, 0x652CD3C3, 0x1758E219, 0x3FF1D1B7,
0x84230FD0, 0xAC471B47, 0x3FEEA7C5, 0x69B6A640,
0xBD05AF6C, 0x3FEB8637, 0x42BC3D33, 0x94D5E57A,
0x3FE7D6BF, 0xCEFDFDC2, 0x77118461, 0x3FE4ABCC,
0xE15B4C2F, 0x94BEC44D, 0x3FC9E695, 0x3B53C492,
0x14CD4475, 0x3FAF9ABE, 0x94BA67DE, 0x1EAD4539,
0x3F94CFB1, 0xE2C62324, 0x313BBABC, 0x3F7A8B61,
0xC1595561, 0x7C53B17E, 0x3F5FBB12, 0x8D2FEED7,
0x8592BE06, 0x3F44FB15, 0xE9A53F24, 0xEA27A539,
0x3F2AA87F, 0xE4A1AC7D, 0x467C64BC, 0x3E55DDD0,
0xCC067B63, 0x83775423, 0x3D8191FF, 0x193AFA91,
0x4325637A, 0x3CACC031, 0x38D18921, 0xB8974782,
0x3BD7FD00, 0x085888DC, 0xE3E8B11B, 0x3B03A686,
0x424584C6, 0x7599B607, 0x3A2EDB37, 0xD21C7133,
0xEE32DB23, 0x395A9049, 0xC0BE87A6, 0x82A5DA57,
0x32B5A2A6, 0x11B268E2, 0x449F52A7, 0x2C10B759,
0x2DE44925, 0x534F3436, 0x256BCEAE, 0xA404598F,
0x7DC2DEC0, 0x1EC6E8FB, 0x5A88E79E, 0xBF3C9157,
0x18228350, 0x62654B4E, 0xAF8F83FD, 0x117D9406,
0x9FDE2DE4, 0x04C8D2CE, 0x0AD8A6DD
};
DWORD dwFunc2Values[] = {
0x00000400, 0xFFFFFC01, 0x00000035, 0x0000000B,
0x00000040, 0x000003FF
};
BOOL atof_binary(LPSTR lpAscii, DWORD dwDouble[], char delimiter)
{
DWORD dwData[3];
char *ss;
int ret;
ret = func1(dwData, &ss, lpAscii, 0, 0, 0, 0, (DWORD)delimiter);
if(ret & 4)
return FALSE;
func2(dwData, dwDouble);
return TRUE;
}
int __declspec(naked) __cdecl func1(DWORD dwData[], char **ss, char *s, int d, int e, int f, int g, DWORD dwDelimiter)
{
// returns 1, 2 on overflow, 4 on error, 0 when all is fine
static DWORD dwSwitchTable[12];
__asm
{
mov eax, offset dwSwitchTable
mov DWORD PTR [eax], offset _project_004027B3
mov DWORD PTR [eax+0x04], offset _project_00402807
mov DWORD PTR [eax+0x08], offset _project_0040285D
mov DWORD PTR [eax+0x0C], offset _project_00402890
mov DWORD PTR [eax+0x10], offset _project_004028D5
mov DWORD PTR [eax+0x14], offset _project_0040290D
mov DWORD PTR [eax+0x18], offset _project_00402921
mov DWORD PTR [eax+0x1C], offset _project_0040297C
mov DWORD PTR [eax+0x20], offset _project_00402967
mov DWORD PTR [eax+0x24], offset _project_004029E6
mov DWORD PTR [eax+0x28], offset _project_004029DB
mov DWORD PTR [eax+0x2C], offset _project_0040298A
}
__asm
{
MOV EDI,EDI
PUSH EBP
MOV EBP,ESP
SUB ESP,0x7C
MOV EAX,DWORD PTR [EBP+8]
PUSH EBX
XOR EBX,EBX
PUSH ESI
XOR ESI,ESI
MOV DWORD PTR [EBP-0x78],EAX
MOV EAX,DWORD PTR [EBP+0xC]
INC ESI
XOR ECX,ECX
PUSH EDI
MOV DWORD PTR [EBP-0x70],EAX
LEA EDI,DWORD PTR [EBP-0x20]
MOV DWORD PTR [EBP-0x74],EBX
MOV DWORD PTR [EBP-0x68],ESI
MOV DWORD PTR [EBP-0x4C],EBX
MOV DWORD PTR [EBP-0x58],EBX
MOV DWORD PTR [EBP-0x5C],EBX
MOV DWORD PTR [EBP-0x60],EBX
MOV DWORD PTR [EBP-0x64],EBX
MOV DWORD PTR [EBP-0x50],EBX
MOV DWORD PTR [EBP-0x6C],EBX
MOV EDX,DWORD PTR [EBP+0x10]
MOV DWORD PTR [EBP-0x54],EDX
_project_00402789:
MOV AL,BYTE PTR [EDX]
CMP AL,0x20
JE _project_0040279B
CMP AL,9
JE _project_0040279B
CMP AL,0xA
JE _project_0040279B
CMP AL,0xD
JNZ _project_0040279E
_project_0040279B:
INC EDX
JMP _project_00402789
_project_0040279E:
MOV BL,0x30
_project_004027A0:
MOV AL,BYTE PTR [EDX]
INC EDX
CMP ECX,0xB
JA _project_004029DB
JMP DWORD PTR [ECX*4+dwSwitchTable] // USING A VARIABLE HERE
_project_004027B3:
MOV CL,AL
SUB CL,0x31
CMP CL,8
JA _project_004027C3
_project_004027BD:
PUSH 3
_project_004027BF:
POP ECX
DEC EDX
JMP _project_004027A0
_project_004027C3:
MOV ECX,DWORD PTR [EBP+0x24]
CMP AL,CL
JNZ _project_004027D9
_project_004027D4:
PUSH 5
_project_004027D6:
POP ECX
JMP _project_004027A0
_project_004027D9:
MOVSX EAX,AL
SUB EAX,0x2B
JE _project_004027FE
DEC EAX
DEC EAX
JE _project_004027F2
SUB EAX,3
JNZ _project_00402979
_project_004027EE:
MOV ECX,ESI
JMP _project_004027A0
_project_004027F2:
PUSH 2
POP ECX
MOV DWORD PTR [EBP-0x74],0x8000
JMP _project_004027A0
_project_004027FE:
AND DWORD PTR [EBP-0x74],0
PUSH 2
POP ECX
JMP _project_004027A0
_project_00402807:
MOV CL,AL
SUB CL,0x31
MOV DWORD PTR [EBP-0x58],ESI
CMP CL,8
JBE _project_004027BD
MOV ECX,DWORD PTR [EBP+0x24]
CMP AL,CL
JNZ _project_00402829
_project_00402825:
PUSH 4
JMP _project_004027D6
_project_00402829:
CMP AL,0x2B
JE _project_00402855
CMP AL,0x2D
JE _project_00402855
CMP AL,BL
JE _project_004027EE
_project_00402835:
CMP AL,0x43
JLE _project_00402979
CMP AL,0x45
JLE _project_00402851
CMP AL,0x63
JLE _project_00402979
CMP AL,0x65
JG _project_00402979
_project_00402851:
PUSH 6
JMP _project_004027D6
_project_00402855:
DEC EDX
PUSH 0xB
JMP _project_004027D6
_project_0040285D:
MOV CL,AL
SUB CL,0x31
CMP CL,8
JBE _project_004027BD
MOV ECX,DWORD PTR [EBP+0x24]
CMP AL,CL
JE _project_004027D4
CMP AL,BL
JE _project_004027EE
_project_00402888:
MOV EDX,DWORD PTR [EBP-0x54]
JMP _project_004029A4
_project_00402890:
MOV DWORD PTR [EBP-0x58],ESI
JMP _project_004028AF
_project_00402895:
CMP AL,0x39
JG _project_004028B3
CMP DWORD PTR [EBP-0x4C],0x19
JNB _project_004028A9
INC DWORD PTR [EBP-0x4C]
SUB AL,BL
MOV BYTE PTR [EDI],AL
INC EDI
JMP _project_004028AC
_project_004028A9:
INC DWORD PTR [EBP-0x50]
_project_004028AC:
MOV AL,BYTE PTR [EDX]
INC EDX
_project_004028AF:
CMP AL,BL
JGE _project_00402895
_project_004028B3:
MOV ECX,DWORD PTR [EBP+0x24]
CMP AL,CL
JE _project_00402825
_project_004028C8:
CMP AL,0x2B
JE _project_00402855
CMP AL,0x2D
JE _project_00402855
JMP _project_00402835
_project_004028D5:
CMP DWORD PTR [EBP-0x4C],0
MOV DWORD PTR [EBP-0x58],ESI
MOV DWORD PTR [EBP-0x5C],ESI
JNZ _project_00402907
JMP _project_004028E9
_project_004028E3:
DEC DWORD PTR [EBP-0x50]
MOV AL,BYTE PTR [EDX]
INC EDX
_project_004028E9:
CMP AL,BL
JE _project_004028E3
JMP _project_00402907
_project_004028EF:
CMP AL,0x39
JG _project_004028C8
CMP DWORD PTR [EBP-0x4C],0x19
JNB _project_00402904
INC DWORD PTR [EBP-0x4C]
SUB AL,BL
MOV BYTE PTR [EDI],AL
INC EDI
DEC DWORD PTR [EBP-0x50]
_project_00402904:
MOV AL,BYTE PTR [EDX]
INC EDX
_project_00402907:
CMP AL,BL
JGE _project_004028EF
JMP _project_004028C8
_project_0040290D:
SUB AL,BL
MOV DWORD PTR [EBP-0x5C],ESI
CMP AL,9
JA _project_00402888
PUSH 4
JMP _project_004027BF
_project_00402921:
LEA ECX,DWORD PTR [EDX-2]
MOV DWORD PTR [EBP-0x54],ECX
MOV CL,AL
SUB CL,0x31
CMP CL,8
JA _project_00402938
_project_00402931:
PUSH 9
JMP _project_004027BF
_project_00402938:
MOVSX EAX,AL
SUB EAX,0x2B
JE _project_00402960
DEC EAX
DEC EAX
JE _project_00402954
SUB EAX,3
_project_00402947:
JNZ _project_00402888
PUSH 8
JMP _project_004027D6
_project_00402954:
OR DWORD PTR [EBP-0x68],0xFFFFFFFF
PUSH 7
POP ECX
JMP _project_004027A0
_project_00402960:
PUSH 7
JMP _project_004027D6
_project_00402967:
MOV DWORD PTR [EBP-0x60],ESI
JMP _project_0040296F
_project_0040296C:
MOV AL,BYTE PTR [EDX]
INC EDX
_project_0040296F:
CMP AL,BL
JE _project_0040296C
SUB AL,0x31
CMP AL,8
JBE _project_00402931
_project_00402979:
DEC EDX
JMP _project_004029A4
_project_0040297C:
MOV CL,AL
SUB CL,0x31
CMP CL,8
JBE _project_00402931
CMP AL,BL
JMP _project_00402947
_project_0040298A:
CMP DWORD PTR [EBP+0x20],0
JE _project_004029D7
MOVSX EAX,AL
SUB EAX,0x2B
LEA ECX,DWORD PTR [EDX-1]
MOV DWORD PTR [EBP-0x54],ECX
JE _project_00402960
DEC EAX
DEC EAX
JE _project_00402954
MOV EDX,ECX
_project_004029A4:
CMP DWORD PTR [EBP-0x58],0
MOV EAX,DWORD PTR [EBP-0x70]
MOV DWORD PTR [EAX],EDX
JE _project_00402D8C
PUSH 0x18
POP EAX
CMP DWORD PTR [EBP-0x4C],EAX
JBE _project_004029CB
CMP BYTE PTR [EBP-9],5
JL _project_004029C4
INC BYTE PTR [EBP-9]
_project_004029C4:
DEC EDI
INC DWORD PTR [EBP-0x50]
MOV DWORD PTR [EBP-0x4C],EAX
_project_004029CB:
CMP DWORD PTR [EBP-0x4C],0
JBE _project_00402DB3
JMP _project_00402A30
_project_004029D7:
PUSH 0xA
POP ECX
DEC EDX
_project_004029DB:
CMP ECX,0xA
JNZ _project_004027A0
JMP _project_004029A4
_project_004029E6:
MOV DWORD PTR [EBP-0x60],ESI
XOR ECX,ECX
JMP _project_00402A06
_project_004029ED:
CMP AL,0x39
JG _project_00402A11
IMUL ECX,ECX,0xA
MOVSX ESI,AL
LEA ECX,DWORD PTR [ECX+ESI-0x30]
CMP ECX,0x1450
JG _project_00402A0C
MOV AL,BYTE PTR [EDX]
INC EDX
_project_00402A06:
CMP AL,BL
JGE _project_004029ED
JMP _project_00402A11
_project_00402A0C:
MOV ECX,0x1451
_project_00402A11:
MOV DWORD PTR [EBP-0x64],ECX
JMP _project_00402A21
_project_00402A16:
CMP AL,0x39
JG _project_00402979
MOV AL,BYTE PTR [EDX]
INC EDX
_project_00402A21:
CMP AL,BL
JGE _project_00402A16
JMP _project_00402979
_project_00402A2A:
DEC DWORD PTR [EBP-0x4C]
INC DWORD PTR [EBP-0x50]
_project_00402A30:
DEC EDI
CMP BYTE PTR [EDI],0
JE _project_00402A2A
LEA EAX,DWORD PTR [EBP-0x3C]
PUSH EAX
PUSH DWORD PTR [EBP-0x4C]
LEA EAX,DWORD PTR [EBP-0x20]
PUSH EAX
CALL func1_helper // USING A VARIABLE HERE
MOV EAX,DWORD PTR [EBP-0x64]
XOR EDX,EDX
ADD ESP,0xC
CMP DWORD PTR [EBP-0x68],EDX
JGE _project_00402A55
NEG EAX
_project_00402A55:
ADD EAX,DWORD PTR [EBP-0x50]
CMP DWORD PTR [EBP-0x60],EDX
JNZ _project_00402A60
ADD EAX,DWORD PTR [EBP+0x18]
_project_00402A60:
CMP DWORD PTR [EBP-0x5C],EDX
JNZ _project_00402A68
SUB EAX,DWORD PTR [EBP+0x1C]
_project_00402A68:
CMP EAX,0x1450
JG _project_00402D95
CMP EAX,-0x1450
JL _project_00402DAC
MOV ECX,offset dwPowerTable1 // USING A VARIABLE HERE
SUB ECX,0x60
MOV DWORD PTR [EBP-0x54],EAX
CMP EAX,EDX
JE _project_00402D7A
JGE _project_00402AA0
NEG EAX
MOV ECX,offset dwPowerTable2 // USING A VARIABLE HERE
MOV DWORD PTR [EBP-0x54],EAX
SUB ECX,0x60
_project_00402AA0:
CMP DWORD PTR [EBP+0x14],EDX
JNZ _project_00402AAB
XOR EAX,EAX
MOV WORD PTR [EBP-0x3C],AX
_project_00402AAB:
CMP DWORD PTR [EBP-0x54],EDX
JE _project_00402D7A
JMP _project_00402ABB
_project_00402AB6:
MOV ECX,DWORD PTR [EBP-0x7C]
XOR EDX,EDX
_project_00402ABB:
MOV EAX,DWORD PTR [EBP-0x54]
SAR DWORD PTR [EBP-0x54],3
ADD ECX,0x54
AND EAX,7
MOV DWORD PTR [EBP-0x7C],ECX
CMP EAX,EDX
JE _project_00402D70
IMUL EAX,EAX,0xC
ADD EAX,ECX
MOV EBX,EAX
MOV EAX,0x8000
CMP WORD PTR [EBX],AX
JB _project_00402AF2
MOV ESI,EBX
LEA EDI,DWORD PTR [EBP-0x48]
MOVS DWORD PTR ES:[EDI],DWORD PTR [ESI]
MOVS DWORD PTR ES:[EDI],DWORD PTR [ESI]
MOVS DWORD PTR ES:[EDI],DWORD PTR [ESI]
DEC DWORD PTR [EBP-0x46]
LEA EBX,DWORD PTR [EBP-0x48]
_project_00402AF2:
MOVZX ECX,WORD PTR [EBX+0xA]
XOR EAX,EAX
MOV DWORD PTR [EBP-0x50],EAX
MOV DWORD PTR [EBP-0x2C],EAX
MOV DWORD PTR [EBP-0x28],EAX
MOV DWORD PTR [EBP-0x24],EAX
MOV EAX,DWORD PTR [EBP-0x32]
MOV ESI,ECX
MOV EDX,0x7FFF
XOR ESI,EAX
AND EAX,EDX
AND ECX,EDX
AND ESI,0x8000
MOV EDI,0x7FFF
LEA EDX,DWORD PTR [ECX+EAX]
MOV DWORD PTR [EBP-0x70],ESI
MOVZX EDX,DX
CMP AX,DI
JNB _project_00402D52
CMP CX,DI
JNB _project_00402D52
MOV EDI,0xBFFD
CMP DX,DI
JA _project_00402D52
MOV ESI,0x3FBF
CMP DX,SI
JA _project_00402B5F
XOR EAX,EAX
MOV DWORD PTR [EBP-0x38],EAX
MOV DWORD PTR [EBP-0x3C],EAX
JMP _project_00402D6D
_project_00402B5F:
XOR ESI,ESI
CMP AX,SI
JNZ _project_00402B85
INC EDX
TEST DWORD PTR [EBP-0x34],0x7FFFFFFF
JNZ _project_00402B85
CMP DWORD PTR [EBP-0x38],ESI
JNZ _project_00402B85
CMP DWORD PTR [EBP-0x3C],ESI
JNZ _project_00402B85
XOR EAX,EAX
MOV WORD PTR [EBP-0x32],AX
JMP _project_00402D70
_project_00402B85:
CMP CX,SI
JNZ _project_00402BAB
INC EDX
TEST DWORD PTR [EBX+8],0x7FFFFFFF
JNZ _project_00402BAB
CMP DWORD PTR [EBX+4],ESI
JNZ _project_00402BAB
CMP DWORD PTR [EBX],ESI
JNZ _project_00402BAB
MOV DWORD PTR [EBP-0x34],ESI
MOV DWORD PTR [EBP-0x38],ESI
MOV DWORD PTR [EBP-0x3C],ESI
JMP _project_00402D70
_project_00402BAB:
MOV DWORD PTR [EBP-0x68],ESI
LEA EDI,DWORD PTR [EBP-0x28]
MOV DWORD PTR [EBP-0x58],5
_project_00402BB8:
MOV EAX,DWORD PTR [EBP-0x68]
MOV ECX,DWORD PTR [EBP-0x58]
ADD EAX,EAX
MOV DWORD PTR [EBP-0x64],ECX
TEST ECX,ECX
JLE _project_00402C19
LEA EAX,DWORD PTR [EBP+EAX-0x3C]
MOV DWORD PTR [EBP-0x5C],EAX
LEA EAX,DWORD PTR [EBX+8]
MOV DWORD PTR [EBP-0x60],EAX
_project_00402BD4:
MOV EAX,DWORD PTR [EBP-0x60]
MOV ECX,DWORD PTR [EBP-0x5C]
MOVZX ECX,WORD PTR [ECX]
MOVZX EAX,WORD PTR [EAX]
AND DWORD PTR [EBP-0x4C],0
IMUL EAX,ECX
MOV ECX,DWORD PTR [EDI-4]
LEA ESI,DWORD PTR [ECX+EAX]
CMP ESI,ECX
JB _project_00402BF5
CMP ESI,EAX
JNB _project_00402BFC
_project_00402BF5:
MOV DWORD PTR [EBP-0x4C],1
_project_00402BFC:
CMP DWORD PTR [EBP-0x4C],0
MOV DWORD PTR [EDI-4],ESI
JE _project_00402C08
INC WORD PTR [EDI]
_project_00402C08:
ADD DWORD PTR [EBP-0x5C],2
SUB DWORD PTR [EBP-0x60],2
DEC DWORD PTR [EBP-0x64]
CMP DWORD PTR [EBP-0x64],0
JG _project_00402BD4
_project_00402C19:
INC EDI
INC EDI
INC DWORD PTR [EBP-0x68]
DEC DWORD PTR [EBP-0x58]
CMP DWORD PTR [EBP-0x58],0
JG _project_00402BB8
ADD EDX,0xC002
TEST DX,DX
JLE _project_00402C69
_project_00402C32:
MOV EDI,DWORD PTR [EBP-0x24]
TEST EDI,EDI
JS _project_00402C64
MOV ESI,DWORD PTR [EBP-0x28]
MOV EAX,DWORD PTR [EBP-0x2C]
SHL DWORD PTR [EBP-0x2C],1
SHR EAX,0x1F
MOV ECX,ESI
ADD ESI,ESI
OR ESI,EAX
SHR ECX,0x1F
LEA EAX,DWORD PTR [EDI+EDI]
OR EAX,ECX
ADD EDX,0xFFFF
MOV DWORD PTR [EBP-0x28],ESI
MOV DWORD PTR [EBP-0x24],EAX
TEST DX,DX
JG _project_00402C32
_project_00402C64:
TEST DX,DX
JG _project_00402CB6
_project_00402C69:
ADD EDX,0xFFFF
TEST DX,DX
JGE _project_00402CB6
MOV EAX,EDX
NEG EAX
MOVZX ESI,AX
ADD EDX,ESI
_project_00402C7D:
TEST BYTE PTR [EBP-0x2C],1
JE _project_00402C86
INC DWORD PTR [EBP-0x50]
_project_00402C86:
MOV EAX,DWORD PTR [EBP-0x24]
MOV EDI,DWORD PTR [EBP-0x28]
MOV ECX,DWORD PTR [EBP-0x28]
SHR DWORD PTR [EBP-0x24],1
SHL EAX,0x1F
SHR EDI,1
OR EDI,EAX
MOV EAX,DWORD PTR [EBP-0x2C]
SHL ECX,0x1F
SHR EAX,1
OR EAX,ECX
DEC ESI
MOV DWORD PTR [EBP-0x28],EDI
MOV DWORD PTR [EBP-0x2C],EAX
JNZ _project_00402C7D
CMP DWORD PTR [EBP-0x50],ESI
JE _project_00402CB6
OR WORD PTR [EBP-0x2C],1
_project_00402CB6:
MOV EAX,0x8000
MOV ECX,EAX
CMP WORD PTR [EBP-0x2C],CX
JA _project_00402CD4
MOV ECX,DWORD PTR [EBP-0x2C]
AND ECX,0x1FFFF
CMP ECX,0x18000
JNZ _project_00402D08
_project_00402CD4:
CMP DWORD PTR [EBP-0x2A],-1
JNZ _project_00402D05
AND DWORD PTR [EBP-0x2A],0
CMP DWORD PTR [EBP-0x26],-1
JNZ _project_00402D00
AND DWORD PTR [EBP-0x26],0
MOV ECX,0xFFFF
CMP WORD PTR [EBP-0x22],CX
JNZ _project_00402CFA
MOV WORD PTR [EBP-0x22],AX
INC EDX
JMP _project_00402D08
_project_00402CFA:
INC WORD PTR [EBP-0x22]
JMP _project_00402D08
_project_00402D00:
INC DWORD PTR [EBP-0x26]
JMP _project_00402D08
_project_00402D05:
INC DWORD PTR [EBP-0x2A]
_project_00402D08:
MOV EAX,0x7FFF
CMP DX,AX
JB _project_00402D35
XOR EAX,EAX
XOR ECX,ECX
CMP WORD PTR [EBP-0x70],AX
MOV DWORD PTR [EBP-0x38],EAX
SETE CL
MOV DWORD PTR [EBP-0x3C],EAX
DEC ECX
AND ECX,0x80000000
ADD ECX,0x7FFF8000
MOV DWORD PTR [EBP-0x34],ECX
JMP _project_00402D70
_project_00402D35:
MOV AX,WORD PTR [EBP-0x2A]
OR EDX,DWORD PTR [EBP-0x70]
MOV WORD PTR [EBP-0x3C],AX
MOV EAX,DWORD PTR [EBP-0x28]
MOV DWORD PTR [EBP-0x3A],EAX
MOV EAX,DWORD PTR [EBP-0x24]
MOV DWORD PTR [EBP-0x36],EAX
MOV WORD PTR [EBP-0x32],DX
JMP _project_00402D70
_project_00402D52:
XOR EAX,EAX
TEST SI,SI
SETE AL
AND DWORD PTR [EBP-0x38],0
DEC EAX
AND EAX,0x80000000
ADD EAX,0x7FFF8000
AND DWORD PTR [EBP-0x3C],0
_project_00402D6D:
MOV DWORD PTR [EBP-0x34],EAX
_project_00402D70:
CMP DWORD PTR [EBP-0x54],0
JNZ _project_00402AB6
_project_00402D7A:
MOV EAX,DWORD PTR [EBP-0x34]
MOVZX ECX,WORD PTR [EBP-0x3C]
MOV ESI,DWORD PTR [EBP-0x3A]
MOV EDX,DWORD PTR [EBP-0x36]
SHR EAX,0x10
JMP _project_00402DBB
_project_00402D8C:
MOV DWORD PTR [EBP-0x6C],4
JMP _project_00402DB3
_project_00402D95:
XOR ESI,ESI
MOV EAX,0x7FFF
MOV EDX,0x80000000
XOR ECX,ECX
MOV DWORD PTR [EBP-0x6C],2
JMP _project_00402DBB
_project_00402DAC:
MOV DWORD PTR [EBP-0x6C],1
_project_00402DB3:
XOR ECX,ECX
XOR EAX,EAX
XOR EDX,EDX
XOR ESI,ESI
_project_00402DBB:
MOV EDI,DWORD PTR [EBP-0x78]
OR EAX,DWORD PTR [EBP-0x74]
MOV WORD PTR [EDI],CX
MOV WORD PTR [EDI+0xA],AX
MOV EAX,DWORD PTR [EBP-0x6C]
MOV DWORD PTR [EDI+2],ESI
MOV DWORD PTR [EDI+6],EDX
POP EDI
POP ESI
POP EBX
LEAVE
RETN
}
}
void __declspec(naked) __cdecl func1_helper(int a, int b, int c)
{
__asm
{
MOV EDI,EDI
PUSH EBP
MOV EBP,ESP
SUB ESP,0x18
MOV EAX,DWORD PTR [EBP+0x10]
PUSH EBX
PUSH ESI
XOR ESI,ESI
PUSH EDI
MOV DWORD PTR [EBP-0x18],0x404E
MOV DWORD PTR [EAX],ESI
MOV DWORD PTR [EAX+4],ESI
MOV DWORD PTR [EAX+8],ESI
CMP DWORD PTR [EBP+0xC],ESI
JBE _project_0040691E
_project_004067D8:
MOV EDX,DWORD PTR [EAX]
MOV EBX,DWORD PTR [EAX+4]
MOV ESI,EAX
LEA EDI,DWORD PTR [EBP-0x10]
MOVS DWORD PTR ES:[EDI],DWORD PTR [ESI]
MOVS DWORD PTR ES:[EDI],DWORD PTR [ESI]
MOVS DWORD PTR ES:[EDI],DWORD PTR [ESI]
MOV ECX,EDX
SHR ECX,0x1F
LEA EDI,DWORD PTR [EDX+EDX]
LEA EDX,DWORD PTR [EBX+EBX]
OR EDX,ECX
MOV ECX,DWORD PTR [EAX+8]
MOV ESI,EBX
SHR ESI,0x1F
ADD ECX,ECX
OR ECX,ESI
MOV DWORD PTR [EBP-0x14],EDI
MOV ESI,EDI
AND DWORD PTR [EBP-0x14],0
MOV EBX,EDX
SHR EBX,0x1F
ADD ECX,ECX
SHR EDI,0x1F
OR ECX,EBX
MOV EBX,DWORD PTR [EBP-0x10]
ADD ESI,ESI
ADD EDX,EDX
OR EDX,EDI
LEA EDI,DWORD PTR [ESI+EBX]
MOV DWORD PTR [EAX],ESI
MOV DWORD PTR [EAX+4],EDX
MOV DWORD PTR [EAX+8],ECX
CMP EDI,ESI
JB _project_0040682F
CMP EDI,EBX
JNB _project_00406836
_project_0040682F:
MOV DWORD PTR [EBP-0x14],1
_project_00406836:
XOR EBX,EBX
MOV DWORD PTR [EAX],EDI
CMP DWORD PTR [EBP-0x14],EBX
JE _project_00406859
LEA ESI,DWORD PTR [EDX+1]
CMP ESI,EDX
JB _project_0040684B
CMP ESI,1
JNB _project_0040684E
_project_0040684B:
XOR EBX,EBX
INC EBX
_project_0040684E:
MOV DWORD PTR [EAX+4],ESI
TEST EBX,EBX
JE _project_00406859
INC ECX
MOV DWORD PTR [EAX+8],ECX
_project_00406859:
MOV ECX,DWORD PTR [EAX+4]
MOV EDX,DWORD PTR [EBP-0xC]
LEA EBX,DWORD PTR [ECX+EDX]
XOR ESI,ESI
CMP EBX,ECX
JB _project_0040686C
CMP EBX,EDX
JNB _project_0040686F
_project_0040686C:
XOR ESI,ESI
INC ESI
_project_0040686F:
MOV DWORD PTR [EAX+4],EBX
TEST ESI,ESI
JE _project_00406879
INC DWORD PTR [EAX+8]
_project_00406879:
MOV ECX,DWORD PTR [EBP-8]
ADD DWORD PTR [EAX+8],ECX
AND DWORD PTR [EBP-0x14],0
LEA ECX,DWORD PTR [EDI+EDI]
MOV EDX,EDI
SHR EDX,0x1F
LEA EDI,DWORD PTR [EBX+EBX]
OR EDI,EDX
MOV EDX,DWORD PTR [EAX+8]
MOV ESI,EBX
SHR ESI,0x1F
LEA EBX,DWORD PTR [EDX+EDX]
MOV EDX,DWORD PTR [EBP+8]
OR EBX,ESI
MOV DWORD PTR [EAX],ECX
MOV DWORD PTR [EAX+4],EDI
MOV DWORD PTR [EAX+8],EBX
MOVSX EDX,BYTE PTR [EDX]
LEA ESI,DWORD PTR [ECX+EDX]
MOV DWORD PTR [EBP-0x10],EDX