// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, 0x50(%rsp)
movl %edi, %ebp
pushq $0x1
popq %rdi
movl $0x1f8, %esi            # imm = 0x1F8
callq 0x4300
movq %rax, %r14
movq %rax, %rbx
leaq 0x18(%rsp), %rax
andq $0x0, (%rax)
leaq 0x8(%r14), %rax
movq %rax, 0x38(%rsp)
xorl %r12d, %r12d
xorpd %xmm0, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd %xmm0, 0x10(%rsp)
movq $0x0, 0x48(%rsp)
movq $0x0, 0x40(%rsp)
movl $0x0, 0xc(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x30(%rsp)
xorl %eax, %eax
movq %r12, %r15
movl %eax, %r13d
movl %ebp, %edi
movq 0x50(%rsp), %rsi
leaq 0x6d788(%rip), %rdx     # 0x75604
leaq 0x9667d(%rip), %rcx     # 0x9e500
xorl %r8d, %r8d
callq 0x4860
testl %eax, %eax
js 0x815d
leal -0x61(%rax), %ecx
cmpl $0x17, %ecx
ja 0x7ecc
leaq 0x6d1a2(%rip), %rax     # 0x75044
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
pushq $0x1
popq %rax
movq %r15, %r12
jmpq *%rcx
movq 0x96108(%rip), %rax     # 0x9dfc0
movq (%rax), %rcx
movq %rcx, 0x48(%rsp)
movq %rcx, 0x168(%rbx)
movl %r13d, %eax
jmp 0x7e68
cmpl $0x4, %eax
jbe 0x7fb8
cmpl $0x43, %eax
je 0x8135
cmpl $0x48, %eax
je 0x8110
cmpl $0x49, %eax
je 0x8120
cmpl $0x4f, %eax
jne 0x832e
movq 0x960c0(%rip), %r12     # 0x9dfc0
movq (%r12), %rdi
leaq 0x18(%rsp), %rsi
callq 0x4350
movsd %xmm0, 0x1b0(%rbx)
movq 0x18(%rsp), %rdi
movq (%r12), %rsi
cmpq %rsi, %rdi
je 0x8379
movzbl (%rdi), %eax
testl %eax, %eax
je 0x7f38
cmpl $0x2c, %eax
jne 0x8379
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
ja 0x838c
ucomisd 0x6d0c2(%rip), %xmm0    # 0x75010
ja 0x838c
movsd %xmm0, 0x20(%rsp)
testb %al, %al
je 0x8148
incq %rdi
leaq 0x18(%rsp), %rsi
callq 0x4350
movsd %xmm0, 0x1b8(%rbx)
movq 0x18(%rsp), %rax
cmpb $0x0, (%rax)
jne 0x836f
movsd %xmm0, 0x10(%rsp)
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
ja 0x8382
movq %r15, %r12
movsd 0x10(%rsp), %xmm0
ucomisd 0x6d066(%rip), %xmm0    # 0x75010
movl %r13d, %eax
jbe 0x7e68
jmp 0x8382
movl %eax, %eax
leaq 0x6d06f(%rip), %rcx     # 0x75030
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movq %r15, %r12
jmpq *%rax
movl $0x1, 0x198(%rbx)
movl %r13d, %eax
jmp 0x7e68
movq 0x95fda(%rip), %r15     # 0x9dfc0
movq (%r15), %rdi
leaq 0x18(%rsp), %rsi
callq 0x4350
cvttsd2si %xmm0, %eax
movl %eax, 0x19c(%rbx)
movq 0x18(%rsp), %rax
movq (%r15), %rsi
cmpq %rsi, %rax
je 0x8325
cmpb $0x0, (%rax)
movl %r13d, %eax
je 0x7e68
jmp 0x8325
movq 0x95f9a(%rip), %rax     # 0x9dfc0
movq (%rax), %rcx
movq %rcx, 0x28(%rsp)
movq %rcx, 0xa8(%rbx)
movl %r13d, %eax
jmp 0x7e68
movq 0x95f7c(%rip), %rax     # 0x9dfc0
movq (%rax), %rax
movq %rax, 0x188(%rbx)
movl %r13d, %eax
jmp 0x7e68
movq 0x95f63(%rip), %rax     # 0x9dfc0
movq (%rax), %rcx
movq %rcx, 0x40(%rsp)
movq %rcx, 0x160(%rbx)
movl %r13d, %eax
jmp 0x7e68
movq 0x95f45(%rip), %rax     # 0x9dfc0
movq (%rax), %rax
movq %rax, 0x148(%rbx)
movl %r13d, %eax
jmp 0x7e68
movq 0x95f2c(%rip), %rax     # 0x9dfc0
movq (%rax), %rax
movq %rax, 0x158(%rbx)
movl %r13d, %eax
jmp 0x7e68
movq 0x95f13(%rip), %rax     # 0x9dfc0
movq (%rax), %rcx
movq %rcx, 0x30(%rsp)
movq 0x38(%rsp), %rax
movq %rcx, (%rax)
movl %r13d, %eax
jmp 0x7e68
movq 0x95ef4(%rip), %rax     # 0x9dfc0
movq (%rax), %rax
movq %rax, 0x170(%rbx)
movl %r13d, %eax
jmp 0x7e68
movq 0x95edb(%rip), %rax     # 0x9dfc0
movq (%rax), %rax
movq %rax, 0x178(%rbx)
movl %r13d, %eax
jmp 0x7e68
movl $0x2, 0x1a0(%rbx)
pushq $0x2
popq %rax
movl %eax, 0xc(%rsp)
movl %r13d, %eax
jmp 0x7e68
leaq 0x6d569(%rip), %rax     # 0x75680
movq %rax, 0x170(%rbx)
jmp 0x8152
movq %r15, %r12
incl %r12d
movl %r12d, 0x1a4(%rbx)
movl %r13d, %eax
jmp 0x7e68
movq 0x95e84(%rip), %rax     # 0x9dfc0
movq (%rax), %rax
movq %rax, 0x150(%rbx)
jmp 0x8152
movl $0x1, 0x1a8(%rbx)
movl %r13d, %eax
movq %r15, %r12
jmp 0x7e68
cmpl $0x1, %ebp
je 0x832e
cmpq $0x0, 0x30(%rsp)
movq 0x48(%rsp), %r12
movq 0x40(%rsp), %rbp
movq 0x38(%rsp), %r15
je 0x8187
cmpq $0x0, 0x28(%rsp)
jne 0x81d2
jmp 0x8193
cmpq $0x0, 0x28(%rsp)
je 0x83d8
movq 0x95e36(%rip), %rax     # 0x9dfd0
movq (%rax), %rdi
callq 0x44f0
movl %eax, %edi
callq 0x48c0
testl %eax, %eax
jne 0x83a3
leaq 0x71c7a(%rip), %rax     # 0x79e32
cmpq $0x0, 0x30(%rsp)
jne 0x81c3
movq %rax, (%r15)
cmpq $0x0, 0x28(%rsp)
jne 0x81d2
movq %rax, 0xa8(%rbx)
movl 0xc(%rsp), %eax
testl %eax, %eax
jne 0x81fc
movq %rbp, %rax
orq %r12, %rax
jne 0x81ee
movl $0x1, 0x1a0(%rbx)
jmp 0x820f
movl $0x3, 0x1a0(%rbx)
movl 0xc(%rsp), %eax
testl %eax, %eax
sete %al
orq %r12, %rbp
sete %cl
orb %al, %cl
je 0x839a
testl %r13d, %r13d
je 0x8279
xorpd %xmm2, %xmm2
movsd 0x10(%rsp), %xmm1
ucomisd %xmm2, %xmm1
movsd 0x20(%rsp), %xmm0
jne 0x822c
jnp 0x8252
ucomisd %xmm2, %xmm0
jne 0x8234
jnp 0x8252
movsd 0x10(%rsp), %xmm1
ucomisd 0x20(%rsp), %xmm1
movsd 0x20(%rsp), %xmm0
jne 0x83c4
jp 0x83c4
ucomisd %xmm2, %xmm0
jne 0x825a
jnp 0x8264
movsd %xmm0, 0x1b8(%rbx)
jmp 0x8272
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x1b0(%rbx)
andl $0x0, 0x1a8(%rbx)
movq %rbx, %rdi
callq 0x6ac2
movq %rbx, %rdi
movq %r15, %rsi
callq 0x673a
addq $0x88, %r14
pushq $0x2e
popq %rbp
movq %r15, %rdi
callq 0x730e
testl %eax, %eax
je 0x82ec
xorl %r12d, %r12d
cmpl 0x84(%rbx), %r12d
jge 0x82cc
movsbl 0x80(%rbx), %edi
movq %r14, %rsi
callq 0x63ed
movl %ebp, %edi
movq %r14, %rsi
callq 0x63ed
incl %r12d
jmp 0x82a5
movq 0x88(%rbx), %rdx
movq 0x98(%rbx), %rsi
movq %rbx, %rdi
callq 0x7567
andq $0x0, 0x88(%rbx)
jmp 0x8296
movq %rbx, %rdi
callq 0x7365
movq %rbx, %rdi
callq 0x45c0
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xf698
leaq 0x6d306(%rip), %rdi     # 0x7561f
movq %rax, %rsi
xorl %eax, %eax
callq 0x4060
jmp 0x82fc
leaq 0x6d332(%rip), %rdi     # 0x7565e
jmp 0x8393
callq 0xf698
leaq 0x6d3a1(%rip), %rdi     # 0x756db
leaq 0x6d4d3(%rip), %rdx     # 0x75814
movq %rax, %rsi
xorl %eax, %eax
callq 0x5b9e
callq 0xf698
leaq 0x6d384(%rip), %rdi     # 0x756db
leaq 0x6d4b6(%rip), %rdx     # 0x75814
movq %rax, %rsi
xorl %eax, %eax
callq 0x4060
xorl %edi, %edi
callq 0x45e0
movq 0x95c4a(%rip), %rax     # 0x9dfc0
movq (%rax), %rsi
leaq 0x6d304(%rip), %rdi     # 0x75684
jmp 0x8393
movq 0x95c37(%rip), %rax     # 0x9dfc0
movq (%rax), %rsi
leaq 0x6d30f(%rip), %rdi     # 0x756a2
xorl %eax, %eax
callq 0x5b9e
leaq 0x6d387(%rip), %rdi     # 0x75728
jmp 0x83df
cmpq $0x0, 0x30(%rsp)
leaq 0x6d375(%rip), %rax     # 0x75725
leaq 0x6d36b(%rip), %rsi     # 0x75722
cmoveq %rax, %rsi
leaq 0x6d349(%rip), %rdi     # 0x7570b
jmp 0x8393
leaq 0x6d38e(%rip), %rdi     # 0x75759
movsd 0x10(%rsp), %xmm1
movb $0x2, %al
callq 0x5b9e
leaq 0x6d30d(%rip), %rdi     # 0x756ec
xorl %eax, %eax
callq 0x5b9e