// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x4260
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0xcf90
movq %rax, %rsi
movl -0x18(%rbp), %edx
leaq 0xe0212(%rip), %rdi     # 0xe6028
movb $0x0, %al
callq 0x4060
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x60fe
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x5e4e
movl $0x2a, %edi
callq 0x46a0
jmp 0x60e4
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x38(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movl 0x14(%rcx), %ecx
shll $0x2, %ecx
movl %ecx, %ecx
addq %rcx, %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movzwl 0x12(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x38(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movl 0x14(%rcx), %ecx
shll $0x2, %ecx
movl %ecx, %ecx
addq %rcx, %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movzwl 0x12(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movl 0x18(%rcx), %ecx
addl $0x1, %ecx
sarl %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
movq -0x10(%rbp), %rcx
movl 0x8(%rcx), %ecx
sarl %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movq -0x10(%rbp), %rcx
movl 0x8(%rcx), %ecx
xorl $-0x1, %ecx
andl $0x1, %ecx
shll $0x2, %ecx
sarl %cl, %eax
andl $0xf, %eax
movslq %eax, %rcx
leaq 0xe0ff6(%rip), %rax     # 0xe6ef0
movb (%rax,%rcx), %al
movb %al, -0x51(%rbp)
movzbl -0x51(%rbp), %edi
callq 0x46a0
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movzbl (%rax,%rcx), %ecx
addl $0x21, %ecx
movl $0x7e, %eax
cmpl %ecx, %eax
jge 0x5f32
movl $0x7e, %eax
movl %eax, -0xbc(%rbp)
jmp 0x5f4b
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movzbl (%rax,%rcx), %eax
addl $0x21, %eax
movl %eax, -0xbc(%rbp)
movl -0xbc(%rbp), %edi
leaq -0x38(%rbp), %rsi
callq 0x5cc0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x60(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
movl $0x5, %r8d
callq 0x40310
movl %eax, -0xb4(%rbp)
cmpl $0x0, %eax
jle 0x60e2
movl $0x5b, %edi
callq 0x46a0
movl $0x0, -0xb8(%rbp)
movl -0xb8(%rbp), %ecx
xorl %eax, %eax
cmpl -0xb4(%rbp), %ecx
movb %al, -0xbd(%rbp)
jge 0x5fd3
cmpl $0x5, -0xb8(%rbp)
setl %al
movb %al, -0xbd(%rbp)
movb -0xbd(%rbp), %al
testb $0x1, %al
jne 0x5fe2
jmp 0x60d8
movslq -0xb8(%rbp), %rcx
leaq -0xb0(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $0x0, (%rax)
jge 0x6061
movslq -0xb8(%rbp), %rcx
leaq -0xb0(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movslq 0x8(%rax), %rcx
leaq 0xe001c(%rip), %rax     # 0xe6038
movsbl (%rax,%rcx), %esi
movslq -0xb8(%rbp), %rcx
leaq -0xb0(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
xorl %edx, %edx
subl (%rax), %edx
movslq -0xb8(%rbp), %rcx
leaq -0xb0(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
leaq 0xdffd7(%rip), %rdi     # 0xe602f
movb $0x0, %al
callq 0x4060
jmp 0x60c2
movslq -0xb8(%rbp), %rcx
leaq -0xb0(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movslq 0x8(%rax), %rcx
leaq 0xdffb7(%rip), %rax     # 0xe6038
movsbl (%rax,%rcx), %esi
movslq -0xb8(%rbp), %rcx
leaq -0xb0(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %edx
movslq -0xb8(%rbp), %rcx
leaq -0xb0(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
leaq 0xdff80(%rip), %rdi     # 0xe603b
movb $0x0, %al
callq 0x4060
jmp 0x60c4
movl -0xb8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb8(%rbp)
jmp 0x5fad
movl $0x5d, %edi
callq 0x46a0
jmp 0x60e4
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x10(%rbp)
jmp 0x5e24
movl $0x9, %edi
callq 0x46a0
cmpq $0x0, -0x38(%rbp)
je 0x611c
movq -0x28(%rbp), %rax
movq %rax, -0xc8(%rbp)
jmp 0x612c
leaq 0xe1117(%rip), %rax     # 0xe723a
movq %rax, -0xc8(%rbp)
jmp 0x612c
movq -0xc8(%rbp), %rdi
callq 0x47d0
movq -0x28(%rbp), %rdi
callq 0x45b0
addq $0xd0, %rsp
popq %rbp
retq
nopw (%rax,%rax)