// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/test_bgzf.c
// Function: setup
static int setup(const char *src, Files *f) {
    size_t len = (strlen(src) + strlen(bgzf_suffix) + strlen(idx_suffix)
                  + strlen(tmp_suffix) + 8);
    char *mem, *text;
    const unsigned int max = 50000;
    unsigned int i;
    size_t text_sz = max * 8 + 1;

    mem = calloc(5, len);
    if (mem == NULL) {
        perror(__func__);
        return -1;
    }

    snprintf(mem,           len, "%s",     src);
    snprintf(mem + len * 1, len, "%s%s",   src, bgzf_suffix);
    snprintf(mem + len * 2, len, "%s%s%s", src, bgzf_suffix, idx_suffix);
    snprintf(mem + len * 3, len, "%s%s%s", src, tmp_suffix, bgzf_suffix);
    snprintf(mem + len * 4, len, "%s%s%s%s",
             src, tmp_suffix, bgzf_suffix, idx_suffix);

    f->src_plain  = mem;
    f->src_bgzf   = mem + len * 1;
    f->src_idx    = mem + len * 2;
    f->tmp_bgzf  = mem + len * 3;
    f->tmp_idx   = mem + len * 4;

    text = malloc(text_sz);
    if (!text) {
        perror(__func__);
        goto fail;
    }
    for (i = 0; i < max; i++) snprintf(text + i*8, text_sz - i*8, "%07u\n", i);
    f->text = (unsigned char *) text;
    f->ltext = text_sz - 1;

    if ((f->f_plain = try_fopen(f->src_plain, "rb")) == NULL) goto fail;
    if ((f->f_bgzf  = try_fopen(f->src_bgzf,  "rb")) == NULL) goto fail;
    if ((f->f_idx   = try_fopen(f->src_idx,   "rb")) == NULL) goto fail;

    return 0;

 fail:
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x41a0
movq %rax, -0x58(%rbp)
movq 0x1023cc(%rip), %rdi    # 0x1084f0
callq 0x41a0
movq %rax, %rcx
movq -0x58(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq 0x1023ba(%rip), %rdi    # 0x1084f8
callq 0x41a0
movq %rax, %rcx
movq -0x50(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq 0x1023a8(%rip), %rdi    # 0x108500
callq 0x41a0
movq %rax, %rcx
movq -0x48(%rbp), %rax
addq %rcx, %rax
addq $0x8, %rax
movq %rax, -0x20(%rbp)
movl $0xc350, -0x34(%rbp)    # imm = 0xC350
movq $0x61a81, -0x40(%rbp)   # imm = 0x61A81
movq -0x20(%rbp), %rsi
movl $0x5, %edi
callq 0x42e0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x61af
leaq 0xe3e93(%rip), %rdi     # 0xea031
callq 0x43b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x63fe
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rcx
leaq 0xe82c2(%rip), %rdx     # 0xee484
movb $0x0, %al
callq 0x47e0
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
shlq $0x0, %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rcx
movq 0x102309(%rip), %r8     # 0x1084f0
leaq 0xe5b7a(%rip), %rdx     # 0xebd68
movb $0x0, %al
callq 0x47e0
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
shlq %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rcx
movq 0x1022de(%rip), %r8     # 0x1084f0
movq 0x1022df(%rip), %r9     # 0x1084f8
leaq 0xe3e19(%rip), %rdx     # 0xea039
movb $0x0, %al
callq 0x47e0
movq -0x28(%rbp), %rdi
imulq $0x3, -0x20(%rbp), %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rcx
movq 0x1022be(%rip), %r8     # 0x108500
movq 0x1022a7(%rip), %r9     # 0x1084f0
leaq 0xe3de9(%rip), %rdx     # 0xea039
movb $0x0, %al
callq 0x47e0
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rcx
movq 0x10228b(%rip), %r8     # 0x108500
movq 0x102274(%rip), %r9     # 0x1084f0
movq 0x102275(%rip), %rax    # 0x1084f8
leaq 0xe3dad(%rip), %rdx     # 0xea037
movq %rax, (%rsp)
movb $0x0, %al
callq 0x47e0
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
shlq $0x0, %rax
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
shlq %rax
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rcx
imulq $0x3, -0x20(%rbp), %rax
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x40(%rbp), %rdi
callq 0x4650
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x631d
leaq 0xe3d1e(%rip), %rdi     # 0xea031
callq 0x43b0
jmp 0x63f7
movl $0x0, -0x38(%rbp)
cmpl $0xc350, -0x38(%rbp)    # imm = 0xC350
jae 0x6367
movq -0x30(%rbp), %rdi
movl -0x38(%rbp), %eax
shll $0x3, %eax
movl %eax, %eax
addq %rax, %rdi
movq -0x40(%rbp), %rsi
movl -0x38(%rbp), %eax
shll $0x3, %eax
movl %eax, %eax
subq %rax, %rsi
movl -0x38(%rbp), %ecx
leaq 0xe3ceb(%rip), %rdx     # 0xea040
movb $0x0, %al
callq 0x47e0
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x6324
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x40(%rbp), %rcx
subq $0x1, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
leaq 0xe3cb5(%rip), %rsi     # 0xea046
callq 0x8af0
movq -0x18(%rbp), %rcx
movq %rax, 0x28(%rcx)
cmpq $0x0, %rax
jne 0x63a6
jmp 0x63f7
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xe3c91(%rip), %rsi     # 0xea046
callq 0x8af0
movq -0x18(%rbp), %rcx
movq %rax, 0x30(%rcx)
cmpq $0x0, %rax
jne 0x63ca
jmp 0x63f7
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0xe3c6d(%rip), %rsi     # 0xea046
callq 0x8af0
movq -0x18(%rbp), %rcx
movq %rax, 0x38(%rcx)
cmpq $0x0, %rax
jne 0x63ee
jmp 0x63f7
movl $0x0, -0x4(%rbp)
jmp 0x63fe
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)