// File: /workspace/github_c_makefile_star2_O1/lh3[P]bgt/bgt.c
// Function: bgt_gen_gt
void bgt_gen_gt(const bcf_hdr_t *h, bcf1_t *b, int m, const uint8_t **a, int32_t *mgs)
{
	int id, i, m2 = m;
	b->indiv.l = 0;
	if (mgs) {
		for (i = m2 = 0; i < m; ++i)
			m2 += (mgs[i] <= 1);
		if (m2 == 0) return;
	}
	id = bcf_id2int(h, BCF_DT_ID, "GT");
	b->n_fmt = 1; b->n_sample = m2;
	bcf_enc_int1(&b->indiv, id);
	bcf_enc_size(&b->indiv, 2, BCF_BT_INT8);
	ks_resize(&b->indiv, b->indiv.l + b->n_sample*2 + 1);
	if (mgs) {
		for (i = 0; i < m<<1; ++i)
			if (mgs[i>>1] <= 1)
				b->indiv.s[b->indiv.l++] = bgt_bits2gt[a[1][i]<<1 | a[0][i]];
	} else {
		for (i = 0; i < m<<1; ++i)
			b->indiv.s[b->indiv.l++] = bgt_bits2gt[a[1][i]<<1 | a[0][i]];
	}
	b->indiv.s[b->indiv.l] = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r15
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %rbx
movq $0x0, 0x30(%rsi)
movl %edx, %r13d
testq %r8, %r8
je 0x166cf
testl %ebp, %ebp
jle 0x166c3
movl %ebp, %eax
xorl %ecx, %ecx
xorl %r13d, %r13d
xorl %edx, %edx
cmpl $0x2, (%r15,%rcx,4)
setl %dl
addl %edx, %r13d
incq %rcx
cmpq %rcx, %rax
jne 0x166ac
jmp 0x166c6
xorl %r13d, %r13d
testl %r13d, %r13d
je 0x16c2a
leaq 0x7bea(%rip), %rdx      # 0x1e2c0
xorl %esi, %esi
callq 0x106de
movl %eax, %r12d
movl 0x10(%rbx), %eax
shlq $0x28, %r13
orq %rax, %r13
btsq $0x20, %r13
movq %r13, 0x10(%rbx)
movl %r12d, %eax
negl %eax
jno 0x167db
movq 0x30(%rbx), %rax
incq %rax
cmpq 0x38(%rbx), %rax
jb 0x16750
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, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x2330
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x30(%rbx)
movb $0x11, (%rcx,%rax)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
movb $0x0, (%rcx,%rax)
movq 0x30(%rbx), %rax
incq %rax
cmpq 0x38(%rbx), %rax
jb 0x167c2
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, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x2330
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x30(%rbx)
movb $-0x80, (%rcx,%rax)
jmp 0x168c3
leal 0x7f(%r12), %eax
cmpl $0xfe, %eax
ja 0x168d0
movq 0x30(%rbx), %rax
incq %rax
cmpq 0x38(%rbx), %rax
jb 0x1683d
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, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x2330
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x30(%rbx)
movb $0x11, (%rcx,%rax)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
movb $0x0, (%rcx,%rax)
movq 0x30(%rbx), %rax
incq %rax
cmpq 0x38(%rbx), %rax
jb 0x168af
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, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x2330
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x30(%rbx)
movb %r12b, (%rcx,%rax)
movq 0x40(%rbx), %rax
addq 0x30(%rbx), %rax
jmp 0x16aa3
movl %r12d, %eax
addl $0x7fff, %eax           # imm = 0x7FFF
cmpl $0xfffe, %eax           # imm = 0xFFFE
ja 0x169c2
movq 0x30(%rbx), %rax
incq %rax
cmpq 0x38(%rbx), %rax
jb 0x16935
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, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x2330
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x30(%rbx)
movb $0x12, (%rcx,%rax)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
movb $0x0, (%rcx,%rax)
movq 0x30(%rbx), %rax
addq $0x3, %rax
cmpq 0x38(%rbx), %rax
jb 0x169a8
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, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x2330
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
movw %r12w, (%rcx,%rax)
movq 0x30(%rbx), %rax
addq $0x2, %rax
jmp 0x16a9b
movq 0x30(%rbx), %rax
incq %rax
cmpq 0x38(%rbx), %rax
jb 0x16a14
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, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x2330
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x30(%rbx)
movb $0x13, (%rcx,%rax)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
movb $0x0, (%rcx,%rax)
movq 0x30(%rbx), %rax
addq $0x5, %rax
cmpq 0x38(%rbx), %rax
jb 0x16a87
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, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x2330
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
movl %r12d, (%rcx,%rax)
movq 0x30(%rbx), %rax
addq $0x4, %rax
movq %rax, 0x30(%rbx)
addq 0x40(%rbx), %rax
movb $0x0, (%rax)
movq 0x30(%rbx), %rax
incq %rax
cmpq 0x38(%rbx), %rax
jb 0x16af8
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, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x2330
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x30(%rbx)
movb $0x21, (%rcx,%rax)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
movb $0x0, (%rcx,%rax)
movq 0x10(%rbx), %rax
movq 0x30(%rbx), %rcx
shrq $0x28, %rax
leaq (%rcx,%rax,2), %rdx
incq %rdx
cmpq %rdx, 0x38(%rbx)
jae 0x16b7a
leaq (%rcx,%rax,2), %rax
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, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x2330
movq %rax, 0x40(%rbx)
addl %ebp, %ebp
testq %r15, %r15
je 0x16bd8
testl %ebp, %ebp
jle 0x16c1e
movl %ebp, %eax
xorl %ecx, %ecx
leaq 0xf80c(%rip), %rdx      # 0x263a0
movl %ecx, %esi
shrl %esi
cmpl $0x1, (%r15,%rsi,4)
jg 0x16bce
movq (%r14), %rsi
movq 0x8(%r14), %rdi
movzbl (%rdi,%rcx), %edi
movzbl (%rsi,%rcx), %esi
shll $0x2, %esi
shll $0x3, %edi
orl %esi, %edi
movb (%rdi,%rdx), %sil
movq 0x30(%rbx), %rdi
movq 0x40(%rbx), %r8
leaq 0x1(%rdi), %r9
movq %r9, 0x30(%rbx)
movb %sil, (%r8,%rdi)
incq %rcx
cmpq %rcx, %rax
jne 0x16b94
jmp 0x16c1e
testl %ebp, %ebp
jle 0x16c1e
movl %ebp, %eax
xorl %ecx, %ecx
leaq 0xf7b9(%rip), %rdx      # 0x263a0
movq (%r14), %rsi
movq 0x8(%r14), %rdi
movzbl (%rdi,%rcx), %edi
movzbl (%rsi,%rcx), %esi
shll $0x2, %esi
shll $0x3, %edi
orl %esi, %edi
movb (%rdi,%rdx), %sil
movq 0x30(%rbx), %rdi
movq 0x40(%rbx), %r8
leaq 0x1(%rdi), %r9
movq %r9, 0x30(%rbx)
movb %sil, (%r8,%rdi)
incq %rcx
cmpq %rcx, %rax
jne 0x16be7
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
movb $0x0, (%rcx,%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq