// File: /workspace/github_c_makefile_star2_O3/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 0x18(%rdi), %rdi
leaq 0x896e3(%rip), %rdx     # 0x915af
callq 0x865e
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x807b
movq 0x18(%rbx), %rcx
leaq 0x896db(%rip), %rsi     # 0x915c5
leaq 0x896be(%rip), %r8      # 0x915af
movl $0x10, %edx
movq %rax, %rdi
callq 0x893c
cmpq $0x10, %rax
jne 0x8043
movq 0x18(%rbx), %rsi
leaq 0x8969c(%rip), %rdx     # 0x915af
leaq 0x8(%rsp), %rdi
xorl %ecx, %ecx
callq 0x86bf
testl %eax, %eax
jne 0x8043
movq 0x18(%rbx), %rdi
leaq 0x8d3b9(%rip), %rsi     # 0x952eb
leaq 0x89676(%rip), %rdx     # 0x915af
callq 0x865e
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x807b
movq %rax, %r14
movq 0x18(%rbx), %rcx
leaq 0x89655(%rip), %r8      # 0x915af
movq %rax, %rdi
xorl %esi, %esi
movl $0x23, %edx
callq 0x8a90
testl %eax, %eax
js 0x8043
movq 0x18(%rbx), %rcx
leaq 0x89633(%rip), %r8      # 0x915af
movl $0x1, %esi
movq %r14, %rdi
movl $0x3e, %edx
callq 0x8a90
testl %eax, %eax
js 0x8043
movq 0x18(%rbx), %rcx
leaq 0x8960e(%rip), %r8      # 0x915af
leaq 0x10(%rsp), %rsi
movl $0x5, %edx
movq %r14, %rdi
callq 0x8732
cmpq $0x5, %rax
jne 0x8043
movl $0x6c6c6548, %eax       # imm = 0x6C6C6548
xorl 0x10(%rsp), %eax
movzbl 0x14(%rsp), %ecx
xorl $0x6f, %ecx
orl %eax, %ecx
jne 0x8043
movq 0x18(%rbx), %rdx
leaq 0x895d2(%rip), %rcx     # 0x915af
movl $0x9, %esi
movq %r14, %rdi
callq 0x8a21
testl %eax, %eax
js 0x8043
movq 0x18(%rbx), %rcx
leaq 0x895b6(%rip), %r8      # 0x915af
leaq 0x10(%rsp), %rsi
movl $0x5, %edx
movq %r14, %rdi
callq 0x8732
cmpq $0x5, %rax
jne 0x8043
movl $0x6c726f57, %eax       # imm = 0x6C726F57
xorl 0x10(%rsp), %eax
movzbl 0x14(%rsp), %ecx
xorl $0x64, %ecx
orl %eax, %ecx
jne 0x8043
movq 0x18(%rbx), %rsi
leaq 0x8957e(%rip), %rdx     # 0x915af
leaq 0x8(%rsp), %rdi
xorl %ebx, %ebx
xorl %ecx, %ecx
callq 0x86bf
testl %eax, %eax
je 0x8085
movq 0x8(%rsp), %r14
movq 0xaaf91(%rip), %rax     # 0xb2fe0
movq (%rax), %rdi
leaq 0x8954a(%rip), %rsi     # 0x915a3
leaq 0x8954f(%rip), %rdx     # 0x915af
xorl %eax, %eax
callq 0x4700
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %r14, %r14
je 0x8085
movq %r14, %rdi
callq 0xbb59
jmp 0x8085
callq 0x4adf
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r14
retq