// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/test-regidx.c
// Function: test
void test(set_line_f set_line, regidx_parse_f parse)
{
    regidx_t *idx = regidx_init(NULL,parse,NULL,0,NULL);
    if ( !idx ) error("init failed\n");

    char line[250], *chr = "1";
    int i, n = 10, start, end, nhit;
    for (i=1; i<n; i++)
    {
        start = end = 10*i;
        set_line(line,sizeof(line),chr,start,end);
        debug("insert: %s", line);
        if ( regidx_insert(idx,line)!=0 ) error("insert failed: %s\n", line);

        start = end = 10*i + 1;
        set_line(line,sizeof(line),chr,start,end);
        debug("insert: %s", line);
        if ( regidx_insert(idx,line)!=0 ) error("insert failed: %s\n", line);

        start = 20000*i; end = start + 2000;
        set_line(line,sizeof(line),chr,start,end);
        debug("insert: %s", line);
        if ( regidx_insert(idx,line)!=0 ) error("insert failed: %s\n", line);
    }

    regitr_t *itr = regitr_init(idx);
    for (i=1; i<n; i++)
    {
        // no hit
        start = end = 10*i - 1;
        if ( regidx_overlap(idx,chr,start-1,end-1,itr) ) error("query failed, there should be no hit: %s:%d-%d\n",chr,start,end);
        debug("ok: no overlap found for %s:%d-%d\n",chr,start,end);


        // one hit
        start = end = 10*i;
        if ( !regidx_overlap(idx,chr,start-1,end-1,itr) ) error("query failed, there should be a hit: %s:%d-%d\n",chr,start,end);
        debug("ok: overlap(s) found for %s:%d-%d\n",chr,start,end);
        nhit = 0;
        while ( regitr_overlap(itr) )
        {
            if ( itr->beg > end-1 || itr->end < start-1 ) error("query failed, incorrect region: %"PRIhts_pos"-%"PRIhts_pos" for %d-%d\n",itr->beg+1,itr->end+1,start,end);
            debug("\t %"PRIhts_pos"-%"PRIhts_pos"\n",itr->beg+1,itr->end+1);
            nhit++;
        }
        if ( nhit!=1 ) error("query failed, expected one hit, found %d: %s:%d-%d\n",nhit,chr,start,end);


        // one hit
        start = end = 10*i+1;
        if ( !regidx_overlap(idx,chr,start-1,end-1,itr) ) error("query failed, there should be a hit: %s:%d-%d\n",chr,start,end);
        debug("ok: overlap(s) found for %s:%d-%d\n",chr,start,end);
        nhit = 0;
        while ( regitr_overlap(itr) )
        {
            if ( itr->beg > end-1 || itr->end < start-1 ) error("query failed, incorrect region: %"PRIhts_pos"-%"PRIhts_pos" for %d-%d\n",itr->beg+1,itr->end+1,start,end);
            debug("\t %"PRIhts_pos"-%"PRIhts_pos"\n",itr->beg+1,itr->end+1);
            nhit++;
        }
        if ( nhit!=1 ) error("query failed, expected one hit, found %d: %s:%d-%d\n",nhit,chr,start,end);


        // two hits
        start = 10*i; end = start+1;
        if ( !regidx_overlap(idx,chr,start-1,end-1,itr) ) error("query failed, there should be a hit: %s:%d-%d\n",chr,start,end);
        debug("ok: overlap(s) found for %s:%d-%d\n",chr,start,end);
        nhit = 0;
        while ( regitr_overlap(itr) )
        {
            if ( itr->beg > end-1 || itr->end < start-1 ) error("query failed, incorrect region: %"PRIhts_pos"-%"PRIhts_pos" for %d-%d\n",itr->beg+1,itr->end+1,start,end);
            debug("\t %"PRIhts_pos"-%"PRIhts_pos"\n",itr->beg+1,itr->end+1);
            nhit++;
        }
        if ( nhit!=2 ) error("query failed, expected two hits, found %d: %s:%d-%d\n",nhit,chr,start,end);

        // fully contained interval, one hit
        start = 20000*i - 5000; end = 20000*i + 3000;
        set_line(line,sizeof(line),chr,start,end);
        if ( !regidx_overlap(idx,chr,start-1,end-1,itr) ) error("query failed, there should be a hit: %s:%d-%d\n",chr,start,end);
        debug("ok: overlap(s) found for %s:%d-%d\n",chr,start,end);
        nhit = 0;
        while ( regitr_overlap(itr) )
        {
            if ( itr->beg > end-1 || itr->end < start-1 ) error("query failed, incorrect region: %"PRIhts_pos"-%"PRIhts_pos" for %d-%d\n",itr->beg+1,itr->end+1,start,end);
            debug("\t %"PRIhts_pos"-%"PRIhts_pos"\n",itr->beg+1,itr->end+1);
            nhit++;
        }
        if ( nhit!=1 ) error("query failed, expected one hit, found %d: %s:%d-%d\n",nhit,chr,start,end);
    }
    regitr_destroy(itr);
    regidx_destroy(idx);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rsi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rdi
movq %r8, %rdx
movq %r8, %rcx
callq 0xa300
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x6dd3
leaq 0xe4238(%rip), %rdi     # 0xeb004
movb $0x0, %al
callq 0x5f40
leaq 0xe75db(%rip), %rax     # 0xee3b5
movq %rax, -0x128(%rbp)
movl $0xa, -0x130(%rbp)
movl $0x1, -0x12c(%rbp)
movl -0x12c(%rbp), %eax
cmpl -0x130(%rbp), %eax
jge 0x6f96
imull $0xa, -0x12c(%rbp), %eax
movl %eax, -0x138(%rbp)
movl %eax, -0x134(%rbp)
movq -0x8(%rbp), %rax
leaq -0x120(%rbp), %rdi
movq -0x128(%rbp), %rdx
movl -0x134(%rbp), %ecx
movl -0x138(%rbp), %r8d
movl $0xfa, %esi
callq *%rax
leaq -0x120(%rbp), %rsi
leaq 0xe45da(%rip), %rdi     # 0xeb428
movb $0x0, %al
callq 0x5ff0
movq -0x18(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x9630
cmpl $0x0, %eax
je 0x6e7f
leaq -0x120(%rbp), %rsi
leaq 0xe41a4(%rip), %rdi     # 0xeb01c
movb $0x0, %al
callq 0x5f40
imull $0xa, -0x12c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x138(%rbp)
movl %eax, -0x134(%rbp)
movq -0x8(%rbp), %rax
leaq -0x120(%rbp), %rdi
movq -0x128(%rbp), %rdx
movl -0x134(%rbp), %ecx
movl -0x138(%rbp), %r8d
movl $0xfa, %esi
callq *%rax
leaq -0x120(%rbp), %rsi
leaq 0xe455f(%rip), %rdi     # 0xeb428
movb $0x0, %al
callq 0x5ff0
movq -0x18(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x9630
cmpl $0x0, %eax
je 0x6efa
leaq -0x120(%rbp), %rsi
leaq 0xe4129(%rip), %rdi     # 0xeb01c
movb $0x0, %al
callq 0x5f40
imull $0x4e20, -0x12c(%rbp), %eax # imm = 0x4E20
movl %eax, -0x134(%rbp)
movl -0x134(%rbp), %eax
addl $0x7d0, %eax            # imm = 0x7D0
movl %eax, -0x138(%rbp)
movq -0x8(%rbp), %rax
leaq -0x120(%rbp), %rdi
movq -0x128(%rbp), %rdx
movl -0x134(%rbp), %ecx
movl -0x138(%rbp), %r8d
movl $0xfa, %esi
callq *%rax
leaq -0x120(%rbp), %rsi
leaq 0xe44d9(%rip), %rdi     # 0xeb428
movb $0x0, %al
callq 0x5ff0
movq -0x18(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x9630
cmpl $0x0, %eax
je 0x6f80
leaq -0x120(%rbp), %rsi
leaq 0xe40a3(%rip), %rdi     # 0xeb01c
movb $0x0, %al
callq 0x5f40
jmp 0x6f82
movl -0x12c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x12c(%rbp)
jmp 0x6df5
movq -0x18(%rbp), %rdi
callq 0xb300
movq %rax, -0x148(%rbp)
movl $0x1, -0x12c(%rbp)
movl -0x12c(%rbp), %eax
cmpl -0x130(%rbp), %eax
jge 0x76c9
imull $0xa, -0x12c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x138(%rbp)
movl %eax, -0x134(%rbp)
movq -0x18(%rbp), %rdi
movq -0x128(%rbp), %rsi
movl -0x134(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rdx
movl -0x138(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
movq -0x148(%rbp), %r8
callq 0xa910
cmpl $0x0, %eax
je 0x702d
movq -0x128(%rbp), %rsi
movl -0x134(%rbp), %edx
movl -0x138(%rbp), %ecx
leaq 0xe440d(%rip), %rdi     # 0xeb433
movb $0x0, %al
callq 0x5f40
movq -0x128(%rbp), %rsi
movl -0x134(%rbp), %edx
movl -0x138(%rbp), %ecx
leaq 0xe441c(%rip), %rdi     # 0xeb463
movb $0x0, %al
callq 0x5ff0
imull $0xa, -0x12c(%rbp), %eax
movl %eax, -0x138(%rbp)
movl %eax, -0x134(%rbp)
movq -0x18(%rbp), %rdi
movq -0x128(%rbp), %rsi
movl -0x134(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rdx
movl -0x138(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
movq -0x148(%rbp), %r8
callq 0xa910
cmpl $0x0, %eax
jne 0x70b6
movq -0x128(%rbp), %rsi
movl -0x134(%rbp), %edx
movl -0x138(%rbp), %ecx
leaq 0xe43d7(%rip), %rdi     # 0xeb486
movb $0x0, %al
callq 0x5f40
movq -0x128(%rbp), %rsi
movl -0x134(%rbp), %edx
movl -0x138(%rbp), %ecx
leaq 0xe43e5(%rip), %rdi     # 0xeb4b5
movb $0x0, %al
callq 0x5ff0
movl $0x0, -0x13c(%rbp)
movq -0x148(%rbp), %rdi
callq 0xb410
cmpl $0x0, %eax
je 0x71a4
movq -0x148(%rbp), %rax
movq (%rax), %rax
movl -0x138(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jg 0x712d
movq -0x148(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x134(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jge 0x7165
movq -0x148(%rbp), %rax
movq (%rax), %rsi
addq $0x1, %rsi
movq -0x148(%rbp), %rax
movq 0x8(%rax), %rdx
addq $0x1, %rdx
movl -0x134(%rbp), %ecx
movl -0x138(%rbp), %r8d
leaq 0xe437a(%rip), %rdi     # 0xeb4d8
movb $0x0, %al
callq 0x5f40
movq -0x148(%rbp), %rax
movq (%rax), %rsi
addq $0x1, %rsi
movq -0x148(%rbp), %rax
movq 0x8(%rax), %rdx
addq $0x1, %rdx
leaq 0xe4382(%rip), %rdi     # 0xeb50b
movb $0x0, %al
callq 0x5ff0
movl -0x13c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13c(%rbp)
jmp 0x70e1
cmpl $0x1, -0x13c(%rbp)
je 0x71d5
movl -0x13c(%rbp), %esi
movq -0x128(%rbp), %rdx
movl -0x134(%rbp), %ecx
movl -0x138(%rbp), %r8d
leaq 0xe4348(%rip), %rdi     # 0xeb516
movb $0x0, %al
callq 0x5f40
imull $0xa, -0x12c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x138(%rbp)
movl %eax, -0x134(%rbp)
movq -0x18(%rbp), %rdi
movq -0x128(%rbp), %rsi
movl -0x134(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rdx
movl -0x138(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
movq -0x148(%rbp), %r8
callq 0xa910
cmpl $0x0, %eax
jne 0x7240
movq -0x128(%rbp), %rsi
movl -0x134(%rbp), %edx
movl -0x138(%rbp), %ecx
leaq 0xe424d(%rip), %rdi     # 0xeb486
movb $0x0, %al
callq 0x5f40
movq -0x128(%rbp), %rsi
movl -0x134(%rbp), %edx
movl -0x138(%rbp), %ecx
leaq 0xe425b(%rip), %rdi     # 0xeb4b5
movb $0x0, %al
callq 0x5ff0
movl $0x0, -0x13c(%rbp)
movq -0x148(%rbp), %rdi
callq 0xb410
cmpl $0x0, %eax
je 0x732e
movq -0x148(%rbp), %rax
movq (%rax), %rax
movl -0x138(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jg 0x72b7
movq -0x148(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x134(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jge 0x72ef
movq -0x148(%rbp), %rax
movq (%rax), %rsi
addq $0x1, %rsi
movq -0x148(%rbp), %rax
movq 0x8(%rax), %rdx
addq $0x1, %rdx
movl -0x134(%rbp), %ecx
movl -0x138(%rbp), %r8d
leaq 0xe41f0(%rip), %rdi     # 0xeb4d8
movb $0x0, %al
callq 0x5f40
movq -0x148(%rbp), %rax
movq (%rax), %rsi
addq $0x1, %rsi
movq -0x148(%rbp), %rax
movq 0x8(%rax), %rdx
addq $0x1, %rdx
leaq 0xe41f8(%rip), %rdi     # 0xeb50b
movb $0x0, %al
callq 0x5ff0
movl -0x13c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13c(%rbp)
jmp 0x726b
cmpl $0x1, -0x13c(%rbp)
je 0x735f
movl -0x13c(%rbp), %esi
movq -0x128(%rbp), %rdx
movl -0x134(%rbp), %ecx
movl -0x138(%rbp), %r8d
leaq 0xe41be(%rip), %rdi     # 0xeb516
movb $0x0, %al
callq 0x5f40
imull $0xa, -0x12c(%rbp), %eax
movl %eax, -0x134(%rbp)
movl -0x134(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x138(%rbp)
movq -0x18(%rbp), %rdi
movq -0x128(%rbp), %rsi
movl -0x134(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rdx
movl -0x138(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
movq -0x148(%rbp), %r8
callq 0xa910
cmpl $0x0, %eax
jne 0x73d0
movq -0x128(%rbp), %rsi
movl -0x134(%rbp), %edx
movl -0x138(%rbp), %ecx
leaq 0xe40bd(%rip), %rdi     # 0xeb486
movb $0x0, %al
callq 0x5f40
movq -0x128(%rbp), %rsi
movl -0x134(%rbp), %edx
movl -0x138(%rbp), %ecx
leaq 0xe40cb(%rip), %rdi     # 0xeb4b5
movb $0x0, %al
callq 0x5ff0
movl $0x0, -0x13c(%rbp)
movq -0x148(%rbp), %rdi
callq 0xb410
cmpl $0x0, %eax
je 0x74be
movq -0x148(%rbp), %rax
movq (%rax), %rax
movl -0x138(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jg 0x7447
movq -0x148(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x134(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jge 0x747f
movq -0x148(%rbp), %rax
movq (%rax), %rsi
addq $0x1, %rsi
movq -0x148(%rbp), %rax
movq 0x8(%rax), %rdx
addq $0x1, %rdx
movl -0x134(%rbp), %ecx
movl -0x138(%rbp), %r8d
leaq 0xe4060(%rip), %rdi     # 0xeb4d8
movb $0x0, %al
callq 0x5f40
movq -0x148(%rbp), %rax
movq (%rax), %rsi
addq $0x1, %rsi
movq -0x148(%rbp), %rax
movq 0x8(%rax), %rdx
addq $0x1, %rdx
leaq 0xe4068(%rip), %rdi     # 0xeb50b
movb $0x0, %al
callq 0x5ff0
movl -0x13c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13c(%rbp)
jmp 0x73fb
cmpl $0x2, -0x13c(%rbp)
je 0x74ef
movl -0x13c(%rbp), %esi
movq -0x128(%rbp), %rdx
movl -0x134(%rbp), %ecx
movl -0x138(%rbp), %r8d
leaq 0xe4062(%rip), %rdi     # 0xeb54a
movb $0x0, %al
callq 0x5f40
imull $0x4e20, -0x12c(%rbp), %eax # imm = 0x4E20
subl $0x1388, %eax           # imm = 0x1388
movl %eax, -0x134(%rbp)
imull $0x4e20, -0x12c(%rbp), %eax # imm = 0x4E20
addl $0xbb8, %eax            # imm = 0xBB8
movl %eax, -0x138(%rbp)
movq -0x8(%rbp), %rax
leaq -0x120(%rbp), %rdi
movq -0x128(%rbp), %rdx
movl -0x134(%rbp), %ecx
movl -0x138(%rbp), %r8d
movl $0xfa, %esi
callq *%rax
movq -0x18(%rbp), %rdi
movq -0x128(%rbp), %rsi
movl -0x134(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rdx
movl -0x138(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
movq -0x148(%rbp), %r8
callq 0xa910
cmpl $0x0, %eax
jne 0x7594
movq -0x128(%rbp), %rsi
movl -0x134(%rbp), %edx
movl -0x138(%rbp), %ecx
leaq 0xe3ef9(%rip), %rdi     # 0xeb486
movb $0x0, %al
callq 0x5f40
movq -0x128(%rbp), %rsi
movl -0x134(%rbp), %edx
movl -0x138(%rbp), %ecx
leaq 0xe3f07(%rip), %rdi     # 0xeb4b5
movb $0x0, %al
callq 0x5ff0
movl $0x0, -0x13c(%rbp)
movq -0x148(%rbp), %rdi
callq 0xb410
cmpl $0x0, %eax
je 0x7682
movq -0x148(%rbp), %rax
movq (%rax), %rax
movl -0x138(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jg 0x760b
movq -0x148(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x134(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jge 0x7643
movq -0x148(%rbp), %rax
movq (%rax), %rsi
addq $0x1, %rsi
movq -0x148(%rbp), %rax
movq 0x8(%rax), %rdx
addq $0x1, %rdx
movl -0x134(%rbp), %ecx
movl -0x138(%rbp), %r8d
leaq 0xe3e9c(%rip), %rdi     # 0xeb4d8
movb $0x0, %al
callq 0x5f40
movq -0x148(%rbp), %rax
movq (%rax), %rsi
addq $0x1, %rsi
movq -0x148(%rbp), %rax
movq 0x8(%rax), %rdx
addq $0x1, %rdx
leaq 0xe3ea4(%rip), %rdi     # 0xeb50b
movb $0x0, %al
callq 0x5ff0
movl -0x13c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13c(%rbp)
jmp 0x75bf
cmpl $0x1, -0x13c(%rbp)
je 0x76b3
movl -0x13c(%rbp), %esi
movq -0x128(%rbp), %rdx
movl -0x134(%rbp), %ecx
movl -0x138(%rbp), %r8d
leaq 0xe3e6a(%rip), %rdi     # 0xeb516
movb $0x0, %al
callq 0x5f40
jmp 0x76b5
movl -0x12c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x12c(%rbp)
jmp 0x6fb0
movq -0x148(%rbp), %rdi
callq 0xb3e0
movq -0x18(%rbp), %rdi
callq 0xa1e0
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nopw (%rax,%rax)