// File: /workspace/github_c_makefile_star2_O3/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 0x22899(%rip), %rax     # 0x2ca48
testq %rax, %rax
je 0xa75e
cmpq $0x0, (%rax)
je 0xa75e
movq %rdi, %r15
movq 0x8(%rdi), %r13
btq $0x22, %r13
jb 0xa6d2
movq %r13, %rbx
shrq $0x30, %rbx
cmpq $0x1, %rbx
je 0xa6d2
movq %rsi, %r12
movl %r13d, %eax
shrl $0x18, %eax
addq 0x30(%r15), %rax
movq %rax, -0x30(%rbp)
movq %rsp, -0x60(%rbp)
movslq 0x10(%r15), %r14
xorl %eax, %eax
cmpq $0x401, %r14            # imm = 0x401
cmovbl %r14d, %eax
addq $0xf, %rax
andq $-0x10, %rax
movq %rsp, %rdi
subq %rax, %rdi
movq %rdi, %rsp
cmpq $0x401, %r14            # imm = 0x401
jb 0xa230
movq %r14, %rdi
callq 0x3420
movq %rax, %rdi
testl %r14d, %r14d
jle 0xa266
movq -0x30(%rbp), %rax
leaq (%rax,%rbx,4), %rax
xorl %edx, %edx
xorl %esi, %esi
movl %esi, %ecx
shrl %ecx
movb (%rax,%rcx), %r8b
movl %edx, %ecx
notb %cl
andb $0x4, %cl
shrb %cl, %r8b
andb $0xf, %r8b
movb %r8b, (%rdi,%rsi)
incq %rsi
addb $0x4, %dl
cmpq %rsi, %r14
jne 0xa241
movq 0x227db(%rip), %rax     # 0x2ca48
movq (%rax), %rdx
movq %rdi, -0x58(%rbp)
movl %r14d, %esi
movl $0x10, %ecx
movl $0x2, %r8d
callq 0xd4d4
movq %rax, -0x40(%rbp)
movq 0xa0(%r12), %rax
movslq (%r15), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, 0x18(%rax)
je 0xa77d
movq %r15, %rdi
movq -0x30(%rbp), %rsi
callq 0xf6d8
movl 0x4(%r15), %ecx
movl %eax, %r12d
subl %ecx, %r12d
testl %r12d, %r12d
jle 0xa79c
movq %rcx, %rsi
movabsq $0xffffffffffff, %rdx   # imm = 0xFFFFFFFFFFFF
movl %r14d, %ecx
shrl $0x1f, %ecx
addl %r14d, %ecx
sarl %ecx
cmpl $0x10, %ecx
movl $0xf, %r10d
cmovgel %ecx, %r10d
leaq 0x1(%rdx), %rcx
cmpq %rcx, %r13
jb 0xa34d
movq -0x30(%rbp), %rcx
movl (%rcx), %ecx
movl %ecx, %edx
andl $0xf, %edx
cmpl $0x4, %edx
jne 0xa31d
shrl $0x4, %ecx
subl %ecx, %esi
addl %r12d, %ecx
xorl %edx, %edx
testl %esi, %esi
cmovgl %esi, %edx
cmovsl %eax, %ecx
movl %edx, %esi
movl %ecx, %r12d
movq -0x30(%rbp), %rax
movl -0x4(%rax,%rbx,4), %eax
movl %eax, %ecx
andl $0xf, %ecx
cmpl $0x4, %ecx
jne 0xa34d
shrl $0x4, %eax
addl %r12d, %eax
leal (%rax,%rsi), %ecx
movq -0x48(%rbp), %rdi
movl 0x8(%rdi), %edx
movl %edx, %r12d
subl %esi, %r12d
cmpl %edx, %ecx
cmovlel %eax, %r12d
jmp 0xa351
movq -0x48(%rbp), %rdi
leal (%r12,%rsi), %eax
cmpl 0x8(%rdi), %eax
jg 0xa7bb
movq %rsi, -0x50(%rbp)
movslq %esi, %rsi
addq 0x18(%rdi), %rsi
leaq 0x8(%r15), %rax
movq %rax, -0x38(%rbp)
movq 0x226d0(%rip), %rax     # 0x2ca48
movzbl 0xa(%rax), %ecx
movzbl 0xb(%rax), %r8d
subq $0x8, %rsp
xorl %eax, %eax
movq -0x40(%rbp), %r13
movq %r13, %rdi
movl %r12d, %edx
movl $0x1, %r9d
pushq %r10
pushq %rax
pushq %rax
callq 0xd5b6
addq $0x20, %rsp
movq %rax, %rbx
movq %r13, %rdi
callq 0xd598
testq %rbx, %rbx
je 0xa6e1
cmpl $0x0, 0xc(%rbx)
jne 0xa3c8
cmpl %r14d, 0x10(%rbx)
je 0xa579
movq 0x18(%rbx), %rdi
movslq 0x20(%rbx), %rax
leaq 0x10(,%rax,4), %rsi
callq 0x3480
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0xa837
leaq 0x20(%rbx), %rcx
movl 0xc(%rbx), %esi
testl %esi, %esi
je 0xa4d9
movl 0x4(%rbx), %edx
cmpl %edx, %esi
cmovll %esi, %edx
testl %edx, %edx
js 0xa83c
je 0xa42b
movq 0x22636(%rip), %rdi     # 0x2ca48
movsbl 0xc(%rdi), %edi
cmpl %edi, %edx
jge 0xa42b
movl (%rax), %esi
testb $0x7, %sil
jne 0xa45c
movl %edx, %edi
shll $0x4, %edi
addl %edi, %esi
jmp 0xa487
movl (%rcx), %edx
leal 0x1(%rdx), %edi
movl %edi, (%rcx)
testl %edx, %edx
js 0xa452
movl %edi, %esi
addl $0x2, %edx
leaq (%rax,%rsi,4), %rsi
movl -0x4(%rsi), %edi
movl %edi, (%rsi)
addq $-0x4, %rsi
decl %edx
cmpl $0x1, %edx
jg 0xa43f
movl 0xc(%rbx), %esi
shll $0x4, %esi
orl $0x4, %esi
movl %esi, (%rax)
jmp 0xa4d9
movl (%rcx), %esi
leal 0x1(%rsi), %edi
movl %edi, (%rcx)
testl %esi, %esi
js 0xa482
movl %edi, %edi
addl $0x2, %esi
leaq (%rax,%rdi,4), %rdi
movl -0x4(%rdi), %r8d
movl %r8d, (%rdi)
addq $-0x4, %rdi
decl %esi
cmpl $0x1, %esi
jg 0xa470
movl %edx, %esi
shll $0x4, %esi
movl %esi, (%rax)
movl 0xc(%rbx), %edi
movl %edx, %esi
cmpl %edi, %edx
je 0xa4d1
jge 0xa87a
movl (%rcx), %esi
leal 0x1(%rsi), %r8d
movl %r8d, (%rcx)
testl %esi, %esi
js 0xa4c4
movl %r8d, %edi
addl $0x2, %esi
leaq (%rax,%rdi,4), %rdi
movl -0x4(%rdi), %r8d
movl %r8d, (%rdi)
addq $-0x4, %rdi
decl %esi
cmpl $0x1, %esi
jg 0xa4af
movl 0xc(%rbx), %edi
subl %edx, %edi
shll $0x4, %edi
orl $0x4, %edi
movl %edi, (%rax)
movl 0xc(%rbx), %esi
subl %edx, %esi
movl %esi, 0xc(%rbx)
subl %edx, 0x4(%rbx)
movl 0x10(%rbx), %edx
leal -0x1(%r14), %esi
cmpl %esi, %edx
je 0xa579
notl %edx
addl %r14d, %edx
movl 0x8(%rbx), %esi
leal (%rsi,%rdx), %edi
notl %esi
addl %r12d, %esi
cmpl %r12d, %edi
cmovll %edx, %esi
testl %esi, %esi
js 0xa85b
movslq (%rcx), %rdi
je 0xa538
movq 0x22536(%rip), %r8      # 0x2ca48
movsbl 0xc(%r8), %r8d
cmpl %r8d, %esi
jge 0xa538
movl -0x4(%rax,%rdi,4), %r8d
testb $0x7, %r8b
jne 0xa548
movl %esi, %r9d
shll $0x4, %r9d
addl %r9d, %r8d
movl %r8d, -0x4(%rax,%rdi,4)
jmp 0xa555
shll $0x4, %edx
orl $0x4, %edx
movl %edx, (%rax,%rdi,4)
movl $0x1, %esi
jmp 0xa577
movl %edx, %r8d
shll $0x4, %r8d
movl %r8d, (%rax,%rdi,4)
incl (%rcx)
subl %esi, %edx
je 0xa56d
jle 0xa899
shll $0x4, %edx
orl $0x4, %edx
movslq (%rcx), %rdi
movl %edx, (%rax,%rdi,4)
incl (%rcx)
movq %rbx, %rcx
addq $0x8, %rcx
addl %esi, 0x10(%rbx)
addl %esi, (%rcx)
movl 0x4(%r15), %eax
subl -0x50(%rbp), %eax
movl 0x20(%rbx), %r12d
movq %rbx, -0x40(%rbp)
cmpl %eax, 0x4(%rbx)
jne 0xa5bd
movq -0x38(%rbp), %rax
movq (%rax), %rbx
movq %rbx, %r13
shrq $0x30, %r13
cmpl %r13d, %r12d
jne 0xa5cb
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
movq %r12, %rdx
callq 0x3460
testl %eax, %eax
jne 0xa5cb
jmp 0xa6b3
movq -0x38(%rbp), %rax
movq (%rax), %rbx
movq %rbx, %r13
shrq $0x30, %r13
testl %r12d, %r12d
jle 0xa7da
movl 0x24(%r15), %eax
movq 0x30(%r15), %rdi
shrl $0x18, %ebx
leal (%rdi,%rbx), %ecx
leal (%rcx,%r13,4), %ecx
movq %r15, %rsi
movl %edi, %r15d
subl %ecx, %r15d
addl %eax, %r15d
js 0xa7f9
movl 0x10(%rsi), %ecx
leal 0x1(%rcx), %edx
shrl $0x1f, %edx
addl %ecx, %edx
incl %edx
sarl %edx
movq %rsi, -0x30(%rbp)
addl 0x20(%rsi), %ecx
addl %edx, %ecx
cmpl %ecx, %r15d
jne 0xa818
subl %r13d, %r12d
leal (,%r12,4), %ecx
testl %r12d, %r12d
movl %ecx, -0x38(%rbp)
jle 0xa63b
addl %ecx, %eax
movq -0x30(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jg 0xa6f3
addq %rdi, %rbx
leaq (%rbx,%r13,4), %rsi
addl %r13d, %r12d
movslq %r12d, %rax
leaq (%rbx,%rax,4), %rdi
movl %r15d, %edx
callq 0x34d0
movq -0x30(%rbp), %rbx
movzbl 0xb(%rbx), %edi
addq 0x30(%rbx), %rdi
movq -0x40(%rbp), %r15
movq 0x18(%r15), %rsi
movslq 0x20(%r15), %rdx
shlq $0x2, %rdx
callq 0x33b0
movl -0x38(%rbp), %eax
addl %eax, 0x24(%rbx)
movl 0x20(%r15), %eax
shlq $0x30, %rax
movabsq $0xffffffffffff, %rcx   # imm = 0xFFFFFFFFFFFF
andq 0x8(%rbx), %rcx
orq %rax, %rcx
movq %rcx, 0x8(%rbx)
movq -0x50(%rbp), %rax
addl 0x4(%r15), %eax
movl %eax, 0x4(%rbx)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rsi
movq %rbx, %rdi
callq 0x1c640
movq -0x40(%rbp), %rdi
callq 0xe1ec
cmpl $0x401, %r14d           # imm = 0x401
movq -0x58(%rbp), %rdi
jb 0xa6ce
callq 0x3070
movq -0x60(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x30, %r15
movq %r15, %rdi
movq -0x38(%rbp), %rsi
callq 0x37dd
jmp 0xa6bc
decl %eax
movl %eax, %ecx
sarl %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x8, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x10, %ecx
orl %eax, %ecx
incl %ecx
movq -0x30(%rbp), %rbx
movl %ecx, 0x28(%rbx)
movslq %ecx, %rsi
callq 0x3480
movq %rax, 0x30(%rbx)
movq 0x218c5(%rip), %rax     # 0x2bff8
movq (%rax), %rdi
movl 0x28(%rbx), %edx
leaq 0x18915(%rip), %rsi     # 0x23055
xorl %eax, %eax
callq 0x3350
movq 0x8(%rbx), %r13
movq 0x30(%rbx), %rdi
movl %r13d, %ebx
shrl $0x18, %ebx
shrq $0x30, %r13
jmp 0xa63b
leaq 0x18727(%rip), %rdi     # 0x22e8c
leaq 0x175f9(%rip), %rsi     # 0x21d65
leaq 0x1875f(%rip), %rcx     # 0x22ed2
movl $0x966, %edx            # imm = 0x966
callq 0x3230
leaq 0x18772(%rip), %rdi     # 0x22ef6
leaq 0x175da(%rip), %rsi     # 0x21d65
leaq 0x18740(%rip), %rcx     # 0x22ed2
movl $0x97f, %edx            # imm = 0x97F
callq 0x3230
leaq 0x1876a(%rip), %rdi     # 0x22f0d
leaq 0x175bb(%rip), %rsi     # 0x21d65
leaq 0x18721(%rip), %rcx     # 0x22ed2
movl $0x982, %edx            # imm = 0x982
callq 0x3230
leaq 0x18759(%rip), %rdi     # 0x22f1b
leaq 0x1759c(%rip), %rsi     # 0x21d65
leaq 0x18702(%rip), %rcx     # 0x22ed2
movl $0x999, %edx            # imm = 0x999
callq 0x3230
leaq 0x187e0(%rip), %rdi     # 0x22fc1
leaq 0x1757d(%rip), %rsi     # 0x21d65
leaq 0x186e3(%rip), %rcx     # 0x22ed2
movl $0xa09, %edx            # imm = 0xA09
callq 0x3230
leaq 0x187ed(%rip), %rdi     # 0x22fed
leaq 0x1755e(%rip), %rsi     # 0x21d65
leaq 0x186c4(%rip), %rcx     # 0x22ed2
movl $0xa0b, %edx            # imm = 0xA0B
callq 0x3230
leaq 0x187e0(%rip), %rdi     # 0x22fff
leaq 0x1753f(%rip), %rsi     # 0x21d65
leaq 0x186a5(%rip), %rcx     # 0x22ed2
movl $0xa0c, %edx            # imm = 0xA0C
callq 0x3230
callq 0x37bb
leaq 0x18743(%rip), %rdi     # 0x22f86
leaq 0x1751b(%rip), %rsi     # 0x21d65
leaq 0x18681(%rip), %rcx     # 0x22ed2
movl $0x9b0, %edx            # imm = 0x9B0
callq 0x3230
leaq 0x18724(%rip), %rdi     # 0x22f86
leaq 0x174fc(%rip), %rsi     # 0x21d65
leaq 0x18662(%rip), %rcx     # 0x22ed2
movl $0x9dc, %edx            # imm = 0x9DC
callq 0x3230
leaq 0x18712(%rip), %rdi     # 0x22f93
leaq 0x174dd(%rip), %rsi     # 0x21d65
leaq 0x18643(%rip), %rcx     # 0x22ed2
movl $0x9c7, %edx            # imm = 0x9C7
callq 0x3230
leaq 0x18711(%rip), %rdi     # 0x22fb1
leaq 0x174be(%rip), %rsi     # 0x21d65
leaq 0x18624(%rip), %rcx     # 0x22ed2
movl $0x9ee, %edx            # imm = 0x9EE
callq 0x3230