// File: /workspace/github_c_makefile_star2_O3/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 0x1f961
testl %eax, %eax
jne 0x1fcd3
jmp 0x1fcdb
movq %r14, %rbp
subq %r13, %rbp
jbe 0x1f9ca
movl (%rbx), %ecx
leal (%rcx,%rbp), %eax
incl %eax
cmpl 0x4(%rbx), %eax
jbe 0x1f9b4
addl %ebp, %ecx
movl %ecx, %eax
shrl %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x2, %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x4, %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x8, %ecx
orl %eax, %ecx
movl %ecx, %edx
shrl $0x10, %edx
orl %ecx, %edx
incl %edx
movl %edx, 0x4(%rbx)
movq 0x8(%rbx), %rsi
movq 0x8(%rsp), %rdi
callq 0x31ed
movq %rax, 0x8(%rbx)
movl (%rbx), %ecx
jmp 0x1f9b8
movq 0x8(%rbx), %rax
movl %ecx, %edi
addq %rax, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2230
addl %ebp, (%rbx)
movzbl 0x1(%r14), %eax
cmpl $0x72, %eax
jg 0x1fa04
cmpl $0x63, %eax
je 0x1fa38
cmpl $0x64, %eax
jne 0x1fd61
movl (%r12), %ecx
cmpq $0x28, %rcx
ja 0x1fb57
movq %rcx, %rax
addq 0x10(%r12), %rax
addl $0x8, %ecx
movl %ecx, (%r12)
jmp 0x1fb65
cmpl $0x73, %eax
je 0x1fa98
cmpl $0x75, %eax
jne 0x1fd61
movl (%r12), %ecx
cmpq $0x28, %rcx
ja 0x1fc1f
movq %rcx, %rax
addq 0x10(%r12), %rax
addl $0x8, %ecx
movl %ecx, (%r12)
jmp 0x1fc2d
movl (%rbx), %eax
leal 0x2(%rax), %ecx
cmpl 0x4(%rbx), %ecx
jbe 0x1fa7d
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 0x31ed
movq %rax, 0x8(%rbx)
movl (%r12), %ecx
cmpq $0x28, %rcx
ja 0x1fab3
movq %rcx, %rax
addq 0x10(%r12), %rax
addl $0x8, %ecx
movl %ecx, (%r12)
jmp 0x1fac1
movl (%r12), %ecx
cmpq $0x28, %rcx
ja 0x1fad6
movq %rcx, %rax
addq 0x10(%r12), %rax
addl $0x8, %ecx
movl %ecx, (%r12)
jmp 0x1fae4
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 0x1fcc5
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), %ecx
addl %ecx, %eax
incl %eax
cmpl 0x4(%rbx), %eax
jbe 0x1fb3c
addl %ebp, %ecx
movl %ecx, %eax
shrl %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x2, %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x4, %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x8, %ecx
orl %eax, %ecx
movl %ecx, %edx
shrl $0x10, %edx
orl %ecx, %edx
incl %edx
movl %edx, 0x4(%rbx)
movq 0x8(%rbx), %rsi
movq 0x8(%rsp), %rdi
callq 0x31ed
movq %rax, 0x8(%rbx)
movl (%rbx), %ecx
jmp 0x1fb40
movq 0x8(%rbx), %rax
movl %ecx, %edi
addq %rax, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2230
addl %ebp, (%rbx)
jmp 0x1fcc5
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 0x1fb71
testl %eax, %eax
jns 0x1fba7
movl %r13d, %eax
incl %r13d
movb $0x2d, 0x10(%rsp,%rax)
movl (%rbx), %eax
leal (%rax,%r13), %ecx
incl %ecx
cmpl 0x4(%rbx), %ecx
jbe 0x1fbf0
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 0x31ed
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 0x1fbfe
jmp 0x1fcc5
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 0x1fc36
movl (%rbx), %ecx
addq %rax, %rcx
leal 0x1(%rcx), %eax
cmpl 0x4(%rbx), %eax
jbe 0x1fcaa
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 0x31ed
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 0x1fcaa
leaq 0x1(%r14), %rax
addq $0x2, %r14
movq %r14, %r13
movq %rax, %r14
incq %r14
jmp 0x1f94b
movl (%rbx), %ecx
subq %r13, %r14
jbe 0x1fd48
leal (%rcx,%r14), %eax
incl %eax
cmpl 0x4(%rbx), %eax
jbe 0x1fd2d
addl %r14d, %ecx
movl %ecx, %eax
shrl %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x2, %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x4, %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x8, %ecx
orl %eax, %ecx
movl %ecx, %edx
shrl $0x10, %edx
orl %ecx, %edx
incl %edx
movl %edx, 0x4(%rbx)
movq 0x8(%rbx), %rsi
movq 0x8(%rsp), %rdi
callq 0x31ed
movq %rax, 0x8(%rbx)
movl (%rbx), %ecx
jmp 0x1fd31
movq 0x8(%rbx), %rax
movl %ecx, %edi
addq %rax, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x2230
movl (%rbx), %ecx
addl %r14d, %ecx
movl %ecx, (%rbx)
movq 0x8(%rbx), %rax
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2050