// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/kstring.c
// Function: kvsprintf
int kvsprintf(kstring_t *s, const char *fmt, va_list ap)
{
	va_list args;
	int l;
	va_copy(args, ap);

	if (fmt[0] == '%' && fmt[1] == 'g' && fmt[2] == 0) {
		double d = va_arg(args, double);
		l = kputd(d, s);
		va_end(args);
		return l;
	}

	if (!s->s) {
		const size_t sz = 64;
		s->s = malloc(sz);
		if (!s->s)
			return -1;
		s->m = sz;
		s->l = 0;
	}

	l = vsnprintf(s->s + s->l, s->m - s->l, fmt, args); // This line does not work with glibc 2.0. See `man snprintf'.
	va_end(args);
	if (l + 1 > s->m - s->l) {
		if (ks_resize(s, s->l + l + 2) < 0)
			return -1;
		va_copy(args, ap);
		l = vsnprintf(s->s + s->l, s->m - s->l, fmt, args);
		va_end(args);
	}
	s->l += l;
	return l;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
leaq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movups (%rcx), %xmm0
movups %xmm0, (%rax)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x25, %eax
jne 0xaf09
movq -0x18(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x67, %eax
jne 0xaf09
movq -0x18(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x0, %eax
jne 0xaf09
leaq -0x40(%rbp), %rax
movq %rax, -0x70(%rbp)
addq $0x4, %rax
movq %rax, -0x68(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x5c(%rbp)
cmpl $0xa0, %eax
ja 0xaec5
movq -0x68(%rbp), %rcx
movl -0x5c(%rbp), %edx
movq -0x70(%rbp), %rsi
movslq %edx, %rax
addq 0x10(%rsi), %rax
addl $0x10, %edx
movl %edx, (%rcx)
movq %rax, -0x78(%rbp)
jmp 0xaedc
movq -0x70(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm0
movq -0x10(%rbp), %rdi
callq 0xa650
movl %eax, -0x44(%rbp)
leaq -0x40(%rbp), %rax
movl -0x44(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xb032
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0xaf5f
movq $0x40, -0x58(%rbp)
movl $0x40, %edi
callq 0x4650
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0xaf48
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xb032
movq -0x10(%rbp), %rax
movq $0x40, 0x8(%rax)
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
addq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rax
subq (%rax), %rsi
movq -0x18(%rbp), %rdx
leaq -0x40(%rbp), %rcx
callq 0x42c0
movl %eax, -0x44(%rbp)
leaq -0x40(%rbp), %rax
movl -0x44(%rbp), %eax
addl $0x1, %eax
cltq
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq -0x10(%rbp), %rdx
subq (%rdx), %rcx
cmpq %rcx, %rax
jbe 0xb01e
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movslq -0x44(%rbp), %rax
addq %rax, %rsi
addq $0x2, %rsi
callq 0xad90
cmpl $0x0, %eax
jge 0xafd6
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xb032
leaq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movups (%rcx), %xmm0
movups %xmm0, (%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
addq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rax
subq (%rax), %rsi
movq -0x18(%rbp), %rdx
leaq -0x40(%rbp), %rcx
callq 0x42c0
movl %eax, -0x44(%rbp)
leaq -0x40(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq -0x10(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movl -0x44(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nop