// File: /workspace/github_c_makefile_star2_O2/sc932[P]ALE/src/ALElike.c
// Function: realign
void realign(bam1_t *thisRead, assemblyT *theAssembly) {
	assert(realignParameters != NULL && realignParameters->scoringMatrix != NULL);
	int i;

	if ((thisRead->core.flag & BAM_FUNMAP) == BAM_FUNMAP)
		return;

	bam1_core_t *core = &thisRead->core;
	if (core->n_cigar == 1)
		return; // no need to realign such a simple match

	//fprintf(stderr, "Realigning %s %d %d\n", bam1_qname(thisRead), thisRead->core.flag, thisRead->core.pos);

	uint32_t *cigar = bam1_cigar(thisRead);
	uint32_t cigarLen = core->n_cigar;
	int32_t seqLen = core->l_qseq;

	uint8_t *seq = bam1_seq(thisRead);
	STACK_OR_MALLOC(int8_t, seqNum, seqLen);

	// translate sequence to seqNum (which is BAM 4-bit encoding)
	for(i=0; i < seqLen; i++) {
		seqNum[i] = bam1_seqi(seq, i);
	}
	s_profile *profile = ssw_init(seqNum, seqLen, realignParameters->scoringMatrix, NUM_NT_CHARACTERS, 2);
	contig_t *contig = theAssembly->contigs[ core->tid ];
	assert(contig->seqNum != NULL);

	int32_t refAlnLen = bam_calend(core, cigar) - core->pos;
	assert(refAlnLen > 0);
	int32_t maskLen = seqLen / 2;
	if (maskLen < 15)
		maskLen = 15;

	// allow left and right soft clip to re-align upto edges of reference (if there is any)
	int32_t offset = core->pos;
	if (cigarLen > 1 && bam_cigar_op(*cigar) == BAM_CSOFT_CLIP) {
		offset -= bam_cigar_oplen(*cigar);
		refAlnLen += bam_cigar_oplen(*cigar);
		if (offset < 0) {
			refAlnLen += offset; // subtract overhanging fraction
			offset = 0;
		}
		//fprintf(stderr, "extended left soft clip of %s %d pos %d to offset: %d, refAlnLen: %d\n", bam1_qname(thisRead), thisRead->core.flag, thisRead->core.pos, offset, refAlnLen);
	}
	if (cigarLen > 1 && bam_cigar_op(*(cigar + cigarLen - 1)) == BAM_CSOFT_CLIP) {
		refAlnLen += bam_cigar_oplen(*(cigar + cigarLen - 1));
		if (offset + refAlnLen > contig->seqLen) {
			refAlnLen = contig->seqLen - offset;
		}
		//fprintf(stderr, "extended right soft clip of %s %d pos %d to offset: %d refAlnLen: %d\n", bam1_qname(thisRead), thisRead->core.flag, thisRead->core.pos, offset, refAlnLen);
	}
	assert(refAlnLen + offset <= contig->seqLen);

	s_align *result = ssw_align(profile, contig->seqNum + offset, refAlnLen, realignParameters->gapOpenPenalty, realignParameters->gapExtendPenalty, 1, 0, 0, maskLen);
	init_destroy( profile );

	if (result == NULL) {
		fprintf(stderr, "Could not realign %s %d\n", bam1_qname(thisRead), thisRead->core.flag);
	} else {

		// fix softclipping (if needed)
		if (result->read_begin1 != 0 || result->read_end1 != seqLen) {
			// prepare and allocate 4 new cigar operation (all may not be needed)
			result->cigar = realloc(result->cigar, sizeof(int32_t) * (result->cigarLen + 4));
			if (result->cigar == NULL) {
				fprintf(stderr, "Could not allocate 4 more cigar operations!\n");
				abort();
			}

			// handle left side of read / ref
			if (result->read_begin1 != 0) {
				int32_t overlap = result->read_begin1;
				if (overlap > result->ref_begin1)
					overlap = result->ref_begin1;
				assert(overlap >= 0);
				uint32_t c = result->cigar[0];
				if (overlap >= realignParameters->minSoftClip || overlap == 0) {
					// prepend new softclip
					result->cigarLen += 1;
					for(i = result->cigarLen; i > 0 ; i--) {
						result->cigar[i] = result->cigar[i-1];
					}
					// softclip the entire unmapped region of the read
					result->cigar[0] = (result->read_begin1 << 4) | BAM_CSOFT_CLIP;
				} else {
					if (bam_cigar_op(c) == BAM_CMATCH || bam_cigar_op(c) == BAM_CDIFF) {
						// extend existing match/diff length: overlap + existing
						result->cigar[0] = ((bam_cigar_oplen(c) + overlap) << 4) | bam_cigar_op(c);
					} else {
						// prepend new match length: overlap
						result->cigarLen += 1;
						for(i = result->cigarLen; i > 0 ; i--) {
							result->cigar[i] = result->cigar[i-1];
						}
						result->cigar[0] = (overlap << 4) | BAM_CMATCH;
					}
					if (overlap != result->read_begin1) {
						assert(overlap < result->read_begin1);
						// prepend a new softclip (too)
						result->cigarLen += 1;
						for(i = result->cigarLen; i > 0 ; i--) {
							result->cigar[i] = result->cigar[i-1];
						}
						result->cigar[0] = ((result->read_begin1 - overlap) << 4) | BAM_CSOFT_CLIP;
					}
					// match was added or extended, adjust the alignment parameters
					result->read_begin1 -= overlap;
					result->ref_begin1 -= overlap;
				}
			}

			// handle right side of read / ref
			if (result->read_end1 != seqLen - 1) {
				int32_t oplen = seqLen - result->read_end1 - 1;
				int32_t overlap = oplen;
				if (oplen + result->ref_end1 >= refAlnLen ) {
					overlap = refAlnLen - result->ref_end1 - 1;
				}
				assert(overlap >= 0);
				//fprintf(stderr, "Right soft clip fix: oplen %d overlap %d refAlnLen %d read_end %d ref_end %d\n", oplen, overlap, refAlnLen, result->read_end1, result->ref_end1);
				uint32_t c = result->cigar[ result->cigarLen - 1 ];
				if (overlap >= realignParameters->minSoftClip || overlap == 0) {
					// append new softclip for entire remainder of the read
					result->cigar[ result->cigarLen ] = (oplen << 4) | BAM_CSOFT_CLIP;
					result->cigarLen += 1;
				} else {
					if (bam_cigar_op(c) == BAM_CMATCH || bam_cigar_op(c) == BAM_CDIFF) {
						// extend existing match/diff length: overlap + existing
						result->cigar[ result->cigarLen - 1 ] = ((overlap + bam_cigar_oplen(c)) << 4) | bam_cigar_op(c);
					} else {
						// add new match
						result->cigar[ result->cigarLen ] = (oplen << 4) | BAM_CMATCH;
						result->cigarLen += 1;
					}
					if (oplen != overlap) {
						// append a new softclip (too) for the remainder of the read after the reference ends
						assert(oplen > overlap);
						result->cigar[ result->cigarLen ] = ((oplen - overlap) << 4) | BAM_CSOFT_CLIP;
						result->cigarLen += 1;
					} else {
						assert(overlap == oplen);
					}
					// match was added or extended, adjust the alignment parameters
					result->read_end1 += overlap;
					result->ref_end1 += overlap;
				}
			}
		}

		if (result->ref_begin1 != core->pos - offset || result->cigarLen != core->n_cigar || memcmp(result->cigar, cigar, result->cigarLen) != 0) {
			// alignment has changed.  Replace with new alignment
			int printit = 0;
			if (printit) {
				int len = (result->cigarLen + core->n_cigar) * 5;
				char buf[len];
				buildCigarString(buf, cigar, thisRead->core.n_cigar);
				fprintf(stderr, "new alignment for %s %d. old %d-%d qlen %d, %s", bam1_qname(thisRead), core->flag, core->pos, bam_calend(core, cigar), bam_cigar2qlen(core, cigar), buf);

				buildCigarString(buf, result->cigar, result->cigarLen);
				fprintf(stderr, "\tnew %d, %s ", result->ref_begin1 + offset, buf);
			}
			// assign new cigar to this bam record
			int deltaCigarLen = result->cigarLen - thisRead->core.n_cigar;
			assert(thisRead->core.n_cigar + deltaCigarLen >= 1);
			int remainderLen = thisRead->data_len - ((uint8_t*) (bam1_cigar(thisRead) + thisRead->core.n_cigar) - thisRead->data);
			assert(remainderLen >= 0);
			assert(remainderLen ==  thisRead->core.l_qseq + (thisRead->core.l_qseq+1)/2 + thisRead->l_aux);
			if (deltaCigarLen > 0) {
				int deltaDatalen = deltaCigarLen*sizeof(uint32_t);
				if (thisRead->data_len + deltaDatalen > thisRead->m_data) {
					// allocate a new data and copy
					thisRead->m_data = thisRead->data_len + deltaDatalen;
					kroundup32(thisRead->m_data);
					thisRead->data = (uint8_t*) realloc(thisRead->data, thisRead->m_data);
					fprintf(stderr, "reallocated thisread to %d bytes\n", thisRead->m_data);
				}
			}
			// calculate pointers to memory that needs shifting
			cigar = bam1_cigar(thisRead);
			uint8_t *src  = (uint8_t*) (cigar + thisRead->core.n_cigar);
			uint8_t *dest = (uint8_t*) (cigar + (thisRead->core.n_cigar + deltaCigarLen));

			// shift right or left seq, qual, aux
			memmove(dest, src, remainderLen);
			// replace cigar
			memcpy(bam1_cigar(thisRead), result->cigar, result->cigarLen * sizeof(uint32_t));
			// change data_len
			thisRead->data_len += deltaCigarLen * sizeof(uint32_t);
			// change alignment parameters
			thisRead->core.n_cigar = result->cigarLen;
			thisRead->core.pos = result->ref_begin1 + offset;
			bam_fillmd1_core_ALE(thisRead, contig->seq);
			cigar = bam1_cigar(thisRead);
			if (printit) {
				fprintf(stderr, "new pos %d endcoord %d qlen: %d\n", thisRead->core.pos, bam_calend(&thisRead->core, cigar), bam_cigar2qlen(&thisRead->core, cigar));
			}
		}
		align_destroy( result );
	}
	STACK_OR_FREE(seqNum);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq 0x219ea(%rip), %rax     # 0x29a48
testq %rax, %rax
je 0x860d
cmpq $0x0, (%rax)
je 0x860d
movq 0x8(%rdi), %r12
btq $0x22, %r12
jb 0x856b
movq %r12, %r13
shrq $0x30, %r13
cmpq $0x1, %r13
je 0x856b
movq %rsi, %r14
movq %rsp, -0x60(%rbp)
movl %r12d, %eax
shrl $0x18, %eax
addq 0x30(%rdi), %rax
movq %rax, -0x30(%rbp)
movq %rdi, -0x48(%rbp)
movslq 0x10(%rdi), %rsi
xorl %ebx, %ebx
cmpq $0x401, %rsi            # imm = 0x401
movl %esi, %eax
cmovael %ebx, %eax
addq $0xf, %rax
andq $-0x10, %rax
movq %rsp, %r15
subq %rax, %r15
movq %r15, %rsp
cmpq $0x401, %rsi            # imm = 0x401
movq %rsi, -0x40(%rbp)
jb 0x80e9
movq %rsi, %rdi
callq 0x3420
movq -0x40(%rbp), %rsi
movq %rax, %r15
movq -0x30(%rbp), %rax
leaq (%rax,%r13,4), %rax
testl %esi, %esi
movl $0x0, %edx
cmovgl %esi, %edx
xorl %r8d, %r8d
cmpq %r8, %rdx
je 0x8126
movl %r8d, %ecx
shrl %ecx
movb (%rax,%rcx), %dil
movl %ebx, %ecx
notb %cl
andb $0x4, %cl
shrb %cl, %dil
andb $0xf, %dil
movb %dil, (%r15,%r8)
incq %r8
addb $0x4, %bl
jmp 0x80fe
movq 0x2191b(%rip), %rax     # 0x29a48
movq (%rax), %rdx
pushq $0x10
popq %rcx
pushq $0x2
popq %r8
movq %r15, %rdi
callq 0xafd4
movq %rax, -0x38(%rbp)
movq 0xa0(%r14), %rax
movq -0x48(%rbp), %rbx
movslq (%rbx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, 0x18(%rax)
je 0x862c
movq %rbx, %rdi
movq -0x30(%rbp), %rsi
callq 0xd54c
movl %eax, %ecx
movl 0x4(%rbx), %eax
movl %ecx, %r14d
subl %eax, %r14d
testl %r14d, %r14d
jle 0x864b
movq %rax, %rsi
movabsq $0xffffffffffff, %rdi   # imm = 0xFFFFFFFFFFFF
movq -0x40(%rbp), %rax
cltd
pushq $0x2
popq %r8
idivl %r8d
cmpl $0x10, %eax
pushq $0xf
popq %r10
cmovgel %eax, %r10d
leaq 0x1(%rdi), %rax
cmpq %rax, %r12
jae 0x81b7
movq -0x50(%rbp), %rdi
jmp 0x820d
movq -0x30(%rbp), %rax
movl (%rax), %eax
movl %eax, %edx
andl $0xf, %edx
cmpl $0x4, %edx
movq -0x50(%rbp), %rdi
jne 0x81e2
shrl $0x4, %eax
subl %eax, %esi
addl %r14d, %eax
xorl %edx, %edx
testl %esi, %esi
cmovgl %esi, %edx
cmovsl %ecx, %eax
movl %edx, %esi
movl %eax, %r14d
movq -0x30(%rbp), %rax
movl -0x4(%rax,%r13,4), %eax
movl %eax, %ecx
andl $0xf, %ecx
cmpl $0x4, %ecx
jne 0x820d
shrl $0x4, %eax
addl %r14d, %eax
leal (%rax,%rsi), %ecx
movl 0x8(%rdi), %edx
movl %edx, %r14d
subl %esi, %r14d
cmpl %edx, %ecx
cmovlel %eax, %r14d
leal (%r14,%rsi), %eax
cmpl 0x8(%rdi), %eax
jg 0x866a
movq %rbx, %r12
movq %rsi, -0x58(%rbp)
movslq %esi, %rsi
addq 0x18(%rdi), %rsi
movq 0x21819(%rip), %rax     # 0x29a48
movzbl 0xa(%rax), %ecx
movzbl 0xb(%rax), %r8d
subq $0x8, %rsp
pushq $0x1
popq %r9
movq -0x38(%rbp), %rbx
movq %rbx, %rdi
movl %r14d, %edx
pushq %r10
pushq $0x0
pushq $0x0
callq 0xb215
addq $0x20, %rsp
movq %rax, %r13
movq %rbx, %rdi
callq 0xb1f7
testq %r13, %r13
je 0x857a
cmpl $0x0, 0xc(%r13)
movq -0x40(%rbp), %rax
movq %r12, %rbx
jne 0x8285
cmpl %eax, 0x10(%r13)
je 0x8412
movq 0x18(%r13), %rdi
movslq 0x20(%r13), %rax
leaq 0x10(,%rax,4), %rsi
callq 0x3480
movq %rax, 0x18(%r13)
testq %rax, %rax
je 0x86e6
leaq 0x20(%r13), %rcx
movl 0xc(%r13), %esi
testl %esi, %esi
movq -0x40(%rbp), %r8
je 0x836f
movl 0x4(%r13), %edx
cmpl %edx, %esi
cmovll %esi, %edx
testl %edx, %edx
js 0x8707
je 0x82ee
movq 0x21773(%rip), %rsi     # 0x29a48
movsbl 0xc(%rsi), %esi
cmpl %esi, %edx
jge 0x82ee
movl (%rax), %esi
testb $0x7, %sil
jne 0x8312
movl %edx, %edi
shll $0x4, %edi
addl %edi, %esi
jmp 0x832d
movl (%rcx), %edx
incl %edx
movl %edx, (%rcx)
testl %edx, %edx
jle 0x8304
movl -0x4(%rax,%rdx,4), %esi
movl %esi, (%rax,%rdx,4)
decq %rdx
jmp 0x82f4
movl 0xc(%r13), %edx
shll $0x4, %edx
orl $0x4, %edx
movl %edx, (%rax)
jmp 0x836f
movl (%rcx), %esi
incl %esi
movl %esi, (%rcx)
testl %esi, %esi
jle 0x8328
movl -0x4(%rax,%rsi,4), %edi
movl %edi, (%rax,%rsi,4)
decq %rsi
jmp 0x8318
movl %edx, %esi
shll $0x4, %esi
movl %esi, (%rax)
movl %edx, %esi
cmpl 0xc(%r13), %edx
je 0x8365
jge 0x8745
movl (%rcx), %esi
incl %esi
movl %esi, (%rcx)
testl %esi, %esi
jle 0x8353
movl -0x4(%rax,%rsi,4), %edi
movl %edi, (%rax,%rsi,4)
decq %rsi
jmp 0x8343
movl 0xc(%r13), %esi
subl %edx, %esi
shll $0x4, %esi
orl $0x4, %esi
movl %esi, (%rax)
movl 0xc(%r13), %esi
subl %edx, %esi
movl %esi, 0xc(%r13)
subl %edx, 0x4(%r13)
movl 0x10(%r13), %edx
leal -0x1(%r8), %esi
cmpl %esi, %edx
je 0x8412
notl %edx
addl %r8d, %edx
movl 0x8(%r13), %esi
leal (%rsi,%rdx), %edi
notl %esi
addl %r14d, %esi
cmpl %r14d, %edi
cmovll %edx, %esi
testl %esi, %esi
js 0x8726
movslq (%rcx), %rdi
je 0x83d0
movq 0x2169e(%rip), %r8      # 0x29a48
movsbl 0xc(%r8), %r8d
cmpl %r8d, %esi
jge 0x83d0
movl -0x4(%rax,%rdi,4), %r8d
testb $0x7, %r8b
jne 0x83de
movl %esi, %r9d
shll $0x4, %r9d
addl %r9d, %r8d
movl %r8d, -0x4(%rax,%rdi,4)
jmp 0x83eb
shll $0x4, %edx
orl $0x4, %edx
movl %edx, (%rax,%rdi,4)
pushq $0x1
popq %rax
jmp 0x8410
movl %edx, %r8d
shll $0x4, %r8d
movl %r8d, (%rax,%rdi,4)
incl (%rcx)
subl %esi, %edx
je 0x8403
jle 0x8764
shll $0x4, %edx
orl $0x4, %edx
movslq (%rcx), %rdi
movl %edx, (%rax,%rdi,4)
incl (%rcx)
movq %r13, %rcx
addq $0x8, %rcx
addl %esi, 0x10(%r13)
movl %esi, %eax
addl %eax, (%rcx)
movl 0x4(%rbx), %eax
subl -0x58(%rbp), %eax
movl 0x20(%r13), %r14d
movq %r13, -0x38(%rbp)
cmpl %eax, 0x4(%r13)
jne 0x8453
movq 0x8(%rbx), %r13
movq %r13, %r12
shrq $0x30, %r12
cmpl %r12d, %r14d
jne 0x845e
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
movq %r14, %rdx
callq 0x3460
testl %eax, %eax
jne 0x845e
jmp 0x854d
movq 0x8(%rbx), %r13
movq %r13, %r12
shrq $0x30, %r12
testl %r14d, %r14d
jle 0x8689
movl 0x24(%rbx), %ecx
movq 0x30(%rbx), %rdi
shrl $0x18, %r13d
leal (%rdi,%r13), %eax
leal (%rax,%r12,4), %eax
movq %rbx, %r8
movl %edi, %ebx
subl %eax, %ebx
addl %ecx, %ebx
js 0x86a8
movl 0x10(%r8), %esi
leal 0x1(%rsi), %eax
cltd
pushq $0x2
popq %r9
idivl %r9d
addl 0x20(%r8), %esi
addl %eax, %esi
cmpl %esi, %ebx
jne 0x86c7
subl %r12d, %r14d
leal (,%r14,4), %eax
testl %r14d, %r14d
movl %eax, -0x30(%rbp)
jle 0x84c8
addl %eax, %ecx
movq -0x48(%rbp), %rax
cmpl 0x28(%rax), %ecx
jg 0x859f
addq %rdi, %r13
leaq (,%r12,4), %rsi
addq %r13, %rsi
addl %r12d, %r14d
movslq %r14d, %rax
leaq (,%rax,4), %rdi
addq %r13, %rdi
movl %ebx, %edx
callq 0x34d0
movq -0x48(%rbp), %rbx
movzbl 0xb(%rbx), %edi
addq 0x30(%rbx), %rdi
movq -0x38(%rbp), %r14
movq 0x18(%r14), %rsi
movslq 0x20(%r14), %rdx
shlq $0x2, %rdx
callq 0x33b0
movl -0x30(%rbp), %eax
addl %eax, 0x24(%rbx)
movl 0x20(%r14), %eax
shlq $0x30, %rax
movabsq $0xffffffffffff, %rcx   # imm = 0xFFFFFFFFFFFF
andq 0x8(%rbx), %rcx
orq %rax, %rcx
movq %rcx, 0x8(%rbx)
movq -0x58(%rbp), %rax
addl 0x4(%r14), %eax
movl %eax, 0x4(%rbx)
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rsi
movq %rbx, %rdi
callq 0x185d0
movq -0x38(%rbp), %rdi
callq 0xc57d
cmpl $0x401, -0x40(%rbp)     # imm = 0x401
jb 0x8567
movq %r15, %rdi
callq 0x3070
movq -0x60(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20a77(%rip), %rax     # 0x28ff8
movq (%rax), %rdi
movq 0x30(%r12), %rdx
movzwl 0xc(%r12), %ecx
leaq 0x1697a(%rip), %rsi     # 0x1ef10
xorl %eax, %eax
callq 0x3350
jmp 0x8556
decl %ecx
movl %ecx, %eax
sarl %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x2, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x4, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x8, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x10, %eax
orl %ecx, %eax
incl %eax
movq -0x48(%rbp), %r13
movl %eax, 0x28(%r13)
movslq %eax, %rsi
callq 0x3480
movq %rax, 0x30(%r13)
movq 0x20a18(%rip), %rax     # 0x28ff8
movq (%rax), %rdi
movl 0x28(%r13), %edx
leaq 0x16a37(%rip), %rsi     # 0x1f025
xorl %eax, %eax
callq 0x3350
movq 0x8(%r13), %r12
movq 0x30(%r13), %rdi
movl %r12d, %r13d
shrl $0x18, %r13d
shrq $0x30, %r12
jmp 0x84c8
leaq 0x16848(%rip), %rdi     # 0x1ee5c
leaq 0x1571a(%rip), %rsi     # 0x1dd35
leaq 0x16880(%rip), %rcx     # 0x1eea2
movl $0x966, %edx            # imm = 0x966
callq 0x3230
leaq 0x16893(%rip), %rdi     # 0x1eec6
leaq 0x156fb(%rip), %rsi     # 0x1dd35
leaq 0x16861(%rip), %rcx     # 0x1eea2
movl $0x97f, %edx            # imm = 0x97F
callq 0x3230
leaq 0x1688b(%rip), %rdi     # 0x1eedd
leaq 0x156dc(%rip), %rsi     # 0x1dd35
leaq 0x16842(%rip), %rcx     # 0x1eea2
movl $0x982, %edx            # imm = 0x982
callq 0x3230
leaq 0x1687a(%rip), %rdi     # 0x1eeeb
leaq 0x156bd(%rip), %rsi     # 0x1dd35
leaq 0x16823(%rip), %rcx     # 0x1eea2
movl $0x999, %edx            # imm = 0x999
callq 0x3230
leaq 0x16901(%rip), %rdi     # 0x1ef91
leaq 0x1569e(%rip), %rsi     # 0x1dd35
leaq 0x16804(%rip), %rcx     # 0x1eea2
movl $0xa09, %edx            # imm = 0xA09
callq 0x3230
leaq 0x1690e(%rip), %rdi     # 0x1efbd
leaq 0x1567f(%rip), %rsi     # 0x1dd35
leaq 0x167e5(%rip), %rcx     # 0x1eea2
movl $0xa0b, %edx            # imm = 0xA0B
callq 0x3230
leaq 0x16901(%rip), %rdi     # 0x1efcf
leaq 0x15660(%rip), %rsi     # 0x1dd35
leaq 0x167c6(%rip), %rcx     # 0x1eea2
movl $0xa0c, %edx            # imm = 0xA0C
callq 0x3230
movq 0x2090b(%rip), %rax     # 0x28ff8
movq (%rax), %rcx
leaq 0x16832(%rip), %rdi     # 0x1ef29
pushq $0x2c
popq %rsi
pushq $0x1
popq %rdx
callq 0x35e0
callq 0x30a0
leaq 0x16848(%rip), %rdi     # 0x1ef56
leaq 0x15620(%rip), %rsi     # 0x1dd35
leaq 0x16786(%rip), %rcx     # 0x1eea2
movl $0x9b0, %edx            # imm = 0x9B0
callq 0x3230
leaq 0x16829(%rip), %rdi     # 0x1ef56
leaq 0x15601(%rip), %rsi     # 0x1dd35
leaq 0x16767(%rip), %rcx     # 0x1eea2
movl $0x9dc, %edx            # imm = 0x9DC
callq 0x3230
leaq 0x16817(%rip), %rdi     # 0x1ef63
leaq 0x155e2(%rip), %rsi     # 0x1dd35
leaq 0x16748(%rip), %rcx     # 0x1eea2
movl $0x9c7, %edx            # imm = 0x9C7
callq 0x3230
leaq 0x16816(%rip), %rdi     # 0x1ef81
leaq 0x155c3(%rip), %rsi     # 0x1dd35
leaq 0x16729(%rip), %rcx     # 0x1eea2
movl $0x9ee, %edx            # imm = 0x9EE
callq 0x3230