// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/misc/wgsim.c
// Function: wgsim_print_mutref
void wgsim_print_mutref(const char *name, const kseq_t *ks, mutseq_t *hap1, mutseq_t *hap2)
{
	int i;
	for (i = 0; i != ks->seq.l; ++i) {
		int c[3];
		c[0] = nst_nt4_table[(int)ks->seq.s[i]];
		c[1] = hap1->s[i]; c[2] = hap2->s[i];
		if (c[0] >= 4) continue;
		if ((c[1] & mutmsk) != NOCHANGE || (c[2] & 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]);
						ins >>= 2;
                        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]);
						ins >>= 2;
                        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 %rdi, 0x10(%rsp)
cmpq $0x0, 0x30(%rsi)
je 0x253f
movq %rcx, %r14
movq %rsi, %r15
leaq 0xd9f(%rip), %rsi       # 0x3080
xorl %r13d, %r13d
movq %rdx, 0x8(%rsp)
movq 0x40(%r15), %rax
movsbq (%rax,%r13), %rax
movzbl (%rax,%rsi), %ebx
cmpq $0x3, %rbx
ja 0x2486
movq 0x8(%rdx), %rax
movzwl (%rax,%r13,2), %r12d
movq 0x8(%r14), %rax
movzwl (%rax,%r13,2), %ebp
cmpl $0xfff, %r12d           # imm = 0xFFF
ja 0x2329
movzwl %bp, %eax
cmpl $0x1000, %eax           # imm = 0x1000
jb 0x2486
leal 0x1(%r13), %edx
leaq 0xe4c(%rip), %rdi       # 0x3180
movq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x1090
movl %r12d, %eax
cmpw %bp, %r12w
jne 0x2386
notl %eax
testl $0xf000, %eax           # imm = 0xF000
je 0x23e5
movl %r12d, %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0xe000, %eax           # imm = 0xE000
leaq 0xe26(%rip), %rbp       # 0x3190
jne 0x23f9
movsbl (%rbx,%rbp), %esi
andl $0xf, %r12d
movsbl (%r12,%rbp), %edx
leaq 0xe03(%rip), %rdi       # 0x3187
jmp 0x23d9
andl $0xf000, %eax           # imm = 0xF000
cmpl $0xe000, %eax           # imm = 0xE000
je 0x23a6
movl %ebp, %ecx
andl $0xf000, %ecx           # imm = 0xF000
cmpl $0xe000, %ecx           # imm = 0xE000
jne 0x2452
andb $0x3, %bpl
movl $0x1, %eax
movl %ebp, %ecx
shlq %cl, %rax
leaq 0xdd5(%rip), %rcx       # 0x3190
movsbl (%rbx,%rcx), %esi
andb $0x3, %r12b
btsq %r12, %rax
leaq 0xe32(%rip), %rcx       # 0x3200
movsbl (%rax,%rcx), %edx
leaq 0xe1e(%rip), %rdi       # 0x31f7
xorl %eax, %eax
callq 0x1090
jmp 0x247a
leaq 0xda4(%rip), %rax       # 0x3190
movsbl (%rbx,%rax), %esi
leaq 0xd9f(%rip), %rdi       # 0x3196
jmp 0x2473
cmpl $0x5fff, %r12d          # imm = 0x5FFF
ja 0x254e
leaq 0xd91(%rip), %rdi       # 0x319e
xorl %eax, %eax
callq 0x1090
cmpl $0x1000, %r12d          # imm = 0x1000
jb 0x2444
movl %r12d, %ebx
shrl $0x4, %ebx
shrl $0xc, %r12d
incl %r12d
movl %ebx, %eax
andl $0x3, %eax
movsbl (%rax,%rbp), %edi
callq 0x1050
shrl $0x2, %ebx
decl %r12d
cmpl $0x1, %r12d
ja 0x242a
leaq 0x11c0(%rip), %rdi      # 0x360b
callq 0x1060
jmp 0x247a
cmpl $0xf000, %eax           # imm = 0xF000
je 0x2461
cmpl $0xf000, %ecx           # imm = 0xF000
jne 0x2498
leaq 0xd28(%rip), %rax       # 0x3190
movsbl (%rbx,%rax), %esi
leaq 0xd9e(%rip), %rdi       # 0x3211
xorl %eax, %eax
callq 0x1090
movq 0x8(%rsp), %rdx
leaq 0xbfa(%rip), %rsi       # 0x3080
incq %r13
cmpq %r13, 0x30(%r15)
jne 0x22e9
jmp 0x253f
cmpl $0x4fff, %r12d          # imm = 0x4FFF
ja 0x24e8
leaq 0xcf6(%rip), %rdi       # 0x319e
xorl %eax, %eax
callq 0x1090
cmpl $0x1000, %r12d          # imm = 0x1000
leaq 0xcd3(%rip), %rbp       # 0x3190
jb 0x2533
movl %r12d, %ebx
shrl $0x4, %ebx
shrl $0xc, %r12d
incl %r12d
movl %ebx, %eax
andl $0x3, %eax
movsbl (%rax,%rbp), %edi
callq 0x1050
shrl $0x2, %ebx
decl %r12d
cmpl $0x1, %r12d
ja 0x24cc
jmp 0x2533
cmpl $0x5fff, %ebp           # imm = 0x5FFF
ja 0x256d
movzwl %bp, %ebx
leaq 0xca4(%rip), %rdi       # 0x319e
xorl %eax, %eax
callq 0x1090
cmpl $0x1000, %ebx           # imm = 0x1000
leaq 0xc82(%rip), %r12       # 0x3190
jb 0x2533
movl %ebp, %ebx
shrl $0x4, %ebx
shrl $0xc, %ebp
incl %ebp
movl %ebx, %eax
andl $0x3, %eax
movsbl (%rax,%r12), %edi
callq 0x1050
shrl $0x2, %ebx
decl %ebp
cmpl $0x1, %ebp
ja 0x251a
leaq 0x10ce(%rip), %rdi      # 0x3608
jmp 0x244b
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xe00(%rip), %rdi       # 0x3355
leaq 0xc45(%rip), %rsi       # 0x31a1
leaq 0xc46(%rip), %rcx       # 0x31a9
movl $0xb7, %edx
callq 0x10a0
leaq 0xde1(%rip), %rdi       # 0x3355
leaq 0xc26(%rip), %rsi       # 0x31a1
leaq 0xc27(%rip), %rcx       # 0x31a9
movl $0xd1, %edx
callq 0x10a0