// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]oatk/rotate.c
// Function: main
int main(int argc, char *argv[])
{
    const char *opt_str = "l:s:o:rVv:h";
    ketopt_t opt = KETOPT_INIT;
    int c, line_width, absent, ret = 0;
    sstream_t *fin;
    kh_str_t *reg_list;
    khint32_t k;
    FILE *fp_help;
    char *rotate_file, *seq_id, *seq;
    int seq_pos, strand, ln;
    
    sys_init();

    fp_help = stderr;
    line_width = 60;
    rotate_file = seq_id = 0;
    seq_pos = 0;
    strand = 0;

    while ((c = ketopt(&opt, argc, argv, 1, opt_str, long_options)) >=0 ) {
        if (c == 's') rotate_file = opt.arg;
        else if (c == 'l') line_width = atoi(opt.arg);
        else if (c == 'r') strand = 1;
        else if (c == 'v') VERBOSE = atoi(opt.arg);
        else if (c == 'h') fp_help = stdout;
        else if (c == 'o') {
            if (strcmp(opt.arg, "-") != 0) {
                if (freopen(opt.arg, "wb", stdout) == NULL) {
                    fprintf(stderr, "[ERROR]\033[1;31m failed to write the output to file '%s'\033[0m: %s\n", opt.arg, strerror(errno));
                    return 1;
                }
            }
        }
        else if (c == 'V') {
            puts(SEQROTATE_VERSION);
            return 0;
        }
        else if (c == '?') {
            fprintf(stderr, "[E::%s] unknown option: \"%s\"\n", __func__, argv[opt.i - 1]);
            return 1;
        }
        else if (c == ':') {
            fprintf(stderr, "[E::%s] missing option: \"%s\"\n", __func__, argv[opt.i - 1]);
            return 1;
        }
    }
    
    if (argc == opt.ind || fp_help == stdout) {
        fprintf(fp_help, "\n");
        fprintf(fp_help, "Usage: rotate [options] <file>[.fa[.gz]] [seq pos]\n");
        fprintf(fp_help, "Options:\n");
        fprintf(fp_help, "    -s STR        two/three-column rotation file\n");
        fprintf(fp_help, "    -r STR        rotate in reverse strand (effective without -s)\n");
        fprintf(fp_help, "    -l INT        number of residues per line; 0 for 2^31-1 [%d]\n", line_width);
        fprintf(fp_help, "    -o FILE       output results to FILE [stdout]\n");
        fprintf(fp_help, "    -v INT        verbose level [%d]\n", VERBOSE);
        fprintf(fp_help, "    --version     show version number\n");
        fprintf(fp_help, "\n");
        fprintf(fp_help, "Example: ./rotate asm.fa ctg1 100\n\n");
        return fp_help == stdout? 0 : 1;
    }

    if (argc - opt.ind < 1) {
        fprintf(stderr, "[E::%s] missing input: please specify the input FASTA file\n", __func__);
        return 1;
    }

    if (argc - opt.ind > 2) {
        seq_id  = argv[opt.ind + 1];
        seq_pos = atoll(argv[opt.ind + 2]);
        if (seq_pos <= 0) {
            fprintf(stderr, "[E::%s] rotate position must be positive: %d\n", __func__, seq_pos);
            exit(1);
        }
        if (rotate_file) {
            fprintf(stderr, "[W::%s] rotate file %s ignored\n", __func__, rotate_file);
            fprintf(stderr, "[W::%s] using positional parameters: %s %u\n", __func__, seq_id, seq_pos);
        }
    } else {
        if (!rotate_file) {
            fprintf(stderr, "[E::%s] need a file (-s) or two rotation parameters\n", __func__);
            return 1;
        }
    }

    if (line_width == 0) line_width = INT32_MAX;

    reg_list = kh_str_init();
    if (seq_id) {
        k = kh_str_put(reg_list, strdup(seq_id), &absent);
        kh_val(reg_list, k) = (uint64_t) seq_pos << 1 | strand;
    } else {
        gzFile fp;
        kstring_t s = {0,0,0};
        kstream_t *ks;
        int dret;
        int64_t pos, lineno = 0;
        char *p, *q, *sid;

        if (strand)
            fprintf(stderr, "[W::%s] the option '-r' is not effective with '-s' \n", __func__);

        fp = gzopen(rotate_file, "r");
        if (!fp) {
            fprintf(stderr, "[E::%s] failed to open file %s to read\n", __func__, rotate_file);
            exit(1);
        }
        ks = ks_init(fp);
        while (ks_getuntil(ks, KS_SEP_LINE, &s, &dret) >= 0) {
            ++lineno;
            
            p = q = s.s;
            while (isspace(*q) && *q != '\0') ++q;
            p = q;
            while (!isspace(*q) && *q != '\0') ++q;
            if (p == q) continue; // empty line
            MYMALLOC(sid, q - p + 1);
            memcpy(sid, p, q - p);
            sid[q-p] = '\0';

            while (isspace(*q) && *q != '\0') ++q;
            p = q;
            while (!isspace(*q) && *q != '\0') ++q;
            pos = atoll(p);
            if (p == q) {
                // no second column found
                fprintf(stderr, "[E::%s] invalid line at line %ld: %s\n", __func__, (long) lineno, s.s);
                fprintf(stderr, "[E::%s] need at least two columns\n", __func__);
                exit(1);
            }
            if (pos <= 0) {
                fprintf(stderr, "[E::%s] rotate position must be positive: %ld\n", __func__, pos);
                exit(1);
            }
            pos <<= 1;

            while (isspace(*q) && *q != '\0') ++q;
            p = q;
            while (!isspace(*q) && *q != '\0') ++q;
            
            if (p != q) {
                if (*p == '-') pos |= 1;
                else if (*p != '+') {
                    fprintf(stderr, "[E::%s] invalid line at line %ld: %s\n", __func__, (long) lineno, s.s);
                    fprintf(stderr, "[E::%s] the third column (strand) must be '+' or '-'\n", __func__);
                    exit(1);
                }
            }
            
            absent = 1;
            k = kh_str_put(reg_list, sid, &absent);
            if (absent)
                kh_val(reg_list, k) = (uint64_t) pos;
            else {
                fprintf(stderr, "[E::%s] invalid line at line %ld: %s\n", __func__, (long) lineno, s.s);
                fprintf(stderr, "[E::%s] duplicate sequence '%s'\n", __func__, sid);
                exit(1);
            }
        }

        ks_destroy(ks);
        gzclose(fp);
    }

    fin = sstream_open(&argv[opt.ind], 1);
    if (fin == 0) {
        fprintf(stderr, "[E::%s] failed to open files: %s\n", __func__, strerror(errno));
        exit(1);
    }
    while ((ln = sstream_read(fin)) >= 0) {
        seq_id = fin->s->ks->name.s;
        seq = fin->s->ks->seq.s;
        k = kh_str_get(reg_list, seq_id);
        fprintf(stdout, ">%s\n", seq_id);
        if (k != kh_end(reg_list)) {
            seq_pos = (kh_val(reg_list, k)) >> 1;
            strand = (kh_val(reg_list, k)) & 1;
            if (seq_pos > ln) {
                fprintf(stderr, "[E::%s] rotation position (%d) larger than sequence length (%d)\n", __func__, seq_pos, ln);
                exit(1);
            }
            if (strand) {
                print_seq(seq, seq_pos, 1, 0, line_width, stdout);
                print_seq(seq + seq_pos, ln - seq_pos, 1, seq_pos, line_width, stdout);
            } else {
                seq_pos -= 1;
                print_seq(seq + seq_pos, ln - seq_pos, 0, 0, line_width, stdout);
                print_seq(seq, seq_pos, 0, ln - seq_pos, line_width, stdout);
            }
            free((void *)kh_key(reg_list, k));
            kh_str_del(reg_list, k);
        } else
            print_seq(seq, ln, 0, 0, line_width, stdout);
        if (ln % line_width != 0) fputc('\n', stdout);
    }
    sstream_close(fin);

    for (k = (khint32_t) 0; k < kh_end(reg_list); k++) {
        if (kh_exist(reg_list, k)) {
            seq_id = (char *) kh_key(reg_list, k);
            fprintf(stderr, "[W::%s] sequence '%s' not found in the FASTA file\n", __func__, seq_id);
            free(seq_id);
        }
    }
    kh_str_destroy(reg_list);

    if (fflush(stdout) == EOF) {
        fprintf(stderr, "[E::%s] failed to write the results\n", __func__);
        exit(1);
    }

    if (VERBOSE >= 0 && !ret) {
        fprintf(stderr, "[M::%s] Version: %s\n", __func__, SEQROTATE_VERSION);
        fprintf(stderr, "[M::%s] CMD:", __func__);
        int i;
        for (i = 0; i < argc; ++i)
            fprintf(stderr, " %s", argv[i]);
        fprintf(stderr, "\n[M::%s] Real time: %.3f sec; CPU: %.3f sec; Peak RSS: %.3f GB\n", __func__, realtime() - realtime0, cputime(), peakrss() / 1024.0 / 1024.0 / 1024.0);
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x5ae0(%rip), %rax      # 0x8010
movq %rax, -0x18(%rbp)
movq 0x8ce5(%rip), %rax      # 0xb220
movq %rax, -0x38(%rbp)
movq 0x8ce2(%rip), %rax      # 0xb228
movq %rax, -0x30(%rbp)
movq 0x8cdf(%rip), %rax      # 0xb230
movq %rax, -0x28(%rbp)
movq 0x8cdc(%rip), %rax      # 0xb238
movq %rax, -0x20(%rbp)
movl $0x0, -0x48(%rbp)
callq 0x5b40
movq 0x8a85(%rip), %rax      # 0xaff8
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movl $0x3c, -0x40(%rbp)
movq $0x0, -0x78(%rbp)
movq $0x0, -0x70(%rbp)
movl $0x0, -0x84(%rbp)
movl $0x0, -0x88(%rbp)
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %r8
leaq -0x38(%rbp), %rdi
movl $0x1, %ecx
leaq 0x8c80(%rip), %r9       # 0xb240
callq 0x35a0
movl %eax, -0x3c(%rbp)
cmpl $0x0, %eax
jl 0x2793
cmpl $0x73, -0x3c(%rbp)
jne 0x25e4
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x278e
cmpl $0x6c, -0x3c(%rbp)
jne 0x25fb
movq -0x30(%rbp), %rdi
callq 0x2340
movl %eax, -0x40(%rbp)
jmp 0x278c
cmpl $0x72, -0x3c(%rbp)
jne 0x2610
movl $0x1, -0x88(%rbp)
jmp 0x278a
cmpl $0x76, -0x3c(%rbp)
jne 0x262a
movq -0x30(%rbp), %rdi
callq 0x2340
movl %eax, 0x8cdf(%rip)      # 0xb304
jmp 0x2788
cmpl $0x68, -0x3c(%rbp)
jne 0x2643
movq 0x89a1(%rip), %rax      # 0xafd8
movq (%rax), %rax
movq %rax, -0x68(%rbp)
jmp 0x2786
cmpl $0x6f, -0x3c(%rbp)
jne 0x26dc
movq -0x30(%rbp), %rdi
leaq 0x59c4(%rip), %rsi      # 0x801c
callq 0x21e0
cmpl $0x0, %eax
je 0x26d7
movq -0x30(%rbp), %rdi
movq 0x896b(%rip), %rax      # 0xafd8
movq (%rax), %rdx
leaq 0x59a7(%rip), %rsi      # 0x801e
callq 0x2170
cmpq $0x0, %rax
jne 0x26d5
movq 0x896f(%rip), %rax      # 0xaff8
movq (%rax), %rax
movq %rax, -0x100(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0xf8(%rbp)
callq 0x2080
movl (%rax), %edi
callq 0x23b0
movq -0x100(%rbp), %rdi
movq -0xf8(%rbp), %rdx
movq %rax, %rcx
leaq 0x595f(%rip), %rsi      # 0x8021
movb $0x0, %al
callq 0x2200
movl $0x1, -0x4(%rbp)
jmp 0x358c
jmp 0x26d7
jmp 0x2784
cmpl $0x56, -0x3c(%rbp)
jne 0x26fa
leaq 0x5978(%rip), %rdi      # 0x8061
callq 0x20b0
movl $0x0, -0x4(%rbp)
jmp 0x358c
cmpl $0x3f, -0x3c(%rbp)
jne 0x273c
movq 0x88f1(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rcx
leaq 0x5943(%rip), %rsi      # 0x8065
leaq 0x595a(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movl $0x1, -0x4(%rbp)
jmp 0x358c
cmpl $0x3a, -0x3c(%rbp)
jne 0x277e
movq 0x88af(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rcx
leaq 0x5924(%rip), %rsi      # 0x8088
leaq 0x5918(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movl $0x1, -0x4(%rbp)
jmp 0x358c
jmp 0x2780
jmp 0x2782
jmp 0x2784
jmp 0x2786
jmp 0x2788
jmp 0x278a
jmp 0x278c
jmp 0x278e
jmp 0x25a5
movl -0x8(%rbp), %eax
cmpl -0x38(%rbp), %eax
je 0x27af
movq -0x68(%rbp), %rax
movq 0x8832(%rip), %rcx      # 0xafd8
cmpq (%rcx), %rax
jne 0x28a1
movq -0x68(%rbp), %rdi
leaq 0x5a83(%rip), %rsi      # 0x823d
movb $0x0, %al
callq 0x2200
movq -0x68(%rbp), %rdi
leaq 0x58da(%rip), %rsi      # 0x80a6
movb $0x0, %al
callq 0x2200
movq -0x68(%rbp), %rdi
leaq 0x58fc(%rip), %rsi      # 0x80da
movb $0x0, %al
callq 0x2200
movq -0x68(%rbp), %rdi
leaq 0x58f4(%rip), %rsi      # 0x80e4
movb $0x0, %al
callq 0x2200
movq -0x68(%rbp), %rdi
leaq 0x5914(%rip), %rsi      # 0x8116
movb $0x0, %al
callq 0x2200
movq -0x68(%rbp), %rdi
movl -0x40(%rbp), %edx
leaq 0x5942(%rip), %rsi      # 0x8159
movb $0x0, %al
callq 0x2200
movq -0x68(%rbp), %rdi
leaq 0x5972(%rip), %rsi      # 0x819b
movb $0x0, %al
callq 0x2200
movq -0x68(%rbp), %rdi
movl 0x8aca(%rip), %edx      # 0xb304
leaq 0x598d(%rip), %rsi      # 0x81ce
movb $0x0, %al
callq 0x2200
movq -0x68(%rbp), %rdi
leaq 0x59a1(%rip), %rsi      # 0x81f4
movb $0x0, %al
callq 0x2200
movq -0x68(%rbp), %rdi
leaq 0x59d8(%rip), %rsi      # 0x823d
movb $0x0, %al
callq 0x2200
movq -0x68(%rbp), %rdi
leaq 0x59a4(%rip), %rsi      # 0x821b
movb $0x0, %al
callq 0x2200
movq -0x68(%rbp), %rdx
movq 0x874f(%rip), %rax      # 0xafd8
movq (%rax), %rsi
movl $0x1, %eax
xorl %ecx, %ecx
cmpq %rsi, %rdx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x358c
movl -0x8(%rbp), %eax
subl -0x38(%rbp), %eax
cmpl $0x1, %eax
jge 0x28d7
movq 0x8745(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x5982(%rip), %rsi      # 0x823f
leaq 0x57bf(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movl $0x1, -0x4(%rbp)
jmp 0x358c
movl -0x8(%rbp), %eax
subl -0x38(%rbp), %eax
cmpl $0x2, %eax
jle 0x29a5
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x21d0
movl %eax, -0x84(%rbp)
cmpl $0x0, -0x84(%rbp)
jg 0x294f
movq 0x86d1(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movl -0x84(%rbp), %ecx
leaq 0x5944(%rip), %rsi      # 0x827b
leaq 0x5745(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movl $0x1, %edi
callq 0x2360
cmpq $0x0, -0x70(%rbp)
je 0x29a3
movq 0x869b(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq -0x70(%rbp), %rcx
leaq 0x593e(%rip), %rsi      # 0x82a9
leaq 0x5711(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movq 0x8678(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq -0x78(%rbp), %rcx
movl -0x84(%rbp), %r8d
leaq 0x5934(%rip), %rsi      # 0x82c9
leaq 0x56e7(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
jmp 0x29d9
cmpq $0x0, -0x70(%rbp)
jne 0x29d7
movq 0x8645(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x5938(%rip), %rsi      # 0x82f5
leaq 0x56bf(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movl $0x1, -0x4(%rbp)
jmp 0x358c
jmp 0x29d9
cmpl $0x0, -0x40(%rbp)
jne 0x29e6
movl $0x7fffffff, -0x40(%rbp) # imm = 0x7FFFFFFF
callq 0x3b00
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0x2a4f
movq -0x58(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x78(%rbp), %rdi
callq 0x23a0
movq -0x108(%rbp), %rdi
movq %rax, %rsi
leaq -0x44(%rbp), %rdx
callq 0x3b10
movl %eax, -0x5c(%rbp)
movslq -0x84(%rbp), %rcx
shlq %rcx
movslq -0x88(%rbp), %rax
orq %rax, %rcx
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x5c(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
jmp 0x3056
leaq -0xb0(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2160
movq $0x0, -0xd0(%rbp)
cmpl $0x0, -0x88(%rbp)
je 0x2a95
movq 0x857b(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x58a3(%rip), %rsi      # 0x832a
leaq 0x55f5(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movq -0x70(%rbp), %rdi
leaq 0x58bf(%rip), %rsi      # 0x835f
callq 0x22b0
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x98(%rbp)
jne 0x2ae3
movq 0x853b(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq -0x70(%rbp), %rcx
leaq 0x5896(%rip), %rsi      # 0x8361
leaq 0x55b1(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movl $0x1, %edi
callq 0x2360
movq -0x98(%rbp), %rdi
callq 0x3b50
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rdi
movl $0x2, %esi
leaq -0xb0(%rbp), %rdx
leaq -0xbc(%rbp), %rcx
callq 0x3bb0
cmpl $0x0, %eax
jl 0x303e
movq -0xd0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xd0(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq %rax, -0xd8(%rbp)
callq 0x23e0
movq (%rax), %rax
movq -0xe0(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x109(%rbp)
je 0x2b87
movq -0xe0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x109(%rbp)
movb -0x109(%rbp), %al
testb $0x1, %al
jne 0x2b93
jmp 0x2ba7
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x2b45
movq -0xe0(%rbp), %rax
movq %rax, -0xd8(%rbp)
callq 0x23e0
movq (%rax), %rax
movq -0xe0(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x10a(%rbp)
jne 0x2bf7
movq -0xe0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x10a(%rbp)
movb -0x10a(%rbp), %al
testb $0x1, %al
jne 0x2c03
jmp 0x2c17
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x2bb5
movq -0xd8(%rbp), %rax
cmpq -0xe0(%rbp), %rax
jne 0x2c2c
jmp 0x2af6
movq -0xe0(%rbp), %rdi
movq -0xd8(%rbp), %rax
subq %rax, %rdi
addq $0x1, %rdi
shlq $0x0, %rdi
callq 0x2260
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rdi
movq -0xd8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movq -0xd8(%rbp), %rax
subq %rax, %rdx
callq 0x2230
movq -0xe8(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq -0xd8(%rbp), %rdx
subq %rdx, %rcx
movb $0x0, (%rax,%rcx)
callq 0x23e0
movq (%rax), %rax
movq -0xe0(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x10b(%rbp)
je 0x2cd3
movq -0xe0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x10b(%rbp)
movb -0x10b(%rbp), %al
testb $0x1, %al
jne 0x2cdf
jmp 0x2cf3
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x2c91
movq -0xe0(%rbp), %rax
movq %rax, -0xd8(%rbp)
callq 0x23e0
movq (%rax), %rax
movq -0xe0(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x10c(%rbp)
jne 0x2d43
movq -0xe0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x10c(%rbp)
movb -0x10c(%rbp), %al
testb $0x1, %al
jne 0x2d4f
jmp 0x2d63
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x2d01
movq -0xd8(%rbp), %rdi
callq 0x21d0
movq %rax, -0xc8(%rbp)
movq -0xd8(%rbp), %rax
cmpq -0xe0(%rbp), %rax
jne 0x2ddc
movq 0x826b(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq -0xd0(%rbp), %rcx
movq -0xa0(%rbp), %r8
leaq 0x55e4(%rip), %rsi      # 0x8389
leaq 0x52d7(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movq 0x823e(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x55eb(%rip), %rsi      # 0x83af
leaq 0x52b8(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movl $0x1, %edi
callq 0x2360
cmpq $0x0, -0xc8(%rbp)
jg 0x2e16
movq 0x820b(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq -0xc8(%rbp), %rcx
leaq 0x55d4(%rip), %rsi      # 0x83d2
leaq 0x527e(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movl $0x1, %edi
callq 0x2360
movq -0xc8(%rbp), %rax
shlq %rax
movq %rax, -0xc8(%rbp)
callq 0x23e0
movq (%rax), %rax
movq -0xe0(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x10d(%rbp)
je 0x2e69
movq -0xe0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x10d(%rbp)
movb -0x10d(%rbp), %al
testb $0x1, %al
jne 0x2e75
jmp 0x2e89
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x2e27
movq -0xe0(%rbp), %rax
movq %rax, -0xd8(%rbp)
callq 0x23e0
movq (%rax), %rax
movq -0xe0(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x10e(%rbp)
jne 0x2ed9
movq -0xe0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x10e(%rbp)
movb -0x10e(%rbp), %al
testb $0x1, %al
jne 0x2ee5
jmp 0x2ef9
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x2e97
movq -0xd8(%rbp), %rax
cmpq -0xe0(%rbp), %rax
je 0x2f99
movq -0xd8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x2f30
movq -0xc8(%rbp), %rax
orq $0x1, %rax
movq %rax, -0xc8(%rbp)
jmp 0x2f97
movq -0xd8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
je 0x2f95
movq 0x80b2(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq -0xd0(%rbp), %rcx
movq -0xa0(%rbp), %r8
leaq 0x542b(%rip), %rsi      # 0x8389
leaq 0x511e(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movq 0x8085(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x5484(%rip), %rsi      # 0x8401
leaq 0x50ff(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movl $0x1, %edi
callq 0x2360
jmp 0x2f97
jmp 0x2f99
movl $0x1, -0x44(%rbp)
movq -0x58(%rbp), %rdi
movq -0xe8(%rbp), %rsi
leaq -0x44(%rbp), %rdx
callq 0x3b10
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x44(%rbp)
je 0x2fdc
movq -0xc8(%rbp), %rcx
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x5c(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
jmp 0x3039
movq 0x8015(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq -0xd0(%rbp), %rcx
movq -0xa0(%rbp), %r8
leaq 0x538e(%rip), %rsi      # 0x8389
leaq 0x5081(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movq 0x7fe8(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq -0xe8(%rbp), %rcx
leaq 0x5416(%rip), %rsi      # 0x8437
leaq 0x505b(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movl $0x1, %edi
callq 0x2360
jmp 0x2af6
movq -0xb8(%rbp), %rdi
callq 0x3bf0
movq -0x98(%rbp), %rdi
callq 0x2050
movq -0x10(%rbp), %rdi
movslq -0x38(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movl $0x1, %esi
callq 0x4d50
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x30c0
movq 0x7f77(%rip), %rax      # 0xaff8
movq (%rax), %rax
movq %rax, -0x118(%rbp)
callq 0x2080
movl (%rax), %edi
callq 0x23b0
movq -0x118(%rbp), %rdi
movq %rax, %rcx
leaq 0x53b0(%rip), %rsi      # 0x8458
leaq 0x4fd4(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movl $0x1, %edi
callq 0x2360
jmp 0x30c2
movq -0x50(%rbp), %rdi
callq 0x4e70
movl %eax, -0x8c(%rbp)
cmpl $0x0, %eax
jl 0x333b
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq 0x40(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x58(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x3c30
movl %eax, -0x5c(%rbp)
movq 0x7ebf(%rip), %rax      # 0xafd8
movq (%rax), %rdi
movq -0x78(%rbp), %rdx
leaq 0x5353(%rip), %rsi      # 0x847a
movb $0x0, %al
callq 0x2200
movl -0x5c(%rbp), %eax
movl %eax, -0x11c(%rbp)
movq -0x58(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x3157
movq -0x58(%rbp), %rax
movl (%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x120(%rbp)
jmp 0x3161
xorl %eax, %eax
movl %eax, -0x120(%rbp)
jmp 0x3161
movl -0x11c(%rbp), %eax
movl -0x120(%rbp), %ecx
cmpl %ecx, %eax
je 0x32f2
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x5c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
shrq %rax
movl %eax, -0x84(%rbp)
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x5c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
andq $0x1, %rax
movl %eax, -0x88(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x8c(%rbp), %eax
jle 0x31f8
movq 0x7e2f(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movl -0x84(%rbp), %ecx
movl -0x8c(%rbp), %r8d
leaq 0x529f(%rip), %rsi      # 0x847f
leaq 0x4e9c(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movl $0x1, %edi
callq 0x2360
cmpl $0x0, -0x88(%rbp)
je 0x325f
movq -0x80(%rbp), %rdi
movl -0x84(%rbp), %esi
movl -0x40(%rbp), %r8d
movq 0x7dc2(%rip), %rax      # 0xafd8
movq (%rax), %r9
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x3c60
movq -0x80(%rbp), %rdi
movslq -0x84(%rbp), %rax
addq %rax, %rdi
movl -0x8c(%rbp), %esi
subl -0x84(%rbp), %esi
movl -0x84(%rbp), %ecx
movl -0x40(%rbp), %r8d
movq 0x7d88(%rip), %rax      # 0xafd8
movq (%rax), %r9
movl $0x1, %edx
callq 0x3c60
jmp 0x32ca
movl -0x84(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x84(%rbp)
movq -0x80(%rbp), %rdi
movslq -0x84(%rbp), %rax
addq %rax, %rdi
movl -0x8c(%rbp), %esi
subl -0x84(%rbp), %esi
movl -0x40(%rbp), %r8d
movq 0x7d45(%rip), %rax      # 0xafd8
movq (%rax), %r9
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x3c60
movq -0x80(%rbp), %rdi
movl -0x84(%rbp), %esi
movl -0x8c(%rbp), %ecx
subl -0x84(%rbp), %ecx
movl -0x40(%rbp), %r8d
movq 0x7d18(%rip), %rax      # 0xafd8
movq (%rax), %r9
xorl %edx, %edx
callq 0x3c60
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x5c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x2060
movq -0x58(%rbp), %rdi
movl -0x5c(%rbp), %esi
callq 0x3d60
jmp 0x3313
movq -0x80(%rbp), %rdi
movl -0x8c(%rbp), %esi
movl -0x40(%rbp), %r8d
movq 0x7cd1(%rip), %rax      # 0xafd8
movq (%rax), %r9
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x3c60
movl -0x8c(%rbp), %eax
cltd
idivl -0x40(%rbp)
cmpl $0x0, %edx
je 0x3336
movq 0x7caf(%rip), %rax      # 0xafd8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x21a0
jmp 0x30c2
movq -0x50(%rbp), %rdi
callq 0x4cd0
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0x124(%rbp)
movq -0x58(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x3374
movq -0x58(%rbp), %rax
movl (%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x128(%rbp)
jmp 0x337e
xorl %eax, %eax
movl %eax, -0x128(%rbp)
jmp 0x337e
movl -0x124(%rbp), %eax
movl -0x128(%rbp), %ecx
cmpl %ecx, %eax
jae 0x3406
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x5c(%rbp), %ecx
shrl $0x5, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl -0x5c(%rbp), %ecx
andl $0x1f, %ecx
shrl %cl, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x33f6
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x5c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movq 0x7c27(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq -0x78(%rbp), %rcx
leaq 0x50e1(%rip), %rsi      # 0x84c0
leaq 0x4c9d(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movq -0x78(%rbp), %rdi
callq 0x2060
jmp 0x33f8
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x334b
movq -0x58(%rbp), %rdi
callq 0x3d90
movq 0x7bc2(%rip), %rax      # 0xafd8
movq (%rax), %rdi
callq 0x2270
cmpl $-0x1, %eax
jne 0x344c
movq 0x7bce(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x50bf(%rip), %rsi      # 0x84f3
leaq 0x4c48(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movl $0x1, %edi
callq 0x2360
cmpl $0x0, 0x7eb1(%rip)      # 0xb304
jl 0x3585
cmpl $0x0, -0x48(%rbp)
jne 0x3585
movq 0x7b8e(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x50a4(%rip), %rsi      # 0x8518
leaq 0x4c08(%rip), %rdx      # 0x8083
leaq 0x4bdf(%rip), %rcx      # 0x8061
movb $0x0, %al
callq 0x2200
movq 0x7b68(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x5093(%rip), %rsi      # 0x852d
leaq 0x4be2(%rip), %rdx      # 0x8083
movb $0x0, %al
callq 0x2200
movl $0x0, -0xec(%rbp)
movl -0xec(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x34f5
movq 0x7b34(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movslq -0xec(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x505d(%rip), %rsi      # 0x853a
movb $0x0, %al
callq 0x2200
movl -0xec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xec(%rbp)
jmp 0x34b2
movq 0x7afc(%rip), %rax      # 0xaff8
movq (%rax), %rax
movq %rax, -0x140(%rbp)
callq 0x5ac0
leaq 0x7df6(%rip), %rax      # 0xb308
subsd (%rax), %xmm0
movsd %xmm0, -0x138(%rbp)
callq 0x5a30
movsd %xmm0, -0x130(%rbp)
callq 0x5a90
movq -0x140(%rbp), %rdi
movsd -0x138(%rbp), %xmm0
movsd -0x130(%rbp), %xmm1
cvtsi2sd %rax, %xmm2
movsd 0x4ab4(%rip), %xmm3     # 0x8008
divsd %xmm3, %xmm2
movsd 0x4aa8(%rip), %xmm3     # 0x8008
divsd %xmm3, %xmm2
movsd 0x4a9c(%rip), %xmm3     # 0x8008
divsd %xmm3, %xmm2
leaq 0x4fc7(%rip), %rsi      # 0x853e
leaq 0x4b05(%rip), %rdx      # 0x8083
movb $0x3, %al
callq 0x2200
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopl (%rax,%rax)