// File: /workspace/github_cpp_makefile_star2_O1/joncampbell123[P]floppytools/kryo_ibm.cpp
// Function: main
int main(int argc,char **argv) {
    struct flux_bits fb;
    struct kryoflux_event ev;
    std::vector<std::string> cappaths;
    std::string path;
    FILE *dsk_fp;
    int c;

    if (argc < 2) {
        fprintf(stderr,"%s <raw capture directory> [dir...]\n",argv[0]);
        return 1;
    }

    for (int i=1;i < argc;i++) {
        char *a = argv[i];

        if (*a == '-') {
            do { a++; } while (*a == '-');

            if (!strcmp(a,"1.4mb")) {
                sectors = 18;
                heads = 2;
                tracks = 80;
                sector_size = 512;
            }
            else if (!strcmp(a,"720k")) {
                sectors = 9;
                heads = 2;
                tracks = 80;
                sector_size = 512;
            }
            else if (!strcmp(a,"sside")) {
                heads = 1;
            }
            else if (!strcmp(a,"dside")) {
                heads = 2;
            }
            else {
                fprintf(stderr,"Unknown switch %s\n",a);
                return 1;
            }
        }
        else {
            cappaths.push_back(argv[i]);
        }
    }

    dsk_fp = fopen("disk.img","wb");
    if (dsk_fp == NULL) return 1;

    /* sector size auto-detect */
    for (size_t capidx=0;capidx < cappaths.size();capidx++) {
        if (sector_size == 0) {
            printf("Auto-detecting sector size...\n");

            FILE *fp = kryo_fopen(cappaths[capidx],0/*track*/,0/*head*/);
            if (fp == NULL)
                continue;

            if (!autodetect_flux_bits_mfm(fb,ev,fp)) {
                fclose(fp);
                continue;
            }

            flux_bits ofb = fb;

            fseek(fp,0,SEEK_SET);
            fb.clear();

            static const unsigned int max_sector = 40; /* more than enough for even 2.88MB formats */
            unsigned long count_sszcode[max_sector] = {0};

            while (mfm_find_sync(fb,ev,fp)) {
                mfm_sector_id sid;

                if (flux_bits_mfm_read_sync_and_byte(fb,ev,fp) != 0xFE) continue;
                if (flux_bits_mfm_read_sector_id(sid,fb,ev,fp) < 0) continue;

                /* this is a read from track 0 head 0, make sure it matches */
                if (sid.track != 0 || sid.side != 0) continue;
                if (sid.sector_size_code < max_sector) count_sszcode[sid.sector_size_code]++;
            }

            /* scan the histogram for the most common sector size */
            {
                int sel = -1;
                unsigned long sel_count = 0;
                for (unsigned int i=0;i < max_sector;i++) {
                    if (sel_count < count_sszcode[i]) {
                        sel_count = count_sszcode[i];
                        sel = i;
                    }
                }

                if (sel_count >= 6 && sel >= 0) {
                    sector_size = 128u << (unsigned int)sel;
                }
            }

            fclose(fp);
        }
    }

    /* double track detect. Read track 2 and see how they are marked. This is needed to support 360KB DD floppies imaged by a 1.2MB HD drive. */
    for (size_t capidx=0;capidx < cappaths.size();capidx++) {
        if (sector_size != 0 && double_track == 0) {
            printf("Auto-detecting double/single track...\n");

            FILE *fp = kryo_fopen(cappaths[capidx],2/*track*/,0/*head*/);
            if (fp == NULL)
                continue;

            if (!autodetect_flux_bits_mfm(fb,ev,fp)) {
                fclose(fp);
                continue;
            }

            flux_bits ofb = fb;

            fseek(fp,0,SEEK_SET);
            fb.clear();

            unsigned long count_1x = 0;
            unsigned long count_2x = 0;

            while (mfm_find_sync(fb,ev,fp)) {
                mfm_sector_id sid;

                if (flux_bits_mfm_read_sync_and_byte(fb,ev,fp) != 0xFE) continue;
                if (flux_bits_mfm_read_sector_id(sid,fb,ev,fp) < 0) continue;

                /* this is a read from track 0 head 0, make sure it matches */
                if (sid.side != 0) continue;
                if (sid.sector_size() != sector_size) continue;

                if (sid.track == 1/*DD in HD case*/) count_2x++;
                else if (sid.track == 2/*HD in HD case or normal floppy*/) count_1x++;
            }

            /* scan the histogram for the most common sector size */
            if (count_1x >= 4 || count_2x >= 4) {
                if (count_2x > (count_1x / 2u))
                    double_track = 2;
                else if (count_1x > (count_2x / 2u))
                    double_track = 1;
            }

            fclose(fp);
        }
    }

    /* sectors per track autodetect. scan multiple tracks in case of missing/unreadable sectors in track 0 */
    for (size_t capidx=0;capidx < cappaths.size();capidx++) {
        if (sectors == 0 && sector_size != 0 && double_track != 0) {
            printf("Auto-detecting sectors per track...\n");

            for (unsigned int track=0;track < 20;track++) {
                FILE *fp = kryo_fopen(cappaths[capidx],track*double_track/*track*/,0/*head*/);
                if (fp == NULL)
                    continue;

                if (!autodetect_flux_bits_mfm(fb,ev,fp)) {
                    fclose(fp);
                    continue;
                }

                flux_bits ofb = fb;

                fseek(fp,0,SEEK_SET);
                fb.clear();

                while (mfm_find_sync(fb,ev,fp)) {
                    mfm_sector_id sid;

                    if (flux_bits_mfm_read_sync_and_byte(fb,ev,fp) != 0xFE) continue;
                    if (flux_bits_mfm_read_sector_id(sid,fb,ev,fp) < 0) continue;

                    /* this is a read from track <track> head 0, make sure it matches */
                    if (sid.track != track || sid.side != 0 || sid.sector_size() != sector_size) continue;

                    /* reject copy protection sectors that most likely have out of range numbers */
                    if (sid.sector > 24) continue; /* more than enough for 1.44MB and even DMF */

                    if (sectors < sid.sector)
                        sectors = sid.sector;
                }

                fclose(fp);
            }
        }
    }

    /* number of heads. look at side 2 (head == 1) and make sure the format matches. */
    for (size_t capidx=0;capidx < cappaths.size();capidx++) {
        if (sectors != 0 && sector_size != 0 && double_track != 0 && heads == 0) {
            unsigned int sectors2 = 0;

            printf("Auto-detecting heads...\n");

            for (unsigned int track=0;track < 20;track++) {
                FILE *fp = kryo_fopen(cappaths[capidx],track*double_track/*track*/,1/*head*/);
                if (fp == NULL)
                    continue;

                if (!autodetect_flux_bits_mfm(fb,ev,fp)) {
                    fclose(fp);
                    continue;
                }

                flux_bits ofb = fb;

                fseek(fp,0,SEEK_SET);
                fb.clear();

                while (mfm_find_sync(fb,ev,fp)) {
                    mfm_sector_id sid;

                    if (flux_bits_mfm_read_sync_and_byte(fb,ev,fp) != 0xFE) continue;
                    if (flux_bits_mfm_read_sector_id(sid,fb,ev,fp) < 0) continue;

                    /* this is a read from track <track> head 1, make sure it matches */
                    if (sid.track != track || sid.side != 1 || sid.sector_size() != sector_size) continue;

                    /* reject copy protection sectors that most likely have out of range numbers */
                    if (sid.sector > 24) continue; /* more than enough for 1.44MB and even DMF */

                    if (sectors2 < sid.sector)
                        sectors2 = sid.sector;
                }

                fclose(fp);
            }

            if (sectors2 == sectors)
                heads = 2;
            else
                heads = 1;
        }
    }

    /* number of tracks */
    for (size_t capidx=0;capidx < cappaths.size();capidx++) {
        if (sectors != 0 && sector_size != 0 && double_track != 0 && heads != 0 && tracks == 0) {
            printf("Auto-detecting tracks...\n");

            for (unsigned int track=0;track < (84/double_track);track++) {
                unsigned long sectcount = 0;
                unsigned long hsectmin = 4;
                unsigned long sectmin = hsectmin * heads; /* in case of damaged or lost sectors */

                for (unsigned int head=0;head < heads;head++) {
                    unsigned long hsectcount = 0;

		    printf("\x0D" "t=%u h=%u ",track,head);
		    fflush(stdout);

                    FILE *fp = kryo_fopen(cappaths[capidx],track*double_track/*track*/,head/*head*/);
                    if (fp == NULL)
                        continue;

                    if (!autodetect_flux_bits_mfm(fb,ev,fp)) {
                        fclose(fp);
                        continue;
                    }

                    flux_bits ofb = fb;

                    fseek(fp,0,SEEK_SET);
                    fb.clear();

                    while (mfm_find_sync(fb,ev,fp)) {
                        mfm_sector_id sid;

                        if (flux_bits_mfm_read_sync_and_byte(fb,ev,fp) != 0xFE) continue;
                        if (flux_bits_mfm_read_sector_id(sid,fb,ev,fp) < 0) continue;

                        /* this is a read from track <track> head <head>, make sure it matches */
                        if (sid.track != track || sid.side != head || sid.sector_size() != sector_size || sid.sector > sectors) continue;

                        sectcount++;
                        hsectcount++;
                        if (hsectcount >= hsectmin) break;
                    }

                    fclose(fp);
                }

		printf("\x0D            \x0D");
		fflush(stdout);

                if (sectcount >= sectmin) {
                    if (tracks <= track)
                        tracks = track + 1;
                }
            }
        }
    }

    printf("Using disk geometry C/H/S/Sz %u/%u/%u/%u doubletrack=%u\n",tracks,heads,sectors,sector_size,double_track);
    if (heads == 0 || sectors == 0 || tracks == 0 || sector_size == 0 || double_track == 0) {
        fprintf(stderr,"Unable to detect format\n");
        return 1;
    }

    captured.resize(heads * sectors * tracks);

    for (size_t pass=0;pass < 3;pass++) {
	    for (size_t capidx=0;capidx < cappaths.size();capidx++) {
		    for (unsigned int track=0;track < tracks;track++) {
			    for (unsigned int head=0;head < heads;head++) {
				    printf("Track %u head %u\n",track,head);

				    FILE *fp = kryo_fopen(cappaths[capidx],track*double_track,head);
				    if (fp == NULL) {
					    printf("Failed to open\n");
					    continue;
				    }

				    if (!autodetect_flux_bits_mfm(fb,ev,fp)) {
					    fprintf(stderr,"Autodetect failure\n");
					    fclose(fp);
					    continue;
				    }

				    flux_bits ofb = fb;
				    unsigned int capcount = 0;

				    int adj_span;
				    int dadj_span;

				    switch (pass) {
					    case 0:
						    adj_span = 0;
						    dadj_span = 0;
						    break;
					    case 1:
						    adj_span = 2;
						    dadj_span = 2;
						    break;
					    case 2:
						    adj_span = 4;
						    dadj_span = 4;
						    break;
					    default:
						    abort();
				    }

				    for (int adj_c = 0;adj_c <= (adj_span*2);adj_c++) {
					    for (int dadj_c = 0;dadj_c <= (dadj_span*2);dadj_c++) {
						    unsigned int capcount = 0;

						    int adj = adj_c;
						    int dadj = dadj_c;

						    if (adj >= (adj_span+1)) adj -= adj_span*2;
						    if (dadj >= (dadj_span+1)) dadj -= dadj_span*2;

						    if ((int)ofb.shortest+(int)adj <= 0)
							    continue;
						    fb.shortest = ofb.shortest + adj;

						    if ((int)ofb.dist+(int)dadj <= 0)
							    continue;
						    fb.dist = ofb.dist + dadj;

						    unsigned long snum = ((track * heads) + head) * sectors;

						    for (size_t i=0;i < sectors;i++)
							    capcount += captured[i+snum];

						    if (capcount >= sectors)
							    break;

						    fseek(fp,0,SEEK_SET);
						    fb.clear();

						    while (mfm_find_sync(fb,ev,fp))
							    process_sync(dsk_fp,fb,ev,fp,track,head);
					    }
				    }

				    {
					    unsigned int capcount = 0;
					    {
						    unsigned long snum = ((track * heads) + head) * sectors;
						    for (size_t i=0;i < sectors;i++)
							    capcount += captured[i+snum];
					    }

					    unsigned long snum = ((track * heads) + head) * sectors;
					    printf("Track %u head %u capture progress: %u/%u ",track,head,capcount,sectors);
					    for (size_t i=0;i < sectors;i++) printf("%u",captured[i+snum]?1:0);
					    printf("\n");

					    if (capcount < sectors) {
						    printf("Track %u head %u not captured fully (%u < %u)\n",track,head,capcount,sectors);
					    }
				    }

				    fclose(fp);
			    }
		    }
	    }
    }

    {
        size_t count = 0;

        for (size_t i=0;i < captured.size();i++) {
            if (captured[i]) count++;
        }

        printf("Capture report: %zu captured / %zu total\n",count,captured.size());

        if (count < captured.size()) {
            printf("Missing sectors:\n");
            for (size_t i=0;i < captured.size();i++) {
                if (!captured[i])
                    printf(" %zu (C/H/S %u/%u/%u)\n",
                        i,
                        i / heads / sectors,
                        (i / sectors) % heads,
                        (i % sectors) + 1);
            }
        }
    }

    printf("Using disk geometry C/H/S/Sz %u/%u/%u/%u doubletrack=%u\n",tracks,heads,sectors,sector_size,double_track);
    fclose(dsk_fp);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x328, %rsp            # imm = 0x328
movq %rsi, -0x30(%rbp)
xorl %ecx, %ecx
movq %rcx, -0x58(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, -0x68(%rbp)
movq %rcx, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
leaq -0x200(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0xa0(%rbp)
movq %rcx, -0x8(%rax)
movb $0x0, (%rax)
cmpl $0x2, %edi
jl 0x3a95
movl %edi, %r12d
movb $0x1, %r13b
movl $0x1, %r15d
leaq -0x350(%rbp), %rbx
movq -0x30(%rbp), %rax
movq (%rax,%r15,8), %r14
cmpb $0x2d, (%r14)
jne 0x28a7
cmpb $0x2d, 0x1(%r14)
leaq 0x1(%r14), %r14
je 0x2838
movq %r14, %rdi
leaq 0x38ba(%rip), %rsi      # 0x6107
callq 0x21d0
testl %eax, %eax
je 0x28dc
movq %r14, %rdi
leaq 0x38a9(%rip), %rsi      # 0x610d
callq 0x21d0
testl %eax, %eax
je 0x28e8
movq %r14, %rdi
leaq 0x389b(%rip), %rsi      # 0x6112
callq 0x21d0
testl %eax, %eax
je 0x292f
movq %r14, %rdi
leaq 0x388a(%rip), %rsi      # 0x6118
callq 0x21d0
testl %eax, %eax
jne 0x293b
movl $0x2, 0x68bf(%rip)      # 0x9164
jmp 0x2910
movq %rbx, %rdi
movq %r14, %rsi
leaq -0x7d(%rbp), %rdx
callq 0x2090
leaq -0x50(%rbp), %rdi
movq %rbx, %rsi
callq 0x3f06
movq -0x350(%rbp), %rdi
leaq -0x340(%rbp), %rax
cmpq %rax, %rdi
je 0x2910
callq 0x2140
jmp 0x2910
movl $0x12, 0x687a(%rip)     # 0x9160
jmp 0x28f2
movl $0x9, 0x686e(%rip)      # 0x9160
movl $0x2, 0x6868(%rip)      # 0x9164
movl $0x50, 0x6862(%rip)     # 0x9168
movl $0x200, 0x685c(%rip)    # imm = 0x200
movb $0x1, %bl
testb %bl, %bl
leaq -0x350(%rbp), %rbx
je 0x2966
incq %r15
cmpq %r12, %r15
setb %r13b
jne 0x282a
jmp 0x2966
movl $0x1, 0x682b(%rip)      # 0x9164
jmp 0x2910
movq 0x669e(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
xorl %ebx, %ebx
leaq 0x37d0(%rip), %rsi      # 0x611e
movq %r14, %rdx
xorl %eax, %eax
callq 0x21e0
movl $0x1, %eax
movq %rax, -0xa0(%rbp)
jmp 0x2912
testb $0x1, %r13b
jne 0x3aaa
leaq 0x37ba(%rip), %rdi      # 0x6131
leaq 0x37bc(%rip), %rsi      # 0x613a
callq 0x2190
movl $0x1, %ecx
movq %rcx, -0xa0(%rbp)
movq %rax, -0xc0(%rbp)
testq %rax, %rax
je 0x3aaa
movq -0x48(%rbp), %rax
cmpq -0x50(%rbp), %rax
je 0x2b9c
xorl %r15d, %r15d
leaq -0x98(%rbp), %r14
cmpl $0x0, 0x67ae(%rip)      # 0x916c
jne 0x2b84
leaq 0x3974(%rip), %rdi      # 0x633f
callq 0x21f0
movq %r15, %rdi
shlq $0x5, %rdi
addq -0x50(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4fa4
movq %rax, %rbx
testq %rax, %rax
je 0x2b84
movq %r14, %rdi
leaq -0x78(%rbp), %rsi
movq %rbx, %rdx
callq 0x4a0c
testb %al, %al
je 0x2b7c
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2170
movq %r14, %rdi
callq 0x49b0
movl $0x140, %edx            # imm = 0x140
leaq -0x350(%rbp), %rdi
xorl %esi, %esi
callq 0x20d0
movups -0x78(%rbp), %xmm0
movaps %xmm0, -0x1f0(%rbp)
movq -0x60(%rbp), %r13
leaq -0x1e0(%rbp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
subq -0x68(%rbp), %r13
je 0x2a6b
js 0x3b01
movq %r13, %rdi
callq 0x2160
movq %rax, %r12
jmp 0x2a6e
xorl %r12d, %r12d
movq %r12, -0x1e0(%rbp)
movq %r12, -0x1d8(%rbp)
addq %r12, %r13
movq %r13, -0x1d0(%rbp)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %r13
subq %rsi, %r13
je 0x2a9e
movq %r12, %rdi
movq %r13, %rdx
callq 0x2210
addq %r13, %r12
movq %r12, -0x1d8(%rbp)
movq %r14, %rdi
leaq -0x1f0(%rbp), %rsi
movq %rbx, %rdx
callq 0x50f2
movl %eax, %r12d
movq -0x1e0(%rbp), %rdi
testq %rdi, %rdi
je 0x2ace
callq 0x2140
testb %r12b, %r12b
je 0x2b38
leaq -0x7d(%rbp), %rdi
callq 0x5286
movq %r14, %rdi
leaq -0x78(%rbp), %rsi
movq %rbx, %rdx
callq 0x5241
cmpl $0xfe, %eax
jne 0x2a2e
leaq -0x7d(%rbp), %rdi
movq %r14, %rsi
leaq -0x78(%rbp), %rdx
movq %rbx, %rcx
callq 0x52be
testl %eax, %eax
js 0x2a2e
movb -0x7c(%rbp), %al
orb -0x7d(%rbp), %al
jne 0x2a2e
movzbl -0x7a(%rbp), %eax
cmpq $0x27, %rax
ja 0x2a2e
incq -0x350(%rbp,%rax,8)
jmp 0x2a2e
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
xorl %eax, %eax
xorl %edx, %edx
movq %rdx, %rsi
movq -0x350(%rbp,%rax,8), %rdx
cmpq %rdx, %rsi
cmovaq %rsi, %rdx
cmovbl %eax, %ecx
incq %rax
cmpq $0x28, %rax
jne 0x2b41
cmpq $0x6, %rdx
setae %al
testl %ecx, %ecx
setns %dl
testb %dl, %al
je 0x2b7c
movl $0x80, %eax
shll %cl, %eax
movl %eax, 0x65f0(%rip)      # 0x916c
movq %rbx, %rdi
callq 0x2150
incq %r15
movq -0x48(%rbp), %rax
subq -0x50(%rbp), %rax
sarq $0x5, %rax
cmpq %rax, %r15
jb 0x29b7
movq -0x48(%rbp), %rax
cmpq -0x50(%rbp), %rax
je 0x2dc7
xorl %r14d, %r14d
cmpl $0x0, 0x65b8(%rip)      # 0x916c
je 0x2daf
cmpl $0x0, 0x65af(%rip)      # 0x9170
jne 0x2daf
leaq 0x374b(%rip), %rdi      # 0x6319
callq 0x21f0
movq %r14, %rdi
shlq $0x5, %rdi
addq -0x50(%rbp), %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x4fa4
movq %rax, %rbx
testq %rax, %rax
je 0x2daf
leaq -0x98(%rbp), %rdi
leaq -0x78(%rbp), %rsi
movq %rbx, %rdx
callq 0x4a0c
movq %r14, -0x30(%rbp)
testb %al, %al
je 0x2da3
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2170
leaq -0x98(%rbp), %rdi
callq 0x49b0
xorl %r14d, %r14d
xorl %r13d, %r13d
movups -0x78(%rbp), %xmm0
movaps %xmm0, -0x1c0(%rbp)
movq -0x60(%rbp), %r12
leaq -0x1b0(%rbp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
subq -0x68(%rbp), %r12
je 0x2c70
js 0x3afc
movq %r12, %rdi
callq 0x2160
movq %rax, %r15
jmp 0x2c73
xorl %r15d, %r15d
movq %r15, -0x1b0(%rbp)
movq %r15, -0x1a8(%rbp)
addq %r15, %r12
movq %r12, -0x1a0(%rbp)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %r12
subq %rsi, %r12
je 0x2ca3
movq %r15, %rdi
movq %r12, %rdx
callq 0x2210
addq %r12, %r15
movq %r15, -0x1a8(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
movq %rbx, %rdx
callq 0x50f2
movl %eax, %r15d
movq -0x1b0(%rbp), %rdi
testq %rdi, %rdi
movq %r14, %r12
je 0x2cda
callq 0x2140
testb %r15b, %r15b
movq %r13, %r14
je 0x2d6b
leaq -0x350(%rbp), %rdi
callq 0x5286
leaq -0x98(%rbp), %rdi
leaq -0x78(%rbp), %rsi
movq %rbx, %rdx
callq 0x5241
cmpl $0xfe, %eax
jne 0x2d63
leaq -0x350(%rbp), %rdi
leaq -0x98(%rbp), %rsi
leaq -0x78(%rbp), %rdx
movq %rbx, %rcx
callq 0x52be
testl %eax, %eax
js 0x2d63
cmpb $0x0, -0x34f(%rbp)
jne 0x2d63
leaq -0x350(%rbp), %rdi
callq 0x52a6
cmpl 0x6427(%rip), %eax      # 0x916c
jne 0x2d63
movzbl -0x350(%rbp), %eax
cmpl $0x2, %eax
je 0x2d5d
cmpl $0x1, %eax
jne 0x2d63
incq %r12
jmp 0x2d63
incq %r14
movq %r14, %r13
movq %r12, %r14
jmp 0x2c33
cmpq $0x4, %r14
setae %al
cmpq $0x4, %r12
setae %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x2da3
movq %r14, %rcx
shrq %rcx
movl $0x2, %eax
cmpq %rcx, %r12
ja 0x2d9d
shrq %r12
movl $0x1, %eax
cmpq %r12, %r14
jbe 0x2da3
movl %eax, 0x63cd(%rip)      # 0x9170
movq %rbx, %rdi
callq 0x2150
movq -0x30(%rbp), %r14
incq %r14
movq -0x48(%rbp), %rax
subq -0x50(%rbp), %rax
sarq $0x5, %rax
cmpq %rax, %r14
jb 0x2bad
movq -0x48(%rbp), %rax
cmpq -0x50(%rbp), %rax
je 0x2ff4
movq $0x0, -0x38(%rbp)
leaq -0x98(%rbp), %r14
cmpl $0x0, 0x6375(%rip)      # 0x9160
jne 0x2fd4
cmpl $0x0, 0x6374(%rip)      # 0x916c
je 0x2fd4
cmpl $0x0, 0x636b(%rip)      # 0x9170
je 0x2fd4
leaq 0x34e3(%rip), %rdi      # 0x62f5
callq 0x21f0
xorl %r13d, %r13d
movq -0x38(%rbp), %rax
shlq $0x5, %rax
movq %rax, -0x30(%rbp)
movq -0x50(%rbp), %rdi
addq -0x30(%rbp), %rdi
movl 0x633c(%rip), %esi      # 0x9170
imull %r13d, %esi
xorl %edx, %edx
callq 0x4fa4
movq %rax, %rbx
testq %rax, %rax
je 0x2fc7
movq %r14, %rdi
leaq -0x78(%rbp), %rsi
movq %rbx, %rdx
callq 0x4a0c
testb %al, %al
je 0x2fbf
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2170
movq %r14, %rdi
callq 0x49b0
movups -0x78(%rbp), %xmm0
movaps %xmm0, -0x190(%rbp)
movq -0x60(%rbp), %r12
leaq -0x180(%rbp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
subq -0x68(%rbp), %r12
je 0x2eb3
js 0x3a8b
movq %r12, %rdi
callq 0x2160
movq %rax, %r15
jmp 0x2eb6
xorl %r15d, %r15d
movq %r15, -0x180(%rbp)
movq %r15, -0x178(%rbp)
addq %r15, %r12
movq %r12, -0x170(%rbp)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %r12
subq %rsi, %r12
je 0x2ee6
movq %r15, %rdi
movq %r12, %rdx
callq 0x2210
addq %r12, %r15
movq %r15, -0x178(%rbp)
movq %r14, %rdi
leaq -0x190(%rbp), %rsi
movq %rbx, %rdx
callq 0x50f2
movl %eax, %r15d
movq -0x180(%rbp), %rdi
testq %rdi, %rdi
je 0x2f16
callq 0x2140
testb %r15b, %r15b
je 0x2fbf
leaq -0x350(%rbp), %rdi
callq 0x5286
movq %r14, %rdi
leaq -0x78(%rbp), %rsi
movq %rbx, %rdx
callq 0x5241
cmpl $0xfe, %eax
jne 0x2e76
leaq -0x350(%rbp), %rdi
movq %r14, %rsi
leaq -0x78(%rbp), %rdx
movq %rbx, %rcx
callq 0x52be
testl %eax, %eax
js 0x2e76
movzbl -0x350(%rbp), %eax
cmpl %eax, %r13d
jne 0x2e76
cmpb $0x0, -0x34f(%rbp)
jne 0x2e76
leaq -0x350(%rbp), %rdi
callq 0x52a6
cmpl 0x61da(%rip), %eax      # 0x916c
jne 0x2e76
movzbl -0x34e(%rbp), %eax
cmpl $0x18, %eax
ja 0x2e76
cmpl %eax, 0x61b2(%rip)      # 0x9160
jae 0x2e76
movl %eax, 0x61a6(%rip)      # 0x9160
jmp 0x2e76
movq %rbx, %rdi
callq 0x2150
incl %r13d
cmpl $0x14, %r13d
jne 0x2e26
movq -0x38(%rbp), %rdx
incq %rdx
movq -0x48(%rbp), %rax
subq -0x50(%rbp), %rax
sarq $0x5, %rax
movq %rdx, -0x38(%rbp)
cmpq %rax, %rdx
jb 0x2de4
movq -0x48(%rbp), %rax
cmpq -0x50(%rbp), %rax
je 0x3243
xorl %ebx, %ebx
leaq -0x98(%rbp), %r14
cmpl $0x0, 0x614e(%rip)      # 0x9160
je 0x322b
cmpl $0x0, 0x614d(%rip)      # 0x916c
je 0x322b
cmpl $0x0, 0x6144(%rip)      # 0x9170
je 0x322b
cmpl $0x0, 0x612b(%rip)      # 0x9164
jne 0x322b
leaq 0x3297(%rip), %rdi      # 0x62dd
callq 0x21f0
xorl %r13d, %r13d
movq %rbx, -0x88(%rbp)
shlq $0x5, %rbx
movq %rbx, -0x30(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x50(%rbp), %rdi
addq -0x30(%rbp), %rdi
movl 0x60fe(%rip), %esi      # 0x9170
imull %r13d, %esi
movl $0x1, %edx
callq 0x4fa4
movq %rax, %rbx
testq %rax, %rax
je 0x3201
movq %r14, %rdi
leaq -0x78(%rbp), %rsi
movq %rbx, %rdx
callq 0x4a0c
testb %al, %al
je 0x31f9
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2170
movq %r14, %rdi
callq 0x49b0
movups -0x78(%rbp), %xmm0
movaps %xmm0, -0x160(%rbp)
movq -0x60(%rbp), %r12
leaq -0x150(%rbp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
subq -0x68(%rbp), %r12
je 0x30f4
js 0x3a90
movq %r12, %rdi
callq 0x2160
movq %rax, %r15
jmp 0x30f7
xorl %r15d, %r15d
movq %r15, -0x150(%rbp)
movq %r15, -0x148(%rbp)
addq %r15, %r12
movq %r12, -0x140(%rbp)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %r12
subq %rsi, %r12
je 0x3127
movq %r15, %rdi
movq %r12, %rdx
callq 0x2210
addq %r12, %r15
movq %r15, -0x148(%rbp)
movq %r14, %rdi
leaq -0x160(%rbp), %rsi
movq %rbx, %rdx
callq 0x50f2
movl %eax, %r15d
movq -0x150(%rbp), %rdi
testq %rdi, %rdi
je 0x3157
callq 0x2140
testb %r15b, %r15b
je 0x31f9
leaq -0x350(%rbp), %rdi
callq 0x5286
movq %r14, %rdi
leaq -0x78(%rbp), %rsi
movq %rbx, %rdx
callq 0x5241
cmpl $0xfe, %eax
jne 0x30b7
leaq -0x350(%rbp), %rdi
movq %r14, %rsi
leaq -0x78(%rbp), %rdx
movq %rbx, %rcx
callq 0x52be
testl %eax, %eax
js 0x30b7
movzbl -0x350(%rbp), %eax
cmpl %eax, %r13d
jne 0x30b7
cmpb $0x1, -0x34f(%rbp)
jne 0x30b7
leaq -0x350(%rbp), %rdi
callq 0x52a6
cmpl 0x5f99(%rip), %eax      # 0x916c
jne 0x30b7
movzbl -0x34e(%rbp), %eax
cmpl $0x18, %eax
ja 0x30b7
movl -0x38(%rbp), %ecx
cmpl %eax, %ecx
cmovbel %eax, %ecx
movl %ecx, -0x38(%rbp)
jmp 0x30b7
movq %rbx, %rdi
callq 0x2150
incl %r13d
cmpl $0x14, %r13d
jne 0x3064
xorl %eax, %eax
movl -0x38(%rbp), %ecx
cmpl 0x5f47(%rip), %ecx      # 0x9160
sete %al
incl %eax
movl %eax, 0x5f40(%rip)      # 0x9164
movq -0x88(%rbp), %rbx
incq %rbx
movq -0x48(%rbp), %rax
subq -0x50(%rbp), %rax
sarq $0x5, %rax
cmpq %rax, %rbx
jb 0x300b
movq -0x48(%rbp), %rax
cmpq -0x50(%rbp), %rax
je 0x356e
leaq -0x98(%rbp), %r13
movq $0x0, -0xb0(%rbp)
cmpl $0x0, 0x5ef6(%rip)      # 0x9160
je 0x3548
cmpl $0x0, 0x5ef5(%rip)      # 0x916c
je 0x3548
cmpl $0x0, 0x5eec(%rip)      # 0x9170
je 0x3548
cmpl $0x0, 0x5ed3(%rip)      # 0x9164
je 0x3548
cmpl $0x0, 0x5eca(%rip)      # 0x9168
jne 0x3548
leaq 0x3019(%rip), %rdi      # 0x62c4
callq 0x21f0
cmpl $0x54, 0x5eb9(%rip)     # 0x9170
ja 0x3548
xorl %ecx, %ecx
movq -0xb0(%rbp), %rax
shlq $0x5, %rax
movq %rax, -0x38(%rbp)
movq %rcx, -0x30(%rbp)
movl 0x5e8c(%rip), %eax      # 0x9164
movq %rax, -0xb8(%rbp)
testq %rax, %rax
je 0x34e0
xorl %r15d, %r15d
movq $0x0, -0xa8(%rbp)
leaq 0x2e40(%rip), %rdi      # 0x613d
movq -0x30(%rbp), %rbx
movl %ebx, %esi
movl %r15d, %edx
xorl %eax, %eax
callq 0x2040
movq 0x5cb4(%rip), %rax      # 0x8fc8
movq (%rax), %rdi
callq 0x2180
movq -0x50(%rbp), %rdi
addq -0x38(%rbp), %rdi
movl 0x5e46(%rip), %esi      # 0x9170
imull %ebx, %esi
movl %r15d, %edx
callq 0x4fa4
movq %rax, %rbx
testq %rax, %rax
je 0x34ce
movq %r13, %rdi
leaq -0x78(%rbp), %rsi
movq %rbx, %rdx
callq 0x4a0c
testb %al, %al
je 0x34c6
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2170
movq %r13, %rdi
callq 0x49b0
movq $0x0, -0x88(%rbp)
movups -0x78(%rbp), %xmm0
movaps %xmm0, -0x130(%rbp)
movq -0x60(%rbp), %r14
leaq -0x120(%rbp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
subq -0x68(%rbp), %r14
je 0x33b4
js 0x3af2
movq %r14, %rdi
callq 0x2160
movq %rax, %r12
jmp 0x33b7
xorl %r12d, %r12d
movq %r12, -0x120(%rbp)
movq %r12, -0x118(%rbp)
addq %r12, %r14
movq %r14, -0x110(%rbp)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %r14
subq %rsi, %r14
je 0x33e7
movq %r12, %rdi
movq %r14, %rdx
callq 0x2210
addq %r14, %r12
movq %r12, -0x118(%rbp)
movq %r13, %rdi
leaq -0x130(%rbp), %rsi
movq %rbx, %rdx
callq 0x50f2
movl %eax, %r14d
movq -0x120(%rbp), %rdi
testq %rdi, %rdi
je 0x3417
callq 0x2140
testb %r14b, %r14b
je 0x34c6
leaq -0x350(%rbp), %rdi
callq 0x5286
movq %r13, %rdi
leaq -0x78(%rbp), %rsi
movq %rbx, %rdx
callq 0x5241
cmpl $0xfe, %eax
jne 0x3499
leaq -0x350(%rbp), %rdi
movq %r13, %rsi
leaq -0x78(%rbp), %rdx
movq %rbx, %rcx
callq 0x52be
testl %eax, %eax
js 0x3499
movzbl -0x350(%rbp), %ecx
xorl %eax, %eax
cmpl %ecx, -0x30(%rbp)
jne 0x349b
movzbl -0x34f(%rbp), %ecx
cmpl %ecx, %r15d
jne 0x349b
leaq -0x350(%rbp), %rdi
callq 0x52a6
cmpl 0x5ce4(%rip), %eax      # 0x916c
jne 0x3499
movzbl -0x34e(%rbp), %eax
cmpl %eax, 0x5cc9(%rip)      # 0x9160
jae 0x34a5
xorl %eax, %eax
testb %al, %al
je 0x3377
jmp 0x34c6
incq -0xa8(%rbp)
movq -0x88(%rbp), %rcx
incq %rcx
movq %rcx, -0x88(%rbp)
cmpq $0x4, %rcx
setae %al
jmp 0x349b
movq %rbx, %rdi
callq 0x2150
incl %r15d
cmpl 0x5c8c(%rip), %r15d     # 0x9164
jb 0x32f6
jmp 0x34eb
movq $0x0, -0xa8(%rbp)
movq -0xb8(%rbp), %rbx
shlq $0x2, %rbx
leaq 0x2c4c(%rip), %rdi      # 0x6149
xorl %eax, %eax
callq 0x2040
movq 0x5abd(%rip), %rax      # 0x8fc8
movq (%rax), %rdi
callq 0x2180
cmpq %rbx, -0xa8(%rbp)
movq -0x30(%rbp), %rcx
jb 0x3531
cmpl %ecx, 0x5c42(%rip)      # 0x9168
ja 0x3531
leal 0x1(%rcx), %eax
movl %eax, 0x5c37(%rip)      # 0x9168
incl %ecx
movl $0x54, %eax
xorl %edx, %edx
divl 0x5c30(%rip)            # 0x9170
cmpl %eax, %ecx
jb 0x32ce
movq -0xb0(%rbp), %rdx
incq %rdx
movq -0x48(%rbp), %rax
subq -0x50(%rbp), %rax
sarq $0x5, %rax
movq %rdx, -0xb0(%rbp)
cmpq %rax, %rdx
jb 0x3263
movl 0x5bf4(%rip), %esi      # 0x9168
movl 0x5bea(%rip), %edx      # 0x9164
movl 0x5be0(%rip), %ecx      # 0x9160
movl 0x5be5(%rip), %r8d      # 0x916c
movl 0x5be2(%rip), %r9d      # 0x9170
leaq 0x2bc3(%rip), %rdi      # 0x6158
xorl %eax, %eax
callq 0x2040
movl 0x5bc2(%rip), %eax      # 0x9164
testl %eax, %eax
je 0x3b06
movl 0x5bb0(%rip), %esi      # 0x9160
testl %esi, %esi
je 0x3b06
movl 0x5baa(%rip), %ecx      # 0x9168
testl %ecx, %ecx
je 0x3b06
cmpl $0x0, 0x5b9f(%rip)      # 0x916c
je 0x3b06
cmpl $0x0, 0x5b96(%rip)      # 0x9170
je 0x3b06
imull %eax, %esi
imull %ecx, %esi
leaq 0x9ba3(%rip), %rdi      # 0xd190
xorl %edx, %edx
callq 0x3d78
leaq 0x2baf(%rip), %r14      # 0x61aa
xorl %ecx, %ecx
movq -0x48(%rbp), %rax
cmpq -0x50(%rbp), %rax
je 0x3a0b
leal (%rcx,%rcx), %eax
movl %eax, -0xa8(%rbp)
leal (,%rcx,4), %r15d
xorl %edx, %edx
movq %rcx, -0xc8(%rbp)
movl %r15d, -0x38(%rbp)
cmpl $0x0, 0x5b38(%rip)      # 0x9168
je 0x39ec
movl $0x0, -0x30(%rbp)
movq %rdx, %rax
shlq $0x5, %rax
movq %rax, -0xd8(%rbp)
movq %rdx, -0xd0(%rbp)
cmpl $0x0, 0x5b0b(%rip)      # 0x9164
je 0x39d1
xorl %ebx, %ebx
movq %r14, %rdi
movl -0x30(%rbp), %r12d
movl %r12d, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x2040
movq -0x50(%rbp), %rdi
addq -0xd8(%rbp), %rdi
movl 0x5aeb(%rip), %esi      # 0x9170
imull %r12d, %esi
movl %ebx, %edx
callq 0x4fa4
movq %rax, %r13
testq %rax, %rax
je 0x38ef
leaq -0x98(%rbp), %rdi
leaq -0x78(%rbp), %rsi
movq %r13, %rdx
callq 0x4a0c
testb %al, %al
je 0x39c7
movl -0x90(%rbp), %eax
movl %eax, -0xb0(%rbp)
movl -0x8c(%rbp), %eax
movl %eax, -0xb8(%rbp)
xorl %ecx, %ecx
cmpl -0xa8(%rbp), %ecx
movl $0x0, %eax
cmoval %r15d, %eax
movq %rcx, -0xa0(%rbp)
subl %eax, %ecx
addl -0xb0(%rbp), %ecx
movl %ecx, -0x88(%rbp)
xorl %r15d, %r15d
movl $0x41, %ecx
movl -0x88(%rbp), %esi
testl %esi, %esi
jle 0x3872
cmpl -0xa8(%rbp), %r15d
movl $0x0, %edx
cmoval -0x38(%rbp), %edx
movl %r15d, %eax
subl %edx, %eax
movl %esi, -0x90(%rbp)
addl -0xb8(%rbp), %eax
jle 0x3872
movl %eax, -0x8c(%rbp)
movl 0x5a22(%rip), %eax      # 0x9160
testq %rax, %rax
je 0x377a
movq 0x9a46(%rip), %rcx      # 0xd190
movl 0x5a14(%rip), %edx      # 0x9164
imull -0x30(%rbp), %edx
addl %ebx, %edx
imull %eax, %edx
xorl %esi, %esi
movq %rax, %rdi
movq %rdx, %r8
shrq $0x6, %r8
movq (%rcx,%r8,8), %r8
btq %rdx, %r8
adcl $0x0, %esi
incq %rdx
decq %rdi
jne 0x375e
jmp 0x377c
xorl %esi, %esi
movl $0x3f, %ecx
cmpl %eax, %esi
jae 0x3872
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2170
leaq -0x98(%rbp), %rdi
callq 0x49b0
movups -0x78(%rbp), %xmm0
movaps %xmm0, -0x100(%rbp)
movq -0x60(%rbp), %r14
leaq -0xf0(%rbp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
subq -0x68(%rbp), %r14
je 0x37de
js 0x3af7
movq %r14, %rdi
callq 0x2160
movq %rax, %r12
jmp 0x37e1
xorl %r12d, %r12d
movq %r12, -0xf0(%rbp)
movq %r12, -0xe8(%rbp)
addq %r12, %r14
movq %r14, -0xe0(%rbp)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %r14
subq %rsi, %r14
je 0x3811
movq %r12, %rdi
movq %r14, %rdx
callq 0x2210
addq %r14, %r12
movq %r12, -0xe8(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0x100(%rbp), %rsi
movq %r13, %rdx
callq 0x50f2
movl %eax, %r14d
movq -0xf0(%rbp), %rdi
testq %rdi, %rdi
je 0x3845
callq 0x2140
testb %r14b, %r14b
je 0x3870
movq -0xc0(%rbp), %rdi
leaq -0x98(%rbp), %rsi
leaq -0x78(%rbp), %rdx
movq %r13, %rcx
movl -0x30(%rbp), %r8d
movl %ebx, %r9d
callq 0x24dc
jmp 0x37a1
xorl %ecx, %ecx
cmpl $0x41, %ecx
je 0x387b
testl %ecx, %ecx
jne 0x388c
leal 0x1(%r15), %eax
cmpl -0x38(%rbp), %r15d
movl %eax, %r15d
jne 0x36f8
movq -0xa0(%rbp), %rcx
leal 0x1(%rcx), %eax
movl -0x38(%rbp), %r15d
cmpl %r15d, %ecx
movl %eax, %ecx
jne 0x36d1
movl 0x58b8(%rip), %r14d     # 0x9164
movl 0x58ad(%rip), %r15d     # 0x9160
testq %r15, %r15
je 0x3900
movq 0x98d1(%rip), %rax      # 0xd190
movl -0x30(%rbp), %ecx
movl %ecx, %edi
imull %r14d, %edi
addl %ebx, %edi
imull %r15d, %edi
xorl %ecx, %ecx
movq %r15, %rdx
movq %rdi, %rsi
shrq $0x6, %rsi
movq (%rax,%rsi,8), %rsi
btq %rdi, %rsi
adcl $0x0, %ecx
incq %rdi
decq %rdx
jne 0x38d3
jmp 0x3902
leaq 0x29bf(%rip), %rdi      # 0x62b5
callq 0x21f0
jmp 0x39b7
xorl %ecx, %ecx
leaq 0x28c7(%rip), %rdi      # 0x61d0
movl -0x30(%rbp), %esi
movl %ebx, %edx
movl %ecx, -0x88(%rbp)
movl %r15d, %r8d
xorl %eax, %eax
callq 0x2040
cmpl $0x0, 0x583b(%rip)      # 0x9160
leaq 0x28ce(%rip), %r12      # 0x61fa
je 0x3975
imull -0x30(%rbp), %r14d
addl %ebx, %r14d
imull %r15d, %r14d
xorl %r15d, %r15d
leaq (%r14,%r15), %rax
movq 0x9848(%rip), %rcx      # 0xd190
movq %rax, %rdx
shrq $0x6, %rdx
movq (%rcx,%rdx,8), %rcx
xorl %esi, %esi
btq %rax, %rcx
setb %sil
movq %r12, %rdi
xorl %eax, %eax
callq 0x2040
incq %r15
movl 0x57f0(%rip), %eax      # 0x9160
cmpq %rax, %r15
jb 0x393d
movl $0xa, %edi
callq 0x21c0
movl 0x57da(%rip), %r8d      # 0x9160
movl -0x88(%rbp), %ecx
cmpl %r8d, %ecx
jae 0x39a4
leaq 0x2865(%rip), %rdi      # 0x61fd
movl -0x30(%rbp), %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x2040
movq %r13, %rdi
callq 0x2150
leaq 0x27f7(%rip), %r14      # 0x61aa
movl -0x38(%rbp), %r15d
incl %ebx
cmpl 0x57a5(%rip), %ebx      # 0x9164
jb 0x3661
jmp 0x39d1
movq %r13, %rdi
callq 0x2270
jmp 0x39b7
movl -0x30(%rbp), %eax
incl %eax
movl %eax, -0x30(%rbp)
cmpl 0x5789(%rip), %eax      # 0x9168
movq -0xd0(%rbp), %rdx
jb 0x3652
incq %rdx
movq -0x48(%rbp), %rax
subq -0x50(%rbp), %rax
sarq $0x5, %rax
cmpq %rax, %rdx
movq -0xc8(%rbp), %rcx
jb 0x3629
incq %rcx
cmpq $0x3, %rcx
jne 0x35fd
movq 0x9781(%rip), %rdx      # 0xd1a0
movl 0x9783(%rip), %ecx      # 0xd1a8
movq 0x9764(%rip), %rax      # 0xd190
subq %rax, %rdx
shlq $0x3, %rdx
addq %rcx, %rdx
je 0x3b0d
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorl %esi, %esi
leaq 0x3f(%rcx), %rdi
xorl %ebx, %ebx
leaq 0x3f(%rsi), %r8
testq %rsi, %rsi
cmovnsq %rsi, %r8
sarq $0x6, %r8
leaq (%rax,%r8,8), %r8
movq %rsi, %r9
andq %rdi, %r9
xorl %r10d, %r10d
cmpq %rcx, %r9
setbe %r10b
movq -0x8(%r8,%r10,8), %r8
btq %rsi, %r8
adcq $0x0, %rbx
incq %rsi
cmpq %rdx, %rsi
jb 0x3a4e
jmp 0x3b0f
callq 0x2080
callq 0x2080
movq -0x30(%rbp), %rdi
callq 0x22c6
movl $0x1, %eax
movq %rax, -0xa0(%rbp)
movq -0x210(%rbp), %rdi
leaq -0x200(%rbp), %rax
cmpq %rax, %rdi
je 0x3ac2
callq 0x2140
leaq -0x50(%rbp), %rdi
callq 0x3dec
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x3ad9
callq 0x2140
movq -0xa0(%rbp), %rax
addq $0x328, %rsp            # imm = 0x328
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2080
callq 0x2080
callq 0x2080
callq 0x2080
callq 0x22a4
jmp 0x3aaa
xorl %ebx, %ebx
leaq 0x2716(%rip), %rdi      # 0x622c
movq $0x0, -0xa0(%rbp)
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2040
movq 0x966e(%rip), %rax      # 0xd1a0
movl 0x9670(%rip), %ecx      # 0xd1a8
subq 0x9651(%rip), %rax      # 0xd190
leaq (%rcx,%rax,8), %rax
cmpq %rax, %rbx
jae 0x3c29
leaq 0x2751(%rip), %rdi      # 0x62a4
callq 0x21f0
movq 0x9641(%rip), %rcx      # 0xd1a0
movl 0x9643(%rip), %edx      # 0xd1a8
movq 0x9624(%rip), %rax      # 0xd190
subq %rax, %rcx
shlq $0x3, %rcx
addq %rdx, %rcx
je 0x3c29
movabsq $-0x8000000000000000, %r15 # imm = 0x8000000000000000
leaq 0x3f(%r15), %r12
leaq 0x26c5(%rip), %rbx      # 0x6256
xorl %r14d, %r14d
leaq 0x3f(%r14), %rcx
testq %r14, %r14
cmovnsq %r14, %rcx
sarq $0x6, %rcx
leaq (%rax,%rcx,8), %rax
movq %r14, %rcx
andq %r12, %rcx
xorl %edx, %edx
cmpq %r15, %rcx
setbe %dl
movq -0x8(%rax,%rdx,8), %rax
btq %r14, %rax
jb 0x3c02
movl 0x559e(%rip), %ecx      # 0x9164
movq %r14, %rax
xorl %edx, %edx
divq %rcx
movl 0x558c(%rip), %esi      # 0x9160
xorl %edx, %edx
divq %rsi
movq %rax, %r9
movq %r14, %rax
xorl %edx, %edx
divq %rsi
movq %rdx, %r8
xorl %edx, %edx
divq %rcx
movq %rdx, %rcx
incq %r8
movq %rbx, %rdi
movq %r14, %rsi
movq %r9, %rdx
xorl %eax, %eax
callq 0x2040
incq %r14
movq 0x9594(%rip), %rcx      # 0xd1a0
movl 0x9596(%rip), %edx      # 0xd1a8
movq 0x9577(%rip), %rax      # 0xd190
subq %rax, %rcx
leaq (%rdx,%rcx,8), %rcx
cmpq %rcx, %r14
jb 0x3b94
movl 0x5539(%rip), %esi      # 0x9168
movl 0x552f(%rip), %edx      # 0x9164
movl 0x5525(%rip), %ecx      # 0x9160
movl 0x552a(%rip), %r8d      # 0x916c
movl 0x5527(%rip), %r9d      # 0x9170
leaq 0x2508(%rip), %rdi      # 0x6158
xorl %eax, %eax
callq 0x2040
movq -0xc0(%rbp), %rdi
callq 0x2150
jmp 0x3aaa
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
movq %rax, %rbx
movq -0x350(%rbp), %rdi
leaq -0x340(%rbp), %rax
cmpq %rax, %rdi
jne 0x3d12
jmp 0x3d2c
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
movq %rax, %rbx
movq -0x1e0(%rbp), %rdi
jmp 0x3d0d
movq %rax, %rbx
movq -0x1b0(%rbp), %rdi
jmp 0x3d0d
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
movq %rax, %rbx
movq -0xf0(%rbp), %rdi
jmp 0x3d0d
movq %rax, %rbx
movq -0x120(%rbp), %rdi
jmp 0x3d0d
movq %rax, %rbx
movq -0x150(%rbp), %rdi
jmp 0x3d0d
jmp 0x3d29
jmp 0x3d29
movq %rax, %rbx
movq -0x180(%rbp), %rdi
testq %rdi, %rdi
je 0x3d2c
callq 0x2140
jmp 0x3d2c
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
jmp 0x3d29
movq %rax, %rbx
movq -0x210(%rbp), %rdi
leaq -0x200(%rbp), %rax
cmpq %rax, %rdi
je 0x3d44
callq 0x2140
leaq -0x50(%rbp), %rdi
callq 0x3dec
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x3d5b
callq 0x2140
movq %rbx, %rdi
callq 0x2220
nop