// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/contrib/ssw/ssw.c
// Function: ssw_align
s_align* ssw_align (const s_profile* prof,
					const int8_t* ref,
				  	int32_t refLen,
				  	const uint8_t weight_gapO,
				  	const uint8_t weight_gapE,
					const uint8_t flag,	/*  (from high to low) bit 5: return the best alignment beginning position; 6: if (ref_end1 - ref_begin1 <= filterd) && (read_end1 - read_begin1 <= filterd), return cigar; 7: if max score >= filters, return cigar; 8: always return cigar; if 6 & 7 are both setted, only return cigar when both filter fulfilled */
					const uint16_t filters,
					const int32_t filterd,
					const int32_t maskLen) {

	alignment_end* bests = 0, *bests_reverse = 0;
	__m128i* vP = 0;
	int32_t word = 0, band_width = 0, readLen = prof->readLen;
	int8_t* read_reverse = 0;
	cigar* path;
	s_align* r = (s_align*)calloc(1, sizeof(s_align));
	r->ref_begin1 = -1;
	r->read_begin1 = -1;
	r->cigar = 0;
	r->cigarLen = 0;
	if (maskLen < 15) {
		fprintf(stderr, "When maskLen < 15, the function ssw_align doesn't return 2nd best alignment information.\n");
	}

	// Find the alignment scores and ending positions
	if (prof->profile_byte) {
		bests = sw_sse2_byte(ref, 0, refLen, readLen, weight_gapO, weight_gapE, prof->profile_byte, -1, prof->bias, maskLen);
		if (prof->profile_word && bests[0].score == 255) {
            r->saturated = 1;
			free(bests);
			bests = sw_sse2_word(ref, 0, refLen, readLen, weight_gapO, weight_gapE, prof->profile_word, -1, maskLen);
			word = 1;
		} else if (bests[0].score == 255) {
			fprintf(stderr, "Please set 2 to the score_size parameter of the function ssw_init, otherwise the alignment results will be incorrect.\n");
			free(r);
			return NULL;
		}
	}else if (prof->profile_word) {
		bests = sw_sse2_word(ref, 0, refLen, readLen, weight_gapO, weight_gapE, prof->profile_word, -1, maskLen);
		word = 1;
	}else {
		fprintf(stderr, "Please call the function ssw_init before ssw_align.\n");
		free(r);
		return NULL;
	}
	r->score1 = bests[0].score;
	r->ref_end1 = bests[0].ref;
	r->read_end1 = bests[0].read;
	if (maskLen >= 15) {
		r->score2 = bests[1].score;
		r->ref_end2 = bests[1].ref;
	} else {
		r->score2 = 0;
		r->ref_end2 = -1;
	}
	free(bests);
	if (flag == 0 || (flag == 2 && r->score1 < filters)) goto end;

	// Find the beginning position of the best alignment.
	read_reverse = seq_reverse(prof->read, r->read_end1);
	if (word == 0) {
		vP = qP_byte(read_reverse, prof->mat, r->read_end1 + 1, prof->n, prof->bias);
		bests_reverse = sw_sse2_byte(ref, 1, r->ref_end1 + 1, r->read_end1 + 1, weight_gapO, weight_gapE, vP, r->score1, prof->bias, maskLen);
	} else {
		vP = qP_word(read_reverse, prof->mat, r->read_end1 + 1, prof->n);
		bests_reverse = sw_sse2_word(ref, 1, r->ref_end1 + 1, r->read_end1 + 1, weight_gapO, weight_gapE, vP, r->score1, maskLen);
	}
	free(vP);
	free(read_reverse);
	r->ref_begin1 = bests_reverse[0].ref;
	r->read_begin1 = r->read_end1 - bests_reverse[0].read;
	free(bests_reverse);
	if ((7&flag) == 0 || ((2&flag) != 0 && r->score1 < filters) || ((4&flag) != 0 && (r->ref_end1 - r->ref_begin1 > filterd || r->read_end1 - r->read_begin1 > filterd))) goto end;

	// Generate cigar.
	refLen = r->ref_end1 - r->ref_begin1 + 1;
	readLen = r->read_end1 - r->read_begin1 + 1;
	band_width = abs(refLen - readLen) + 1;
	path = banded_sw(ref + r->ref_begin1, prof->read + r->read_begin1, refLen, readLen, r->score1, weight_gapO, weight_gapE, band_width, prof->mat, prof->n);
	if (path == 0) {
		free(r);
		r = NULL;
	}
	else {
		r->cigar = path->seq;
		r->cigarLen = path->length;
		free(path);
	}

end:
	return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movl %r9d, 0x10(%rsp)
movl %r8d, %r14d
movl %ecx, %ebx
movl %edx, %r12d
movq %rsi, 0x30(%rsp)
movq %rdi, %r15
movl 0x140(%rsp), %ebp
movl 0x20(%rdi), %r13d
pushq $0x1
popq %rdi
pushq $0x28
popq %rsi
callq 0x29b0e0
orl $-0x1, 0x4(%rax)
movq %rax, 0x8(%rsp)
orl $-0x1, 0xc(%rax)
cmpl $0xe, %ebp
jle 0x29cade
movq (%r15), %rax
movzbl %bl, %ebp
movzbl %r14b, %ebx
testq %rax, %rax
je 0x29c24d
movzbl 0x28(%r15), %r10d
movq 0x30(%rsp), %rdi
xorl %esi, %esi
movl %r12d, %edx
movl %r13d, %ecx
movl %ebp, %r8d
movl %ebx, %r9d
movl 0x140(%rsp), %r11d
pushq %r11
pushq %r10
pushq $0xff
pushq %rax
callq 0x29cce7
addq $0x20, %rsp
movq %r15, %r14
movq 0x8(%r15), %r15
movzwl (%rax), %ecx
testq %r15, %r15
je 0x29c298
cmpw $0xff, %cx
jne 0x29c2c5
movq 0x8(%rsp), %rcx
movl $0x1, 0x24(%rcx)
movq %rax, %rdi
callq 0x29b170
jmp 0x29c25d
movq %r15, %r14
movq 0x8(%r15), %r15
testq %r15, %r15
je 0x29caff
subq $0x8, %rsp
movl $0x0, 0x20(%rsp)
movq 0x38(%rsp), %rdi
xorl %esi, %esi
movl %r12d, %edx
movl %r13d, %ecx
movl %ebp, %r8d
movl %ebx, %r9d
movl 0x148(%rsp), %r13d
pushq %r13
pushq $0xffff                 # imm = 0xFFFF
pushq %r15
callq 0x29d131
addq $0x20, %rsp
jmp 0x29c2d3
movb $0x1, %dl
movl %edx, 0x18(%rsp)
cmpw $0xff, %cx
movl 0x140(%rsp), %r13d
jne 0x29c2d3
movq 0x5b8d24(%rip), %rax    # 0x854fd8
movq (%rax), %rcx
leaq 0x3bf14c(%rip), %rdi    # 0x65b40a
pushq $0x76
jmp 0x29cab3
movb $0x1, %cl
movl %ecx, 0x18(%rsp)
movl 0x140(%rsp), %r13d
movl %ebx, 0x2c(%rsp)
movzwl (%rax), %ecx
movq 0x8(%rsp), %r12
movq %rcx, 0x48(%rsp)
movw %cx, (%r12)
movl 0x4(%rax), %ebx
movl %ebx, 0x8(%r12)
movslq 0x8(%rax), %r15
movl %r15d, 0x10(%r12)
cmpl $0xf, %r13d
jl 0x29c309
movzwl 0xc(%rax), %edx
movl 0x10(%rax), %ecx
jmp 0x29c30e
pushq $-0x1
popq %rcx
xorl %edx, %edx
movl 0x10(%rsp), %r13d
movw %dx, 0x2(%r12)
movl %ecx, 0x14(%r12)
movq %rax, %rdi
callq 0x29b170
testb %r13b, %r13b
je 0x29cac9
movzwl 0x130(%rsp), %ecx
movzbl %r13b, %eax
cmpl $0x2, %eax
jne 0x29c34b
cmpw %cx, 0x48(%rsp)
jb 0x29cac9
movl %eax, 0x10(%rsp)
movl %ebp, 0x28(%rsp)
movq 0x10(%r14), %rbp
leaq 0x1(%r15), %r13
pushq $0x1
popq %rsi
movq %r13, %rdi
callq 0x29b0e0
movq %rax, %r12
xorl %eax, %eax
movq %r15, %rcx
cmpq %rcx, %rax
jg 0x29c38b
movb (%rbp,%rcx), %dl
movb %dl, (%r12,%rax)
movb (%rbp,%rax), %dl
movb %dl, (%r12,%rcx)
incq %rax
decq %rcx
jmp 0x29c36e
movq 0x18(%r14), %rsi
movl 0x24(%r14), %ecx
cmpb $0x0, 0x18(%rsp)
movq %r14, 0x20(%rsp)
je 0x29c3ea
movzbl 0x28(%r14), %r8d
movq %r12, %rdi
movl %r13d, %edx
callq 0x29bff7
leal 0x1(%rbx), %edx
movzbl 0x28(%r14), %ebp
movq %rax, %r14
movzbl 0x48(%rsp), %r10d
pushq $0x1
popq %rsi
movq 0x30(%rsp), %rdi
movl %r13d, %ecx
movl 0x28(%rsp), %r8d
movl 0x2c(%rsp), %r9d
movl 0x140(%rsp), %r11d
pushq %r11
pushq %rbp
pushq %r10
pushq %rax
callq 0x29cce7
jmp 0x29c427
movq %r12, %rdi
movl %r13d, %edx
callq 0x29c0b6
movq %rax, %r14
leal 0x1(%rbx), %edx
subq $0x8, %rsp
pushq $0x1
popq %rsi
movq 0x38(%rsp), %rdi
movl %r13d, %ecx
movl 0x30(%rsp), %r8d
movl 0x34(%rsp), %r9d
movl 0x148(%rsp), %eax
pushq %rax
pushq 0x58(%rsp)
pushq %r14
callq 0x29d131
addq $0x20, %rsp
movq %rax, %r13
movq %r14, %rdi
callq 0x29b170
movq %r12, %rdi
callq 0x29b170
movslq 0x4(%r13), %r12
movq 0x8(%rsp), %rax
movl %r12d, 0x4(%rax)
movl 0x8(%r13), %r14d
subl %r14d, %r15d
movl %r15d, 0xc(%rax)
movq %r13, %rdi
callq 0x29b170
movl 0x10(%rsp), %eax
testb $0x7, %al
je 0x29c479
testb $0x2, %al
je 0x29c483
movzwl 0x130(%rsp), %ecx
cmpw %cx, 0x48(%rsp)
jae 0x29c483
movq 0x8(%rsp), %r12
jmp 0x29cac9
subl %r12d, %ebx
testb $0x4, %al
je 0x29c49a
movl 0x138(%rsp), %eax
cmpl %eax, %ebx
jg 0x29c479
cmpl %eax, %r14d
jg 0x29c479
leal 0x1(%r14), %r13d
movq %rbx, 0x60(%rsp)
movl %ebx, %eax
movq %r14, 0x98(%rsp)
subl %r14d, %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
incl %ecx
movq %rcx, 0x58(%rsp)
movslq %r15d, %rax
movq 0x20(%rsp), %rbp
addq 0x10(%rbp), %rax
movq %rax, 0xf0(%rsp)
movq 0x18(%rbp), %rax
movq %rax, 0xe8(%rsp)
movslq 0x24(%rbp), %rax
movq %rax, 0xe0(%rsp)
pushq $0x40
popq %rdi
callq 0x29b190
movq %rax, 0xa8(%rsp)
pushq $0x10
popq %rdi
callq 0x29b190
movq %rax, 0x90(%rsp)
pushq $0x20
popq %rbp
movq %rbp, %rdi
callq 0x29b190
movq %rax, %rbx
movq %rbp, %rdi
callq 0x29b190
movq %rax, 0x40(%rsp)
movq %rbp, %rdi
callq 0x29b190
movq %rax, 0x10(%rsp)
movl $0x400, %eax            # imm = 0x400
movq %rax, 0xa0(%rsp)
movl $0x400, %edi            # imm = 0x400
callq 0x29b190
leal (%r13,%r13,2), %ecx
movl %ecx, 0x80(%rsp)
xorl %r15d, %r15d
testl %r13d, %r13d
cmovlel %r15d, %r13d
movq %r13, 0xc8(%rsp)
movq %rax, 0x38(%rsp)
addq %r12, 0x30(%rsp)
pushq $0x8
popq %rax
movl %eax, 0x54(%rsp)
movq 0x58(%rsp), %rax
leal (%rax,%rax), %ecx
movq %rcx, 0x58(%rsp)
movq %rax, 0x78(%rsp)
leal 0x3(,%rax,2), %r12d
movl 0x54(%rsp), %ebp
cmpl %ebp, %r12d
jl 0x29c5fe
movl %ebp, %eax
sarl %eax
orl %ebp, %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, %ebp
sarl $0x10, %ebp
orl %ecx, %ebp
movslq %ebp, %rax
incl %ebp
leaq 0x4(,%rax,4), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x29b1e0
movq %rax, %rbx
movq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0x29b1e0
movq %rax, 0x40(%rsp)
movq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x29b1e0
movq %rax, 0x10(%rsp)
jmp 0x29c596
movl %ebp, 0x54(%rsp)
movq 0x58(%rsp), %r12
orl $0x1, %r12d
movl 0x80(%rsp), %eax
imull %r12d, %eax
movslq %eax, %r13
movq 0xa0(%rsp), %r14
cmpq %r13, %r14
movq %r14, %rcx
jg 0x29c67b
movq %rcx, %rax
sarq %rax
orq %rcx, %rax
movq %rax, %rcx
sarq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
sarq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
sarq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rsi
sarq $0x10, %rsi
orq %rcx, %rsi
cmpq $-0x2, %rsi
jle 0x29caa0
incq %rsi
movq 0x38(%rsp), %rdi
movq %rsi, %r14
callq 0x29b1e0
movq %rax, 0x38(%rsp)
jmp 0x29c621
movq 0x58(%rsp), %rax
leal 0x2(%rax), %edi
pushq $0x1
popq %rax
cmpq %rdi, %rax
jae 0x29c694
andl $0x0, (%rbx,%rax,4)
incq %rax
jmp 0x29c686
movq %rcx, 0xa0(%rsp)
leal (%r12,%r12,2), %r9d
movq 0x78(%rsp), %rax
movl %eax, %ecx
notl %ecx
movl %eax, %edx
negl %edx
leaq 0x4(%rbx), %rax
movq %rax, 0xb8(%rsp)
movq 0x40(%rsp), %rax
leaq 0x4(%rax), %r8
movq 0x38(%rsp), %rax
leaq 0x1(%rax), %rsi
movq %rsi, 0xb0(%rsp)
xorl %esi, %esi
xorl %r11d, %r11d
movq %rax, 0x70(%rsp)
movq %rbx, 0x68(%rsp)
movq %rdi, 0xc0(%rsp)
movl %r9d, 0x84(%rsp)
testl %edx, %edx
movl $0x0, %r14d
cmovgl %edx, %r14d
testl %ecx, %ecx
movl $0x0, %eax
cmovgl %ecx, %eax
cmpq 0xc8(%rsp), %r11
je 0x29c93a
movl %edx, 0x88(%rsp)
movl %ecx, 0x8c(%rsp)
leaq (,%r14,4), %rdx
shlq $0x2, %rax
subq %rax, %rdx
movq 0xb8(%rsp), %rax
leaq (%rax,%rdx), %rcx
addq %r8, %rdx
movq %rdx, 0xd8(%rsp)
movq %rsi, 0xd0(%rsp)
movl %esi, %eax
addq 0xb0(%rsp), %rax
movq 0x78(%rsp), %rdx
leal (%rdx,%r11), %esi
movq 0x60(%rsp), %rdx
cmpl %esi, %edx
cmovll %edx, %esi
leal 0x1(%rsi), %edx
cmpl %edi, %edx
cmovgel %edi, %edx
movq 0x10(%rsp), %rdi
andl $0x0, (%rdi)
movslq %edx, %rdx
movq 0x40(%rsp), %rdi
andl $0x0, (%rdi,%rdx,4)
andl $0x0, (%rbx,%rdx,4)
andl $0x0, (%rdi)
andl $0x0, (%rbx)
movq 0x30(%rsp), %rdx
addq %r14, %rdx
movq %rdx, 0x20(%rsp)
movl %r9d, %edx
imull %r11d, %edx
addq 0x38(%rsp), %rdx
movq %rdx, 0x70(%rsp)
movslq %esi, %rdx
movq %rdx, 0x18(%rsp)
xorl %r10d, %r10d
xorl %r13d, %r13d
xorl %ebx, %ebx
leaq (%r14,%r13), %r9
cmpq 0x18(%rsp), %r9
jg 0x29c8e4
movq %r14, %rsi
movl $0x0, %ebp
movl $0x0, %r14d
testq %r11, %r11
je 0x29c7f5
movl (%rcx,%r13,4), %ebp
movq 0xd8(%rsp), %rdx
movl (%rdx,%r13,4), %r14d
movl 0x28(%rsp), %edi
subl %edi, %ebp
movl 0x2c(%rsp), %r12d
subl %r12d, %r14d
cmpl %r14d, %ebp
cmovgl %ebp, %r14d
setg %r9b
movl %r14d, (%r8,%r13,4)
orb $0x2, %r9b
movb %r9b, -0x1(%rax)
movq 0x10(%rsp), %rdx
movl (%rdx,%r13,4), %r9d
subl %edi, %r9d
subl %r12d, %ebx
cmpl %ebx, %r9d
setg %bpl
cmovgl %r9d, %ebx
orb $0x4, %bpl
movb %bpl, (%rax)
movl (%r8,%r13,4), %ebp
testl %ebp, %ebp
movl $0x0, %r14d
cmovgl %ebp, %r14d
movl %ebx, %r12d
testl %ebx, %ebx
jg 0x29c855
xorl %r12d, %r12d
cmpl %r12d, %r14d
cmovbel %r12d, %r14d
movq 0x20(%rsp), %rdx
movsbq (%rdx,%r13), %r9
imulq 0xe0(%rsp), %r9
movq 0xf0(%rsp), %rdx
movsbq (%rdx,%r11), %rdi
addq %r9, %rdi
movq 0xe8(%rsp), %rdx
movsbl (%rdx,%rdi), %edi
addl -0x4(%rcx,%r13,4), %edi
cmpl %edi, %r14d
movl %edi, %r9d
cmovgl %r14d, %r9d
cmpl %r15d, %r9d
cmovgl %r9d, %r15d
movq 0x10(%rsp), %rdx
movl %r9d, 0x4(%rdx,%r13,4)
movb $0x1, %r9b
cmpl %edi, %r14d
movq %rsi, %r14
jle 0x29c8c7
cmpl %r12d, %ebp
jg 0x29c8c0
movq %rax, %r9
jmp 0x29c8c4
leaq -0x1(%rax), %r9
movb (%r9), %r9b
movb %r9b, 0x1(%rax)
incq %r13
addq $0x3, %rax
movabsq $0x100000000, %rdx      # imm = 0x100000000
addq %rdx, %r10
jmp 0x29c7c3
sarq $0x20, %r10
pushq $0x1
popq %rax
movq 0x68(%rsp), %rbx
movq 0xc0(%rsp), %rdi
movl 0x84(%rsp), %r9d
movl 0x88(%rsp), %edx
movq 0xd0(%rsp), %rsi
cmpq %r10, %rax
jg 0x29c924
movq 0x10(%rsp), %rcx
movl (%rcx,%rax,4), %ecx
movl %ecx, (%rbx,%rax,4)
incq %rax
jmp 0x29c90f
incq %r11
incl %edx
movl 0x8c(%rsp), %ecx
incl %ecx
addl %r9d, %esi
jmp 0x29c6f2
cmpl 0x48(%rsp), %r15d
jl 0x29c578
movl %r9d, %eax
negq %rax
movq %rax, 0x20(%rsp)
pushq $0x2
popq %rbx
pushq $0x10
popq %r15
movb $0x4d, 0x18(%rsp)
xorl %r10d, %r10d
xorl %r14d, %r14d
movb $0x4d, %r12b
movq 0x60(%rsp), %rdx
movq 0xa8(%rsp), %rdi
shll $0x4, %r14d
movq 0x98(%rsp), %rsi
pushq $0x1
popq %r8
movq 0x70(%rsp), %r9
movl %r10d, %r13d
testl %esi, %esi
jle 0x29cb14
movl %esi, %eax
subl 0x78(%rsp), %eax
testl %eax, %eax
movl $0x0, %ecx
cmovlel %ecx, %eax
movl %edx, %ecx
subl %eax, %ecx
leal (%rcx,%rcx,2), %eax
addl %ebx, %eax
cltq
movzbl (%r9,%rax), %ecx
decl %ecx
cmpl $0x4, %ecx
ja 0x29cb75
leaq 0x3be94c(%rip), %r11    # 0x65b310
movslq (%r11,%rcx,4), %rax
addq %r11, %rax
jmpq *%rax
decl %esi
decl %edx
addq 0x20(%rsp), %r9
movb $0x4d, %r12b
jmp 0x29c9fa
decl %edx
movb $0x44, %r12b
jmp 0x29c9fa
decl %esi
addq 0x20(%rsp), %r9
xorl %ebx, %ebx
movb $0x49, %r12b
jmp 0x29ca07
decl %esi
addq 0x20(%rsp), %r9
movb $0x49, %r12b
pushq $0x2
popq %rbx
jmp 0x29ca07
decl %edx
movb $0x44, %r12b
movl %r8d, %ebx
cmpb 0x18(%rsp), %r12b
jne 0x29ca17
addl $0x10, %r14d
jmp 0x29c987
movq %r9, 0x70(%rsp)
movq %rsi, 0x98(%rsp)
movq %rdx, 0x60(%rsp)
incl %r10d
cmpl %r15d, %r10d
jl 0x29ca76
movl %r15d, %eax
sarl %eax
orl %r15d, %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, %r15d
sarl $0x10, %r15d
orl %ecx, %r15d
movslq %r15d, %rax
incl %r15d
leaq 0x4(,%rax,4), %rsi
movq %r10, %rbp
callq 0x29b1e0
movq %rbp, %r10
movq %rax, %rdi
jmp 0x29ca2c
movzbl 0x18(%rsp), %eax
leaq 0x3be8ae(%rip), %rcx    # 0x65b330
movzbl (%rax,%rcx), %eax
orl %eax, %r14d
movl %r14d, (%rdi,%r13,4)
movb %r12b, 0x18(%rsp)
pushq $0x1
popq %r14
movq 0x60(%rsp), %rdx
jmp 0x29c972
movq 0x5b8531(%rip), %rax    # 0x854fd8
movq (%rax), %rcx
leaq 0x3bea05(%rip), %rdi    # 0x65b4b6
pushq $0x30
popq %rsi
pushq $0x1
popq %rdx
callq 0x29b210
movq 0x8(%rsp), %rdi
callq 0x29b170
xorl %r12d, %r12d
movq %r12, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x5b84f3(%rip), %rax    # 0x854fd8
movq (%rax), %rcx
leaq 0x3be8c1(%rip), %rdi    # 0x65b3b0
pushq $0x59
popq %rsi
pushq $0x1
popq %rdx
callq 0x29b210
jmp 0x29c1db
movq 0x5b84d2(%rip), %rax    # 0x854fd8
movq (%rax), %rcx
leaq 0x3be971(%rip), %rdi    # 0x65b481
pushq $0x34
jmp 0x29cab3
cmpb $0x4d, %r12b
movq %r10, %rbp
jne 0x29cbd8
leal 0x1(%r10), %ebx
movq 0x8(%rsp), %r12
cmpl %r15d, %ebx
jl 0x29cc23
movl %r15d, %eax
sarl %eax
orl %r15d, %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, %r15d
sarl $0x10, %r15d
orl %ecx, %r15d
movslq %r15d, %rax
incl %r15d
leaq 0x4(,%rax,4), %rsi
callq 0x29b1e0
movq %rbp, %r10
movq %rax, %rdi
jmp 0x29cb2a
movq 0x5b845c(%rip), %rcx    # 0x854fd8
movq %rdi, %rbx
movq (%rcx), %rdi
movsbl -0x1(%rax,%r9), %edx
leaq 0x3be958(%rip), %rsi    # 0x65b4e7
xorl %eax, %eax
callq 0x29b1c0
movq 0x38(%rsp), %rdi
callq 0x29b170
movq 0x10(%rsp), %rdi
callq 0x29b170
movq 0x40(%rsp), %rdi
callq 0x29b170
movq 0x68(%rsp), %rdi
callq 0x29b170
movq %rbx, %rdi
callq 0x29b170
movq 0x90(%rsp), %rdi
callq 0x29b170
jmp 0x29cabc
leal 0x2(%r10), %ebx
cmpl %r15d, %ebx
jl 0x29cc29
movl %r15d, %eax
sarl %eax
orl %r15d, %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, %r15d
sarl $0x10, %r15d
orl %ecx, %r15d
movslq %r15d, %rax
incl %r15d
leaq 0x4(,%rax,4), %rsi
callq 0x29b1e0
movq %rbp, %r10
movq %rax, %rdi
jmp 0x29cbdc
addl $0x10, %r14d
jmp 0x29cc4b
movzbl %r12b, %eax
leaq 0x3be6fc(%rip), %rcx    # 0x65b330
movzbl (%rax,%rcx), %eax
orl %eax, %r14d
movl %r14d, (%rdi,%r13,4)
incl %r10d
pushq $0x10
popq %r14
movq 0x8(%rsp), %r12
movslq %r10d, %rax
movl %r14d, (%rdi,%rax,4)
movslq %ebx, %r14
movq %rdi, %r15
leaq (,%r14,4), %rdi
callq 0x29b190
movq %r15, %rsi
xorl %ecx, %ecx
cmpq %r14, %rcx
jge 0x29cc87
movl -0x4(%rsi,%r14,4), %edx
movl %edx, (%rax,%rcx,4)
movl (%rsi,%rcx,4), %edx
movl %edx, -0x4(%rax,%r14,4)
decq %r14
incq %rcx
jmp 0x29cc6a
movq 0x90(%rsp), %r14
movq %rax, (%r14)
movl %ebx, 0x8(%r14)
movq %rsi, %rbx
movq 0x38(%rsp), %rdi
callq 0x29b170
movq 0x10(%rsp), %rdi
callq 0x29b170
movq 0x40(%rsp), %rdi
callq 0x29b170
movq 0x68(%rsp), %rdi
callq 0x29b170
movq %rbx, %rdi
callq 0x29b170
movq (%r14), %rax
movq %rax, 0x18(%r12)
movl 0x8(%r14), %eax
movl %eax, 0x20(%r12)
movq %r14, %rdi
callq 0x29b170
jmp 0x29cac9