// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/test_bgzf.c
// Function: test_tell_read
static int test_tell_read(Files *f, const char *mode) {

    BGZF* bgz = NULL;
    ssize_t bg_put;
    size_t num_points = 10;
    size_t i, iskip = f->ltext / num_points;
    int64_t point_vos[num_points];

    unsigned char *bg_buf = calloc(iskip+1,1);
    if (!bg_buf) return -1;

    bgz = try_bgzf_open(f->tmp_bgzf, mode, __func__);
    if (!bgz) goto fail;

    for (i = 0; i < num_points; i++) {
        point_vos[i] = try_bgzf_tell(bgz, f->tmp_bgzf, __func__);
        if (point_vos[i] < 0) goto fail;
        bg_put = try_bgzf_write(bgz, f->text + i * iskip, iskip, f->tmp_bgzf, __func__);
        if (bg_put < 0) goto fail;
    }

    if (try_bgzf_close(&bgz, f->tmp_bgzf, __func__, 0) != 0) goto fail;

    bgz = try_bgzf_open(f->tmp_bgzf, "r", __func__);
    if (!bgz) goto fail;

    for (i = 0; i < f->ltext; i += iskip) {
        if (try_bgzf_tell_expect(bgz, point_vos[i/iskip], f->tmp_bgzf, __func__) < 0) {
            goto fail;
        }
        if (try_bgzf_read(bgz, bg_buf, iskip, f->tmp_bgzf, __func__) < 0) {
            goto fail;
        }
        if (compare_buffers(f->text+i, bg_buf, iskip, iskip,
                f->tmp_bgzf, f->tmp_bgzf, __func__) != 0) {
            goto fail;
        }
    }

    if (try_bgzf_close(&bgz, f->tmp_bgzf, __func__, 0) != 0) goto fail;
    free(bg_buf);
    return 0;

 fail:
    fprintf(stderr, "%s: failed\n", __func__);
    if (bgz) bgzf_close(bgz);
    free(bg_buf);
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0xa, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x30(%rbp), %rcx
xorl %edx, %edx
divq %rcx
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movq %rsp, %rcx
movq %rcx, -0x48(%rbp)
leaq 0xf(,%rax,8), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x68(%rbp)
movq %rcx, %rsp
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rdi
addq $0x1, %rdi
movl $0x1, %esi
callq 0x42e0
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x7d8d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x5c(%rbp)
jmp 0x7ffd
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
leaq 0xe27d8(%rip), %rdx     # 0xea578
callq 0x8b70
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x7db5
jmp 0x7fb7
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x7e55
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
leaq 0xe279a(%rip), %rdx     # 0xea578
callq 0x9920
movq %rax, %rdx
movq -0x68(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x38(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jge 0x7e02
jmp 0x7fb7
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rsi
movq -0x38(%rbp), %rax
imulq -0x40(%rbp), %rax
addq %rax, %rsi
movq -0x40(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
leaq 0xe274b(%rip), %r8      # 0xea578
callq 0x9370
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jge 0x7e42
jmp 0x7fb7
jmp 0x7e44
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x7dbd
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
leaq -0x20(%rbp), %rdi
leaq 0xe2710(%rip), %rdx     # 0xea578
xorl %ecx, %ecx
callq 0x8c10
cmpl $0x0, %eax
je 0x7e79
jmp 0x7fb7
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0xe66f9(%rip), %rsi     # 0xee581
leaq 0xe26e9(%rip), %rdx     # 0xea578
callq 0x8b70
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x7ea4
jmp 0x7fb7
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x48(%rcx), %rax
jae 0x7f7d
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x40(%rbp)
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq (%rax,%rcx,8), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
leaq 0xe2690(%rip), %rcx     # 0xea578
callq 0x9a80
cmpq $0x0, %rax
jge 0x7ef8
jmp 0x7fb7
movq -0x20(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
leaq 0xe2665(%rip), %r8      # 0xea578
callq 0x8d30
cmpq $0x0, %rax
jge 0x7f23
jmp 0x7fb7
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
addq -0x38(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %r8
movq -0x10(%rbp), %rax
movq 0x18(%rax), %r9
leaq 0xe2626(%rip), %rax     # 0xea578
subq $0x10, %rsp
movq %rax, (%rsp)
callq 0x8e70
addq $0x10, %rsp
cmpl $0x0, %eax
je 0x7f6a
jmp 0x7fb7
jmp 0x7f6c
movq -0x40(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x7eac
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
leaq -0x20(%rbp), %rdi
leaq 0xe25e8(%rip), %rdx     # 0xea578
xorl %ecx, %ecx
callq 0x8c10
cmpl $0x0, %eax
je 0x7f9e
jmp 0x7fb7
movq -0x58(%rbp), %rdi
callq 0x4590
movl $0x0, -0x4(%rbp)
movl $0x1, -0x5c(%rbp)
jmp 0x7ffd
movq 0x100022(%rip), %rax    # 0x107fe0
movq (%rax), %rdi
leaq 0xe25bf(%rip), %rsi     # 0xea587
leaq 0xe25a9(%rip), %rdx     # 0xea578
movb $0x0, %al
callq 0x46d0
cmpq $0x0, -0x20(%rbp)
je 0x7fe6
movq -0x20(%rbp), %rdi
callq 0xe0e0
movq -0x58(%rbp), %rdi
callq 0x4590
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x5c(%rbp)
movq -0x48(%rbp), %rax
movq %rax, %rsp
movl -0x4(%rbp), %eax
movq %rbp, %rsp
popq %rbp
retq
nopl (%rax)