// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/tbx.c
// Function: tbx_set_meta
static int tbx_set_meta(tbx_t *tbx)
{
    int i, l = 0, l_nm;
    uint32_t x[7];
    char **name;
    uint8_t *meta;
    khint_t k;
    khash_t(s2i) *d = (khash_t(s2i)*)tbx->dict;

    memcpy(x, &tbx->conf, 24);
    name = (char**)malloc(sizeof(char*) * kh_size(d));
    if (!name) return -1;
    for (k = kh_begin(d), l = 0; k != kh_end(d); ++k) {
        if (!kh_exist(d, k)) continue;
        name[kh_val(d, k)] = (char*)kh_key(d, k);
        l += strlen(kh_key(d, k)) + 1; // +1 to include '\0'
    }
    l_nm = x[6] = l;
    meta = (uint8_t*)malloc(l_nm + 28);
    if (!meta) { free(name); return -1; }
    if (ed_is_big())
        for (i = 0; i < 7; ++i)
            x[i] = ed_swap_4(x[i]);
    memcpy(meta, x, 28);
    for (l = 28, i = 0; i < (int)kh_size(d); ++i) {
        int x = strlen(name[i]) + 1;
        memcpy(meta + l, name[i], x);
        l += x;
    }
    free(name);
    hts_idx_set_meta(tbx->idx, l, meta, 0);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x40(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x60(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x4670
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0xf1e73
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xf202f
movl $0x0, -0x54(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x54(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpl (%rcx), %eax
je 0xf1f10
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x54(%rbp), %ecx
shrl $0x4, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl -0x54(%rbp), %ecx
andl $0xf, %ecx
shll %ecx
shrl %cl, %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0xf1eb7
jmp 0xf1f02
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x54(%rbp), %ecx
movq (%rax,%rcx,8), %rdx
movq -0x48(%rbp), %rax
movq -0x60(%rbp), %rcx
movq 0x20(%rcx), %rcx
movl -0x54(%rbp), %esi
movq (%rcx,%rsi,8), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x54(%rbp), %ecx
movq (%rax,%rcx,8), %rdi
callq 0x41a0
movq %rax, %rcx
addq $0x1, %rcx
movslq -0x18(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x18(%rbp)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0xf1e81
movl -0x18(%rbp), %eax
movl %eax, -0x28(%rbp)
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1c, %eax
movslq %eax, %rdi
callq 0x4670
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0xf1f47
movq -0x48(%rbp), %rdi
callq 0x45a0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xf202f
callq 0xf26b0
cmpl $0x0, %eax
je 0xf1f82
movl $0x0, -0x14(%rbp)
cmpl $0x7, -0x14(%rbp)
jge 0xf1f80
movslq -0x14(%rbp), %rax
movl -0x40(%rbp,%rax,4), %edi
callq 0xf26d0
movl %eax, %ecx
movslq -0x14(%rbp), %rax
movl %ecx, -0x40(%rbp,%rax,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xf1f58
jmp 0xf1f82
movq -0x50(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, (%rax)
movq -0x38(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0x28(%rbp), %ecx
movl %ecx, 0x18(%rax)
movl $0x1c, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0xf2009
movq -0x48(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x41a0
addq $0x1, %rax
movl %eax, -0x64(%rbp)
movq -0x50(%rbp), %rdi
movslq -0x18(%rbp), %rax
addq %rax, %rdi
movq -0x48(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movslq -0x64(%rbp), %rdx
callq 0x43b0
movl -0x64(%rbp), %eax
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xf1fb1
movq -0x48(%rbp), %rdi
callq 0x45a0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl -0x18(%rbp), %esi
movq -0x50(%rbp), %rdx
xorl %ecx, %ecx
callq 0xf4f0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)