// File: /workspace/github_c_makefile_star2_O3/c-zhou[P]yahs/agp_to_fasta.c
// Function: main
int main(int argc, char *argv[])
{
    if (argc < 2) {
        print_help(stderr);
        return 1;
    }

    liftrlimit();
    af_realtime0 = realtime();

    FILE *fo;
    char *fa, *agp, *out;
    int line_wd, allow_unknown_oris;

    const char *opt_str = "o:ul:Vh";
    ketopt_t opt = KETOPT_INIT;
    int c;
    FILE *fp_help = stderr;
    fa = agp = out = 0;
    line_wd = 60;
    allow_unknown_oris = 0;

    while ((c = ketopt(&opt, argc, argv, 1, opt_str, long_options)) >= 0) {
        if (c == 'l') {
            line_wd = atoi(opt.arg);
        } else if (c == 'u') {
            allow_unknown_oris = 1;
        } else if (c == 'o') {
            out = opt.arg;
        } else if (c == 'h') {
            fp_help = stdout;
        } else if (c == 'V') {
            puts(AF_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 (fp_help == stdout) {
        print_help(stdout);
        return 0;
    }

    if (argc - opt.ind < 2) {
        fprintf(stderr, "[E::%s] missing input: two positional options required\n", __func__);
        print_help(stderr);
        return 1;
    }

    agp = argv[opt.ind];
    fa = argv[opt.ind + 1];

    fo = out == 0? stdout : fopen(out, "w");
    if (fo == 0) {
        fprintf(stderr, "[E::%s] cannot open file %s for writing\n", __func__, out);
        exit(EXIT_FAILURE);
    }
    
    write_fasta_file_from_agp(fa, agp, fo, line_wd, allow_unknown_oris);

    if (out != 0)
        fclose(fo);

    fprintf(stderr, "[I::%s] Version: %s\n", __func__, AF_VERSION);
    fprintf(stderr, "[I::%s] CMD:", __func__);
    int i;
    for (i = 0; i < argc; ++i)
        fprintf(stderr, " %s", argv[i]);
    fprintf(stderr, "\n[I::%s] Real time: %.3f sec; CPU: %.3f sec; Peak RSS: %.3f GB\n", __func__, realtime() - af_realtime0, cputime(), peakrss() / 1024.0 / 1024.0 / 1024.0);
 
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
cmpl $0x1, %edi
jg 0x8ff3
movq 0x500f(%rip), %rax      # 0xdff0
movq (%rax), %rdi
callq 0x970e
movl $0x1, %eax
jmp 0x9573
movq %rsi, %r13
movl %edi, %ebp
movabsq $0x100000000, %rbx      # imm = 0x100000000
movq $0x0, 0x78(%rsp)
xorl %eax, %eax
callq 0x2a1f
callq 0x2a74
movq %rbx, %r11
movsd %xmm0, 0x5326(%rip)     # 0xe348
movq 0x4fc7(%rip), %rax      # 0xdff0
movq (%rax), %rax
movq %rax, 0x68(%rsp)
leal -0x1(%rbp), %eax
movl %eax, 0x54(%rsp)
movl %ebp, %r8d
negl %r8d
movl $0x1, %ecx
movl $0x3c, 0x3c(%rsp)
xorl %r9d, %r9d
xorl %eax, %eax
movl $0x0, 0x30(%rsp)
movq %rbp, 0x18(%rsp)
movl %eax, %r10d
movq %rcx, 0x20(%rsp)
movslq %ecx, %rbx
leal (%r10,%rbp), %ecx
subl %ebx, %ecx
movl %ebx, %eax
leaq (%r8,%rax), %rdx
movq %rbx, %rbp
shlq $0x20, %rbp
leaq (,%rbx,8), %rsi
addq %r13, %rsi
movq %rsi, %r15
xorl %r14d, %r14d
movl %r10d, %r12d
movq %rbx, 0xa0(%rsp)
movq (%rsi,%r14,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x90a6
cmpb $0x0, 0x1(%rdi)
jne 0x90c2
incq %rbx
incl %r12d
incq %r14
addq %r11, %rbp
addq $0x8, %r15
movl %edx, %edi
addl %r14d, %edi
jne 0x9097
jmp 0x954c
sarq $0x1d, %rbp
movq (%r13,%rbp), %rsi
cmpb $0x2d, (%rsi)
jne 0x95cf
leaq (%rax,%r14), %rcx
movq %rcx, 0x70(%rsp)
movl %r10d, %ecx
leaq (%rcx,%r14), %rdx
movq %rdx, 0x90(%rsp)
movzbl 0x1(%rsi), %edx
cmpl $0x2d, %edx
movq %r13, 0x28(%rsp)
movq %r9, 0x40(%rsp)
movq %r10, 0x60(%rsp)
movq %r8, 0x48(%rsp)
je 0x9199
movq %rsi, 0x8(%rsp)
testl %edx, %edx
je 0x95d7
movl 0x30(%rsp), %eax
cmpl $0x1, %eax
adcl $0x0, %eax
movl %eax, 0x30(%rsp)
movslq %eax, %r13
movq 0x8(%rsp), %rax
movsbl (%rax,%r13), %ebx
incq %r13
movl $0x8, %edx
leaq 0x1cbc(%rip), %rdi      # 0xae00
movl %ebx, %esi
callq 0x21b0
testq %rax, %rax
je 0x9350
cmpb $0x3a, 0x1(%rax)
movq 0x70(%rsp), %rdx
jne 0x9375
movq 0x8(%rsp), %rax
cmpb $0x0, (%rax,%r13)
movq 0x40(%rsp), %r9
movq 0x60(%rsp), %r10
movabsq $0x100000000, %r11      # imm = 0x100000000
movq 0x48(%rsp), %r8
je 0x94fd
addq %r13, %rax
movq %rax, 0x8(%rsp)
jmp 0x93cf
movb 0x2(%rsi), %dil
testb %dil, %dil
movq %rsi, %rdx
je 0x9644
leaq 0x2(%rdx), %rax
movq %rax, 0x30(%rsp)
addq $0x3, %rdx
xorl %ecx, %ecx
testb %dil, %dil
je 0x91d1
movzbl %dil, %eax
cmpl $0x3d, %eax
je 0x91d1
movb (%rdx), %dil
incq %rdx
addq %r11, %rcx
jmp 0x91b8
movb %dil, 0x17(%rsp)
movq %rdx, 0x8(%rsp)
sarq $0x20, %rcx
movq $0x0, 0x98(%rsp)
leaq 0x4b9e(%rip), %rbp      # 0xdd90
leaq 0x1e2b(%rip), %r13      # 0xb024
movq $0x0, 0x80(%rsp)
movl $0x0, 0x5c(%rsp)
movl $0x0, 0x58(%rsp)
movq %r14, 0x88(%rsp)
movq 0x30(%rsp), %rdi
movq %r13, %rsi
movq %rcx, %rdx
movq %rcx, %r14
callq 0x2090
testl %eax, %eax
je 0x9243
movabsq $0x100000000, %r11      # imm = 0x100000000
movq %r14, %rcx
jmp 0x9272
cmpb $0x0, (%r13,%r14)
movq %r14, %rcx
je 0x925c
incl 0x5c(%rsp)
movq %rbp, 0x98(%rsp)
jmp 0x9268
incl 0x58(%rsp)
movq %rbp, 0x80(%rsp)
movabsq $0x100000000, %r11      # imm = 0x100000000
movq 0x88(%rsp), %r14
movq 0x10(%rbp), %r13
addq $0x10, %rbp
testq %r13, %r13
jne 0x921d
movl 0x58(%rsp), %esi
cmpl $0x1, %esi
movq 0x28(%rsp), %r13
movq 0x70(%rsp), %rdx
jg 0x96da
testl %esi, %esi
sete %al
movl 0x5c(%rsp), %edi
cmpl $0x2, %edi
setge %cl
andb %al, %cl
cmpb $0x1, %cl
je 0x96b3
cmpl $0x1, %edi
movq 0x40(%rsp), %r9
movq 0x60(%rsp), %r10
movq 0x20(%rsp), %rax
jne 0x92ec
cmpl $0x1, %esi
movq 0x80(%rsp), %rcx
cmovneq 0x98(%rsp), %rcx
movq 0x18(%rsp), %rbp
movq 0x48(%rsp), %r8
jmp 0x9303
cmpl $0x1, %esi
movq 0x18(%rsp), %rbp
movq 0x48(%rsp), %r8
movq 0x80(%rsp), %rcx
jne 0x933d
testq %rcx, %rcx
je 0x933d
movq %rcx, %rsi
movl 0xc(%rcx), %ebx
movb 0x17(%rsp), %cl
cmpb $0x3d, %cl
je 0x93d9
testb %cl, %cl
jne 0x9342
cmpl $0x1, 0x8(%rsi)
jne 0x9342
cmpl %edx, 0x54(%rsp)
jle 0x9542
leal (%rax,%r14), %edx
incl %edx
movslq %edx, %rax
jmp 0x951b
movl $0x3f, %ebx
movq $0x0, 0x8(%rsp)
jmp 0x93d9
movl $0x3f, %ebx
movq 0x40(%rsp), %r9
movq 0x60(%rsp), %r10
movabsq $0x100000000, %r11      # imm = 0x100000000
movq 0x48(%rsp), %r8
movq 0x70(%rsp), %rdx
jmp 0x938e
movq 0x40(%rsp), %r9
movq 0x60(%rsp), %r10
movabsq $0x100000000, %r11      # imm = 0x100000000
movq 0x48(%rsp), %r8
cmpl $-0x2, 0x30(%rsp)
jle 0x93c6
movq 0x28(%rsp), %rax
movq (%rax,%rbp), %rax
movl %r13d, %ecx
cmpb $0x0, (%rax,%rcx)
je 0x93c6
movl %r13d, 0x30(%rsp)
movl %edx, %ecx
movq $0x0, 0x8(%rsp)
movq 0x28(%rsp), %r13
movq 0x18(%rsp), %rbp
jmp 0x9452
movq $0x0, 0x8(%rsp)
movq 0x28(%rsp), %r13
movq 0x18(%rsp), %rbp
leal 0x1(%rdx), %ecx
movl $0x0, 0x30(%rsp)
movq 0x90(%rsp), %rax
testl %eax, %eax
jle 0x9452
movq %rcx, 0x20(%rsp)
movq %r8, %r9
movq 0xa0(%rsp), %rsi
addq %r14, %rsi
movl %eax, %eax
movslq %edx, %rcx
movl %r12d, %edx
movq %rsi, %r12
negq %rdx
movq (%r13,%r12,8), %rsi
xorl %edi, %edi
movq -0x8(%r15,%rdi,8), %r8
movq %r8, (%r15,%rdi,8)
decq %rdi
cmpq %rdi, %rdx
jne 0x9418
movq %r12, %rdi
subq %rax, %rdi
movq %rsi, (%r13,%rdi,8)
leaq 0x1(%r12), %rsi
addq $0x8, %r15
cmpq %rcx, %r12
movq %rsi, %r12
jl 0x9411
movq %r9, %r8
movq 0x40(%rsp), %r9
movq 0x20(%rsp), %rcx
testl %ebx, %ebx
js 0x962a
cmpl $0x6b, %ebx
jg 0x947a
cmpl $0x67, %ebx
jle 0x94cd
cmpl $0x68, %ebx
jne 0x94e8
movq 0x4b60(%rip), %rax      # 0xdfd0
movq (%rax), %rax
movq %rax, 0x68(%rsp)
jmp 0x94e8
cmpl $0x75, %ebx
je 0x94ba
cmpl $0x6f, %ebx
je 0x94c6
cmpl $0x6c, %ebx
jne 0x94e8
movq 0x8(%rsp), %rdi
movq %r10, %r15
movq %r11, %r12
movq %r8, %rbx
movq %rcx, 0x20(%rsp)
callq 0x2340
movq 0x20(%rsp), %rcx
movq %rbx, %r8
movq %r12, %r11
movq %r15, %r10
movq 0x40(%rsp), %r9
movl %eax, 0x3c(%rsp)
jmp 0x94e8
movl $0x1, %eax
movq %rax, 0x78(%rsp)
jmp 0x94e8
movq 0x8(%rsp), %r9
jmp 0x94e8
cmpl $0x56, %ebx
je 0x96a2
cmpl $0x3a, %ebx
je 0x96bd
cmpl $0x3f, %ebx
je 0x96d8
cmpl %ebp, %ecx
movq 0x90(%rsp), %rax
jl 0x905d
jmp 0x9637
cmpl %edx, 0x54(%rsp)
movq 0x18(%rsp), %rbp
jle 0x952a
movq 0x20(%rsp), %rax
leal (%rax,%r14), %edx
incl %edx
movslq %edx, %rax
movq 0x28(%rsp), %r13
movq (%r13,%rax,8), %rax
movq %rax, 0x8(%rsp)
jmp 0x93d9
movl $0x3a, %ebx
movq $0x0, 0x8(%rsp)
movq 0x28(%rsp), %r13
jmp 0x93d9
movl $0x3a, %ebx
jmp 0x9342
movq 0x18(%rsp), %rbp
movl %ebp, %ebx
subl %ecx, %ebx
movq 0x68(%rsp), %rax
movq 0x4a6f(%rip), %rcx      # 0xdfd0
movq (%rcx), %rdx
cmpq %rdx, %rax
jne 0x9585
movq %rdx, %rdi
callq 0x970e
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebp, %eax
subl %ebx, %eax
cmpl $0x1, %eax
jg 0x9598
callq 0x28c0
jmp 0x8fe9
movslq %ebx, %rax
movq (%r13,%rax,8), %r15
movq %r13, %rbx
movq 0x8(%r13,%rax,8), %r12
testq %r9, %r9
jne 0x95de
movq %r9, %r14
testq %rdx, %rdx
je 0x9706
movq %r12, %rdi
movq %r15, %rsi
movl 0x3c(%rsp), %ecx
movq 0x78(%rsp), %r8
callq 0x24e1
jmp 0x961b
movq 0x20(%rsp), %rbx
addl %r14d, %ebx
movq 0x18(%rsp), %rbp
jmp 0x9639
leaq 0xa2b(%rip), %rsi       # 0xa010
movq %r9, %r14
movq %r9, %rdi
callq 0x22c0
testq %rax, %rax
je 0x9706
movq %rax, %r13
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
movl 0x3c(%rsp), %ecx
movq 0x78(%rsp), %r8
callq 0x24e1
movq %r13, %rdi
callq 0x2100
movl %ebp, %edi
movq %rbx, %rsi
callq 0x27ae
jmp 0x9571
subl %r10d, %ecx
subl %r14d, %ecx
movl %ecx, %ebx
jmp 0x9555
movl %ecx, %ebx
addl %r14d, %r10d
movl %r10d, %ecx
jmp 0x9553
movq %rdx, %r10
addq %r14, %rcx
addq %r14, %rax
testl %ecx, %ecx
movq 0x18(%rsp), %rbp
jle 0x967c
movl %ecx, %edx
negq %rdx
movslq %eax, %rsi
leaq (,%rsi,8), %rsi
addq %r13, %rsi
xorl %edi, %edi
movq -0x8(%rsi,%rdi,8), %r8
movq %r8, (%rsi,%rdi,8)
decq %rdi
cmpq %rdi, %rdx
jne 0x966b
xorl %edx, %edx
testl %r12d, %r12d
cmovgl %r12d, %edx
movq 0x20(%rsp), %rsi
subl %edx, %esi
addl %esi, %r14d
movslq %r14d, %rdx
movq %r10, (%r13,%rdx,8)
subl %ecx, %eax
incl %eax
movl %eax, %ebx
jmp 0x9555
leaq 0x175f(%rip), %rdi      # 0xae08
callq 0x20a0
jmp 0x9571
movq 0x20(%rsp), %rbx
addl %r14d, %ebx
jmp 0x96da
movq 0x492c(%rip), %rax      # 0xdff0
movq (%rax), %rdi
movslq %ecx, %rax
movq -0x8(%r13,%rax,8), %rcx
leaq 0x175b(%rip), %rsi      # 0xae31
jmp 0x96f3
movl %ecx, %ebx
movq 0x490f(%rip), %rax      # 0xdff0
movq (%rax), %rdi
movslq %ebx, %rax
movq -0x8(%r13,%rax,8), %rcx
leaq 0x171b(%rip), %rsi      # 0xae0e
leaq 0x1732(%rip), %rdx      # 0xae2c
xorl %eax, %eax
callq 0x2200
jmp 0x8fe9
movq %r14, %rdi
callq 0x2895