// File: /workspace/github_c_makefile_star2_O1/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 -0x154(%rip), %rsi      # 0x5e5c
leaq -0x24(%rip), %rdx       # 0x5f93
movl $0x8, %ecx
xorl %edi, %edi
xorl %r8d, %r8d
callq 0x92c7
testq %rax, %rax
je 0x611a
movq %rax, %rbx
xorps %xmm0, %xmm0
movq %rsp, %r14
movaps %xmm0, (%r14)
movq $0x0, 0x10(%r14)
movl $0xa, %ecx
leaq 0x8e021(%rip), %r15     # 0x94011
leal 0xa(%rcx), %ebp
cmpl $0x78, %ebp
je 0x6038
movq $0x0, (%rsp)
movq %r14, %rdi
movq %r15, %rsi
movl %ecx, %edx
movl %ecx, %r8d
xorl %eax, %eax
callq 0x7c1b
movq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x8743
movl %ebp, %ecx
testl %eax, %eax
je 0x5ff0
movq 0x10(%rsp), %rsi
leaq 0x8dfeb(%rip), %rdi     # 0x9401c
xorl %eax, %eax
callq 0x6141
movq %rbx, %rdi
callq 0x9df9
movq %rax, %r14
movl $0xa, %r15d
xorl %r12d, %r12d
movq %r14, %rdi
callq 0x9f67
testl %eax, %eax
je 0x60c4
movq (%r14), %rdx
cmpq 0x8(%r14), %rdx
jne 0x6106
leaq 0x1(%rdx), %rax
cmpq %rax, %r15
jne 0x6106
movq $0x0, (%rsp)
movq %rsp, %rdi
leaq 0x8f818(%rip), %rsi     # 0x9589c
movq %rax, %rdx
xorl %eax, %eax
callq 0x7c1b
movq 0x10(%r14), %rax
movq (%rax), %r13
movq 0x10(%rsp), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x46d0
decq %r12
addq $0xa, %r15
testl %eax, %eax
je 0x604c
leaq 0x8dfa0(%rip), %rdi     # 0x94057
movq %rbp, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x6141
cmpq $-0xa, %r12
jne 0x6128
leaq 0x8dfd9(%rip), %rdi     # 0x940aa
movl $0xa, %esi
xorl %eax, %eax
callq 0x61db
movq %r14, %rdi
callq 0x9e69
movq %rbx, %rdi
callq 0x91ad
movq 0x10(%rsp), %rdi
callq 0x45d0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
incq %rdx
leaq 0x8df1f(%rip), %rdi     # 0x9402f
movl %r15d, %esi
xorl %eax, %eax
callq 0x6141
leaq 0x8dee3(%rip), %rdi     # 0x94004
xorl %eax, %eax
callq 0x6141
negl %r12d
leaq 0x8df58(%rip), %rdi     # 0x9408a
movl $0xa, %esi
movl %r12d, %edx
xorl %eax, %eax
callq 0x6141