// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/test/test-regidx.c
// Function: test_sequential_access
void test_sequential_access(void)
{
    // Init index with no file name, we will insert the regions manually
    regidx_t *idx = regidx_init(NULL,custom_parse,custom_free,sizeof(char*),NULL);
    if ( !idx ) error("init failed\n");

    // Insert regions
    kstring_t str = {0,0,0};
    int i, n = 10;
    for (i=0; i<n; i++)
    {
        int beg = 10*(i+1);
        str.l = 0;
        ksprintf(&str,"1\t%d\t%d\t%d",beg,beg,beg);
        if ( regidx_insert(idx,str.s)!=0 ) error("insert failed: %s\n",str.s);
    }

    // Test
    regitr_t *itr = regitr_init(idx);
    i = 0;
    while ( regitr_loop(itr) )
    {
        if ( itr->beg!=itr->end || itr->beg+1!=10*(i+1) ) error("listing failed, expected %d, found %"PRIhts_pos"\n",10*(i+1),itr->beg+1);
        str.l = 0;
        ksprintf(&str,"%"PRIhts_pos, itr->beg+1);
        if ( strcmp(regitr_payload(itr,char*),str.s) ) error("listing failed, expected payload \"%s\", found \"%s\"\n",str.s,regitr_payload(itr,char*));
        i++;
    }
    if ( i!=n ) error("Expected %d regions, listed %d\n", n,i);
    debug("ok: listed %d regions\n", n);

    // Clean up
    regitr_destroy(itr);
    regidx_destroy(idx);
    free(str.s);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq -0x151(%rip), %rsi      # 0x5e6c
leaq -0x24(%rip), %rdx       # 0x5fa0
movl $0x8, %ecx
xorl %edi, %edi
xorl %r8d, %r8d
callq 0x92d3
testq %rax, %rax
je 0x6121
movq %rax, %rbx
xorps %xmm0, %xmm0
movq %rsp, %r14
movaps %xmm0, (%r14)
movq $0x0, 0x10(%r14)
movl $0xa, %ecx
leaq 0x8c014(%rip), %r15     # 0x92011
leal 0xa(%rcx), %ebp
cmpl $0x78, %ebp
je 0x6045
movq $0x0, (%rsp)
movq %r14, %rdi
movq %r15, %rsi
movl %ecx, %edx
movl %ecx, %r8d
xorl %eax, %eax
callq 0x7c37
movq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x87cd
movl %ebp, %ecx
testl %eax, %eax
je 0x5ffd
movq 0x10(%rsp), %rsi
leaq 0x8bfde(%rip), %rdi     # 0x9201c
xorl %eax, %eax
callq 0x6148
movq %rbx, %rdi
callq 0x9def
movq %rax, %r14
movl $0xa, %r12d
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x9f37
testl %eax, %eax
je 0x60ce
movq (%r14), %rax
leaq 0x1(%rax), %rdx
cmpq 0x8(%r14), %rax
jne 0x6110
cmpq %rdx, %r12
jne 0x6110
movq $0x0, (%rsp)
movq %rsp, %rdi
leaq 0x8d8bb(%rip), %rsi     # 0x9394c
xorl %eax, %eax
callq 0x7c37
movq 0x10(%r14), %rax
movq (%rax), %r13
movq 0x10(%rsp), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x46d0
decq %r15
addq $0xa, %r12
testl %eax, %eax
je 0x6059
leaq 0x8bf96(%rip), %rdi     # 0x92057
movq %rbp, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x6148
cmpq $-0xa, %r15
jne 0x612f
leaq 0x8bfcf(%rip), %rdi     # 0x920aa
movl $0xa, %esi
xorl %eax, %eax
callq 0x61e2
movq %r14, %rdi
callq 0x9e57
movq %rbx, %rdi
callq 0x91b4
movq 0x10(%rsp), %rdi
callq 0x45d0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8bf18(%rip), %rdi     # 0x9202f
movl %r12d, %esi
xorl %eax, %eax
callq 0x6148
leaq 0x8bedc(%rip), %rdi     # 0x92004
xorl %eax, %eax
callq 0x6148
negl %r15d
leaq 0x8bf51(%rip), %rdi     # 0x9208a
movl $0xa, %esi
movl %r15d, %edx
xorl %eax, %eax
callq 0x6148