// File: /workspace/github_c_makefile_star2_O3/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 0x16d16
testl %ebp, %ebp
jle 0x172a2
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 0x16cf8
testl %r13d, %r13d
je 0x172a2
leaq 0x75a3(%rip), %rdx      # 0x1e2c0
xorl %esi, %esi
callq 0x1088a
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 0x16d55
movq 0x30(%rbx), %rdx
leaq 0x1(%rdx), %rcx
cmpq 0x38(%rbx), %rcx
jae 0x16d80
movq 0x40(%rbx), %rax
jmp 0x16dcd
leal 0x7f(%r12), %eax
cmpl $0xfe, %eax
ja 0x16df5
movq 0x30(%rbx), %rdx
leaq 0x1(%rdx), %rcx
cmpq 0x38(%rbx), %rcx
jae 0x16e7d
movq 0x40(%rbx), %rax
jmp 0x16eca
movq %rcx, %rax
shrq %rax
orq %rcx, %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, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x2330
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rdx
leaq 0x1(%rdx), %rcx
movq %rcx, 0x30(%rbx)
movb $0x11, (%rax,%rdx)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
movb $0x0, (%rcx,%rax)
movq 0x30(%rbx), %rdx
leaq 0x1(%rdx), %rcx
cmpq 0x38(%rbx), %rcx
jae 0x16e23
movq 0x40(%rbx), %rax
jmp 0x16e70
movl %r12d, %eax
addl $0x7fff, %eax           # imm = 0x7FFF
cmpl $0xfffe, %eax           # imm = 0xFFFE
ja 0x16ef2
movq 0x30(%rbx), %rdx
leaq 0x1(%rdx), %rcx
cmpq 0x38(%rbx), %rcx
jae 0x16f6f
movq 0x40(%rbx), %rax
jmp 0x16fbc
movq %rcx, %rax
shrq %rax
orq %rcx, %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, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x2330
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rdx
leaq 0x1(%rdx), %rcx
movq %rcx, 0x30(%rbx)
movb $-0x80, (%rax,%rdx)
jmp 0x16f62
movq %rcx, %rax
shrq %rax
orq %rcx, %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, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x2330
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rdx
leaq 0x1(%rdx), %rcx
movq %rcx, 0x30(%rbx)
movb $0x11, (%rax,%rdx)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
movb $0x0, (%rcx,%rax)
movq 0x30(%rbx), %rdx
leaq 0x1(%rdx), %rcx
cmpq 0x38(%rbx), %rcx
jae 0x16f0d
movq 0x40(%rbx), %rax
jmp 0x16f5a
movq 0x30(%rbx), %rdx
leaq 0x1(%rdx), %rcx
cmpq 0x38(%rbx), %rcx
jae 0x16feb
movq 0x40(%rbx), %rax
jmp 0x17038
movq %rcx, %rax
shrq %rax
orq %rcx, %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, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x2330
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rdx
leaq 0x1(%rdx), %rcx
movq %rcx, 0x30(%rbx)
movb %r12b, (%rax,%rdx)
movq 0x40(%rbx), %rax
addq 0x30(%rbx), %rax
jmp 0x17118
movq %rcx, %rax
shrq %rax
orq %rcx, %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, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x2330
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rdx
leaq 0x1(%rdx), %rcx
movq %rcx, 0x30(%rbx)
movb $0x12, (%rax,%rdx)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
movb $0x0, (%rcx,%rax)
movq 0x30(%rbx), %rcx
leaq 0x3(%rcx), %rax
cmpq 0x38(%rbx), %rax
jae 0x17063
movq 0x40(%rbx), %rax
jmp 0x170ac
movq %rcx, %rax
shrq %rax
orq %rcx, %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, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x2330
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rdx
leaq 0x1(%rdx), %rcx
movq %rcx, 0x30(%rbx)
movb $0x13, (%rax,%rdx)
movq 0x30(%rbx), %rax
movq 0x40(%rbx), %rcx
movb $0x0, (%rcx,%rax)
movq 0x30(%rbx), %rcx
leaq 0x5(%rcx), %rax
cmpq 0x38(%rbx), %rax
jae 0x170bb
movq 0x40(%rbx), %rax
jmp 0x17104
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), %rcx
movw %r12w, (%rax,%rcx)
movq 0x30(%rbx), %rax
addq $0x2, %rax
jmp 0x17110
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), %rcx
movl %r12d, (%rax,%rcx)
movq 0x30(%rbx), %rax
addq $0x4, %rax
movq %rax, 0x30(%rbx)
addq 0x40(%rbx), %rax
movb $0x0, (%rax)
movq 0x30(%rbx), %rdx
leaq 0x1(%rdx), %rcx
cmpq 0x38(%rbx), %rcx
jae 0x1712f
movq 0x40(%rbx), %rax
jmp 0x1717c
movq %rcx, %rax
shrq %rax
orq %rcx, %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, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x2330
movq %rax, 0x40(%rbx)
movq 0x30(%rbx), %rdx
leaq 0x1(%rdx), %rcx
movq %rcx, 0x30(%rbx)
movb $0x21, (%rax,%rdx)
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 0x171f2
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 0x17250
testl %ebp, %ebp
jle 0x17296
movl %ebp, %eax
xorl %ecx, %ecx
leaq 0xf194(%rip), %rdx      # 0x263a0
movl %ecx, %esi
shrl %esi
cmpl $0x1, (%r15,%rsi,4)
jg 0x17246
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 0x1720c
jmp 0x17296
testl %ebp, %ebp
jle 0x17296
movl %ebp, %eax
xorl %ecx, %ecx
leaq 0xf141(%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 0x1725f
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