// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
xorl %eax, %eax
movl %eax, %r8d
leaq -0x294(%rip), %rsi      # 0x5ac0
leaq -0x4b(%rip), %rdx       # 0x5d10
movl $0x8, %ecx
movq %r8, %rdi
callq 0xa300
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x5d81
leaq 0xe528a(%rip), %rdi     # 0xeb004
movb $0x0, %al
callq 0x5f40
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x4250
movl $0xa, -0x28(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x5e08
movl -0x24(%rbp), %eax
addl $0x1, %eax
imull $0xa, %eax, %eax
movl %eax, -0x2c(%rbp)
movq $0x0, -0x20(%rbp)
movl -0x2c(%rbp), %edx
movl -0x2c(%rbp), %ecx
movl -0x2c(%rbp), %r8d
leaq -0x20(%rbp), %rdi
leaq 0xe5241(%rip), %rsi     # 0xeb011
movb $0x0, %al
callq 0x8460
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x9630
cmpl $0x0, %eax
je 0x5dfb
movq -0x10(%rbp), %rsi
leaq 0xe5228(%rip), %rdi     # 0xeb01c
movb $0x0, %al
callq 0x5f40
jmp 0x5dfd
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5d9f
movq -0x8(%rbp), %rdi
callq 0xb300
movq %rax, -0x38(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x38(%rbp), %rdi
callq 0xb5d0
cmpl $0x0, %eax
je 0x5ee6
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x38(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x5e5b
movq -0x38(%rbp), %rax
movq (%rax), %rax
addq $0x1, %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
imull $0xa, %ecx, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
je 0x5e7d
movl -0x24(%rbp), %eax
addl $0x1, %eax
imull $0xa, %eax, %esi
movq -0x38(%rbp), %rax
movq (%rax), %rdx
addq $0x1, %rdx
leaq 0xe51b9(%rip), %rdi     # 0xeb02f
movb $0x0, %al
callq 0x5f40
movq $0x0, -0x20(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rdx
addq $0x1, %rdx
leaq -0x20(%rbp), %rdi
leaq 0xe6ac7(%rip), %rsi     # 0xec962
movb $0x0, %al
callq 0x8460
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x46a0
cmpl $0x0, %eax
je 0x5ed8
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdx
leaq 0xe5186(%rip), %rdi     # 0xeb057
movb $0x0, %al
callq 0x5f40
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5e1c
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
je 0x5f02
movl -0x28(%rbp), %esi
movl -0x24(%rbp), %edx
leaq 0xe518f(%rip), %rdi     # 0xeb08a
movb $0x0, %al
callq 0x5f40
movl -0x28(%rbp), %esi
leaq 0xe519e(%rip), %rdi     # 0xeb0aa
movb $0x0, %al
callq 0x5ff0
movq -0x38(%rbp), %rdi
callq 0xb3e0
movq -0x8(%rbp), %rdi
callq 0xa1e0
movq -0x10(%rbp), %rdi
callq 0x45b0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)