// File: karel-brinda[P]ococo/src/stats.h
// Function: ococo::stats_t<unsigned short, 3, 4>::print_vcf_substitution(_IO_FILE*, int, long, char, char, ococo::pos_stats_uncompr_t const&) const
int stats_t<T, counter_size, refbase_size>::print_vcf_substitution(
    FILE *vcf_file, int32_t seqid, int64_t pos, char old_base, char new_base,
    const pos_stats_uncompr_t &psu) const {
    assert(check_allocation());
    assert(vcf_file != nullptr);

    float alt_freq =
        1.0 * psu.counters[nt256_nt4[static_cast<int16_t>(new_base)]] / psu.sum;

    fprintf(vcf_file,
            "%s\t%" PRId64 "\t.\t%c\t%c\t100\tPASS\tAF=%.2f;CS=%" PRId32
            ",%" PRId32 ",%" PRId32 ",%" PRId32 ";COV=%" PRId32 "\n",
            seq_name[seqid].c_str(), pos + 1, old_base, new_base,
            round(alt_freq * 100.0) / 100, psu.counters[0], psu.counters[1],
            psu.counters[2], psu.counters[3], psu.sum);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xa0, %rsp
movl %r8d, -0x5c(%rbp)
movq %rcx, %rax
movl -0x5c(%rbp), %ecx
movq %rax, -0x58(%rbp)
movl %edx, %eax
movq -0x58(%rbp), %rdx
movl %eax, -0x4c(%rbp)
movq %rsi, %rax
movl -0x4c(%rbp), %esi
movq %rax, -0x48(%rbp)
movq %rdi, %r8
movq -0x48(%rbp), %rdi
movb %r9b, %al
movq 0x10(%rbp), %r9
movq %r8, -0x18(%rbp)
movq %rdi, -0x20(%rbp)
movl %esi, -0x24(%rbp)
movq %rdx, -0x30(%rbp)
movb %cl, -0x31(%rbp)
movb %al, -0x32(%rbp)
movq -0x18(%rbp), %rdi
movq %rdi, -0x40(%rbp)
callq 0x9440
testb $0x1, %al
jne 0xae15
jmp 0xae17
jmp 0xae36
leaq 0x6d561(%rip), %rdi     # 0x7837f
leaq 0x6d56d(%rip), %rsi     # 0x78392
movl $0x1fd, %edx            # imm = 0x1FD
leaq 0x6dd21(%rip), %rcx     # 0x78b52
callq 0x4360
cmpq $0x0, -0x20(%rbp)
je 0xae3f
jmp 0xae5e
leaq 0x6d97e(%rip), %rdi     # 0x787c4
leaq 0x6d545(%rip), %rsi     # 0x78392
movl $0x1fe, %edx            # imm = 0x1FE
leaq 0x6dcf9(%rip), %rcx     # 0x78b52
callq 0x4360
movq -0x40(%rbp), %rax
movq 0x10(%rbp), %rcx
movsbl -0x32(%rbp), %edx
movswq %dx, %rsi
leaq 0x6ec6b(%rip), %rdx     # 0x79ae0
movzbl (%rdx,%rsi), %edx
cvtsi2sdl 0x4(%rcx,%rdx,4), %xmm1
movsd 0x6d201(%rip), %xmm0    # 0x78088
mulsd %xmm1, %xmm0
movq 0x10(%rbp), %rcx
cvtsi2sdl 0x14(%rcx), %xmm1
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x38(%rbp)
movq -0x20(%rbp), %rcx
movq %rcx, -0x80(%rbp)
movq 0x18(%rax), %rdi
movslq -0x24(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
callq 0x4200
movq %rax, -0x78(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
movsbl -0x31(%rbp), %eax
movl %eax, -0x64(%rbp)
movsbl -0x32(%rbp), %eax
movl %eax, -0x60(%rbp)
movss -0x38(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x6d194(%rip), %xmm1    # 0x78080
mulsd %xmm1, %xmm0
callq 0x4210
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rdx
movq -0x70(%rbp), %rcx
movl -0x64(%rbp), %r8d
movl -0x60(%rbp), %r9d
movsd 0x6d16f(%rip), %xmm1    # 0x78080
divsd %xmm1, %xmm0
movq 0x10(%rbp), %rax
movl 0x4(%rax), %r14d
movq 0x10(%rbp), %rax
movl 0x8(%rax), %ebx
movq 0x10(%rbp), %rax
movl 0xc(%rax), %r11d
movq 0x10(%rbp), %rax
movl 0x10(%rax), %r10d
movq 0x10(%rbp), %rax
movl 0x14(%rax), %eax
leaq 0x6dcd3(%rip), %rsi     # 0x78c15
movl %r14d, (%rsp)
movl %ebx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movb $0x1, %al
callq 0x4830
xorl %eax, %eax
addq $0xa0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)