// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/test/pileup_mod.c
// Function: process_mod_pileup1
void process_mod_pileup1(sam_hdr_t *h, const bam_pileup1_t *p,
                         int tid, int pos, int n) {
    kstring_t s = {0,0};
    printf("%s\t%d\t", sam_hdr_tid2name(h, tid), pos);
    int i;
    for (i = 0; i < n; i++, p++) {
        if (p->is_del) {
            putchar('*');
            continue;
        }

        uint8_t *seq = bam_get_seq(p->b);
        uint8_t *qual = bam_get_qual(p->b);
        unsigned char c = seq_nt16_str[bam_seqi(seq, p->qpos)];
        putchar(c);
        kputc(MIN('~','!'+qual[p->qpos]), &s);

        // Simple mod detection; assumes at most 5 mods
        hts_base_mod_state *m = p->cd.p;
        hts_base_mod mod[5];
        int nm;
        if ((nm = bam_mods_at_qpos(p->b, p->qpos, m, mod, 5)) > 0) {
            int j;
            putchar('[');
            for (j = 0; j < nm && j < 5; j++) {
                if (mod[j].modified_base < 0)
                    // ChEBI
                    printf("%c(%d)%d", "+-"[mod[j].strand],
                           -mod[j].modified_base, mod[j].qual);
                else
                    printf("%c%c%d", "+-"[mod[j].strand],
                           mod[j].modified_base, mod[j].qual);
            }
            putchar(']');
        }
    }
    putchar('\t');
    puts(s.l ? s.s : "");

    free(s.s);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %r8d, %r13d
movl %ecx, %ebp
movq %rsi, %r14
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movl %edx, %esi
callq 0x9fa5
leaq 0x6b356(%rip), %rdi     # 0x71028
xorl %ebx, %ebx
movq %rax, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x4060
testl %r13d, %r13d
cmovlel %ebx, %r13d
leaq 0x6b34a(%rip), %rbp     # 0x71038
leaq 0x6b346(%rip), %r15     # 0x7103b
xorl %ebx, %ebx
movl %r13d, 0xc(%rsp)
cmpl %r13d, %ebx
je 0x5e14
testb $0x1, 0x14(%r14)
jne 0x5df2
movq (%r14), %rcx
movl 0x14(%rcx), %edx
movl 0x18(%rcx), %eax
shll $0x2, %edx
addq 0x38(%rcx), %rdx
movzwl 0x12(%rcx), %esi
addq %rdx, %rsi
incl %eax
sarl %eax
movl 0x8(%r14), %ecx
movl %ecx, %edx
sarl %edx
movslq %edx, %rdx
movzbl (%rdx,%rsi), %edx
shll $0x2, %ecx
notb %cl
andb $0x4, %cl
shrl %cl, %edx
movslq %eax, %r12
addq %rsi, %r12
andl $0xf, %edx
leaq 0x6c1ac(%rip), %rax     # 0x71f00
movzbl (%rax,%rdx), %edi
callq 0x46d0
movslq 0x8(%r14), %rax
movzbl (%rax,%r12), %eax
leal 0x21(%rax), %edi
cmpl $0x5e, %eax
pushq $0x7e
popq %rax
cmovael %eax, %edi
leaq 0x10(%rsp), %rsi
callq 0x5be7
movq 0x18(%r14), %rdx
movq (%r14), %rdi
movl 0x8(%r14), %esi
leaq 0x30(%rsp), %rcx
pushq $0x5
popq %r8
callq 0x257a0
testl %eax, %eax
jle 0x5e09
movl %eax, %r12d
pushq $0x5b
popq %rdi
callq 0x46d0
cmpl $0x5, %r12d
pushq $0x5
popq %rax
cmovael %eax, %r12d
shll $0x4, %r12d
xorl %r13d, %r13d
cmpq %r13, %r12
je 0x5dfc
movl 0x30(%rsp,%r13), %edx
movslq 0x38(%rsp,%r13), %rax
movsbl (%rax,%rbp), %esi
testl %edx, %edx
js 0x5dd7
movl 0x3c(%rsp,%r13), %ecx
movq %r15, %rdi
jmp 0x5de5
negl %edx
movl 0x3c(%rsp,%r13), %ecx
leaq 0x6b24a(%rip), %rdi     # 0x7102f
xorl %eax, %eax
callq 0x4060
addq $0x10, %r13
jmp 0x5db6
pushq $0x2a
popq %rdi
callq 0x46d0
jmp 0x5e09
pushq $0x5d
popq %rdi
callq 0x46d0
movl 0xc(%rsp), %r13d
incl %ebx
addq $0x28, %r14
jmp 0x5cfc
pushq $0x9
popq %rdi
callq 0x46d0
cmpq $0x0, 0x10(%rsp)
movq 0x20(%rsp), %rbx
leaq 0x6c418(%rip), %rdi     # 0x72246
cmovneq %rbx, %rdi
callq 0x47f0
movq %rbx, %rdi
callq 0x45d0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq