// File: /workspace/github_c_makefile_star2_O1/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 $0x88, %rsp
cmpl $0x1, %edi
jg 0x8e6f
movq 0x5193(%rip), %rax      # 0xdff0
movq (%rax), %rdi
callq 0x952d
movl $0x1, %eax
jmp 0x9374
movq %rsi, %rbx
movl %edi, %r14d
xorl %eax, %eax
callq 0x297f
callq 0x29d4
movsd %xmm0, 0x54bf(%rip)     # 0xe348
movq 0x5160(%rip), %rax      # 0xdff0
movq (%rax), %rax
movq %rax, 0x50(%rsp)
movl %r14d, %r15d
leal -0x1(%r14), %eax
movl %eax, 0x34(%rsp)
movl %r14d, %eax
negl %eax
movq %rax, 0x78(%rsp)
movl $0x3c, 0x3c(%rsp)
movl $0x1, %r9d
xorl %r13d, %r13d
xorl %r10d, %r10d
movl $0x1, 0x1c(%rsp)
movq $0x0, 0x28(%rsp)
movl $0x0, 0x38(%rsp)
movq %r15, 0x68(%rsp)
cmpl %r14d, %r9d
setl %al
jge 0x8f33
movslq %r9d, %rcx
leal (%r14,%r13), %edx
subl %r9d, %edx
incq %rcx
movq 0x78(%rsp), %rax
leal (%rax,%r9), %edi
movb $0x1, %al
xorl %esi, %esi
movq -0x8(%rbx,%rcx,8), %r8
cmpb $0x2d, (%r8)
jne 0x8f13
cmpb $0x0, 0x1(%r8)
jne 0x8f2d
cmpq %r15, %rcx
setl %al
decl %esi
incq %rcx
cmpl %esi, %edi
jne 0x8f01
movl %edx, %r13d
movl %r14d, %r9d
movl %r14d, %r8d
jmp 0x8f36
subl %esi, %r13d
subl %esi, %r9d
movl %r9d, %r8d
testb $0x1, %al
movq %r13, 0x10(%rsp)
je 0x8f65
movslq %r8d, %r15
movq (%rbx,%r15,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x8f65
movzbl 0x1(%rdi), %eax
cmpl $0x2d, %eax
movq %r9, 0x20(%rsp)
je 0x9011
testl %eax, %eax
jne 0x9052
subl %r13d, %r8d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %edi, %edi
movl %r8d, 0x1c(%rsp)
testl %eax, %eax
js 0x934b
cmpl $0x6b, %eax
jle 0x8fc0
cmpl $0x75, %eax
movq 0x68(%rsp), %r15
je 0x919e
cmpl $0x6f, %eax
movq 0x10(%rsp), %r13
je 0x91b0
cmpl $0x6c, %eax
jne 0x8edf
movq %r9, %rbp
movq %r10, %r12
callq 0x2340
movq %r12, %r10
movq %rbp, %r9
movl %eax, 0x3c(%rsp)
jmp 0x8edf
cmpl $0x67, %eax
movq 0x68(%rsp), %r15
jg 0x8fef
cmpl $0x56, %eax
movq 0x10(%rsp), %r13
je 0x9366
cmpl $0x3a, %eax
je 0x93b9
cmpl $0x3f, %eax
jne 0x8edf
jmp 0x939e
cmpl $0x68, %eax
movq 0x10(%rsp), %r13
jne 0x8edf
movq 0x4fcc(%rip), %rax      # 0xdfd0
movq (%rax), %rax
movq %rax, 0x50(%rsp)
jmp 0x8edf
cmpb $0x0, 0x2(%rdi)
je 0x9165
movq %r8, 0x8(%rsp)
leaq 0x2(%rdi), %rax
movq %rax, 0x80(%rsp)
addq $0x3, %rdi
xorl %r12d, %r12d
movabsq $0x100000000, %rax      # imm = 0x100000000
movzbl -0x1(%rdi), %ebp
testl %ebp, %ebp
je 0x90be
cmpl $0x3d, %ebp
je 0x90be
addq %rax, %r12
incq %rdi
jmp 0x903d
movq %r8, 0x8(%rsp)
cmpl $0x1, %r10d
adcl $0x0, %r10d
movslq %r10d, %r10
movq %rdi, %rbp
movsbl (%rdi,%r10), %esi
incq %r10
movq %r10, %r13
movl $0x8, %edx
leaq 0x1d84(%rip), %rdi      # 0xae00
movl %esi, %r12d
callq 0x21b0
testq %rax, %rax
je 0x918f
cmpb $0x3a, 0x1(%rax)
movq 0x20(%rsp), %r9
jne 0x91e7
cmpb $0x0, (%rbp,%r13)
je 0x927a
movq %rbp, %rdi
addq %r13, %rdi
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rsi
jmp 0x92b8
movq %rdi, 0x70(%rsp)
movq %r14, 0x48(%rsp)
sarq $0x20, %r12
movq $0x0, 0x60(%rsp)
leaq 0x4cb4(%rip), %r14      # 0xdd90
leaq 0x1f41(%rip), %r13      # 0xb024
movq $0x0, 0x58(%rsp)
movl $0x0, 0x44(%rsp)
movl $0x0, 0x40(%rsp)
movq 0x80(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x2090
testl %eax, %eax
jne 0x912f
cmpb $0x0, (%r13,%r12)
je 0x9126
incl 0x44(%rsp)
movq %r14, 0x60(%rsp)
jmp 0x912f
incl 0x40(%rsp)
movq %r14, 0x58(%rsp)
movq 0x20(%rsp), %r9
movq 0x10(%r14), %r13
addq $0x10, %r14
testq %r13, %r13
jne 0x90fc
movl $0x3f, %eax
movl 0x40(%rsp), %r8d
cmpl $0x1, %r8d
jle 0x91ba
xorl %edi, %edi
movl $0x3f, %r12d
xorl %ecx, %ecx
movq 0x48(%rsp), %r14
jmp 0x92a5
testl %r13d, %r13d
jle 0x9250
movl %r13d, %ecx
leaq (%rbx,%r15,8), %rdx
xorl %eax, %eax
movq -0x8(%rdx), %rsi
movq %rsi, (%rdx)
addq $-0x8, %rdx
incq %rax
cmpq %rax, %rcx
jne 0x9177
jmp 0x9252
movl $0x3f, %r12d
xorl %edi, %edi
movq 0x20(%rsp), %r9
jmp 0x91e9
movl $0x1, 0x38(%rsp)
movq 0x10(%rsp), %r13
jmp 0x8edf
movq %rdi, 0x28(%rsp)
jmp 0x8edf
testl %r8d, %r8d
sete %cl
movl 0x44(%rsp), %esi
cmpl $0x2, %esi
setge %dl
testb %dl, %cl
movq 0x48(%rsp), %r14
movq 0x70(%rsp), %rdi
je 0x91f6
xorl %edi, %edi
movl $0x3f, %r12d
xorl %ecx, %ecx
jmp 0x92a5
xorl %edi, %edi
movq 0x8(%rsp), %rsi
movq %r13, %r10
jmp 0x92b8
cmpl $0x1, %esi
movl $0x0, %edx
movq 0x60(%rsp), %rsi
cmovneq %rdx, %rsi
cmpl $0x1, %r8d
cmoveq 0x58(%rsp), %rsi
movb $0x1, %cl
testq %rsi, %rsi
je 0x929d
movl 0xc(%rsi), %r12d
cmpb $0x3d, %bpl
cmovneq %rdx, %rdi
testb %bpl, %bpl
jne 0x92a5
cmpl $0x1, 0x8(%rsi)
movq 0x8(%rsp), %rsi
jne 0x92aa
cmpl 0x34(%rsp), %esi
jge 0x9340
leal 0x1(%rsi), %r9d
movslq %esi, %rdx
movq 0x8(%rbx,%rdx,8), %rdi
jmp 0x92aa
xorl %eax, %eax
movl %r8d, %ecx
subl %eax, %ecx
movslq %ecx, %rax
movq %rdi, (%rbx,%rax,8)
incl %r8d
movl %r8d, %eax
subl %r13d, %eax
movl %eax, 0x1c(%rsp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %r8d, %r9d
xorl %edi, %edi
jmp 0x8f74
movq 0x8(%rsp), %rsi
cmpl 0x34(%rsp), %esi
jge 0x932d
leal 0x1(%rsi), %r9d
movslq %esi, %rax
movq 0x8(%rbx,%rax,8), %rdi
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
jmp 0x92b8
xorl %edi, %edi
movl $0x3f, %r12d
movq 0x8(%rsp), %rsi
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
testb %cl, %cl
je 0x8f74
testl %r10d, %r10d
js 0x92d2
movslq %r9d, %rax
movq (%rbx,%rax,8), %rax
movl %r10d, %ecx
cmpb $0x0, (%rax,%rcx)
je 0x92d2
movl %r9d, %eax
jmp 0x9318
leal 0x1(%r9), %eax
xorl %r10d, %r10d
cmpl $0x0, 0x10(%rsp)
jle 0x9318
cmpl %r9d, %esi
jg 0x9318
movl 0x10(%rsp), %ecx
leaq (%rbx,%r15,8), %rdx
negq %rcx
movq (%rbx,%r15,8), %rsi
xorl %r9d, %r9d
movq -0x8(%rdx,%r9,8), %r8
movq %r8, (%rdx,%r9,8)
decq %r9
cmpq %r9, %rcx
jne 0x92f7
movq %rsi, (%rdx,%r9,8)
incq %r15
addq $0x8, %rdx
cmpl %r15d, %eax
jne 0x92f0
movl %eax, %ecx
subl 0x10(%rsp), %ecx
movl %ecx, 0x1c(%rsp)
movl %eax, %r9d
movl %r12d, %eax
jmp 0x8f74
movl $0x3a, %r12d
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
xorl %edi, %edi
jmp 0x92b8
movl $0x3a, %r12d
jmp 0x92aa
movq 0x4c7e(%rip), %rax      # 0xdfd0
movq (%rax), %r15
cmpq %r15, 0x50(%rsp)
jne 0x9386
movq %r15, %rdi
callq 0x952d
jmp 0x9372
leaq 0x1a9b(%rip), %rdi      # 0xae08
callq 0x20a0
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r14d, %eax
movl 0x1c(%rsp), %ecx
subl %ecx, %eax
cmpl $0x1, %eax
jg 0x93e5
callq 0x2823
jmp 0x8e65
movq 0x4c4b(%rip), %rax      # 0xdff0
movq (%rax), %rdi
movslq %r9d, %rax
movq -0x8(%rbx,%rax,8), %rcx
leaq 0x1a57(%rip), %rsi      # 0xae0e
jmp 0x93d2
movq 0x4c30(%rip), %rax      # 0xdff0
movq (%rax), %rdi
movslq %r9d, %rax
movq -0x8(%rbx,%rax,8), %rcx
leaq 0x1a5f(%rip), %rsi      # 0xae31
leaq 0x1a53(%rip), %rdx      # 0xae2c
xorl %eax, %eax
callq 0x2200
jmp 0x8e65
movslq %ecx, %rax
movq (%rbx,%rax,8), %r12
movq 0x8(%rbx,%rax,8), %r13
cmpq $0x0, 0x28(%rsp)
je 0x940d
leaq 0xc10(%rip), %rsi       # 0xa010
movq 0x28(%rsp), %rdi
callq 0x22c0
movq %rax, %r15
testq %r15, %r15
je 0x9523
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
movl 0x3c(%rsp), %ecx
movl 0x38(%rsp), %r8d
callq 0x24e1
cmpq $0x0, 0x28(%rsp)
je 0x943d
movq %r15, %rdi
callq 0x2100
movq 0x4bac(%rip), %r12      # 0xdff0
movq (%r12), %rdi
leaq 0x1a61(%rip), %rsi      # 0xaeb0
leaq 0x19d6(%rip), %r15      # 0xae2c
leaq 0x19ab(%rip), %rcx      # 0xae08
movq %r15, %rdx
xorl %eax, %eax
callq 0x2200
movq (%r12), %rdi
leaq 0x1a53(%rip), %rsi      # 0xaec5
movq %r15, %rdx
xorl %eax, %eax
callq 0x2200
cmpl $0x2, %r14d
movl $0x1, %r15d
cmovgel %r14d, %r15d
leaq 0x107c(%rip), %r14      # 0xa50d
xorl %r12d, %r12d
movq 0x4b55(%rip), %rax      # 0xdff0
movq (%rax), %rdi
movq (%rbx,%r12,8), %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x2200
incq %r12
cmpq %r12, %r15
jne 0x9494
movq 0x4b35(%rip), %rax      # 0xdff0
movq (%rax), %rbx
callq 0x29d4
subsd 0x4e7d(%rip), %xmm0     # 0xe348
movsd %xmm0, 0x10(%rsp)
callq 0x293c
movsd %xmm0, 0x20(%rsp)
callq 0x29ae
cvtsi2sd %rax, %xmm2
movsd 0x190a(%rip), %xmm0     # 0xadf8
mulsd %xmm0, %xmm2
mulsd %xmm0, %xmm2
mulsd %xmm0, %xmm2
leaq 0x19d1(%rip), %rsi      # 0xaed2
leaq 0x1924(%rip), %rdx      # 0xae2c
movq %rbx, %rdi
movsd 0x10(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
movb $0x3, %al
callq 0x2200
jmp 0x9372
movq 0x28(%rsp), %rdi
callq 0x27f8