// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/misc/wgsim.c
// Function: wgsim_core
void wgsim_core(FILE *fpout1, FILE *fpout2, const char *fn, int is_hap, uint64_t N, int dist, int std_dev, int size_l, int size_r)
{
	kseq_t *ks;
    mutseq_t rseq[2];
	gzFile fp_fa;
	uint64_t tot_len, ii;
	int i, l, n_ref;
	char *qstr;
	int size[2], Q, max_size;
	uint8_t *tmp_seq[2];
    mut_t *target;

	l = size_l > size_r? size_l : size_r;
	qstr = (char*)calloc(l+1, 1);
	tmp_seq[0] = (uint8_t*)calloc(l+2, 1);
	tmp_seq[1] = (uint8_t*)calloc(l+2, 1);
	size[0] = size_l; size[1] = size_r;
	max_size = size_l > size_r? size_l : size_r;

	Q = (ERR_RATE == 0.0)? 'I' : (int)(-10.0 * log(ERR_RATE) / log(10.0) + 0.499) + 33;

	fp_fa = gzopen(fn, "r");
	ks = kseq_init(fp_fa);
	tot_len = n_ref = 0;
	fprintf(stderr, "[%s] calculating the total length of the reference sequence...\n", __func__);
	while ((l = kseq_read(ks)) >= 0) {
		tot_len += l;
		++n_ref;
	}
	fprintf(stderr, "[%s] %d sequences, total length: %llu\n", __func__, n_ref, (long long)tot_len);
	kseq_destroy(ks);
	gzclose(fp_fa);

	fp_fa = gzopen(fn, "r");
	ks = kseq_init(fp_fa);
	while ((l = kseq_read(ks)) >= 0) {
		uint64_t n_pairs = (uint64_t)((long double)l / tot_len * N + 0.5);
		if (l < dist + 3 * std_dev) {
			fprintf(stderr, "[%s] skip sequence '%s' as it is shorter than %d!\n", __func__, ks->name.s, dist + 3 * std_dev);
			continue;
		}

		// generate mutations and print them out
		wgsim_mut_diref(ks, is_hap, rseq, rseq+1);
		wgsim_print_mutref(ks->name.s, ks, rseq, rseq+1);

		for (ii = 0; ii != n_pairs; ++ii) { // the core loop
			double ran;
			int d, pos, s[2], is_flip = 0;
			int n_sub[2], n_indel[2], n_err[2], ext_coor[2], j, k;
			FILE *fpo[2];

			do { // avoid boundary failure
				ran = ran_normal();
				ran = ran * std_dev + dist;
				d = (int)(ran + 0.5);
				d = d > max_size? d : max_size;
				pos = (int)((l - d + 1) * drand48());
			} while (pos < 0 || pos >= ks->seq.l || pos + d - 1 >= ks->seq.l);

			// flip or not
			if (drand48() < 0.5) {
				fpo[0] = fpout1; fpo[1] = fpout2;
				s[0] = size[0]; s[1] = size[1];
			} else {
				fpo[1] = fpout1; fpo[0] = fpout2;
				s[1] = size[0]; s[0] = size[1];
				is_flip = 1;
			}

			// generate the read sequences
			target = rseq[drand48()<0.5?0:1].s; // haplotype from which the reads are generated
			n_sub[0] = n_sub[1] = n_indel[0] = n_indel[1] = n_err[0] = n_err[1] = 0;

#define __gen_read(x, start, iter) do {									\
				for (i = (start), k = 0, ext_coor[x] = -10; i >= 0 && i < ks->seq.l && k < s[x]; iter) {	\
					int c = target[i], mut_type = c & mutmsk;			\
					if (ext_coor[x] < 0) {								\
						if (mut_type != NOCHANGE && mut_type != SUBSTITUTE) continue; \
						ext_coor[x] = i;								\
					}													\
					if (mut_type == DELETE) ++n_indel[x];				\
					else if (mut_type == NOCHANGE || mut_type == SUBSTITUTE) { \
						tmp_seq[x][k++] = c & 0xf;						\
						if (mut_type == SUBSTITUTE) ++n_sub[x];			\
					} else {											\
						int n, ins;										\
						++n_indel[x];									\
						tmp_seq[x][k++] = c & 0xf;						\
						for (n = mut_type>>12, ins = c>>4; n > 0 && k < s[x]; --n, ins >>= 2) \
							tmp_seq[x][k++] = ins & 0x3;				\
					}													\
				}														\
				if (k != s[x]) ext_coor[x] = -10;						\
			} while (0)

			__gen_read(0, pos, ++i);
			__gen_read(1, pos + d - 1, --i);
			for (k = 0; k < s[1]; ++k) tmp_seq[1][k] = tmp_seq[1][k] < 4? 3 - tmp_seq[1][k] : 4; // complement
			if (ext_coor[0] < 0 || ext_coor[1] < 0) { // fail to generate the read(s)
				--ii;
				continue;
			}

			// generate sequencing errors
			for (j = 0; j < 2; ++j) {
				int n_n = 0;
				for (i = 0; i < s[j]; ++i) {
					int c = tmp_seq[j][i];
					if (c >= 4) { // actually c should be never larger than 4 if everything is correct
						c = 4;
						++n_n;
					} else if (drand48() < ERR_RATE) {
						// c = (c + (int)(drand48() * 3.0 + 1)) & 3; // random sequencing errors
						c = (c + 1) & 3; // recurrent sequencing errors
						++n_err[j];
					}
					tmp_seq[j][i] = c;
				}
				if ((double)n_n / s[j] > MAX_N_RATIO) break;
			}
			if (j < 2) { // too many ambiguous bases on one of the reads
				--ii;
				continue;
			}

			// print
			for (j = 0; j < 2; ++j) {
				for (i = 0; i < s[j]; ++i) qstr[i] = Q;
				qstr[i] = 0;
				fprintf(fpo[j], "@%s_%u_%u_%d:%d:%d_%d:%d:%d_%llx/%d\n", ks->name.s, ext_coor[0]+1, ext_coor[1]+1,
						n_err[0], n_sub[0], n_indel[0], n_err[1], n_sub[1], n_indel[1],
						(long long)ii, j==0? is_flip+1 : 2-is_flip);
				for (i = 0; i < s[j]; ++i)
					fputc("ACGTN"[(int)tmp_seq[j][i]], fpo[j]);
				fprintf(fpo[j], "\n+\n%s\n", qstr);
			}
		}
		free(rseq[0].s); free(rseq[1].s);
	}
	kseq_destroy(ks);
	gzclose(fp_fa);
	free(qstr);
	free(tmp_seq[0]); free(tmp_seq[1]);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movl %r9d, 0x8(%rsp)
movq %r8, 0x70(%rsp)
movl %ecx, 0x94(%rsp)
movq %rdx, %rbx
movq %rsi, 0xc8(%rsp)
movq %rdi, 0xc0(%rsp)
movl 0x1b0(%rsp), %eax
movl 0x1a8(%rsp), %ecx
cmpl %eax, %ecx
movl %eax, %r15d
cmovgl %ecx, %r15d
leal 0x1(%r15), %eax
movslq %eax, %rdi
pushq $0x1
popq %r14
movq %r14, %rsi
callq 0x10e0
movq %rax, %rbp
movq %r15, 0x78(%rsp)
leal 0x2(%r15), %eax
movslq %eax, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x10e0
movq %rax, 0x38(%rsp)
movq %rax, 0xb0(%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x10e0
movq %rax, 0x58(%rsp)
movq %rax, 0xe0(%rsp)
movsd 0x3e82(%rip), %xmm0     # 0x5118
movb $0x49, %al
movl %eax, 0x4c(%rsp)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x12a8
jnp 0x12cf
callq 0x10c0
mulsd 0x1d93(%rip), %xmm0     # 0x3048
divsd 0x1d93(%rip), %xmm0     # 0x3050
addsd 0x1d93(%rip), %xmm0     # 0x3058
cvttsd2si %xmm0, %eax
addb $0x21, %al
movl %eax, 0x4c(%rsp)
leaq 0x1f43(%rip), %rsi      # 0x3219
movq %rbx, %rdi
callq 0x1160
movq %rax, %r14
movq %rax, %rdi
callq 0x258c
movq %rax, %r12
movq 0x3d05(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0x1f1e(%rip), %rsi      # 0x321b
leaq 0x1f57(%rip), %rdx      # 0x325b
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x1100
movq %r12, %rdi
callq 0x25d6
xorl %r15d, %r15d
testl %eax, %eax
js 0x1334
xorl %r13d, %r13d
movl %eax, %eax
addq %rax, %r15
incl %r13d
movq %r12, %rdi
callq 0x25d6
testl %eax, %eax
jns 0x1320
movq 0x3cbd(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0x1f21(%rip), %rsi      # 0x3266
leaq 0x1f0f(%rip), %rdx      # 0x325b
movl %r13d, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x1100
movq %r12, %rdi
callq 0x28fa
movq %r14, %rdi
callq 0x1030
leaq 0x1ea9(%rip), %rsi      # 0x3219
movq %rbx, %rdi
callq 0x1160
movq %rax, 0xe8(%rsp)
movq %rax, %rdi
callq 0x258c
movq %rax, 0x40(%rsp)
movq %rax, %rdi
callq 0x25d6
testl %eax, %eax
movq 0x38(%rsp), %r14
movq 0x58(%rsp), %r12
js 0x1bca
movl 0x1a0(%rsp), %esi
movq %r15, 0x118(%rsp)
xorl %ecx, %ecx
testq %r15, %r15
sets %cl
fildll 0x118(%rsp)
leaq 0x1c94(%rip), %rdx      # 0x3060
fadds (%rdx,%rcx,4)
fstpt 0x134(%rsp)
movq 0x70(%rsp), %rdi
movq %rdi, 0x120(%rsp)
xorl %ecx, %ecx
testq %rdi, %rdi
sets %cl
fildll 0x120(%rsp)
fadds (%rdx,%rcx,4)
fstpt 0x128(%rsp)
leal (%rsi,%rsi,2), %ecx
movl 0x8(%rsp), %edx
addl %edx, %ecx
movl %ecx, 0x48(%rsp)
cvtsi2sd %esi, %xmm0
movsd %xmm0, 0x108(%rsp)
cvtsi2sd %edx, %xmm0
movsd %xmm0, 0x100(%rsp)
movq %rbp, 0xd0(%rsp)
movl %eax, 0x9c(%rsp)
fldt 0x134(%rsp)
fidivrl 0x9c(%rsp)
fldt 0x128(%rsp)
fmulp %st, %st(1)
fadds 0x1c21(%rip)            # 0x3070
flds 0x1c1f(%rip)            # 0x3074
xorl %r8d, %r8d
fxch %st(1)
fucomi %st(1), %st
fldz
fcmovnb %st(2), %st
fstp %st(2)
fsubp %st, %st(1)
setae %dl
fnstcw 0x12(%rsp)
movzwl 0x12(%rsp), %ecx
orl $0xc00, %ecx            # imm = 0xC00
movw %cx, 0x26(%rsp)
fldcw 0x26(%rsp)
fistpll 0x110(%rsp)
fldcw 0x12(%rsp)
cmpl 0x48(%rsp), %eax
jl 0x1b9b
movl %eax, 0x70(%rsp)
movb %dl, %r8b
shlq $0x3f, %r8
xorq 0x110(%rsp), %r8
movq 0x40(%rsp), %rbx
movq %rbx, %rdi
movl 0x94(%rsp), %esi
leaq 0x140(%rsp), %rdx
movq %r8, %r13
leaq 0x150(%rsp), %r15
movq %r15, %rcx
callq 0x1f9a
movq 0x10(%rbx), %rdi
movq %rdi, 0xf8(%rsp)
movq %rbx, %rsi
leaq 0x140(%rsp), %rdx
movq %r15, %rcx
callq 0x22b6
movq %r13, 0xf0(%rsp)
testq %r13, %r13
movq 0x78(%rsp), %r15
je 0x1b6d
incl 0x70(%rsp)
movq $0x0, 0x80(%rsp)
callq 0x1ebc
mulsd 0x108(%rsp), %xmm0
addsd 0x100(%rsp), %xmm0
addsd 0x1b03(%rip), %xmm0     # 0x3038
cvttsd2si %xmm0, %eax
movl %r15d, %r14d
cmpl %eax, %r15d
jg 0x1544
movl %eax, %r14d
movl 0x70(%rsp), %eax
subl %r14d, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x8(%rsp)
callq 0x11d0
mulsd 0x8(%rsp), %xmm0
cvttsd2si %xmm0, %eax
testl %eax, %eax
js 0x1516
movl %eax, %r12d
movq 0x40(%rsp), %rcx
movq 0x30(%rcx), %rbx
cmpq %r12, %rbx
jbe 0x1516
leal (%r14,%rax), %r13d
decl %r13d
movslq %r13d, %rax
cmpq %rax, %rbx
jbe 0x1516
callq 0x11d0
movsd 0x1aa3(%rip), %xmm1     # 0x3038
ucomisd %xmm0, %xmm1
jbe 0x15db
movq 0xc0(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0xd8(%rsp)
movl $0x0, 0x14(%rsp)
movl 0x1b0(%rsp), %eax
movl %eax, 0x8(%rsp)
movl 0x1a8(%rsp), %eax
movl %eax, 0x4(%rsp)
jmp 0x1618
movq 0xc0(%rsp), %rax
movq %rax, 0xd8(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0xa0(%rsp)
movl 0x1a8(%rsp), %eax
movl %eax, 0x8(%rsp)
movl 0x1b0(%rsp), %eax
movl %eax, 0x4(%rsp)
pushq $0x1
popq %rax
movl %eax, 0x14(%rsp)
movq 0x38(%rsp), %r14
callq 0x11d0
xorl %eax, %eax
movsd 0x1a0c(%rip), %xmm1     # 0x3038
ucomisd %xmm0, %xmm1
setbe %al
andl $0x0, 0x50(%rsp)
andl $0x0, 0x54(%rsp)
shll $0x4, %eax
movq 0x148(%rsp,%rax), %rax
movq $0x0, 0x60(%rsp)
movl $0x0, %ecx
movq %rcx, 0x68(%rsp)
movl $0x0, %ecx
movq %rcx, 0x30(%rsp)
pushq $-0xa
popq %r10
movl $0x0, %edx
cmpl $0x0, 0x4(%rsp)
jle 0x1784
movl 0x4(%rsp), %ecx
xorl %edx, %edx
pushq $-0xa
popq %rdi
movq $0x0, 0x30(%rsp)
movq $0x0, 0x68(%rsp)
movzwl (%rax,%r12,2), %esi
movl %esi, %r8d
andl $0xf000, %r8d           # imm = 0xF000
testl %edi, %edi
js 0x16be
cmpl $0xf000, %r8d           # imm = 0xF000
jne 0x16d4
movq 0x30(%rsp), %rsi
incl %esi
movq %rsi, 0x30(%rsp)
jmp 0x16cf
movl %r12d, %r10d
testl %r8d, %r8d
je 0x16d7
cmpl $0xe000, %r8d           # imm = 0xE000
je 0x16d7
movl %edi, %r10d
jmp 0x1710
movl %edi, %r10d
movslq %edx, %rdi
cmpw $0xe000, %r8w           # imm = 0xE000
je 0x16ea
movzwl %r8w, %edx
testl %edx, %edx
jne 0x1727
xorl %r9d, %r9d
cmpl $0xe000, %r8d           # imm = 0xE000
sete %r9b
andb $0xf, %sil
leal 0x1(%rdi), %edx
movb %sil, (%r14,%rdi)
movq 0x68(%rsp), %rsi
addl %r9d, %esi
movq %rsi, 0x68(%rsp)
incq %r12
cmpq %r12, %rbx
jbe 0x1784
movl %r10d, %edi
cmpl 0x4(%rsp), %edx
jl 0x1694
jmp 0x1784
movq 0x30(%rsp), %rdx
incl %edx
movq %rdx, 0x30(%rsp)
movl %esi, %edx
andb $0xf, %dl
movb %dl, (%r14,%rdi)
movl %edi, %edx
incl %edx
cmpw $0x1000, %si            # imm = 0x1000
jb 0x1710
cmpl 0x4(%rsp), %edx
jge 0x1710
movl %esi, %edi
shrl $0x4, %edi
shrl $0xc, %esi
movslq %edx, %r8
incq %r8
movl %edi, %r9d
andb $0x3, %r9b
movb %r9b, -0x1(%r14,%r8)
incl %edx
cmpl $0x2, %esi
jb 0x1710
movzwl %di, %edi
decl %esi
shrl $0x2, %edi
leaq 0x1(%r8), %r9
cmpq %rcx, %r8
movq %r9, %r8
jl 0x175b
jmp 0x1710
cmpl 0x4(%rsp), %edx
pushq $-0xa
popq %rcx
cmovnel %ecx, %r10d
movl %r10d, 0x1c(%rsp)
movl $0x0, %edx
movq %rdx, 0x28(%rsp)
movl %ecx, %r8d
movl $0x0, %ecx
testl %r13d, %r13d
movq 0x58(%rsp), %r12
js 0x18da
movslq 0x8(%rsp), %rdx
xorl %ecx, %ecx
pushq $-0xa
popq %rdi
movq $0x0, 0x28(%rsp)
movq $0x0, 0x60(%rsp)
movl %r13d, %esi
cmpq %rsi, %rbx
jbe 0x18d7
cmpl 0x8(%rsp), %ecx
jge 0x18d7
movzwl (%rax,%rsi,2), %esi
movl %esi, %r8d
andl $0xf000, %r8d           # imm = 0xF000
testl %edi, %edi
js 0x180f
cmpl $0xf000, %r8d           # imm = 0xF000
jne 0x1825
movq 0x28(%rsp), %rsi
incl %esi
movq %rsi, 0x28(%rsp)
jmp 0x1820
movl %r13d, %r10d
testl %r8d, %r8d
je 0x1828
cmpl $0xe000, %r8d           # imm = 0xE000
je 0x1828
movl %edi, %r8d
jmp 0x1864
movl %edi, %r10d
movslq %ecx, %rdi
cmpw $0xe000, %r8w           # imm = 0xE000
je 0x183c
movzwl %r8w, %r9d
testl %r9d, %r9d
jne 0x1879
xorl %r9d, %r9d
cmpl $0xe000, %r8d           # imm = 0xE000
sete %r9b
andb $0xf, %sil
incl %ecx
movb %sil, (%r12,%rdi)
movq 0x60(%rsp), %rsi
addl %r9d, %esi
movq %rsi, 0x60(%rsp)
movl %r10d, %r8d
leal -0x1(%r13), %esi
movl %r8d, %edi
testl %r13d, %r13d
movl %esi, %r13d
jg 0x17d0
jmp 0x18da
movq 0x28(%rsp), %r8
incl %r8d
movq %r8, 0x28(%rsp)
movl %esi, %r8d
andb $0xf, %r8b
movb %r8b, (%r12,%rdi)
incl %ecx
cmpw $0x1000, %si            # imm = 0x1000
jb 0x1861
cmpl 0x8(%rsp), %ecx
jge 0x1861
movl %esi, %edi
shrl $0x4, %edi
shrl $0xc, %esi
movslq %ecx, %r8
incq %r8
movl %edi, %r9d
andb $0x3, %r9b
movb %r9b, -0x1(%r12,%r8)
incl %ecx
cmpl $0x2, %esi
jb 0x1861
movzwl %di, %edi
decl %esi
shrl $0x2, %edi
leaq 0x1(%r8), %r9
cmpq %rdx, %r8
movq %r9, %r8
jl 0x18ae
jmp 0x1861
movl %edi, %r8d
movl 0x8(%rsp), %edx
cmpl %edx, %ecx
pushq $-0xa
popq %rax
cmovnel %eax, %r8d
movl %r8d, 0x18(%rsp)
testl %edx, %edx
pushq $0x4
popq %rdi
jle 0x1919
movl 0x8(%rsp), %eax
xorl %ecx, %ecx
movb (%r12,%rcx), %dl
movb $0x3, %sil
subb %dl, %sil
cmpb $0x4, %dl
movzbl %sil, %edx
cmovael %edi, %edx
movb %dl, (%r12,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x18f9
cmpl $0x0, 0x1c(%rsp)
js 0x1b57
cmpl $0x0, 0x18(%rsp)
js 0x1b57
movb $0x1, %cl
leaq 0x54(%rsp), %r15
movl 0x4(%rsp), %edx
leaq 0xb0(%rsp), %rax
testl %edx, %edx
jle 0x19ba
movl %ecx, 0x20(%rsp)
movq (%rax), %r13
movl %edx, 0x88(%rsp)
movl %edx, %r14d
xorl %ebp, %ebp
xorl %ebx, %ebx
movb (%r13,%rbp), %r12b
cmpb $0x4, %r12b
jb 0x196d
incl %ebx
movb $0x4, %r12b
jmp 0x198a
callq 0x11d0
movsd 0x379e(%rip), %xmm1     # 0x5118
ucomisd %xmm0, %xmm1
jbe 0x198a
incb %r12b
andb $0x3, %r12b
incl (%r15)
movb %r12b, (%r13,%rbp)
incq %rbp
cmpq %rbp, %r14
jne 0x195b
cvtsi2sd %ebx, %xmm0
movq 0xd0(%rsp), %rbp
movq 0x38(%rsp), %r14
movq 0x58(%rsp), %r12
movl 0x20(%rsp), %ecx
movl 0x88(%rsp), %edx
jmp 0x19be
xorpd %xmm0, %xmm0
cvtsi2sd %edx, %xmm1
divsd %xmm1, %xmm0
ucomisd 0x169a(%rip), %xmm0     # 0x3068
ja 0x1b52
leaq 0x50(%rsp), %r15
movl 0x8(%rsp), %edx
leaq 0xe0(%rsp), %rax
testb $0x1, %cl
movl $0x0, %ecx
jne 0x1942
incl 0x1c(%rsp)
incl 0x18(%rsp)
movl 0x54(%rsp), %eax
movl %eax, 0x20(%rsp)
movl 0x50(%rsp), %eax
movq %rax, 0x88(%rsp)
pushq $0x2
popq %rcx
movl 0x14(%rsp), %eax
subl %eax, %ecx
movl %ecx, 0x98(%rsp)
incl %eax
movl %eax, 0x14(%rsp)
movb $0x1, %r12b
leaq 0xa0(%rsp), %rbx
leaq 0xb0(%rsp), %r15
movl 0x4(%rsp), %eax
movl %eax, %r13d
testl %eax, %eax
movl %eax, %r14d
jle 0x1a5b
movzbl 0x4c(%rsp), %esi
movq %rbp, %rdi
movq %r13, %rdx
callq 0x10b0
movq %r13, %rax
jmp 0x1a5d
xorl %eax, %eax
movb $0x0, (%rbp,%rax)
movq (%rbx), %rbx
testb $0x1, %r12b
movl 0x98(%rsp), %eax
movl %eax, %r10d
cmovnel 0x14(%rsp), %r10d
subq $0x8, %rsp
movq %rbx, %rdi
leaq 0x1839(%rip), %rsi      # 0x32c0
movq 0x100(%rsp), %rdx
movl 0x24(%rsp), %ecx
movl 0x20(%rsp), %r8d
movl 0x28(%rsp), %r9d
xorl %eax, %eax
pushq %r10
pushq 0x90(%rsp)
pushq 0x40(%rsp)
pushq 0x80(%rsp)
pushq 0xb0(%rsp)
pushq 0x60(%rsp)
pushq 0xa0(%rsp)
callq 0x1100
addq $0x40, %rsp
testl %r14d, %r14d
leaq 0x16b8(%rip), %rbp      # 0x3190
jle 0x1af9
movq (%r15), %r14
xorl %r15d, %r15d
movzbl (%r14,%r15), %eax
movsbl (%rax,%rbp), %edi
movq %rbx, %rsi
callq 0x10d0
incq %r15
cmpq %r15, %r13
jne 0x1ae0
movq %rbx, %rdi
leaq 0x17e2(%rip), %rsi      # 0x32e5
movq 0xd0(%rsp), %rbp
movq %rbp, %rdx
xorl %eax, %eax
callq 0x1100
leaq 0xd8(%rsp), %rbx
movl 0x8(%rsp), %eax
leaq 0xe0(%rsp), %r15
testb $0x1, %r12b
movl $0x0, %r12d
movq 0x38(%rsp), %r14
jne 0x1a3c
incq 0x80(%rsp)
movq 0x78(%rsp), %r15
movq 0x58(%rsp), %r12
jmp 0x1b57
movq 0x78(%rsp), %r15
movq 0x80(%rsp), %rax
cmpq 0xf0(%rsp), %rax
jne 0x1516
movq 0x148(%rsp), %rdi
callq 0x1040
movq 0x158(%rsp), %rdi
callq 0x1040
movq 0x40(%rsp), %rdi
callq 0x25d6
testl %eax, %eax
jns 0x142b
jmp 0x1bca
movq 0x3456(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rcx
leaq 0x16d8(%rip), %rsi      # 0x328d
leaq 0x169f(%rip), %rdx      # 0x325b
movl 0x48(%rsp), %r8d
xorl %eax, %eax
callq 0x1100
jmp 0x1b87
movq 0x40(%rsp), %rdi
callq 0x28fa
movq 0xe8(%rsp), %rdi
callq 0x1030
movq %rbp, %rdi
callq 0x1040
movq %r14, %rdi
callq 0x1040
movq %r12, %rdi
callq 0x1040
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq