// File: /workspace/github_c_makefile_star2_O0/lh3[P]bgt/vcf.c
// Function: bcf_enc_vint
void bcf_enc_vint(kstring_t *s, int n, const int32_t *a, int wsize)
{
	int32_t max = INT32_MIN + 1, min = INT32_MAX;
	int i;
	if (n == 0) bcf_enc_size(s, 0, BCF_BT_NULL);
	else if (n == 1) bcf_enc_int1(s, a[0]);
	else {
		if (wsize <= 0) wsize = n;
		for (i = 0; i < n; ++i) { // test min and max to determine the actual integer type
			if (a[i] == bcf_int32_missing || a[i] == bcf_int32_end) continue;
			if (max < a[i]) max = a[i];
			if (min > a[i]) min = a[i];
		}
		if (max <= INT8_MAX && min > bcf_int8_end) { // int8_t
			bcf_enc_size(s, wsize, BCF_BT_INT8);
			for (i = 0; i < n; ++i)
				kputc(a[i] == bcf_int32_end? bcf_int8_end : a[i] == bcf_int32_missing? bcf_int8_missing : a[i], s);
		} else if (max <= INT16_MAX && min > bcf_int16_end) { // int16_t
			bcf_enc_size(s, wsize, BCF_BT_INT16);
			for (i = 0; i < n; ++i) {
				int16_t x = a[i] == bcf_int32_end? bcf_int16_end : a[i] == bcf_int32_missing? bcf_int16_missing : a[i];
				kputsn((char*)&x, 2, s);
			}
		} else { // int32_t
			bcf_enc_size(s, wsize, BCF_BT_INT32);
			for (i = 0; i < n; ++i)
				kputsn((char*)&a[i], 4, s);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl $0x80000001, -0x20(%rbp) # imm = 0x80000001
movl $0x7fffffff, -0x24(%rbp) # imm = 0x7FFFFFFF
cmpl $0x0, -0xc(%rbp)
jne 0x10f2c
movq -0x8(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x11170
jmp 0x11162
cmpl $0x1, -0xc(%rbp)
jne 0x10f46
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %esi
callq 0x11240
jmp 0x11160
cmpl $0x0, -0x1c(%rbp)
jg 0x10f52
movl -0xc(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x10fce
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
cmpl $0x80000000, (%rax,%rcx,4) # imm = 0x80000000
je 0x10f83
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
cmpl $0x80000001, (%rax,%rcx,4) # imm = 0x80000001
jne 0x10f85
jmp 0x10fc3
movl -0x20(%rbp), %eax
movq -0x18(%rbp), %rcx
movslq -0x28(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x10fa3
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x20(%rbp)
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
movslq -0x28(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jle 0x10fc1
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x24(%rbp)
jmp 0x10fc3
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x10f59
cmpl $0x7f, -0x20(%rbp)
jg 0x11068
cmpl $-0x7f, -0x24(%rbp)
jle 0x11068
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl $0x1, %edx
callq 0x11170
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x11063
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
cmpl $0x80000001, (%rax,%rcx,4) # imm = 0x80000001
jne 0x1101d
movl $0xffffff81, %eax       # imm = 0xFFFFFF81
movl %eax, -0x30(%rbp)
jmp 0x1104c
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
cmpl $0x80000000, (%rax,%rcx,4) # imm = 0x80000000
jne 0x11038
movl $0xffffff80, %eax       # imm = 0xFFFFFF80
movl %eax, -0x34(%rbp)
jmp 0x11046
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %edi
movq -0x8(%rbp), %rsi
callq 0x10ce0
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x10ffa
jmp 0x1115e
cmpl $0x7fff, -0x20(%rbp)    # imm = 0x7FFF
jg 0x11112
cmpl $0xffff8001, -0x24(%rbp) # imm = 0xFFFF8001
jle 0x11112
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl $0x2, %edx
callq 0x11170
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x11110
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
cmpl $0x80000001, (%rax,%rcx,4) # imm = 0x80000001
jne 0x110bd
movl $0xffff8001, %eax       # imm = 0xFFFF8001
movl %eax, -0x38(%rbp)
jmp 0x110ec
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
cmpl $0x80000000, (%rax,%rcx,4) # imm = 0x80000000
jne 0x110d8
movl $0xffff8000, %eax       # imm = 0xFFFF8000
movl %eax, -0x3c(%rbp)
jmp 0x110e6
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
movw %ax, -0x2a(%rbp)
movq -0x8(%rbp), %rdx
leaq -0x2a(%rbp), %rdi
movl $0x2, %esi
callq 0x10ab0
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x1109a
jmp 0x1115c
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl $0x3, %edx
callq 0x11170
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x1115a
movq -0x18(%rbp), %rdi
movslq -0x28(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq -0x8(%rbp), %rdx
movl $0x4, %esi
callq 0x10ab0
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x1112a
jmp 0x1115c
jmp 0x1115e
jmp 0x11160
jmp 0x11162
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)