// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, 0x30(%rax)
cmpq $0x0, -0x28(%rbp)
je 0x1d4ec
movl $0x0, -0x34(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x1d4df
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
cmpl $0x1, (%rax,%rcx,4)
setle %al
andb $0x1, %al
movzbl %al, %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x1d4b2
cmpl $0x0, -0x34(%rbp)
jne 0x1d4ea
jmp 0x1d6b8
jmp 0x1d4ec
movq -0x8(%rbp), %rdi
xorl %esi, %esi
leaq 0x9dc7(%rip), %rdx      # 0x272c0
callq 0x14b90
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movabsq $-0xff00000001, %rcx    # imm = 0xFFFFFF00FFFFFFFF
andq 0x10(%rax), %rcx
movabsq $0x100000000, %rdx      # imm = 0x100000000
orq %rdx, %rcx
movq %rcx, 0x10(%rax)
movl -0x34(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, %ecx
movl %ecx, %edx
movq 0x10(%rax), %rcx
andq $0xffffff, %rdx         # imm = 0xFFFFFF
shlq $0x28, %rdx
movabsq $0xffffffffff, %rsi     # imm = 0xFFFFFFFFFF
andq %rsi, %rcx
orq %rdx, %rcx
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rdi
addq $0x30, %rdi
movl -0x2c(%rbp), %esi
callq 0x1d6c0
movq -0x10(%rbp), %rdi
addq $0x30, %rdi
movl $0x2, %esi
movl $0x1, %edx
callq 0x1d7a0
movq -0x10(%rbp), %rdi
addq $0x30, %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
shrq $0x28, %rax
shll %eax
cltq
addq %rax, %rsi
addq $0x1, %rsi
callq 0x1d870
cmpq $0x0, -0x28(%rbp)
je 0x1d634
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl -0x14(%rbp), %ecx
shll %ecx
cmpl %ecx, %eax
jge 0x1d632
movq -0x28(%rbp), %rax
movl -0x30(%rbp), %ecx
sarl %ecx
movslq %ecx, %rcx
cmpl $0x1, (%rax,%rcx,4)
jg 0x1d625
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
movzbl (%rax,%rcx), %eax
shll %eax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movslq -0x30(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
orl %ecx, %eax
movslq %eax, %rcx
leaq 0x10fde(%rip), %rax     # 0x2e5e0
movl (%rax,%rcx,4), %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x10(%rbp), %rsi
movq 0x30(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x30(%rsi)
movb %dl, (%rax,%rcx)
jmp 0x1d627
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x1d5b7
jmp 0x1d6a4
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl -0x14(%rbp), %ecx
shll %ecx
cmpl %ecx, %eax
jge 0x1d6a2
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x30(%rbp), %rcx
movzbl (%rax,%rcx), %eax
shll %eax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movslq -0x30(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
orl %ecx, %eax
movslq %eax, %rcx
leaq 0x10f6c(%rip), %rax     # 0x2e5e0
movl (%rax,%rcx,4), %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x10(%rbp), %rsi
movq 0x30(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x30(%rsi)
movb %dl, (%rax,%rcx)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x1d63b
jmp 0x1d6a4
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x30(%rcx), %rcx
movb $0x0, (%rax,%rcx)
addq $0x40, %rsp
popq %rbp
retq
nop