// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
cmpl $0x0, (%rdi)
je 0x19094
movq %rdi, %rbx
movl $0x0, 0x4(%rdi)
cmpl $0x0, (%rdi)
jle 0x18403
xorl %r14d, %r14d
movq 0x38(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x161e0
movq 0x38(%rbx), %rax
movq (%rax,%r14,8), %rax
movl 0x34(%rax), %eax
addl %eax, 0x4(%rbx)
incq %r14
movslq (%rbx), %rax
cmpq %rax, %r14
jl 0x183dd
movq 0x28(%rbx), %rdi
movslq 0x4(%rbx), %rsi
shlq $0x2, %rsi
callq 0x2330
movq %rax, 0x28(%rbx)
movq 0x20(%rbx), %rdi
movslq 0x4(%rbx), %rsi
shlq $0x2, %rsi
callq 0x2330
movq %rax, 0x20(%rbx)
movq 0x18(%rbx), %rdi
movslq 0x4(%rbx), %rsi
shlq $0x3, %rsi
callq 0x2330
movq %rax, 0x18(%rbx)
cmpl $0x0, (%rbx)
jle 0x184de
movq 0x38(%rbx), %rcx
xorl %edx, %edx
xorl %esi, %esi
movq (%rcx,%rdx,8), %rdi
cmpl $0x0, 0x34(%rdi)
jle 0x184cf
movq %rdx, %r8
shlq $0x20, %r8
movq (%rdi), %r10
movq 0x40(%rdi), %r9
movq 0x20(%r10), %r10
movslq %esi, %r11
leaq (%rax,%r11,8), %r14
shlq $0x2, %r11
movq 0x20(%rbx), %r15
addq %r11, %r15
addq 0x28(%rbx), %r11
xorl %r12d, %r12d
movslq (%r9,%r12,4), %r13
orq %r8, %r13
movq %r13, (%r14,%r12,8)
cmpl $0x0, 0x8(%rbx)
je 0x184a4
movq 0x48(%rdi), %r13
movl (%r13,%r12,4), %ebp
jmp 0x184a9
movl $0x1, %ebp
movl %ebp, (%r15,%r12,4)
movslq (%r9,%r12,4), %r13
movl (%r10,%r13,4), %ebp
testl %ebp, %ebp
jns 0x184bc
movl 0x30(%rbx), %ebp
movl %ebp, (%r11,%r12,4)
incq %r12
movslq 0x34(%rdi), %r13
cmpq %r13, %r12
jl 0x18488
addl %r12d, %esi
incq %rdx
movslq (%rbx), %rdi
cmpq %rdi, %rdx
jl 0x18453
cmpl $0x0, 0x8(%rbx)
jne 0x184eb
movl $0x1, 0x8(%rbx)
movslq 0x4(%rbx), %rax
testq %rax, %rax
jle 0x18514
movq 0x28(%rbx), %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 0x184fc
testl %esi, %esi
jne 0x18518
orb $0x2, 0xc(%rbx)
movq 0x38(%rbx), %rax
movq (%rax), %rax
movq (%rax), %rax
movq 0x10(%rax), %rbp
movq (%rsp), %rax
addq $0x16, %rax
cmpq 0x8(%rsp), %rax
jb 0x1857d
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)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
movups 0x731e(%rip), %xmm0     # 0x1f8ab
movups %xmm0, (%rcx,%rax)
movabsq $0xa312e3476464356, %rdx # imm = 0xA312E3476464356
movq %rdx, 0xd(%rcx,%rax)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
leaq 0x15(%rax), %rdx
movq %rdx, (%rsp)
movb $0x0, 0x15(%rcx,%rax)
movq (%rsp), %rax
addq $0x4e, %rax
cmpq 0x8(%rsp), %rax
jb 0x1860d
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)
movq (%rsp), %r14
movq 0x10(%rsp), %r15
leaq (%r15,%r14), %rdi
leaq 0x72a0(%rip), %rsi      # 0x1f8c1
movl $0x4d, %edx
callq 0x2280
leaq 0x4d(%r14), %rax
movq %rax, (%rsp)
movb $0x0, 0x4d(%r15,%r14)
movq (%rsp), %rax
addq $0x4a, %rax
cmpq 0x8(%rsp), %rax
jb 0x18690
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)
movq (%rsp), %r14
movq 0x10(%rsp), %r15
leaq (%r15,%r14), %rdi
leaq 0x726b(%rip), %rsi      # 0x1f90f
movl $0x49, %edx
callq 0x2280
leaq 0x49(%r14), %rax
movq %rax, (%rsp)
movb $0x0, 0x49(%r15,%r14)
cmpl $0x0, 0x8(%rbx)
jle 0x1870c
movl $0x1, %r15d
leaq 0x728a(%rip), %r14      # 0x1f959
movq %rsp, %r12
leaq 0x72e4(%rip), %r13      # 0x1f9bd
movq %r12, %rdi
movq %r14, %rsi
movl %r15d, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x190a5
movq %r12, %rdi
movq %r13, %rsi
movl %r15d, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x190a5
leal 0x1(%r15), %eax
cmpl 0x8(%rbx), %r15d
movl %eax, %r15d
jl 0x186d9
movq (%rsp), %rax
addq $0x45, %rax
cmpq 0x8(%rsp), %rax
jb 0x18763
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)
movq (%rsp), %r14
movq 0x10(%rsp), %r15
leaq (%r15,%r14), %rdi
leaq 0x72a6(%rip), %rsi      # 0x1fa1d
movl $0x44, %edx
callq 0x2280
leaq 0x44(%r14), %rax
movq %rax, (%rsp)
movb $0x0, 0x44(%r15,%r14)
movq (%rsp), %rax
addq $0x3e, %rax
cmpq 0x8(%rsp), %rax
jb 0x187e6
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)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
movups 0x7299(%rip), %xmm0     # 0x1fa8f
movups %xmm0, 0x2d(%rcx,%rax)
movups 0x7280(%rip), %xmm0     # 0x1fa82
movups %xmm0, 0x20(%rcx,%rax)
movups 0x7264(%rip), %xmm0     # 0x1fa72
movups %xmm0, 0x10(%rcx,%rax)
movups 0x7248(%rip), %xmm0     # 0x1fa62
movups %xmm0, (%rcx,%rax)
leaq 0x3d(%rax), %rdx
movq %rdx, (%rsp)
movb $0x0, 0x3d(%rcx,%rax)
movq (%rsp), %rax
addq $0x29, %rax
cmpq 0x8(%rsp), %rax
jb 0x18882
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)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
movups 0x721e(%rip), %xmm0     # 0x1fab0
movups %xmm0, 0x10(%rcx,%rax)
movups 0x7202(%rip), %xmm0     # 0x1faa0
movups %xmm0, (%rcx,%rax)
movabsq $0xa3e22656c656c6c, %rdx # imm = 0xA3E22656C656C6C
movq %rdx, 0x20(%rcx,%rax)
leaq 0x28(%rax), %rdx
movq %rdx, (%rsp)
movb $0x0, 0x28(%rcx,%rax)
movq (%rsp), %rax
addq $0x27, %rax
cmpq 0x8(%rsp), %rax
jb 0x18915
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)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
movups 0x71b4(%rip), %xmm0     # 0x1fad9
movups %xmm0, 0x10(%rcx,%rax)
movups 0x7198(%rip), %xmm0     # 0x1fac9
movups %xmm0, (%rcx,%rax)
movabsq $0xa3e226e6f697465, %rdx # imm = 0xA3E226E6F697465
movq %rdx, 0x1e(%rcx,%rax)
leaq 0x26(%rax), %rdx
movq %rdx, (%rsp)
movb $0x0, 0x26(%rcx,%rax)
movq (%rsp), %rax
addq $0x2a, %rax
cmpq 0x8(%rsp), %rax
jb 0x189a8
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)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
movups 0x7151(%rip), %xmm0     # 0x1fb09
movups %xmm0, 0x19(%rcx,%rax)
movups 0x713c(%rip), %xmm0     # 0x1fb00
movups %xmm0, 0x10(%rcx,%rax)
movups 0x7120(%rip), %xmm0     # 0x1faf0
movups %xmm0, (%rcx,%rax)
leaq 0x29(%rax), %rdx
movq %rdx, (%rsp)
movb $0x0, 0x29(%rcx,%rax)
movq (%rsp), %rax
addq $0x28, %rax
cmpq 0x8(%rsp), %rax
jb 0x18a38
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)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
movups 0x70e2(%rip), %xmm0     # 0x1fb2a
movups %xmm0, 0x10(%rcx,%rax)
movups 0x70c6(%rip), %xmm0     # 0x1fb1a
movups %xmm0, (%rcx,%rax)
movabsq $0xa3e226e6f697472, %rdx # imm = 0xA3E226E6F697472
movq %rdx, 0x1f(%rcx,%rax)
leaq 0x27(%rax), %rdx
movq %rdx, (%rsp)
movb $0x0, 0x27(%rcx,%rax)
movq (%rsp), %rax
addq $0x28, %rax
cmpq 0x8(%rsp), %rax
jb 0x18acb
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)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
movups 0x7077(%rip), %xmm0     # 0x1fb52
movups %xmm0, 0x10(%rcx,%rax)
movups 0x705b(%rip), %xmm0     # 0x1fb42
movups %xmm0, (%rcx,%rax)
movabsq $0xa3e226e6f697372, %rdx # imm = 0xA3E226E6F697372
movq %rdx, 0x1f(%rcx,%rax)
leaq 0x27(%rax), %rdx
movq %rdx, (%rsp)
movb $0x0, 0x27(%rcx,%rax)
movq (%rsp), %rax
addq $0x38, %rax
cmpq 0x8(%rsp), %rax
jb 0x18b5e
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)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
movups 0x701c(%rip), %xmm0     # 0x1fb8a
movups %xmm0, 0x20(%rcx,%rax)
movups 0x7000(%rip), %xmm0     # 0x1fb7a
movups %xmm0, 0x10(%rcx,%rax)
movups 0x6fe4(%rip), %xmm0     # 0x1fb6a
movups %xmm0, (%rcx,%rax)
movabsq $0xa3e226e6f697461, %rdx # imm = 0xA3E226E6F697461
movq %rdx, 0x2f(%rcx,%rax)
leaq 0x37(%rax), %rdx
movq %rdx, (%rsp)
movb $0x0, 0x37(%rcx,%rax)
movq (%rsp), %rax
addq $0x3c, %rax
cmpq 0x8(%rsp), %rax
jb 0x18bfd
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)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
movups 0x6fc0(%rip), %xmm0     # 0x1fbcd
movups %xmm0, 0x2b(%rcx,%rax)
movups 0x6fa9(%rip), %xmm0     # 0x1fbc2
movups %xmm0, 0x20(%rcx,%rax)
movups 0x6f8d(%rip), %xmm0     # 0x1fbb2
movups %xmm0, 0x10(%rcx,%rax)
movups 0x6f71(%rip), %xmm0     # 0x1fba2
movups %xmm0, (%rcx,%rax)
leaq 0x3b(%rax), %rdx
movq %rdx, (%rsp)
movb $0x0, 0x3b(%rcx,%rax)
movq (%rsp), %rax
addq $0x3d, %rax
cmpq 0x8(%rsp), %rax
jb 0x18c99
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)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
movups 0x6f61(%rip), %xmm0     # 0x1fc0a
movups %xmm0, 0x2c(%rcx,%rax)
movups 0x6f49(%rip), %xmm0     # 0x1fbfe
movups %xmm0, 0x20(%rcx,%rax)
movups 0x6f2d(%rip), %xmm0     # 0x1fbee
movups %xmm0, 0x10(%rcx,%rax)
movups 0x6f11(%rip), %xmm0     # 0x1fbde
movups %xmm0, (%rcx,%rax)
leaq 0x3c(%rax), %rdx
movq %rdx, (%rsp)
movb $0x0, 0x3c(%rcx,%rax)
cmpl $0x0, 0xc(%rbp)
jle 0x18d23
movl $0x8, %r12d
leaq 0x6f2a(%rip), %r14      # 0x1fc1b
movq %rsp, %r15
xorl %r13d, %r13d
movq 0x20(%rbp), %rax
movq -0x8(%rax,%r12), %rdx
movq (%rax,%r12), %rax
movl (%rax), %ecx
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x190a5
incq %r13
movslq 0xc(%rbp), %rax
addq $0x10, %r12
cmpq %rax, %r13
jl 0x18cf7
movq (%rsp), %rax
addq $0x27, %rax
cmpq 0x8(%rsp), %rax
jb 0x18d7a
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)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
movups 0x6ebd(%rip), %xmm0     # 0x1fc47
movups %xmm0, 0x10(%rcx,%rax)
movups 0x6ea1(%rip), %xmm0     # 0x1fc37
movups %xmm0, (%rcx,%rax)
movabsq $0x4f464e4909524554, %rdx # imm = 0x4F464E4909524554
movq %rdx, 0x1e(%rcx,%rax)
leaq 0x26(%rax), %rdx
movq %rdx, (%rsp)
movb $0x0, 0x26(%rcx,%rax)
testb $0x2, 0xc(%rbx)
jne 0x18fd4
movq (%rsp), %rax
addq $0x8, %rax
cmpq 0x8(%rsp), %rax
jb 0x18e17
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)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
movl $0x54414d52, 0x3(%rcx,%rax) # imm = 0x54414D52
movl $0x524f4609, (%rcx,%rax) # imm = 0x524F4609
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
leaq 0x7(%rax), %rdx
movq %rdx, (%rsp)
movb $0x0, 0x7(%rcx,%rax)
cmpl $0x0, (%rbx)
jle 0x18fd4
xorl %ecx, %ecx
xorl %edx, %edx
movq 0x38(%rbx), %rax
movq (%rax,%rcx,8), %r13
cmpl $0x0, 0x34(%r13)
jle 0x18fc5
movq %rcx, 0x20(%rsp)
movl %edx, 0x1c(%rsp)
movslq %edx, %rbp
shlq $0x2, %rbp
xorl %r12d, %r12d
movq 0x28(%rbx), %rax
addq %rbp, %rax
cmpl $0x1, (%rax,%r12,4)
jg 0x18fa9
movq (%rsp), %rax
incq %rax
cmpq 0x8(%rsp), %rax
jb 0x18ee0
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)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rsp)
movb $0x9, (%rcx,%rax)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
movb $0x0, (%rcx,%rax)
movq (%r13), %rax
movq 0x40(%r13), %rcx
movq 0x8(%rax), %rax
movq 0x28(%rax), %rax
movslq (%rcx,%r12,4), %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %r14
movq %r14, %rdi
callq 0x2170
movq (%rsp), %rcx
movslq %eax, %r15
leaq (%rcx,%r15), %rax
incq %rax
cmpq 0x8(%rsp), %rax
jb 0x18f83
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)
movq 0x10(%rsp), %rdi
addq (%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2280
addq (%rsp), %r15
movq %r15, (%rsp)
movq 0x10(%rsp), %rax
movb $0x0, (%rax,%r15)
incq %r12
movslq 0x34(%r13), %rax
cmpq %rax, %r12
jl 0x18e78
movl 0x1c(%rsp), %edx
addl %r12d, %edx
movq 0x20(%rsp), %rcx
incq %rcx
movslq (%rbx), %rax
cmpq %rax, %rcx
jl 0x18e52
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x18fe2
callq 0xb84a
callq 0xb807
movq %rax, 0x50(%rbx)
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 0xb655
movq 0x58(%rbx), %rdi
movl 0x4(%rbx), %eax
addl %eax, %eax
movslq %eax, %rsi
callq 0x2330
movq %rax, 0x58(%rbx)
movq 0x60(%rbx), %rdi
movl 0x4(%rbx), %eax
addl %eax, %eax
movslq %eax, %rsi
callq 0x2330
movq %rax, 0x60(%rbx)
movq 0xa0(%rbx), %r14
testq %r14, %r14
je 0x19094
movl 0xc(%rbx), %ebp
testb $0x4, %bpl
je 0x1905e
movslq 0x4(%rbx), %rdi
movl $0x4, %esi
callq 0x2220
movq %rax, 0xa8(%rbx)
testb $0x8, %bpl
je 0x1907d
movl 0x4(%rbx), %eax
addl %eax, %eax
movslq %eax, %rdi
movl $0x8, %esi
callq 0x2220
movq %rax, 0xb0(%rbx)
movl 0x4(%r14), %edi
addl %edi, %edi
movl $0x30, %esi
callq 0x2220
movq %rax, 0x98(%rbx)
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq