// File: /workspace/github_c_makefile_star2_O1/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 $0x158, %rsp            # imm = 0x158
movl %r9d, 0x18(%rsp)
movq %r8, 0x88(%rsp)
movl %ecx, 0x94(%rsp)
movq %rdx, %r12
movq %rsi, 0xb0(%rsp)
movq %rdi, 0xa8(%rsp)
movl 0x1a0(%rsp), %eax
movl 0x198(%rsp), %ecx
cmpl %eax, %ecx
movl %eax, %ebx
cmovgl %ecx, %ebx
leal 0x1(%rbx), %eax
movslq %eax, %rdi
pushq $0x1
popq %r14
movq %r14, %rsi
callq 0x10e0
movq %rax, 0x38(%rsp)
movq %rbx, 0x80(%rsp)
leal 0x2(%rbx), %eax
movslq %eax, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x10e0
movq %rax, %rbx
movq %rax, 0xd0(%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x10e0
movq %rax, %r14
movq %rax, 0xd8(%rsp)
movsd 0x3e82(%rip), %xmm0     # 0x5118
movb $0x49, %al
movl %eax, 0x54(%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, 0x54(%rsp)
movq %r14, 0xb8(%rsp)
leaq 0x1f3b(%rip), %rsi      # 0x3219
movq %r12, %rdi
callq 0x1160
movq %rax, %r14
movq %rax, %rdi
callq 0x2567
movq %rax, %rbp
movq 0x3cfd(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0x1f16(%rip), %rsi      # 0x321b
leaq 0x1f4f(%rip), %rdx      # 0x325b
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x1100
movq %rbp, %rdi
callq 0x25b1
testl %eax, %eax
movq %rbx, 0x78(%rsp)
js 0x1343
xorl %r13d, %r13d
xorl %r15d, %r15d
movl %eax, %eax
addq %rax, %r13
incl %r15d
movq %rbp, %rdi
callq 0x25b1
testl %eax, %eax
jns 0x132d
jmp 0x1346
xorl %r13d, %r13d
movq 0x3cab(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0x1f0f(%rip), %rsi      # 0x3266
leaq 0x1efd(%rip), %rdx      # 0x325b
movl %r15d, %ecx
movq %r13, %r8
xorl %eax, %eax
callq 0x1100
movq %rbp, %rdi
callq 0x28dc
movq %r14, %rdi
callq 0x1030
leaq 0x1e97(%rip), %rsi      # 0x3219
movq %r12, %rdi
callq 0x1160
movq %rax, 0xe0(%rsp)
movq %rax, %rdi
callq 0x2567
movq %rax, %r14
movq %rax, %rdi
callq 0x25b1
testl %eax, %eax
movq 0x80(%rsp), %r12
movq 0x38(%rsp), %rbx
js 0x1ba5
movl %eax, %ebp
movq %r13, 0x108(%rsp)
xorl %eax, %eax
testq %r13, %r13
sets %al
fildll 0x108(%rsp)
leaq 0x1c86(%rip), %rcx      # 0x3060
fadds (%rcx,%rax,4)
fstpt 0x124(%rsp)
movq 0x88(%rsp), %rdx
movq %rdx, 0x110(%rsp)
xorl %eax, %eax
testq %rdx, %rdx
sets %al
fildll 0x110(%rsp)
fadds (%rcx,%rax,4)
fstpt 0x118(%rsp)
movl 0x190(%rsp), %eax
leal (%rax,%rax,2), %ecx
movl 0x18(%rsp), %edx
addl %edx, %ecx
movl %ecx, 0x4c(%rsp)
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x88(%rsp)
cvtsi2sd %edx, %xmm0
movsd %xmm0, 0xf8(%rsp)
movq %r14, 0x60(%rsp)
movl %ebp, 0x9c(%rsp)
fldt 0x124(%rsp)
fidivrl 0x9c(%rsp)
fldt 0x118(%rsp)
fmulp %st, %st(1)
fadds 0x1c0c(%rip)            # 0x3070
flds 0x1c0a(%rip)            # 0x3074
xorl %edx, %edx
fxch %st(1)
fucomi %st(1), %st
fldz
fcmovnb %st(2), %st
fstp %st(2)
fsubp %st, %st(1)
setae %al
fnstcw 0xe(%rsp)
movzwl 0xe(%rsp), %ecx
orl $0xc00, %ecx            # imm = 0xC00
movw %cx, 0x36(%rsp)
fldcw 0x36(%rsp)
fistpll 0x100(%rsp)
fldcw 0xe(%rsp)
cmpl 0x4c(%rsp), %ebp
jl 0x1b7b
movb %al, %dl
shlq $0x3f, %rdx
xorq 0x100(%rsp), %rdx
movq %rdx, 0x58(%rsp)
movq %r14, %rdi
movl 0x94(%rsp), %esi
leaq 0x130(%rsp), %r13
movq %r13, %rdx
leaq 0x140(%rsp), %r15
movq %r15, %rcx
callq 0x1f7a
movq 0x10(%r14), %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x2294
cmpq $0x0, 0x58(%rsp)
je 0x1b4d
incl %ebp
xorl %ecx, %ecx
movl %ebp, 0x50(%rsp)
movq %rcx, 0x40(%rsp)
callq 0x1e9c
mulsd 0x88(%rsp), %xmm0
addsd 0xf8(%rsp), %xmm0
addsd 0x1b0e(%rip), %xmm0     # 0x3038
cvttsd2si %xmm0, %eax
movl %r12d, %ebx
cmpl %eax, %r12d
jg 0x1538
movl %eax, %ebx
movl %ebp, %eax
subl %ebx, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x18(%rsp)
callq 0x11d0
mulsd 0x18(%rsp), %xmm0
cvttsd2si %xmm0, %eax
testl %eax, %eax
js 0x150b
movl %eax, %r13d
movq 0x30(%r14), %rcx
cmpq %r13, %rcx
jbe 0x150b
leal (%rbx,%rax), %r15d
decl %r15d
movslq %r15d, %rax
cmpq %rax, %rcx
jbe 0x150b
callq 0x11d0
movsd 0x1ab7(%rip), %xmm1     # 0x3038
ucomisd %xmm0, %xmm1
jbe 0x15c7
movq 0xa8(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0xc8(%rsp)
movl 0x198(%rsp), %eax
movl %eax, 0x24(%rsp)
movl 0x1a0(%rsp), %eax
movl %eax, 0x28(%rsp)
movl $0x0, 0x20(%rsp)
jmp 0x1604
movq 0xa8(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movl 0x198(%rsp), %eax
movl %eax, 0x28(%rsp)
movl 0x1a0(%rsp), %eax
movl %eax, 0x24(%rsp)
pushq $0x1
popq %rax
movl %eax, 0x20(%rsp)
movq 0x78(%rsp), %rbx
callq 0x11d0
xorl %eax, %eax
movsd 0x1a20(%rip), %xmm1     # 0x3038
ucomisd %xmm0, %xmm1
setbe %al
shll $0x4, %eax
andq $0x0, 0xa0(%rsp)
movq 0x138(%rsp,%rax), %r10
movq 0x30(%r14), %rdx
movl 0x24(%rsp), %esi
movl %esi, %ecx
cmpq %r13, %rdx
seta %dil
testl %esi, %esi
setg %r8b
andb %dil, %r8b
movq $0x0, 0x68(%rsp)
movl $0x0, %esi
movq %rsi, 0x70(%rsp)
movl $0x0, %r11d
pushq $-0xa
popq %rax
movl $0x0, %esi
cmpb $0x1, %r8b
movq %r10, 0x10(%rsp)
jne 0x1776
xorl %esi, %esi
pushq $-0xa
popq %r8
xorl %r11d, %r11d
movq $0x0, 0x70(%rsp)
movzwl (%r10,%r13,2), %edi
movl %edi, %r9d
andl $0xf000, %r9d           # imm = 0xF000
testl %r8d, %r8d
js 0x16f6
movl %r8d, %eax
cmpl $0xf000, %r9d           # imm = 0xF000
jne 0x16b7
incl %r11d
jmp 0x1763
movslq %esi, %r8
cmpl $0xe000, %r9d           # imm = 0xE000
je 0x16c8
testl %r9d, %r9d
jne 0x170c
xorl %r10d, %r10d
cmpl $0xe000, %r9d           # imm = 0xE000
sete %r10b
andb $0xf, %dil
leal 0x1(%r8), %esi
movb %dil, (%rbx,%r8)
movq 0x70(%rsp), %rdi
addl %r10d, %edi
movq 0x10(%rsp), %r10
movq %rdi, 0x70(%rsp)
jmp 0x1763
movl %r13d, %eax
cmpl $0xe000, %r9d           # imm = 0xE000
je 0x16a6
testl %r9d, %r9d
je 0x16a6
movl %r8d, %eax
jmp 0x1763
incl %r11d
movl %edi, %esi
andb $0xf, %sil
movb %sil, (%rbx,%r8)
movl %r8d, %esi
incl %esi
cmpw $0x1000, %di            # imm = 0x1000
jb 0x1763
cmpl %ecx, %esi
jge 0x1763
movl %edi, %r8d
shrl $0x4, %r8d
shrl $0xc, %edi
movslq %esi, %r9
incq %r9
movl %r8d, %r10d
andb $0x3, %r10b
movb %r10b, -0x1(%rbx,%r9)
incl %esi
cmpl $0x2, %edi
jl 0x175e
decl %edi
shrl $0x2, %r8d
leaq 0x1(%r9), %r10
cmpq %rcx, %r9
movq %r10, %r9
jl 0x1739
movq 0x10(%rsp), %r10
incq %r13
cmpq %r13, %rdx
jbe 0x1776
movl %eax, %r8d
cmpl %ecx, %esi
jl 0x168f
movq %r11, 0xf0(%rsp)
cmpl %ecx, %esi
pushq $-0xa
popq %r13
cmovnel %r13d, %eax
movl %eax, 0x30(%rsp)
movl $0x0, %edx
movq %rdx, 0x18(%rsp)
movl $0x0, %ecx
testl %r15d, %r15d
movq 0xb8(%rsp), %r11
pushq $0x4
popq %rbx
js 0x18e1
movq 0x30(%r14), %rdx
movslq 0x28(%rsp), %rsi
xorl %ecx, %ecx
pushq $-0xa
popq %r8
movq $0x0, 0x18(%rsp)
movq $0x0, 0x68(%rsp)
movl %r15d, %edi
cmpq %rdi, %rdx
jbe 0x18de
cmpl %esi, %ecx
jge 0x18de
movzwl (%r10,%rdi,2), %edi
movl %edi, %r9d
andl $0xf000, %r9d           # imm = 0xF000
testl %r8d, %r8d
js 0x1852
movl %r8d, %r13d
cmpl $0xf000, %r9d           # imm = 0xF000
jne 0x1815
movq 0x18(%rsp), %rax
incl %eax
movq %rax, 0x18(%rsp)
jmp 0x18c9
movslq %ecx, %r8
cmpl $0xe000, %r9d           # imm = 0xE000
je 0x1826
testl %r9d, %r9d
jne 0x186b
xorl %r10d, %r10d
cmpl $0xe000, %r9d           # imm = 0xE000
sete %r10b
andb $0xf, %dil
incl %ecx
movb %dil, (%r11,%r8)
movq 0x68(%rsp), %rdi
addl %r10d, %edi
movq 0x10(%rsp), %r10
movq %rdi, 0x68(%rsp)
jmp 0x18c9
movl %r15d, %r13d
cmpl $0xe000, %r9d           # imm = 0xE000
je 0x17fb
movl %r15d, %r13d
testl %r9d, %r9d
je 0x17fb
movl %r8d, %r13d
jmp 0x18c9
movq 0x18(%rsp), %rax
incl %eax
movq %rax, 0x18(%rsp)
movl %edi, %r9d
andb $0xf, %r9b
movb %r9b, (%r11,%r8)
incl %ecx
cmpw $0x1000, %di            # imm = 0x1000
jb 0x18c9
cmpl %esi, %ecx
jge 0x18c9
movl %edi, %r8d
shrl $0x4, %r8d
shrl $0xc, %edi
movslq %ecx, %r9
incq %r9
movl %r8d, %r10d
andb $0x3, %r10b
movb %r10b, -0x1(%r11,%r9)
incl %ecx
cmpl $0x2, %edi
jl 0x18c4
decl %edi
shrl $0x2, %r8d
leaq 0x1(%r9), %r10
cmpq %rsi, %r9
movq %r10, %r9
jl 0x189f
movq 0x10(%rsp), %r10
leal -0x1(%r15), %edi
movl %r13d, %r8d
testl %r15d, %r15d
movl %edi, %r15d
jg 0x17d0
jmp 0x18e1
movl %r8d, %r13d
movl 0x28(%rsp), %eax
cmpl %eax, %ecx
pushq $-0xa
popq %rcx
cmovnel %ecx, %r13d
movl %r13d, 0x10(%rsp)
testl %eax, %eax
jle 0x1919
xorl %ecx, %ecx
movb (%r11,%rcx), %dl
movb $0x3, %sil
subb %dl, %sil
cmpb $0x4, %dl
movzbl %sil, %edx
cmovael %ebx, %edx
movb %dl, (%r11,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x18f9
movl 0x30(%rsp), %eax
testl %eax, %eax
movq 0x38(%rsp), %rbx
movq 0x58(%rsp), %rax
js 0x19ed
cmpl $0x0, 0x10(%rsp)
js 0x19ed
movb $0x1, %cl
xorl %r15d, %r15d
movb %cl, 0x2c(%rsp)
movslq 0x24(%rsp,%r15,4), %r13
testq %r13, %r13
jle 0x19b0
movq 0xd0(%rsp,%r15,8), %r14
xorl %r12d, %r12d
xorl %ebx, %ebx
movb (%r14,%r12), %bpl
cmpb $0x4, %bpl
jb 0x196b
incl %ebx
movb $0x4, %bpl
jmp 0x198d
callq 0x11d0
movsd 0x37a0(%rip), %xmm1     # 0x5118
ucomisd %xmm0, %xmm1
jbe 0x198d
incb %bpl
andb $0x3, %bpl
incl 0xa0(%rsp,%r15,4)
movb %bpl, (%r14,%r12)
incq %r12
cmpq %r12, %r13
jne 0x195a
cvtsi2sd %ebx, %xmm0
movq 0x80(%rsp), %r12
movq 0x60(%rsp), %r14
movl 0x50(%rsp), %ebp
jmp 0x19b4
xorpd %xmm0, %xmm0
cvtsi2sd %r13d, %xmm1
divsd %xmm1, %xmm0
ucomisd 0x16a3(%rip), %xmm0     # 0x3068
ja 0x19dc
leaq 0x1(%r15), %rax
testq %r15, %r15
sete %cl
movq %rax, %r15
je 0x193f
jmp 0x19f7
testb $0x1, 0x2c(%rsp)
je 0x19f7
movq 0x38(%rsp), %rbx
movq 0x58(%rsp), %rax
movq 0x40(%rsp), %rcx
jmp 0x1b44
incl 0x30(%rsp)
incl 0x10(%rsp)
movl 0xa0(%rsp), %eax
movl %eax, 0x2c(%rsp)
movl 0xa4(%rsp), %eax
movq %rax, 0xe8(%rsp)
pushq $0x2
popq %rcx
movl 0x20(%rsp), %eax
subl %eax, %ecx
movl %ecx, 0x98(%rsp)
incl %eax
movl %eax, 0x20(%rsp)
xorl %r13d, %r13d
movq 0x38(%rsp), %rbx
movslq 0x24(%rsp,%r13,4), %rbp
testq %rbp, %rbp
jle 0x1a56
movzbl 0x54(%rsp), %esi
movq %rbx, %rdi
movq %rbp, %rdx
callq 0x10b0
movq %rbp, %rax
jmp 0x1a58
xorl %eax, %eax
movq 0x60(%rsp), %rcx
movb $0x0, (%rbx,%rax)
movq 0xc0(%rsp,%r13,8), %r15
movq 0x10(%rcx), %rdx
testq %r13, %r13
movl 0x98(%rsp), %eax
movl %eax, %r10d
cmovel 0x20(%rsp), %r10d
subq $0x8, %rsp
movq %r15, %rdi
leaq 0x1832(%rip), %rsi      # 0x32c0
movl 0x38(%rsp), %ecx
movl 0x18(%rsp), %r8d
movl 0x34(%rsp), %r9d
xorl %eax, %eax
pushq %r10
pushq 0x50(%rsp)
pushq 0x30(%rsp)
pushq 0x88(%rsp)
pushq 0x110(%rsp)
pushq 0x120(%rsp)
pushq 0xa8(%rsp)
callq 0x1100
addq $0x40, %rsp
testl %ebp, %ebp
leaq 0x16ba(%rip), %r12      # 0x3190
jle 0x1afd
movq 0xd0(%rsp,%r13,8), %rbx
xorl %r14d, %r14d
movzbl (%rbx,%r14), %eax
movsbl (%rax,%r12), %edi
movq %r15, %rsi
callq 0x10d0
incq %r14
cmpq %r14, %rbp
jne 0x1ae3
movq %r15, %rdi
leaq 0x17de(%rip), %rsi      # 0x32e5
movq 0x38(%rsp), %rbx
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1100
leaq 0x1(%r13), %rax
testq %r13, %r13
movq %rax, %r13
movq 0x80(%rsp), %r12
je 0x1a37
movq 0x40(%rsp), %rcx
incq %rcx
movq 0x60(%rsp), %r14
movl 0x50(%rsp), %ebp
movq 0x58(%rsp), %rax
cmpq %rax, %rcx
jne 0x1506
movq 0x138(%rsp), %rdi
callq 0x1040
movq 0x148(%rsp), %rdi
callq 0x1040
movq %r14, %rdi
callq 0x25b1
movl %eax, %ebp
testl %eax, %eax
jns 0x1440
jmp 0x1ba5
movq 0x3476(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
movq 0x10(%r14), %rcx
leaq 0x16fd(%rip), %rsi      # 0x328d
leaq 0x16c4(%rip), %rdx      # 0x325b
movl 0x4c(%rsp), %r8d
xorl %eax, %eax
callq 0x1100
jmp 0x1b67
movq %r14, %rdi
callq 0x28dc
movq 0xe0(%rsp), %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1040
movq 0x78(%rsp), %rdi
callq 0x1040
movq 0xb8(%rsp), %rdi
callq 0x1040
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq