// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/misc/wgsim.c
// Function: maq_print_mutref
void maq_print_mutref(const char *name, const seq_t *seq, mutseq_t *hap1, mutseq_t *hap2)
{
	int i;
	for (i = 0; i != seq->l; ++i) {
		int c[3];
		c[0] = nst_nt4_table[(int)seq->s[i]];
		c[1] = hap1->s[i]; c[2] = hap2->s[i];
		if (c[0] >= 4) continue;
		if ((c[1] & mutmsk) != NOCHANGE || (c[1] & mutmsk) != NOCHANGE) {
			printf("%s\t%d\t", name, i+1);
			if (c[1] == c[2]) { // hom
				if ((c[1]&mutmsk) == SUBSTITUTE) { // substitution
					printf("%c\t%c\t-\n", "ACGTN"[c[0]], "ACGTN"[c[1]&0xf]);
				} else if ((c[1]&mutmsk) == DELETE) { // del
					printf("%c\t-\t-\n", "ACGTN"[c[0]]);
				} else if (((c[1] & mutmsk) >> 12) <= 5) { // ins
					printf("-\t");
                    int n = (c[1]&mutmsk) >> 12, ins = c[1] >> 4;
                    while(n > 0) {
                        putchar("ACGTN"[ins & 0x3]);
                        n--;
                    }
                    printf("\t-\n");
				}  else assert(0);
			} else { // het
				if ((c[1]&mutmsk) == SUBSTITUTE || (c[2]&mutmsk) == SUBSTITUTE) { // substitution
					printf("%c\t%c\t+\n", "ACGTN"[c[0]], "XACMGRSVTWYHKDBN"[1<<(c[1]&0x3)|1<<(c[2]&0x3)]);
				} else if ((c[1]&mutmsk) == DELETE) {
					printf("%c\t-\t+\n", "ACGTN"[c[0]]);
				} else if ((c[2]&mutmsk) == DELETE) {
					printf("%c\t-\t+\n", "ACGTN"[c[0]]);
				} else if (((c[1] & mutmsk) >> 12) <= 4) { // ins1
					printf("-\t");
                    int n = (c[1]&mutmsk) >> 12, ins = c[1] >> 4;
                    while (n > 0) {
                        putchar("ACGTN"[ins & 0x3]);
                        n--;
                    }
                    printf("\t+\n");
				} else if (((c[2] & mutmsk) >> 12) <= 5) { // ins2
					printf("-\t");
                    int n = (c[2]&mutmsk) >> 12, ins = c[2] >> 4;
                    while (n > 0) {
                        putchar("ACGTN"[ins & 0x3]);
                        ins >>= 2;
                        n--;
                    }
                    printf("\t+\n");
				} else assert(0);
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
cmpl $0x0, (%rsi)
je 0x2e5e
movq %rsi, %r15
leaq 0x147e(%rip), %r14      # 0x4090
xorl %r13d, %r13d
movq %rdx, (%rsp)
movq 0x8(%r15), %rax
movzbl (%rax,%r13), %eax
movzbl (%rax,%r14), %r12d
cmpq $0x4, %r12
setae %al
movq 0x8(%rdx), %rcx
movzwl (%rcx,%r13,2), %ebx
cmpl $0x1000, %ebx           # imm = 0x1000
setb %cl
orb %al, %cl
jne 0x2dab
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movzwl (%rax,%r13,2), %ebp
leal 0x1(%r13), %edx
leaq 0x1596(%rip), %rdi      # 0x41f7
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x10a0
movl %ebx, %eax
cmpw %bp, %bx
jne 0x2caf
notl %eax
testl $0xf000, %eax           # imm = 0xF000
je 0x2d0e
movl %ebx, %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0xe000, %eax           # imm = 0xE000
jne 0x2d23
leaq 0x156d(%rip), %rax      # 0x4207
movsbl (%r12,%rax), %esi
andl $0xf, %ebx
movsbl (%rbx,%rax), %edx
leaq 0x1551(%rip), %rdi      # 0x41fe
jmp 0x2d02
andl $0xf000, %eax           # imm = 0xF000
cmpl $0xe000, %eax           # imm = 0xE000
je 0x2ccf
movl %ebp, %ecx
andl $0xf000, %ecx           # imm = 0xF000
cmpl $0xe000, %ecx           # imm = 0xE000
jne 0x2d7e
andb $0x3, %bpl
movl $0x1, %eax
movl %ebp, %ecx
shlq %cl, %rax
leaq 0x1523(%rip), %rcx      # 0x4207
movsbl (%r12,%rcx), %esi
andb $0x3, %bl
btsq %rbx, %rax
leaq 0x157f(%rip), %rcx      # 0x4276
movsbl (%rax,%rcx), %edx
leaq 0x156b(%rip), %rdi      # 0x426d
xorl %eax, %eax
callq 0x10a0
jmp 0x2da7
leaq 0x14f2(%rip), %rax      # 0x4207
movsbl (%r12,%rax), %esi
leaq 0x14ec(%rip), %rdi      # 0x420d
jmp 0x2da0
cmpl $0x5fff, %ebx           # imm = 0x5FFF
ja 0x2e6d
leaq 0x14df(%rip), %rdi      # 0x4215
xorl %eax, %eax
callq 0x10a0
cmpl $0x1000, %ebx           # imm = 0x1000
jb 0x2d70
movl %ebx, %r12d
shrl $0xc, %r12d
shrl $0x4, %ebx
andl $0x3, %ebx
leaq 0x14ae(%rip), %rax      # 0x4207
movsbl (%rbx,%rax), %ebp
incl %r12d
movl %ebp, %edi
callq 0x1040
decl %r12d
cmpl $0x1, %r12d
jg 0x2d60
leaq 0x197b(%rip), %rdi      # 0x46f2
callq 0x1060
jmp 0x2da7
cmpl $0xf000, %eax           # imm = 0xF000
je 0x2d8d
cmpl $0xf000, %ecx           # imm = 0xF000
jne 0x2dbf
leaq 0x1473(%rip), %rax      # 0x4207
movsbl (%r12,%rax), %esi
leaq 0x14e7(%rip), %rdi      # 0x4287
xorl %eax, %eax
callq 0x10a0
movq (%rsp), %rdx
incq %r13
movl (%r15), %eax
cmpq %rax, %r13
jne 0x2c19
jmp 0x2e5e
cmpl $0x4fff, %ebx           # imm = 0x4FFF
ja 0x2e0a
leaq 0x1447(%rip), %rdi      # 0x4215
xorl %eax, %eax
callq 0x10a0
cmpl $0x1000, %ebx           # imm = 0x1000
jb 0x2e52
movl %ebx, %r12d
shrl $0xc, %r12d
shrl $0x4, %ebx
andl $0x3, %ebx
leaq 0x1416(%rip), %rax      # 0x4207
movsbl (%rbx,%rax), %ebp
incl %r12d
movl %ebp, %edi
callq 0x1040
decl %r12d
cmpl $0x1, %r12d
jg 0x2df8
jmp 0x2e52
cmpl $0x5fff, %ebp           # imm = 0x5FFF
ja 0x2e8c
leaq 0x13fc(%rip), %rdi      # 0x4215
xorl %eax, %eax
callq 0x10a0
cmpl $0x1000, %ebp           # imm = 0x1000
leaq 0x13da(%rip), %r12      # 0x4207
jb 0x2e52
movl %ebp, %ebx
shrl $0x4, %ebx
shrl $0xc, %ebp
incl %ebp
movl %ebx, %eax
andl $0x3, %eax
movsbl (%rax,%r12), %edi
callq 0x1040
shrl $0x2, %ebx
decl %ebp
cmpl $0x1, %ebp
jg 0x2e39
leaq 0x1896(%rip), %rdi      # 0x46ef
jmp 0x2d77
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x13a4(%rip), %rdi      # 0x4218
leaq 0x139f(%rip), %rsi      # 0x421a
leaq 0x13a0(%rip), %rcx      # 0x4222
movl $0x100, %edx            # imm = 0x100
callq 0x10c0
leaq 0x1385(%rip), %rdi      # 0x4218
leaq 0x1380(%rip), %rsi      # 0x421a
leaq 0x1381(%rip), %rcx      # 0x4222
movl $0x119, %edx            # imm = 0x119
callq 0x10c0