// File: /workspace/github_c_makefile_star2_O3/lh3[P]bgt/bgt.c
// Function: bgtm_prepare
int bgtm_prepare(bgtm_t *bm)
{
	int i, j, m;
	kstring_t h = {0,0,0};
	bcf_hdr_t *h0;

	if (bm->n_bgt == 0) return 0;

	// prepare group and sample_idx
	for (i = bm->n_out = 0; i < bm->n_bgt; ++i) {
		bgt_prepare(bm->bgt[i]);
		bm->n_out += bm->bgt[i]->n_out;
	}
	bm->mgs = (int32_t*)realloc(bm->mgs, bm->n_out * 4);
	bm->group = (uint32_t*)realloc(bm->group, bm->n_out * 4);
	bm->sample_idx = (uint64_t*)realloc(bm->sample_idx, bm->n_out * 8);
	for (i = m = 0; i < bm->n_bgt; ++i) {
		bgt_t *bgt = bm->bgt[i];
		for (j = 0; j < bm->bgt[i]->n_out; ++j) {
			bm->sample_idx[m] = (uint64_t)i<<32 | bgt->out[j];
			bm->group[m] = bm->n_groups? bgt->group[j] : 1;
			bm->mgs[m++] = bgt->f->mgs[bgt->out[j]] >= 0? bgt->f->mgs[bgt->out[j]] : bm->mgs_def;
		}
	}
	if (bm->n_groups == 0) bm->n_groups = 1;
	for (i = m = 0; i < bm->n_out; ++i)
		if (bm->mgs[i] <= 1) ++m;
	if (m == 0) bm->flag |= BGT_F_NO_GT;

	// prepare header
	h0 = bm->bgt[0]->f->h0; // FIXME: test if headers are consistent
	kputs("##fileformat=VCFv4.1\n", &h);
	kputs("##INFO=<ID=AC,Number=A,Type=String,Description=\"Count of alternate alleles\">\n", &h);
	kputs("##INFO=<ID=AN,Number=A,Type=String,Description=\"Count of total alleles\">\n", &h);
	for (i = 1; i <= bm->n_groups; ++i) {
		ksprintf(&h, "##INFO=<ID=AC%d,Number=A,Type=String,Description=\"Count of alternate alleles for sample group %d\">\n", i, i);
		ksprintf(&h, "##INFO=<ID=AN%d,Number=A,Type=String,Description=\"Count of total alleles for sample group %d\">\n", i, i);
	}
	kputs("##INFO=<ID=END,Number=1,Type=Integer,Description=\"Ending position\">\n", &h);
	kputs("##FORMAT=<ID=GT,Number=1,Type=String,Description=\"Genotype\">\n", &h);
	kputs("##ALT=<ID=M,Description=\"Multi-allele\">\n", &h);
	kputs("##ALT=<ID=DEL,Description=\"Deletion\">\n", &h);
	kputs("##ALT=<ID=DUP,Description=\"Duplication\">\n", &h);
	kputs("##ALT=<ID=INS,Description=\"Insertion\">\n", &h);
	kputs("##ALT=<ID=INV,Description=\"Inversion\">\n", &h);
	kputs("##ALT=<ID=DUP:TANDEM,Description=\"Tandem duplication\">\n", &h);
	kputs("##ALT=<ID=DEL:ME,Description=\"Deletion of mobile element\">\n", &h);
	kputs("##ALT=<ID=INS:ME,Description=\"Insertion of mobile element\">\n", &h);
	for (i = 0; i < h0->n[BCF_DT_CTG]; ++i)
		ksprintf(&h, "##contig=<ID=%s,length=%d>\n", h0->id[BCF_DT_CTG][i].key, h0->id[BCF_DT_CTG][i].val->info[0]);
	kputs("#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO", &h);
	if (!(bm->flag & BGT_F_NO_GT)) {
		kputs("\tFORMAT", &h);
		for (i = m = 0; i < bm->n_bgt; ++i) {
			bgt_t *bgt = bm->bgt[i];
			for (j = 0; j < bgt->n_out; ++j) {
				if (bm->mgs[m++] > 1) continue;
				kputc('\t', &h);
				kputs(bgt->f->f->rows[bgt->out[j]].name, &h);
			}
		}
	}
	if (bm->h_out) bcf_hdr_destroy(bm->h_out);
	bm->h_out = bcf_hdr_init();
	bm->h_out->l_text = h.l + 1, bm->h_out->m_text = h.m, bm->h_out->text = h.s;
	bcf_hdr_parse(bm->h_out);

	// prepare the haplotype arrays
	bm->a[0] = (uint8_t*)realloc(bm->a[0], bm->n_out<<1);
	bm->a[1] = (uint8_t*)realloc(bm->a[1], bm->n_out<<1);

	if (bm->h_al != 0) {
		if (bm->flag&BGT_F_CNT_AL)
			bm->alcnt = (int*)calloc(bm->n_out, sizeof(int));
		if (bm->flag&BGT_F_CNT_HAP)
			bm->hap = (uint64_t*)calloc(bm->n_out<<1, 8);
		bm->aal = (bgt_allele_t*)calloc(kh_size((khash_t(str)*)bm->h_al) * 2, sizeof(bgt_allele_t));
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movl (%rdi), %eax
testl %eax, %eax
je 0x19820
movq %rdi, %r13
movl $0x0, 0x4(%rdi)
jle 0x18c7d
movq 0x38(%r13), %rax
xorl %ebx, %ebx
movq (%rax,%rbx,8), %rdi
callq 0x16816
movq 0x38(%r13), %rax
movq (%rax,%rbx,8), %rcx
movslq 0x34(%rcx), %rcx
movslq 0x4(%r13), %rsi
addq %rcx, %rsi
movl %esi, 0x4(%r13)
incq %rbx
movslq (%r13), %rcx
cmpq %rcx, %rbx
jl 0x18c4b
shlq $0x2, %rsi
jmp 0x18c7f
xorl %esi, %esi
movq 0x28(%r13), %rdi
callq 0x2330
movq %rax, 0x28(%r13)
movq 0x20(%r13), %rdi
movslq 0x4(%r13), %rsi
shlq $0x2, %rsi
callq 0x2330
movq %rax, 0x20(%r13)
movq 0x18(%r13), %rdi
movslq 0x4(%r13), %rsi
shlq $0x3, %rsi
callq 0x2330
movq %rax, 0x18(%r13)
movl (%r13), %r8d
testl %r8d, %r8d
jle 0x18d5b
movq 0x38(%r13), %rcx
xorl %edx, %edx
xorl %esi, %esi
movq (%rcx,%rdx,8), %rdi
cmpl $0x0, 0x34(%rdi)
jle 0x18d4c
movq %rdx, %r8
shlq $0x20, %r8
movq (%rdi), %r10
movq 0x40(%rdi), %r9
movq 0x20(%r10), %r10
movslq %esi, %r11
leaq (%rax,%r11,8), %rbx
shlq $0x2, %r11
movq 0x20(%r13), %r14
addq %r11, %r14
addq 0x28(%r13), %r11
xorl %r15d, %r15d
movslq (%r9,%r15,4), %r12
orq %r8, %r12
movq %r12, (%rbx,%r15,8)
cmpl $0x0, 0x8(%r13)
je 0x18d1c
movq 0x48(%rdi), %r12
movl (%r12,%r15,4), %ebp
jmp 0x18d21
movl $0x1, %ebp
movl %ebp, (%r14,%r15,4)
movslq (%r9,%r15,4), %r12
movl (%r10,%r12,4), %ebp
testl %ebp, %ebp
jns 0x18d35
movl 0x30(%r13), %ebp
movl %ebp, (%r11,%r15,4)
incq %r15
movslq 0x34(%rdi), %r12
cmpq %r12, %r15
jl 0x18d00
addl %r15d, %esi
movl (%r13), %r8d
incq %rdx
movslq %r8d, %rdi
cmpq %rdi, %rdx
jl 0x18ccb
movl 0x8(%r13), %ebx
testl %ebx, %ebx
jne 0x18d70
movl $0x1, 0x8(%r13)
movl $0x1, %ebx
movslq 0x4(%r13), %rax
testq %rax, %rax
jle 0x18d99
movq 0x28(%r13), %rcx
xorl %edx, %edx
xorl %esi, %esi
xorl %edi, %edi
cmpl $0x2, (%rcx,%rdx,4)
setl %dil
addl %edi, %esi
incq %rdx
cmpq %rdx, %rax
jne 0x18d81
testl %esi, %esi
jne 0x18d9e
orb $0x2, 0xc(%r13)
movq 0x38(%r13), %rax
movq (%rax), %rax
movq (%rax), %rax
movq 0x10(%rax), %rbp
movl $0x20, %edi
callq 0x22e0
movabsq $0xa312e3476464356, %rcx # imm = 0xA312E3476464356
movq %rcx, 0xd(%rax)
movups 0x6b00(%rip), %xmm0     # 0x1f8cb
movups %xmm0, (%rax)
xorl %r15d, %r15d
movb %r15b, 0x15(%rax)
movl $0x80, %esi
movq %rax, %rdi
callq 0x2330
movq %rax, %r14
leaq 0x15(%rax), %rdi
leaq 0x6af1(%rip), %rsi      # 0x1f8e1
movl $0x4d, %edx
callq 0x2280
movb %r15b, 0x62(%r14)
movq $0x100, 0x8(%rsp)       # imm = 0x100
movl $0x100, %r12d           # imm = 0x100
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdi
callq 0x2330
movq %rax, %r14
movq %rax, 0x10(%rsp)
leaq 0x62(%rax), %rdi
leaq 0x6b02(%rip), %rsi      # 0x1f92f
movl $0x49, %edx
callq 0x2280
movq $0xab, (%rsp)
movb %r15b, 0xab(%r14)
testl %ebx, %ebx
jle 0x18e9f
movl $0x1, %r15d
leaq 0x6b22(%rip), %r14      # 0x1f979
movq %rsp, %r12
leaq 0x6b7c(%rip), %rbx      # 0x1f9dd
movq %r12, %rdi
movq %r14, %rsi
movl %r15d, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x19831
movq %r12, %rdi
movq %rbx, %rsi
movl %r15d, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x19831
leal 0x1(%r15), %eax
cmpl 0x8(%r13), %r15d
movl %eax, %r15d
jl 0x18e61
movq (%rsp), %rbx
movq 0x8(%rsp), %r12
jmp 0x18ea4
movl $0xab, %ebx
leaq 0x45(%rbx), %rax
cmpq %r12, %rax
jae 0x18eb4
movq 0x10(%rsp), %r14
jmp 0x18eff
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, %r14
movq %rax, 0x10(%rsp)
leaq (%r14,%rbx), %rdi
leaq 0x6b33(%rip), %rsi      # 0x1fa3d
movl $0x44, %edx
callq 0x2280
leaq 0x44(%rbx), %rax
movq %rax, (%rsp)
movb $0x0, 0x44(%r14,%rbx)
movq (%rsp), %rbx
leaq 0x3e(%rbx), %rax
cmpq 0x8(%rsp), %rax
jae 0x18f38
movq 0x10(%rsp), %rax
jmp 0x18f80
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movups 0x6b28(%rip), %xmm0     # 0x1faaf
movups %xmm0, 0x2d(%rax,%rbx)
movups 0x6b0f(%rip), %xmm0     # 0x1faa2
movups %xmm0, 0x20(%rax,%rbx)
movups 0x6af3(%rip), %xmm0     # 0x1fa92
movups %xmm0, 0x10(%rax,%rbx)
movups 0x6ad7(%rip), %xmm0     # 0x1fa82
movups %xmm0, (%rax,%rbx)
leaq 0x3d(%rbx), %rcx
movq %rcx, (%rsp)
movb $0x0, 0x3d(%rax,%rbx)
movq (%rsp), %rbx
leaq 0x29(%rbx), %rax
cmpq 0x8(%rsp), %rax
jae 0x18fd2
movq 0x10(%rsp), %rax
jmp 0x1901a
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movups 0x6aaf(%rip), %xmm0     # 0x1fad0
movups %xmm0, 0x10(%rax,%rbx)
movups 0x6a93(%rip), %xmm0     # 0x1fac0
movups %xmm0, (%rax,%rbx)
movabsq $0xa3e22656c656c6c, %rcx # imm = 0xA3E22656C656C6C
movq %rcx, 0x20(%rax,%rbx)
leaq 0x28(%rbx), %rcx
movq %rcx, (%rsp)
movb $0x0, 0x28(%rax,%rbx)
movq (%rsp), %rbx
leaq 0x27(%rbx), %rax
cmpq 0x8(%rsp), %rax
jae 0x19063
movq 0x10(%rsp), %rax
jmp 0x190ab
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movups 0x6a47(%rip), %xmm0     # 0x1faf9
movups %xmm0, 0x10(%rax,%rbx)
movups 0x6a2b(%rip), %xmm0     # 0x1fae9
movups %xmm0, (%rax,%rbx)
movabsq $0xa3e226e6f697465, %rcx # imm = 0xA3E226E6F697465
movq %rcx, 0x1e(%rax,%rbx)
leaq 0x26(%rbx), %rcx
movq %rcx, (%rsp)
movb $0x0, 0x26(%rax,%rbx)
movq (%rsp), %rbx
leaq 0x2a(%rbx), %rax
cmpq 0x8(%rsp), %rax
jae 0x190f4
movq 0x10(%rsp), %rax
jmp 0x1913c
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movups 0x69e6(%rip), %xmm0     # 0x1fb29
movups %xmm0, 0x19(%rax,%rbx)
movups 0x69d1(%rip), %xmm0     # 0x1fb20
movups %xmm0, 0x10(%rax,%rbx)
movups 0x69b5(%rip), %xmm0     # 0x1fb10
movups %xmm0, (%rax,%rbx)
leaq 0x29(%rbx), %rcx
movq %rcx, (%rsp)
movb $0x0, 0x29(%rax,%rbx)
movq (%rsp), %rbx
leaq 0x28(%rbx), %rax
cmpq 0x8(%rsp), %rax
jae 0x19182
movq 0x10(%rsp), %rax
jmp 0x191ca
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movups 0x6979(%rip), %xmm0     # 0x1fb4a
movups %xmm0, 0x10(%rax,%rbx)
movups 0x695d(%rip), %xmm0     # 0x1fb3a
movups %xmm0, (%rax,%rbx)
movabsq $0xa3e226e6f697472, %rcx # imm = 0xA3E226E6F697472
movq %rcx, 0x1f(%rax,%rbx)
leaq 0x27(%rbx), %rcx
movq %rcx, (%rsp)
movb $0x0, 0x27(%rax,%rbx)
movq (%rsp), %rbx
leaq 0x28(%rbx), %rax
cmpq 0x8(%rsp), %rax
jae 0x19213
movq 0x10(%rsp), %rax
jmp 0x1925b
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movups 0x6910(%rip), %xmm0     # 0x1fb72
movups %xmm0, 0x10(%rax,%rbx)
movups 0x68f4(%rip), %xmm0     # 0x1fb62
movups %xmm0, (%rax,%rbx)
movabsq $0xa3e226e6f697372, %rcx # imm = 0xA3E226E6F697372
movq %rcx, 0x1f(%rax,%rbx)
leaq 0x27(%rbx), %rcx
movq %rcx, (%rsp)
movb $0x0, 0x27(%rax,%rbx)
movq (%rsp), %rbx
leaq 0x38(%rbx), %rax
cmpq 0x8(%rsp), %rax
jae 0x192a4
movq 0x10(%rsp), %rax
jmp 0x192ec
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movups 0x68b7(%rip), %xmm0     # 0x1fbaa
movups %xmm0, 0x20(%rax,%rbx)
movups 0x689b(%rip), %xmm0     # 0x1fb9a
movups %xmm0, 0x10(%rax,%rbx)
movups 0x687f(%rip), %xmm0     # 0x1fb8a
movups %xmm0, (%rax,%rbx)
movabsq $0xa3e226e6f697461, %rcx # imm = 0xA3E226E6F697461
movq %rcx, 0x2f(%rax,%rbx)
leaq 0x37(%rbx), %rcx
movq %rcx, (%rsp)
movb $0x0, 0x37(%rax,%rbx)
movq (%rsp), %rbx
leaq 0x3c(%rbx), %rax
cmpq 0x8(%rsp), %rax
jae 0x19341
movq 0x10(%rsp), %rax
jmp 0x19389
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movups 0x685d(%rip), %xmm0     # 0x1fbed
movups %xmm0, 0x2b(%rax,%rbx)
movups 0x6846(%rip), %xmm0     # 0x1fbe2
movups %xmm0, 0x20(%rax,%rbx)
movups 0x682a(%rip), %xmm0     # 0x1fbd2
movups %xmm0, 0x10(%rax,%rbx)
movups 0x680e(%rip), %xmm0     # 0x1fbc2
movups %xmm0, (%rax,%rbx)
leaq 0x3b(%rbx), %rcx
movq %rcx, (%rsp)
movb $0x0, 0x3b(%rax,%rbx)
movq (%rsp), %rbx
leaq 0x3d(%rbx), %rax
cmpq 0x8(%rsp), %rax
jae 0x193db
movq 0x10(%rsp), %rax
jmp 0x19423
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movups 0x6800(%rip), %xmm0     # 0x1fc2a
movups %xmm0, 0x2c(%rax,%rbx)
movups 0x67e8(%rip), %xmm0     # 0x1fc1e
movups %xmm0, 0x20(%rax,%rbx)
movups 0x67cc(%rip), %xmm0     # 0x1fc0e
movups %xmm0, 0x10(%rax,%rbx)
movups 0x67b0(%rip), %xmm0     # 0x1fbfe
movups %xmm0, (%rax,%rbx)
leaq 0x3c(%rbx), %rcx
movq %rcx, (%rsp)
movb $0x0, 0x3c(%rax,%rbx)
cmpl $0x0, 0xc(%rbp)
jle 0x194a3
movl $0x8, %ebx
leaq 0x67ca(%rip), %r14      # 0x1fc3b
movq %rsp, %r15
xorl %r12d, %r12d
movq 0x20(%rbp), %rax
movq -0x8(%rax,%rbx), %rdx
movq (%rax,%rbx), %rax
movl (%rax), %ecx
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x19831
incq %r12
movslq 0xc(%rbp), %rax
addq $0x10, %rbx
cmpq %rax, %r12
jl 0x19477
movq (%rsp), %rbx
leaq 0x27(%rbx), %rax
cmpq 0x8(%rsp), %rax
jae 0x194b9
movq 0x10(%rsp), %rax
jmp 0x19501
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movups 0x675f(%rip), %xmm0     # 0x1fc67
movups %xmm0, 0x10(%rax,%rbx)
movups 0x6743(%rip), %xmm0     # 0x1fc57
movups %xmm0, (%rax,%rbx)
movabsq $0x4f464e4909524554, %rcx # imm = 0x4F464E4909524554
movq %rcx, 0x1e(%rax,%rbx)
leaq 0x26(%rbx), %rcx
movq %rcx, (%rsp)
movb $0x0, 0x26(%rax,%rbx)
testb $0x2, 0xc(%r13)
jne 0x1975d
movq (%rsp), %rbx
leaq 0x8(%rbx), %rax
cmpq 0x8(%rsp), %rax
jae 0x19555
movq 0x10(%rsp), %rax
jmp 0x1959d
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movl $0x54414d52, 0x3(%rax,%rbx) # imm = 0x54414D52
movl $0x524f4609, (%rax,%rbx) # imm = 0x524F4609
leaq 0x7(%rbx), %rcx
movq %rcx, (%rsp)
movb $0x0, 0x7(%rax,%rbx)
movl (%r13), %eax
testl %eax, %eax
jle 0x1975d
xorl %edx, %edx
xorl %esi, %esi
movq %r13, 0x28(%rsp)
movq 0x38(%r13), %rcx
movq (%rcx,%rdx,8), %rbp
movl 0x34(%rbp), %ecx
testl %ecx, %ecx
jle 0x1974e
movq %rdx, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
movslq %esi, %rdx
shlq $0x2, %rdx
xorl %ebx, %ebx
movq %rdx, 0x30(%rsp)
movq 0x28(%r13), %rax
addq %rdx, %rax
cmpl $0x1, (%rax,%rbx,4)
jg 0x19730
movq (%rsp), %r14
leaq 0x1(%r14), %r15
cmpq 0x8(%rsp), %r15
jae 0x1961f
movq 0x10(%rsp), %rax
jmp 0x19667
movq %r15, %rax
shrq %rax
orq %r15, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rsi
shrq $0x10, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movq %r15, (%rsp)
movb $0x9, (%rax,%r14)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
movb $0x0, (%rcx,%rax)
movq (%rbp), %rax
movq 0x40(%rbp), %rcx
movq 0x8(%rax), %rax
movq 0x28(%rax), %rax
movslq (%rcx,%rbx,4), %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %r14
movq %r14, %rdi
callq 0x2170
movq (%rsp), %r13
movslq %eax, %r15
leaq (%r15,%r13), %rax
incq %rax
cmpq 0x8(%rsp), %rax
jae 0x196bd
movq 0x10(%rsp), %r12
jmp 0x19708
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, %r12
movq %rax, 0x10(%rsp)
leaq (%r12,%r13), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2280
addq %r15, %r13
movq %r13, (%rsp)
movb $0x0, (%r12,%r13)
movl 0x34(%rbp), %ecx
movq 0x28(%rsp), %r13
movq 0x30(%rsp), %rdx
incq %rbx
movslq %ecx, %rax
cmpq %rax, %rbx
jl 0x195f8
movl 0x1c(%rsp), %esi
addl %ebx, %esi
movl (%r13), %eax
movq 0x20(%rsp), %rdx
incq %rdx
movslq %eax, %rcx
cmpq %rcx, %rdx
jl 0x195ce
movq 0x50(%r13), %rdi
testq %rdi, %rdi
je 0x1976b
callq 0xb980
callq 0xb93d
movq %rax, 0x50(%r13)
movl (%rsp), %ecx
incl %ecx
movl %ecx, (%rax)
movl 0x8(%rsp), %ecx
movl %ecx, 0x4(%rax)
movq 0x10(%rsp), %rcx
movq %rcx, 0x48(%rax)
movq %rax, %rdi
callq 0xb797
movq 0x58(%r13), %rdi
movl 0x4(%r13), %eax
addl %eax, %eax
movslq %eax, %rsi
callq 0x2330
movq %rax, 0x58(%r13)
movq 0x60(%r13), %rdi
movl 0x4(%r13), %eax
addl %eax, %eax
movslq %eax, %rsi
callq 0x2330
movq %rax, 0x60(%r13)
movq 0xa0(%r13), %rbx
testq %rbx, %rbx
je 0x19820
movl 0xc(%r13), %ebp
testb $0x4, %bpl
je 0x197ea
movslq 0x4(%r13), %rdi
movl $0x4, %esi
callq 0x2220
movq %rax, 0xa8(%r13)
testb $0x8, %bpl
je 0x1980a
movl 0x4(%r13), %eax
addl %eax, %eax
movslq %eax, %rdi
movl $0x8, %esi
callq 0x2220
movq %rax, 0xb0(%r13)
movl 0x4(%rbx), %edi
addl %edi, %edi
movl $0x30, %esi
callq 0x2220
movq %rax, 0x98(%r13)
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq