// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/annot-tsv.c
// Function: main
int main(int argc, char **argv)
{
    args_t *args = (args_t*) calloc(1,sizeof(args_t));
    static struct option loptions[] =
    {
        {"core",required_argument,NULL,'c'},
        {"coords",required_argument,NULL,'C'},
        {"transfer",required_argument,NULL,'f'},
        {"match",required_argument,NULL,'m'},
        {"output",required_argument,NULL,'o'},
        {"source-file",required_argument,NULL,'s'},
        {"target-file",required_argument,NULL,'t'},
        {"allow-dups",no_argument,NULL,0},
        {"max-annots",required_argument,NULL,2},
        {"no-header-idx",required_argument,NULL,'I'},
        {"version",no_argument,NULL,1},
        {"annotate",required_argument,NULL,'a'},
        {"headers",no_argument,NULL,'h'},
        {"ignore-headers",no_argument,NULL,'H'},
        {"overlap",required_argument,NULL,'O'},
        {"reciprocal",no_argument,NULL,'r'},
        {"drop-overlaps",no_argument,NULL,'x'},
        {"delim",required_argument,NULL,'d'},
        {"help",no_argument,NULL,4},
        {NULL,0,NULL,0}
    };
    char *tmp = NULL;
    int c;
    int reciprocal = 0;
    while ((c = getopt_long(argc, argv, "c:C:f:m:o:s:t:a:HO:rxh:Id:",loptions,NULL)) >= 0)
    {
        switch (c)
        {
            case  0 : args->allow_dups = 1; break;
            case  1 :
                printf(
"annot-tsv (htslib) %s\n"
"Copyright (C) 2025 Genome Research Ltd.\n", hts_version());
                return EXIT_SUCCESS;
                break;
            case  2 :
                args->max_annots = strtod(optarg, &tmp);
                if ( tmp==optarg || *tmp ) error("Could not parse --max-annots  %s\n", optarg);
                break;
            case 'I': args->no_write_hdr++; break;
            case 'd': args->delim_str = optarg; break;
            case 'h': args->headers_str = optarg; break;
            case 'H': args->headers_str = "0:0"; break;
            case 'r': reciprocal = 1; break;
            case 'c': args->core_str  = optarg; break;
            case 'C': args->coords_str  = optarg; break;
            case 't': args->dst.fname = optarg; break;
            case 'm': args->match_str = optarg; break;
            case 'a': args->annots_str = optarg; break;
            case 'o': args->out_fname = optarg; break;
            case 'O':
                args->overlap_src = strtod(optarg, &tmp);
                if ( tmp==optarg || (*tmp && *tmp!=',') ) error("Could not parse --overlap %s\n", optarg);
                if ( args->overlap_src<0 || args->overlap_src>1 ) error("Expected value(s) from the interval [0,1]: --overlap %s\n", optarg);
                if ( *tmp )
                {
                    args->overlap_dst = strtod(tmp+1, &tmp);
                    if ( *tmp ) error("Could not parse --overlap %s\n", optarg);
                    if ( args->overlap_dst<0 || args->overlap_dst>1 ) error("Expected value(s) from the interval [0,1]: --overlap %s\n", optarg);
                }
                else
                    args->overlap_either = 1;
                break;
            case 's': args->src.fname = optarg; break;
            case 'f': args->transfer_str = optarg; break;
            case 'x': args->mode = PRINT_NONMATCHING; break;
            case  4 : printf("\nVersion: %s\n%s\n",hts_version(),usage_text()); exit(EXIT_SUCCESS); break;
            case '?': // fall through
            default: error("\nVersion: %s\n%s\n",hts_version(),usage_text()); break;
        }
    }
    if ( argc==1 ) error("\nVersion: %s\n%s\n",hts_version(),usage_text());
    if ( !args->dst.fname && !args->src.fname ) error("Missing the -s and -t options\n");
    if ( !args->dst.fname || !args->src.fname )
    {
        if ( isatty(fileno((FILE *)stdin)) ) error("Missing the %s option\n",args->dst.fname?"-s":"-t");
        // reading from stdin
        if ( !args->dst.fname ) args->dst.fname = "-";
        if ( !args->src.fname ) args->src.fname = "-";
    }
    if ( !args->mode )
    {
        if ( !args->transfer_str && !args->annots_str ) args->mode = PRINT_MATCHING;
        else args->mode = PRINT_MATCHING|PRINT_NONMATCHING;
    }
    if ( (args->transfer_str || args->annots_str) && !(args->mode & PRINT_MATCHING) ) error("The option -x cannot be combined with -f and -a\n");
    if ( reciprocal )
    {
        if ( args->overlap_dst && args->overlap_src && args->overlap_dst!=args->overlap_src )
            error("The combination of --reciprocal with --overlap %f,%f makes no sense: expected single value or identical values\n",args->overlap_src,args->overlap_dst);
        if ( !args->overlap_src )
            args->overlap_src = args->overlap_dst;
        else
            args->overlap_dst = args->overlap_src;
        args->overlap_either = 0;
    }

    init_data(args);
    write_header(args, &args->dst);
    while ( read_next_line(&args->dst) )
    {
        int i;
        for (i=0; i<args->dst.grow_n; i++)
        {
            kputc(args->dst.delim, &args->dst.line);
            kputc('.', &args->dst.line);
        }
        process_line(args, args->dst.line.s, args->dst.line.l);
        args->dst.line.l = 0;
    }
    destroy_data(args);
    free(args);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, %edi
movl $0x1f8, %esi            # imm = 0x1F8
callq 0x42f0
movq %rax, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0xe4707(%rip), %rdx     # 0xed82d
leaq 0x1043e3(%rip), %rcx    # 0x10d510
xorl %eax, %eax
movl %eax, %r8d
callq 0x4840
movl %eax, -0x24(%rbp)
cmpl $0x0, %eax
jl 0x94d6
movl -0x24(%rbp), %eax
movq %rax, -0x38(%rbp)
subq $0x78, %rax
ja 0x94ae
movq -0x38(%rbp), %rax
leaq 0xe3ec1(%rip), %rcx     # 0xed020
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rax
movl $0x1, 0x198(%rax)
jmp 0x94d1
callq 0x18120
movq %rax, %rsi
leaq 0xe46be(%rip), %rdi     # 0xed848
movb $0x0, %al
callq 0x4060
movl $0x0, -0x4(%rbp)
jmp 0x97f7
movq 0x103e24(%rip), %rax    # 0x10cfc8
movq (%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x4340
cvttsd2si %xmm0, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x19c(%rax)
movq -0x20(%rbp), %rax
movq 0x103dff(%rip), %rcx    # 0x10cfc8
cmpq (%rcx), %rax
je 0x91da
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x91f2
movq 0x103de7(%rip), %rax    # 0x10cfc8
movq (%rax), %rsi
leaq 0xe469c(%rip), %rdi     # 0xed887
movb $0x0, %al
callq 0x5c70
jmp 0x94d1
movq -0x18(%rbp), %rax
movl 0x1a4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1a4(%rax)
jmp 0x94d1
movq 0x103db2(%rip), %rax    # 0x10cfc8
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x178(%rax)
jmp 0x94d1
movq 0x103d98(%rip), %rax    # 0x10cfc8
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x170(%rax)
jmp 0x94d1
movq -0x18(%rbp), %rax
leaq 0xe465b(%rip), %rcx     # 0xed8a9
movq %rcx, 0x170(%rax)
jmp 0x94d1
movl $0x1, -0x28(%rbp)
jmp 0x94d1
movq 0x103d5b(%rip), %rax    # 0x10cfc8
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x148(%rax)
jmp 0x94d1
movq 0x103d41(%rip), %rax    # 0x10cfc8
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x150(%rax)
jmp 0x94d1
movq 0x103d27(%rip), %rax    # 0x10cfc8
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x94d1
movq 0x103d10(%rip), %rax    # 0x10cfc8
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x158(%rax)
jmp 0x94d1
movq 0x103cf6(%rip), %rax    # 0x10cfc8
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x168(%rax)
jmp 0x94d1
movq 0x103cdc(%rip), %rax    # 0x10cfc8
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x188(%rax)
jmp 0x94d1
movq 0x103cc2(%rip), %rax    # 0x10cfc8
movq (%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x4340
movq -0x18(%rbp), %rax
movsd %xmm0, 0x1b0(%rax)
movq -0x20(%rbp), %rax
movq 0x103c9f(%rip), %rcx    # 0x10cfc8
cmpq (%rcx), %rax
je 0x9346
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x935e
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
je 0x935e
movq 0x103c7b(%rip), %rax    # 0x10cfc8
movq (%rax), %rsi
leaq 0xe4556(%rip), %rdi     # 0xed8ad
movb $0x0, %al
callq 0x5c70
movq -0x18(%rbp), %rax
xorps %xmm0, %xmm0
ucomisd 0x1b0(%rax), %xmm0
ja 0x9389
movq -0x18(%rbp), %rax
movsd 0x1b0(%rax), %xmm0
movsd 0xe3c85(%rip), %xmm1    # 0xed008
ucomisd %xmm1, %xmm0
jbe 0x93a1
movq 0x103c38(%rip), %rax    # 0x10cfc8
movq (%rax), %rsi
leaq 0xe4531(%rip), %rdi     # 0xed8cb
movb $0x0, %al
callq 0x5c70
movq -0x20(%rbp), %rax
cmpb $0x0, (%rax)
je 0x9431
movq -0x20(%rbp), %rdi
addq $0x1, %rdi
leaq -0x20(%rbp), %rsi
callq 0x4340
movq -0x18(%rbp), %rax
movsd %xmm0, 0x1b8(%rax)
movq -0x20(%rbp), %rax
cmpb $0x0, (%rax)
je 0x93ec
movq 0x103bed(%rip), %rax    # 0x10cfc8
movq (%rax), %rsi
leaq 0xe44c8(%rip), %rdi     # 0xed8ad
movb $0x0, %al
callq 0x5c70
movq -0x18(%rbp), %rax
xorps %xmm0, %xmm0
ucomisd 0x1b8(%rax), %xmm0
ja 0x9417
movq -0x18(%rbp), %rax
movsd 0x1b8(%rax), %xmm0
movsd 0xe3bf7(%rip), %xmm1    # 0xed008
ucomisd %xmm1, %xmm0
jbe 0x942f
movq 0x103baa(%rip), %rax    # 0x10cfc8
movq (%rax), %rsi
leaq 0xe44a3(%rip), %rdi     # 0xed8cb
movb $0x0, %al
callq 0x5c70
jmp 0x943f
movq -0x18(%rbp), %rax
movl $0x1, 0x1a8(%rax)
jmp 0x94d1
movq 0x103b7d(%rip), %rax    # 0x10cfc8
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0xa8(%rax)
jmp 0x94d1
movq 0x103b66(%rip), %rax    # 0x10cfc8
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x160(%rax)
jmp 0x94d1
movq -0x18(%rbp), %rax
movl $0x2, 0x1a0(%rax)
jmp 0x94d1
callq 0x18120
movq %rax, -0x40(%rbp)
callq 0x9800
movq -0x40(%rbp), %rsi
movq %rax, %rdx
leaq 0xe4466(%rip), %rdi     # 0xed904
movb $0x0, %al
callq 0x4060
xorl %edi, %edi
callq 0x45c0
jmp 0x94ae
callq 0x18120
movq %rax, -0x48(%rbp)
callq 0x9800
movq -0x48(%rbp), %rsi
movq %rax, %rdx
leaq 0xe443a(%rip), %rdi     # 0xed904
movb $0x0, %al
callq 0x5c70
jmp 0x9118
cmpl $0x1, -0x8(%rbp)
jne 0x94ff
callq 0x18120
movq %rax, -0x50(%rbp)
callq 0x9800
movq -0x50(%rbp), %rsi
movq %rax, %rdx
leaq 0xe440c(%rip), %rdi     # 0xed904
movb $0x0, %al
callq 0x5c70
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x9526
movq -0x18(%rbp), %rax
cmpq $0x0, 0xa8(%rax)
jne 0x9526
leaq 0xe43f6(%rip), %rdi     # 0xed915
movb $0x0, %al
callq 0x5c70
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x9543
movq -0x18(%rbp), %rax
cmpq $0x0, 0xa8(%rax)
jne 0x95c6
movq 0x103a8e(%rip), %rax    # 0x10cfd8
movq (%rax), %rdi
callq 0x44d0
movl %eax, %edi
callq 0x48a0
cmpl $0x0, %eax
je 0x958a
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
leaq 0xe43e1(%rip), %rsi     # 0xed94e
leaq 0xe43d7(%rip), %rax     # 0xed94b
cmpq $0x0, %rcx
cmovneq %rax, %rsi
leaq 0xe43b1(%rip), %rdi     # 0xed934
movb $0x0, %al
callq 0x5c70
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x95a4
movq -0x18(%rbp), %rax
leaq 0xe8e55(%rip), %rcx     # 0xf23f5
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0xa8(%rax)
jne 0x95c4
movq -0x18(%rbp), %rax
leaq 0xe8e38(%rip), %rcx     # 0xf23f5
movq %rcx, 0xa8(%rax)
jmp 0x95c6
movq -0x18(%rbp), %rax
cmpl $0x0, 0x1a0(%rax)
jne 0x960f
movq -0x18(%rbp), %rax
cmpq $0x0, 0x160(%rax)
jne 0x95ff
movq -0x18(%rbp), %rax
cmpq $0x0, 0x168(%rax)
jne 0x95ff
movq -0x18(%rbp), %rax
movl $0x1, 0x1a0(%rax)
jmp 0x960d
movq -0x18(%rbp), %rax
movl $0x3, 0x1a0(%rax)
jmp 0x960f
movq -0x18(%rbp), %rax
cmpq $0x0, 0x160(%rax)
jne 0x962b
movq -0x18(%rbp), %rax
cmpq $0x0, 0x168(%rax)
je 0x964b
movq -0x18(%rbp), %rax
movl 0x1a0(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x964b
leaq 0xe430d(%rip), %rdi     # 0xed951
movb $0x0, %al
callq 0x5c70
cmpl $0x0, -0x28(%rbp)
je 0x9722
movq -0x18(%rbp), %rax
movsd 0x1b8(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x966e
jp 0x966e
jmp 0x96cb
movq -0x18(%rbp), %rax
movsd 0x1b0(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x9687
jp 0x9687
jmp 0x96cb
movq -0x18(%rbp), %rax
movsd 0x1b8(%rax), %xmm0
movq -0x18(%rbp), %rax
ucomisd 0x1b0(%rax), %xmm0
jne 0x96a5
jp 0x96a5
jmp 0x96cb
movq -0x18(%rbp), %rax
movsd 0x1b0(%rax), %xmm0
movq -0x18(%rbp), %rax
movsd 0x1b8(%rax), %xmm1
leaq 0xe42be(%rip), %rdi     # 0xed982
movb $0x2, %al
callq 0x5c70
movq -0x18(%rbp), %rax
movsd 0x1b0(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x96fc
jp 0x96fc
movq -0x18(%rbp), %rax
movsd 0x1b8(%rax), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x1b0(%rax)
jmp 0x9714
movq -0x18(%rbp), %rax
movsd 0x1b0(%rax), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x1b8(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x1a8(%rax)
movq -0x18(%rbp), %rdi
callq 0x6ff0
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
callq 0x6ad0
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0x7f00
cmpl $0x0, %eax
je 0x97de
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x84(%rcx), %eax
jge 0x97ab
movq -0x18(%rbp), %rax
movsbl 0x80(%rax), %edi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
addq $0x80, %rsi
callq 0x68f0
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
addq $0x80, %rsi
movl $0x2e, %edi
callq 0x68f0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x9759
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x98(%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rdx
callq 0x82a0
movq -0x18(%rbp), %rax
movq $0x0, 0x88(%rax)
jmp 0x973c
movq -0x18(%rbp), %rdi
callq 0x7f90
movq -0x18(%rbp), %rdi
callq 0x45a0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq