// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: bcf_fmt_array
int bcf_fmt_array(kstring_t *s, int n, int type, void *data)
{
    int j = 0;
    uint32_t e = 0;
    if (n == 0) {
        return kputc_('.', s) >= 0 ? 0 : -1;
    }

    if (type == BCF_BT_CHAR)
    {
        char *p = (char *)data;

        // Note bcf_str_missing is already accounted for in n==0 above.
        if (n >= 8) {
            char *p_end = memchr(p, 0, n);
            e |= kputsn(p, p_end ? p_end-p : n, s) < 0;
        } else {
            for (j = 0; j < n && *p; ++j, ++p)
               e |= kputc(*p, s) < 0;
        }
    }
    else
    {
        #define BRANCH(type_t, convert, is_missing, is_vector_end, kprint) { \
            uint8_t *p = (uint8_t *) data; \
            for (j=0; j<n; j++, p += sizeof(type_t))    \
            { \
                type_t v = convert(p); \
                if ( is_vector_end ) break; \
                if ( j ) e |= kputc_(',', s) < 0; \
                e |= (is_missing ? kputc('.', s) : kprint) < 0; \
            } \
        }
        switch (type) {
            case BCF_BT_INT8:  BRANCH(int8_t,  le_to_i8, v==bcf_int8_missing,  v==bcf_int8_vector_end,  kputw(v, s)); break;
            case BCF_BT_INT16: BRANCH(int16_t, le_to_i16, v==bcf_int16_missing, v==bcf_int16_vector_end, kputw(v, s)); break;
            case BCF_BT_INT32: BRANCH(int32_t, le_to_i32, v==bcf_int32_missing, v==bcf_int32_vector_end, kputw(v, s)); break;
            case BCF_BT_FLOAT: BRANCH(uint32_t, le_to_u32, v==bcf_float_missing, v==bcf_float_vector_end, kputd(le_to_float(p), s)); break;
            default: hts_log_error("Unexpected type %d", type); exit(1); break;
        }
        #undef BRANCH
    }
    return e == 0 ? 0 : -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testl %esi, %esi
je 0x282e8
movq %rcx, %r14
movl %edx, %ecx
leal -0x1(%rcx), %eax
cmpl $0x6, %eax
ja 0x284a3
movl %esi, %r15d
leaq 0x5d953(%rip), %rdx     # 0x85bd0
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
xorl %r13d, %r13d
testl %r15d, %r15d
cmovlel %r13d, %r15d
xorl %ebp, %ebp
cmpl %r13d, %r15d
je 0x2832f
movsbl (%r14,%r13), %r12d
cmpl $-0x7f, %r12d
je 0x2832f
testl %r13d, %r13d
je 0x282bf
pushq $0x2c
popq %rdi
movq %rbx, %rsi
callq 0x284c4
shrl $0x1f, %eax
orl %eax, %ebp
movl %r12d, %eax
negb %al
jno 0x282d3
pushq $0x2e
popq %rdi
movq %rbx, %rsi
callq 0x25f76
jmp 0x282de
movl %r12d, %edi
movq %rbx, %rsi
callq 0x22eac
shrl $0x1f, %eax
orl %eax, %ebp
incq %r13
jmp 0x28292
pushq $0x2e
popq %rdi
movq %rbx, %rsi
callq 0x284c4
sarl $0x1f, %eax
jmp 0x28335
cmpl $0x7, %r15d
jle 0x2846f
movl %r15d, %r15d
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x4550
movq %rax, %rsi
subq %r14, %rsi
testq %rax, %rax
cmoveq %r15, %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x2787b
movl %eax, %ebp
shrl $0x1f, %ebp
xorl %eax, %eax
negl %ebp
sbbl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r13d, %r13d
testl %r15d, %r15d
cmovlel %r13d, %r15d
xorl %ebp, %ebp
cmpl %r13d, %r15d
je 0x2832f
movl (%r14,%r13,4), %r12d
cmpl $0x80000001, %r12d      # imm = 0x80000001
je 0x2832f
testl %r13d, %r13d
je 0x28377
pushq $0x2c
popq %rdi
movq %rbx, %rsi
callq 0x284c4
shrl $0x1f, %eax
orl %eax, %ebp
movl %r12d, %eax
negl %eax
jno 0x2838b
pushq $0x2e
popq %rdi
movq %rbx, %rsi
callq 0x25f76
jmp 0x28396
movl %r12d, %edi
movq %rbx, %rsi
callq 0x22eac
shrl $0x1f, %eax
orl %eax, %ebp
incq %r13
jmp 0x28350
xorl %r12d, %r12d
testl %r15d, %r15d
cmovlel %r12d, %r15d
xorl %ebp, %ebp
cmpl %r12d, %r15d
je 0x2832f
movl (%r14,%r12,4), %r13d
cmpl 0x87154(%rip), %r13d    # 0xaf514
je 0x2832f
testl %r12d, %r12d
je 0x283db
pushq $0x2c
popq %rdi
movq %rbx, %rsi
callq 0x284c4
shrl $0x1f, %eax
orl %eax, %ebp
cmpl 0x8712e(%rip), %r13d    # 0xaf510
jne 0x283f1
pushq $0x2e
popq %rdi
movq %rbx, %rsi
callq 0x25f76
jmp 0x283ff
cvtss2sd (%r14,%r12,4), %xmm0
movq %rbx, %rdi
callq 0x68b28
shrl $0x1f, %eax
orl %eax, %ebp
incq %r12
jmp 0x283ac
xorl %r13d, %r13d
testl %r15d, %r15d
cmovlel %r13d, %r15d
xorl %ebp, %ebp
cmpl %r13d, %r15d
je 0x2832f
movswl (%r14,%r13,2), %r12d
cmpl $0xffff8001, %r12d      # imm = 0xFFFF8001
je 0x2832f
testl %r13d, %r13d
je 0x28445
pushq $0x2c
popq %rdi
movq %rbx, %rsi
callq 0x284c4
shrl $0x1f, %eax
orl %eax, %ebp
movl %r12d, %eax
negw %ax
jno 0x2845a
pushq $0x2e
popq %rdi
movq %rbx, %rsi
callq 0x25f76
jmp 0x28465
movl %r12d, %edi
movq %rbx, %rsi
callq 0x22eac
shrl $0x1f, %eax
orl %eax, %ebp
incq %r13
jmp 0x28415
xorl %r12d, %r12d
testl %r15d, %r15d
cmovlel %r12d, %r15d
xorl %ebp, %ebp
cmpl %r12d, %r15d
je 0x2832f
movsbl (%r14,%r12), %edi
testl %edi, %edi
je 0x2832f
movq %rbx, %rsi
callq 0x25f76
shrl $0x1f, %eax
orl %eax, %ebp
incq %r12
jmp 0x2847b
leaq 0x5e4e4(%rip), %rsi     # 0x8698e
leaq 0x5e4eb(%rip), %rdx     # 0x8699c
pushq $0x1
popq %rbx
movl %ebx, %edi
xorl %eax, %eax
callq 0x8132
movl %ebx, %edi
callq 0x45f0