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

    BGZF* bgz = NULL;
    char bg_buf[99];

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


    if (try_bgzf_write(bgz, "#>Hello, World!\n", 16,
                       f->tmp_bgzf, __func__) != 16)
        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;

    if (try_bgzf_getc(bgz, 0, '#', f->tmp_bgzf, __func__) < 0 ||
        try_bgzf_getc(bgz, 1, '>', f->tmp_bgzf, __func__) < 0)
        goto fail;

    if (try_bgzf_read(bgz, bg_buf, 5, f->tmp_bgzf, __func__) != 5)
        goto fail;
    if (memcmp(bg_buf, "Hello", 5) != 0)
        goto fail;

    if (try_bgzf_useek(bgz, 9, SEEK_SET, f->tmp_bgzf, __func__) < 0)
        goto fail;

    if (try_bgzf_read(bgz, bg_buf, 5, f->tmp_bgzf, __func__) != 5)
        goto fail;
    if (memcmp(bg_buf, "World", 5) != 0)
        goto fail;

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

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

// Assembly:
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
movq $0x0, 0x8(%rsp)
movq 0x18(%rdi), %rdi
leaq 0x8c77e(%rip), %rdx     # 0x94593
callq 0x85b7
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x7f8c
movq 0x18(%rbx), %rcx
leaq 0x8c776(%rip), %rsi     # 0x945a9
leaq 0x8c759(%rip), %r8      # 0x94593
movl $0x10, %edx
movq %rax, %rdi
callq 0x88a5
cmpq $0x10, %rax
jne 0x7f8c
movq 0x18(%rbx), %rsi
leaq 0x8c737(%rip), %rdx     # 0x94593
leaq 0x8(%rsp), %rdi
xorl %ecx, %ecx
callq 0x861b
testl %eax, %eax
jne 0x7f8c
movq 0x18(%rbx), %rdi
leaq 0x904c9(%rip), %rsi     # 0x98344
leaq 0x8c711(%rip), %rdx     # 0x94593
callq 0x85b7
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x7f8c
movq %rax, %r14
movq 0x18(%rbx), %rcx
leaq 0x8c6f0(%rip), %r8      # 0x94593
movq %rax, %rdi
xorl %esi, %esi
movl $0x23, %edx
callq 0x89f6
testl %eax, %eax
js 0x7f8c
movq 0x18(%rbx), %rcx
leaq 0x8c6ce(%rip), %r8      # 0x94593
movl $0x1, %esi
movq %r14, %rdi
movl $0x3e, %edx
callq 0x89f6
testl %eax, %eax
js 0x7f8c
movq 0x18(%rbx), %rcx
leaq 0x8c6a9(%rip), %r8      # 0x94593
leaq 0x10(%rsp), %rsi
movl $0x5, %edx
movq %r14, %rdi
callq 0x868e
cmpq $0x5, %rax
jne 0x7f8c
movl $0x6c6c6548, %eax       # imm = 0x6C6C6548
xorl 0x10(%rsp), %eax
movzbl 0x14(%rsp), %ecx
xorl $0x6f, %ecx
orl %eax, %ecx
jne 0x7f8c
movq 0x18(%rbx), %rdx
leaq 0x8c66d(%rip), %rcx     # 0x94593
movl $0x9, %esi
movq %r14, %rdi
callq 0x8987
testl %eax, %eax
js 0x7f8c
movq 0x18(%rbx), %rcx
leaq 0x8c651(%rip), %r8      # 0x94593
leaq 0x10(%rsp), %rsi
movl $0x5, %edx
movq %r14, %rdi
callq 0x868e
cmpq $0x5, %rax
jne 0x7f8c
movl $0x6c726f57, %eax       # imm = 0x6C726F57
xorl 0x10(%rsp), %eax
movzbl 0x14(%rsp), %ecx
xorl $0x64, %ecx
orl %eax, %ecx
jne 0x7f8c
movq 0x18(%rbx), %rsi
leaq 0x8c619(%rip), %rdx     # 0x94593
leaq 0x8(%rsp), %rdi
xorl %ebx, %ebx
xorl %ecx, %ecx
callq 0x861b
testl %eax, %eax
je 0x7fbf
movq 0xad04d(%rip), %rax     # 0xb4fe0
movq (%rax), %rdi
leaq 0x8c5ea(%rip), %rsi     # 0x94587
leaq 0x8c5ef(%rip), %rdx     # 0x94593
xorl %eax, %eax
callq 0x4700
movq 0x8(%rsp), %rdi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x7fbf
callq 0xbc44
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r14
retq