// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/vcf.c
// Function: bcf_fmt_array1
static inline int bcf_fmt_array1(kstring_t *s, int type, void *data) {
    uint32_t e = 0;
    uint8_t *p = (uint8_t *)data;
    int32_t v;

    // helps gcc more than clang here. In billions of cycles:
    //          bcf_fmt_array1  bcf_fmt_array
    // gcc7:    23.2            24.3
    // gcc13:   21.6            23.0
    // clang13: 27.1            27.8
    switch (type) {
    case BCF_BT_CHAR:
        e |= kputc_(*p == bcf_str_missing ? '.' : *p, s) < 0;
        break;

    case BCF_BT_INT8:
        if (*(int8_t *)p != bcf_int8_vector_end) {
            e |= ((*(int8_t *)p == bcf_int8_missing)
                  ? kputc_('.', s)
                  : kputw(*(int8_t *)p, s)) < 0;
        }
        break;
    case BCF_BT_INT16:
        v = le_to_i16(p);
        if (v != bcf_int16_vector_end) {
            e |= (v == bcf_int16_missing
                  ? kputc_('.', s)
                  : kputw(v, s)) < 0;
        }
        break;

    case BCF_BT_INT32:
        v = le_to_i32(p);
        if (v != bcf_int32_vector_end) {
            e |= (v == bcf_int32_missing
                  ? kputc_('.', s)
                  : kputw(v, s)) < 0;
        }
        break;

    case BCF_BT_FLOAT:
        v = le_to_u32(p);
        if (v != bcf_float_vector_end) {
            e |= (v == bcf_float_missing
                  ? kputc_('.', s)
                  : kputd(le_to_float(p), s)) < 0;
        }
        break;

    default:
        hts_log_error("Unexpected type %d", type);
        return -1;
    }

    return e == 0 ? 0 : -1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ecx
leal -0x1(%rcx), %eax
cmpl $0x6, %eax
ja 0x3af3a
movq %rdi, %rbx
leaq 0x6ffa9(%rip), %rsi     # 0xaaeb0
movslq (%rsi,%rax,4), %rax
addq %rsi, %rax
jmpq *%rax
movzbl (%rdx), %eax
cmpl $0x81, %eax
je 0x3b10e
cmpl $0x80, %eax
je 0x3b053
movsbl %al, %ebp
testb %bpl, %bpl
jns 0x3b13e
jmp 0x3afe9
leaq 0x720a5(%rip), %rsi     # 0xacfe6
leaq 0x70cfb(%rip), %rdx     # 0xabc43
movl $0x1, %edi
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x942d
movl (%rdx), %edi
cmpl $0x80000001, %edi       # imm = 0x80000001
je 0x3b10e
movl %edi, %ebp
negl %ebp
jo 0x3b053
testl %edi, %edi
jns 0x3b140
movq (%rbx), %rcx
leaq 0x3(%rcx), %rax
cmpq %rax, 0x8(%rbx)
jae 0x3b12f
movq %rax, %rcx
shrq $0x3e, %rcx
movq %rax, %rdx
shrq %rdx
xorl %r14d, %r14d
testq %rcx, %rcx
cmoveq %rdx, %r14
addq %rax, %r14
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x4860
testq %rax, %rax
je 0x3b10e
movq %rax, 0x10(%rbx)
movq %r14, 0x8(%rbx)
movq (%rbx), %rcx
jmp 0x3b133
movzwl (%rdx), %eax
cmpl $0x8001, %eax           # imm = 0x8001
je 0x3b10e
cmpl $0x8000, %eax           # imm = 0x8000
je 0x3b053
movswl %ax, %ebp
testw %bp, %bp
jns 0x3b13e
movq (%rbx), %rcx
leaq 0x3(%rcx), %rax
cmpq %rax, 0x8(%rbx)
jae 0x3b127
movq %rax, %rcx
shrq $0x3e, %rcx
movq %rax, %rdx
shrq %rdx
xorl %r14d, %r14d
testq %rcx, %rcx
cmoveq %rdx, %r14
addq %rax, %r14
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x4860
testq %rax, %rax
je 0x3b10e
movq %rax, 0x10(%rbx)
movq %r14, 0x8(%rbx)
movq (%rbx), %rcx
jmp 0x3b12b
movl (%rdx), %eax
cmpl 0x924d3(%rip), %eax     # 0xcd514
je 0x3b10e
cmpl 0x924c3(%rip), %eax     # 0xcd510
jne 0x3b113
movq (%rbx), %rdx
leaq 0x1(%rdx), %rcx
cmpq %rcx, 0x8(%rbx)
jae 0x3b0f6
movq %rcx, %rax
shrq $0x3e, %rax
movq %rcx, %rdx
shrq %rdx
xorl %r14d, %r14d
testq %rax, %rax
cmoveq %rdx, %r14
addq %rcx, %r14
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x4860
testq %rax, %rax
je 0x3b10e
movq %rax, 0x10(%rbx)
movq %r14, 0x8(%rbx)
movq (%rbx), %rdx
leaq 0x1(%rdx), %rcx
jmp 0x3b0fa
movzbl (%rdx), %eax
cmpb $0x7, %al
movl $0x2e, %ebp
cmovnel %eax, %ebp
movq (%rbx), %rdx
leaq 0x1(%rdx), %rcx
cmpq %rcx, 0x8(%rbx)
jae 0x3b103
movq %rcx, %rax
shrq $0x3e, %rax
movq %rcx, %rdx
shrq %rdx
xorl %r14d, %r14d
testq %rax, %rax
cmoveq %rdx, %r14
addq %rcx, %r14
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x4860
testq %rax, %rax
je 0x3b10e
movq %rax, 0x10(%rbx)
movq %r14, 0x8(%rbx)
movq (%rbx), %rdx
leaq 0x1(%rdx), %rcx
jmp 0x3b107
movq 0x10(%rbx), %rax
movq %rcx, (%rbx)
movb $0x2e, (%rax,%rdx)
jmp 0x3b10e
movq 0x10(%rbx), %rax
movq %rcx, (%rbx)
movb %bpl, (%rax,%rdx)
popq %rbx
popq %r14
popq %rbp
retq
movd %eax, %xmm0
cvtss2sd %xmm0, %xmm0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x88e98
movq 0x10(%rbx), %rax
negl %ebp
jmp 0x3b133
movq 0x10(%rbx), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
movb $0x2d, (%rax,%rcx)
movl %ebp, %edi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x41065