// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/cram/cram_encode.c
// Function: cram_add_substitution
static int cram_add_substitution(cram_fd *fd, cram_container *c,
				 cram_slice *s, cram_record *r,
				 int pos, char base, char qual, char ref) {
    cram_feature f;

    // seq=ACGTN vs ref=ACGT or seq=ACGT vs ref=ACGTN
    if (fd->L2[(uc)base]<4 || (fd->L2[(uc)base]<5 && fd->L2[(uc)ref]<4)) {
	f.X.pos = pos+1;
	f.X.code = 'X';
	f.X.base = fd->cram_sub_matrix[ref&0x1f][base&0x1f];
	cram_stats_add(c->stats[DS_BS], f.X.base);
    } else {
	f.B.pos = pos+1;
	f.B.code = 'B';
	f.B.base = base;
	f.B.qual = qual;
	cram_stats_add(c->stats[DS_BA], f.B.base);
	cram_stats_add(c->stats[DS_QS], f.B.qual);
	BLOCK_APPEND_CHAR(s->qual_blk, qual);
    }
    return cram_add_feature(c, s, r, &f);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %r9b, %al
movb 0x18(%rbp), %r9b
movb 0x10(%rbp), %r9b
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movb %al, -0x25(%rbp)
movq -0x8(%rbp), %rax
movzbl -0x25(%rbp), %ecx
movzbl 0x8334(%rax,%rcx), %eax
cmpl $0x4, %eax
jl 0xc8ae9
movq -0x8(%rbp), %rax
movzbl -0x25(%rbp), %ecx
movzbl 0x8334(%rax,%rcx), %eax
cmpl $0x5, %eax
jge 0xc8b3d
movq -0x8(%rbp), %rax
movzbl 0x18(%rbp), %ecx
movzbl 0x8334(%rax,%rcx), %eax
cmpl $0x4, %eax
jge 0xc8b3d
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movl $0x58, -0x34(%rbp)
movq -0x8(%rbp), %rax
addq $0x8434, %rax           # imm = 0x8434
movsbl 0x18(%rbp), %ecx
andl $0x1f, %ecx
movslq %ecx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movsbl -0x25(%rbp), %ecx
andl $0x1f, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x1b8(%rax), %rdi
movl -0x30(%rbp), %esi
callq 0x8c870
jmp 0xc8c9f
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movl $0x42, -0x34(%rbp)
movsbl -0x25(%rbp), %eax
movl %eax, -0x30(%rbp)
movsbl 0x10(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq 0x1b0(%rax), %rdi
movl -0x30(%rbp), %esi
callq 0x8c870
movq -0x10(%rbp), %rax
movq 0x120(%rax), %rdi
movl -0x2c(%rbp), %esi
callq 0x8c870
jmp 0xc8b83
jmp 0xc8b85
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x70(%rcx), %rcx
movq 0x30(%rcx), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
ja 0xc8c72
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
cmpq $0x0, 0x28(%rax)
je 0xc8bfb
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
movq 0x28(%rax), %xmm0
movaps 0xd453(%rip), %xmm1     # 0xd6020
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0xd457(%rip), %xmm1     # 0xd6030
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x11a80(%rip), %xmm1    # 0xda670
mulsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
jmp 0xc8c0a
movsd 0x19fb5(%rip), %xmm0    # 0xe2bb8
movsd %xmm0, -0x40(%rbp)
jmp 0xc8c0a
movsd -0x40(%rbp), %xmm0
movsd 0x19441(%rip), %xmm2    # 0xe2058
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
andq %rdx, %rax
orq %rax, %rcx
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
movq %rcx, 0x28(%rax)
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
movq 0x20(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
movq 0x28(%rax), %rsi
callq 0x6c80
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
movq %rcx, 0x20(%rax)
jmp 0xc8b85
jmp 0xc8c74
movb 0x10(%rbp), %dl
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
movq 0x20(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x70(%rcx), %rsi
movq 0x30(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x30(%rsi)
movb %dl, (%rax,%rcx)
jmp 0xc8c9f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x38(%rbp), %rcx
callq 0xca800
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)