// File: /workspace/github_c_makefile_star2_O2/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 -0x114(%rip), %rsi      # 0x5abc
leaq -0x24(%rip), %rdx       # 0x5bb3
pushq $0x8
popq %rcx
xorl %edi, %edi
xorl %r8d, %r8d
callq 0x88ba
testq %rax, %rax
je 0x5d23
movq %rax, %rbx
movq %rsp, %r14
andq $0x0, 0x10(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
pushq $0xa
popq %rcx
leaq 0x6e408(%rip), %r15     # 0x74011
leal 0xa(%rcx), %ebp
cmpl $0x78, %ebp
je 0x5c4e
andq $0x0, (%rsp)
movq %r14, %rdi
movq %r15, %rsi
movl %ecx, %edx
movl %ecx, %r8d
xorl %eax, %eax
callq 0x7530
movq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x7f92
movl %ebp, %ecx
testl %eax, %eax
je 0x5c09
movq 0x10(%rsp), %rsi
leaq 0x6e3d5(%rip), %rdi     # 0x7401c
xorl %eax, %eax
callq 0x5d48
movq %rbx, %rdi
callq 0x918c
movq %rax, %r14
pushq $0xa
popq %r12
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x92cb
testl %eax, %eax
je 0x5cd2
movq (%r14), %rax
leaq 0x1(%rax), %rdx
cmpq 0x8(%r14), %rax
jne 0x5d12
cmpq %rdx, %r12
jne 0x5d12
andq $0x0, (%rsp)
movq %rsp, %rdi
leaq 0x6fcb1(%rip), %rsi     # 0x75946
xorl %eax, %eax
callq 0x7530
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 0x5c60
leaq 0x6e392(%rip), %rdi     # 0x74057
movq %rbp, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x5d48
cmpq $-0xa, %r15
jne 0x5d31
leaq 0x6e3cb(%rip), %rdi     # 0x740aa
pushq $0xa
popq %rsi
xorl %eax, %eax
callq 0x5de0
movq %r14, %rdi
callq 0x91ec
movq %rbx, %rdi
callq 0x87b0
movq 0x10(%rsp), %rdi
callq 0x45d0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6e316(%rip), %rdi     # 0x7402f
movl %r12d, %esi
xorl %eax, %eax
callq 0x5d48
leaq 0x6e2da(%rip), %rdi     # 0x74004
xorl %eax, %eax
callq 0x5d48
negl %r15d
leaq 0x6e34f(%rip), %rdi     # 0x7408a
pushq $0xa
popq %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x5d48