// File: /workspace/github_c_makefile_star2_O1/lh3[P]minigraph/format.c
// Function: mg_sprintf_core
void mg_sprintf_core(void *km, kstring_t *s, const char *fmt, va_list ap)
{
	char buf[16]; // for integer to string conversion
	const char *p, *q;
	for (q = p = fmt; *p; ++p) {
		if (*p == '%') {
			if (p > q) str_copy(km, s, q, p);
			++p;
			if (*p == 'd') {
				int c, i, l = 0;
				unsigned int x;
				c = va_arg(ap, int);
				x = c >= 0? c : -c;
				do { buf[l++] = x%10 + '0'; x /= 10; } while (x > 0);
				if (c < 0) buf[l++] = '-';
				str_enlarge(km, s, l);
				for (i = l - 1; i >= 0; --i) s->s[s->l++] = buf[i];
			} else if (*p == 'u') {
				int i, l = 0;
				uint32_t x;
				x = va_arg(ap, uint32_t);
				do { buf[l++] = x%10 + '0'; x /= 10; } while (x > 0);
				str_enlarge(km, s, l);
				for (i = l - 1; i >= 0; --i) s->s[s->l++] = buf[i];
			} else if (*p == 's') {
				char *r = va_arg(ap, char*);
				str_copy(km, s, r, r + strlen(r));
			} else if (*p == 'c') {
				str_enlarge(km, s, 1);
				s->s[s->l++] = va_arg(ap, int);
			} else abort();
			q = p + 1;
		}
	}
	if (p > q) str_copy(km, s, q, p);
	s->s[s->l] = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
movl $0xcccccccd, %r15d      # imm = 0xCCCCCCCD
movq %rdx, %r14
movzbl (%r14), %eax
cmpl $0x25, %eax
je 0x1f90e
testl %eax, %eax
jne 0x1fc73
jmp 0x1fc7b
movq %r14, %rbp
subq %r13, %rbp
jbe 0x1f970
movl (%rbx), %eax
leal (%rax,%rbp), %ecx
incl %ecx
cmpl 0x4(%rbx), %ecx
jbe 0x1f95d
addl %ebp, %eax
movl %eax, %ecx
shrl %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x8, %eax
orl %ecx, %eax
movl %eax, %edx
shrl $0x10, %edx
orl %eax, %edx
incl %edx
movl %edx, 0x4(%rbx)
movq 0x8(%rbx), %rsi
movq 0x8(%rsp), %rdi
callq 0x32c4
movq %rax, 0x8(%rbx)
movl (%rbx), %edi
addq 0x8(%rbx), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2230
addl %ebp, (%rbx)
movzbl 0x1(%r14), %eax
cmpl $0x72, %eax
jg 0x1f9aa
cmpl $0x63, %eax
je 0x1f9de
cmpl $0x64, %eax
jne 0x1fcf6
movl (%r12), %ecx
cmpq $0x28, %rcx
ja 0x1faf7
movq %rcx, %rax
addq 0x10(%r12), %rax
addl $0x8, %ecx
movl %ecx, (%r12)
jmp 0x1fb05
cmpl $0x73, %eax
je 0x1fa3e
cmpl $0x75, %eax
jne 0x1fcf6
movl (%r12), %ecx
cmpq $0x28, %rcx
ja 0x1fbbf
movq %rcx, %rax
addq 0x10(%r12), %rax
addl $0x8, %ecx
movl %ecx, (%r12)
jmp 0x1fbcd
movl (%rbx), %eax
leal 0x2(%rax), %ecx
cmpl 0x4(%rbx), %ecx
jbe 0x1fa23
incl %eax
movl %eax, %ecx
shrl %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x8, %eax
orl %ecx, %eax
movl %eax, %edx
shrl $0x10, %edx
orl %eax, %edx
incl %edx
movl %edx, 0x4(%rbx)
movq 0x8(%rbx), %rsi
movq 0x8(%rsp), %rdi
callq 0x32c4
movq %rax, 0x8(%rbx)
movl (%r12), %ecx
cmpq $0x28, %rcx
ja 0x1fa59
movq %rcx, %rax
addq 0x10(%r12), %rax
addl $0x8, %ecx
movl %ecx, (%r12)
jmp 0x1fa67
movl (%r12), %ecx
cmpq $0x28, %rcx
ja 0x1fa7c
movq %rcx, %rax
addq 0x10(%r12), %rax
addl $0x8, %ecx
movl %ecx, (%r12)
jmp 0x1fa8a
movq 0x8(%r12), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r12)
movb (%rax), %al
movq 0x8(%rbx), %rcx
movl (%rbx), %edx
leal 0x1(%rdx), %esi
movl %esi, (%rbx)
movb %al, (%rcx,%rdx)
jmp 0x1fc65
movq 0x8(%r12), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r12)
movq (%rax), %r13
movq %r13, %rdi
callq 0x2110
movq %rax, %rbp
movl (%rbx), %eax
leal (%rax,%rbp), %ecx
incl %ecx
cmpl 0x4(%rbx), %ecx
jbe 0x1fadf
addl %ebp, %eax
movl %eax, %ecx
shrl %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x8, %eax
orl %ecx, %eax
movl %eax, %edx
shrl $0x10, %edx
orl %eax, %edx
incl %edx
movl %edx, 0x4(%rbx)
movq 0x8(%rbx), %rsi
movq 0x8(%rsp), %rdi
callq 0x32c4
movq %rax, 0x8(%rbx)
movl (%rbx), %edi
addq 0x8(%rbx), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2230
addl %ebp, (%rbx)
jmp 0x1fc65
movq 0x8(%r12), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r12)
movl (%rax), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
xorl %r13d, %r13d
movl %ecx, %edx
imulq %r15, %rdx
shrq $0x23, %rdx
leal (%rdx,%rdx), %esi
leal (%rsi,%rsi,4), %esi
movl %ecx, %edi
subl %esi, %edi
orb $0x30, %dil
movb %dil, 0x10(%rsp,%r13)
incq %r13
cmpl $0x9, %ecx
movl %edx, %ecx
ja 0x1fb11
testl %eax, %eax
jns 0x1fb47
movl %r13d, %eax
incl %r13d
movb $0x2d, 0x10(%rsp,%rax)
movl (%rbx), %eax
leal (%rax,%r13), %ecx
incl %ecx
cmpl 0x4(%rbx), %ecx
jbe 0x1fb90
addl %r13d, %eax
movl %eax, %ecx
shrl %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x8, %eax
orl %ecx, %eax
movl %eax, %edx
shrl $0x10, %edx
orl %eax, %edx
incl %edx
movl %edx, 0x4(%rbx)
movq 0x8(%rbx), %rsi
movq 0x8(%rsp), %rdi
callq 0x32c4
movq %rax, 0x8(%rbx)
movl %r13d, %eax
leaq 0xf(%rsp), %rcx
addq %rcx, %rax
incl %r13d
movb (%rax), %cl
movq 0x8(%rbx), %rdx
movl (%rbx), %esi
leal 0x1(%rsi), %edi
movl %edi, (%rbx)
movb %cl, (%rdx,%rsi)
decl %r13d
decq %rax
cmpl $0x1, %r13d
jg 0x1fb9e
jmp 0x1fc65
movq 0x8(%r12), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r12)
movl (%rax), %ecx
movl $0x1, %edx
xorl %eax, %eax
movq %rdx, %r13
movl %ecx, %esi
imulq %r15, %rsi
shrq $0x23, %rsi
leal (%rsi,%rsi), %edx
leal (%rdx,%rdx,4), %edx
movl %ecx, %edi
subl %edx, %edi
orb $0x30, %dil
movb %dil, 0x10(%rsp,%rax)
incq %rax
leaq 0x1(%r13), %rdx
cmpl $0x9, %ecx
movl %esi, %ecx
ja 0x1fbd6
movl (%rbx), %ecx
addq %rax, %rcx
leal 0x1(%rcx), %eax
cmpl 0x4(%rbx), %eax
jbe 0x1fc4a
movl %ecx, %eax
shrl %eax
orl %eax, %ecx
movl %ecx, %eax
shrl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x8, %eax
orl %ecx, %eax
movl %eax, %edx
shrl $0x10, %edx
orl %eax, %edx
incl %edx
movl %edx, 0x4(%rbx)
movq 0x8(%rbx), %rsi
movq 0x8(%rsp), %rdi
callq 0x32c4
movq %rax, 0x8(%rbx)
movb 0xf(%rsp,%r13), %al
movq 0x8(%rbx), %rcx
movl (%rbx), %edx
leal 0x1(%rdx), %esi
movl %esi, (%rbx)
movb %al, (%rcx,%rdx)
decq %r13
testq %r13, %r13
jg 0x1fc4a
leaq 0x1(%r14), %rax
addq $0x2, %r14
movq %r14, %r13
movq %rax, %r14
incq %r14
jmp 0x1f8f8
subq %r13, %r14
jbe 0x1fcdd
movl (%rbx), %eax
leal (%rax,%r14), %ecx
incl %ecx
cmpl 0x4(%rbx), %ecx
jbe 0x1fcc9
addl %r14d, %eax
movl %eax, %ecx
shrl %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x8, %eax
orl %ecx, %eax
movl %eax, %edx
shrl $0x10, %edx
orl %eax, %edx
incl %edx
movl %edx, 0x4(%rbx)
movq 0x8(%rbx), %rsi
movq 0x8(%rsp), %rdi
callq 0x32c4
movq %rax, 0x8(%rbx)
movl (%rbx), %edi
addq 0x8(%rbx), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x2230
addl %r14d, (%rbx)
movq 0x8(%rbx), %rax
movl (%rbx), %ecx
movb $0x0, (%rax,%rcx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2050