// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xa0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
jge 0xbafa
movq 0x5512(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
callq 0xbf00
movl $0x1, -0x4(%rbp)
jmp 0xbee8
movb $0x0, %al
callq 0x2580
callq 0x25f0
movsd %xmm0, 0x588a(%rip)     # 0x11398
leaq 0x2213(%rip), %rax      # 0xdd28
movq %rax, -0x40(%rbp)
movq 0x5820(%rip), %rax      # 0x11340
movq %rax, -0x60(%rbp)
movq 0x581d(%rip), %rax      # 0x11348
movq %rax, -0x58(%rbp)
movq 0x581a(%rip), %rax      # 0x11350
movq %rax, -0x50(%rbp)
movq 0x5817(%rip), %rax      # 0x11358
movq %rax, -0x48(%rbp)
movq 0x54ac(%rip), %rax      # 0x10ff8
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x3c, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
movq -0x40(%rbp), %r8
leaq -0x60(%rbp), %rdi
movl $0x1, %ecx
leaq 0x57cc(%rip), %r9       # 0x11360
callq 0xbf80
movl %eax, -0x64(%rbp)
cmpl $0x0, %eax
jl 0xbcad
cmpl $0x6c, -0x64(%rbp)
jne 0xbbbc
movq -0x58(%rbp), %rdi
callq 0x2350
movl %eax, -0x34(%rbp)
jmp 0xbca8
cmpl $0x75, -0x64(%rbp)
jne 0xbbce
movl $0x1, -0x38(%rbp)
jmp 0xbca6
cmpl $0x6f, -0x64(%rbp)
jne 0xbbe1
movq -0x58(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0xbca4
cmpl $0x68, -0x64(%rbp)
jne 0xbbfa
movq 0x53ea(%rip), %rax      # 0x10fd8
movq (%rax), %rax
movq %rax, -0x70(%rbp)
jmp 0xbca2
cmpl $0x56, -0x64(%rbp)
jne 0xbc18
leaq 0x2129(%rip), %rdi      # 0xdd30
callq 0x20a0
movl $0x0, -0x4(%rbp)
jmp 0xbee8
cmpl $0x3f, -0x64(%rbp)
jne 0xbc5a
movq 0x53d3(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl -0x4c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rcx
leaq 0x20f6(%rip), %rsi      # 0xdd36
leaq 0x210d(%rip), %rdx      # 0xdd54
movb $0x0, %al
callq 0x2200
movl $0x1, -0x4(%rbp)
jmp 0xbee8
cmpl $0x3a, -0x64(%rbp)
jne 0xbc9c
movq 0x5391(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl -0x4c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rcx
leaq 0x20d7(%rip), %rsi      # 0xdd59
leaq 0x20cb(%rip), %rdx      # 0xdd54
movb $0x0, %al
callq 0x2200
movl $0x1, -0x4(%rbp)
jmp 0xbee8
jmp 0xbc9e
jmp 0xbca0
jmp 0xbca2
jmp 0xbca4
jmp 0xbca6
jmp 0xbca8
jmp 0xbb79
movq -0x70(%rbp), %rax
movq 0x5320(%rip), %rcx      # 0x10fd8
cmpq (%rcx), %rax
jne 0xbcd8
movq 0x5314(%rip), %rax      # 0x10fd8
movq (%rax), %rdi
callq 0xbf00
movl $0x0, -0x4(%rbp)
jmp 0xbee8
movl -0x8(%rbp), %eax
subl -0x60(%rbp), %eax
cmpl $0x2, %eax
jge 0xbd1d
movq 0x530e(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x2083(%rip), %rsi      # 0xdd77
leaq 0x2059(%rip), %rdx      # 0xdd54
movb $0x0, %al
callq 0x2200
movq 0x52ef(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
callq 0xbf00
movl $0x1, -0x4(%rbp)
jmp 0xbee8
movq -0x10(%rbp), %rax
movslq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl -0x60(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xbd59
movq 0x5288(%rip), %rax      # 0x10fd8
movq (%rax), %rax
movq %rax, -0x80(%rbp)
jmp 0xbd6d
movq -0x30(%rbp), %rdi
leaq 0x12ac(%rip), %rsi      # 0xd010
callq 0x22d0
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xbda9
movq 0x5275(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
movq -0x30(%rbp), %rcx
leaq 0x201e(%rip), %rsi      # 0xddaf
leaq 0x1fbc(%rip), %rdx      # 0xdd54
movb $0x0, %al
callq 0x2200
movl $0x1, %edi
callq 0x2370
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x34(%rbp), %ecx
movl -0x38(%rbp), %r8d
callq 0xa470
cmpq $0x0, -0x30(%rbp)
je 0xbdd1
movq -0x18(%rbp), %rdi
callq 0x2100
movq 0x5220(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x1ff6(%rip), %rsi      # 0xddd8
leaq 0x1f6b(%rip), %rdx      # 0xdd54
leaq 0x1f40(%rip), %rcx      # 0xdd30
movb $0x0, %al
callq 0x2200
movq 0x51fa(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x1fe5(%rip), %rsi      # 0xdded
leaq 0x1f45(%rip), %rdx      # 0xdd54
movb $0x0, %al
callq 0x2200
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0xbe54
movq 0x51cc(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x15f5(%rip), %rsi      # 0xd437
movb $0x0, %al
callq 0x2200
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0xbe1d
movq 0x519d(%rip), %rax      # 0x10ff8
movq (%rax), %rax
movq %rax, -0x98(%rbp)
callq 0x25f0
subsd 0x5526(%rip), %xmm0     # 0x11398
movsd %xmm0, -0x90(%rbp)
callq 0x2520
movsd %xmm0, -0x88(%rbp)
callq 0x25c0
movq -0x98(%rbp), %rdi
movsd -0x90(%rbp), %xmm0
movsd -0x88(%rbp), %xmm1
cvtsi2sd %rax, %xmm2
movsd 0x1e70(%rip), %xmm3     # 0xdd20
divsd %xmm3, %xmm2
movsd 0x1e64(%rip), %xmm3     # 0xdd20
divsd %xmm3, %xmm2
movsd 0x1e58(%rip), %xmm3     # 0xdd20
divsd %xmm3, %xmm2
leaq 0x1f27(%rip), %rsi      # 0xddfa
leaq 0x1e7a(%rip), %rdx      # 0xdd54
movb $0x3, %al
callq 0x2200
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)