// File: /workspace/github_c_makefile_star2_O0/lh3[P]miniprot/format.c
// Function: mp_sprintf_lite
int64_t mp_sprintf_lite(kstring_t *s, const char *fmt, ...)
{
	char buf[32]; // for integer to string conversion
	const char *p, *q;
	int64_t len = 0;
	va_list ap;
	va_start(ap, fmt);
	for (q = p = fmt; *p; ++p) {
		if (*p == '%') {
			if (p > q) {
				len += p - q;
				if (s) str_copy(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++] = '-';
				len += l;
				if (s) {
					str_enlarge(s, l);
					for (i = l - 1; i >= 0; --i) s->s[s->l++] = buf[i];
				}
			} else if (*p == 'l' && *(p+1) == 'd') {
				int i, l = 0;
				long c;
				unsigned long x;
				c = va_arg(ap, long);
				x = c >= 0? c : -c;
				do { buf[l++] = x%10 + '0'; x /= 10; } while (x > 0);
				if (c < 0) buf[l++] = '-';
				len += l;
				if (s) {
					str_enlarge(s, l);
					for (i = l - 1; i >= 0; --i) s->s[s->l++] = buf[i];
				}
				++p;
			} 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);
				len += l;
				if (s) {
					str_enlarge(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*);
				int l;
				l = strlen(r);
				len += l;
				if (s) str_copy(s, r, r + l);
			} else if (*p == 'c') {
				++len;
				if (s) {
					str_enlarge(s, 1);
					s->s[s->l++] = va_arg(ap, int);
				}
			} else {
				fprintf(stderr, "ERROR: unrecognized type '%%%c'\n", *p);
				abort();
			}
			q = p + 1;
		}
	}
	if (p > q) {
		len += p - q;
		if (s) str_copy(s, q, p);
	}
	va_end(ap);
	if (s) s->s[s->l] = 0;
	return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
testb %al, %al
je 0x1bcc7
movaps %xmm0, -0x130(%rbp)
movaps %xmm1, -0x120(%rbp)
movaps %xmm2, -0x110(%rbp)
movaps %xmm3, -0x100(%rbp)
movaps %xmm4, -0xf0(%rbp)
movaps %xmm5, -0xe0(%rbp)
movaps %xmm6, -0xd0(%rbp)
movaps %xmm7, -0xc0(%rbp)
movq %r9, -0x138(%rbp)
movq %r8, -0x140(%rbp)
movq %rcx, -0x148(%rbp)
movq %rdx, -0x150(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x48(%rbp)
leaq -0x60(%rbp), %rax
leaq -0x160(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x10, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
cmpb $0x0, (%rax)
je 0x1c374
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x25, %eax
jne 0x1c361
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
jbe 0x1bd77
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rcx, %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1bd75
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x1c3e0
jmp 0x1bd77
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x64, %eax
jne 0x1bed6
movl $0x0, -0x6c(%rbp)
leaq -0x60(%rbp), %rax
movq %rax, -0x170(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x164(%rbp)
cmpl $0x28, %eax
ja 0x1bdd5
movq -0x170(%rbp), %rcx
movl -0x164(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x178(%rbp)
jmp 0x1bdf2
movq -0x170(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x64(%rbp)
jl 0x1be0f
movl -0x64(%rbp), %eax
movl %eax, -0x17c(%rbp)
jmp 0x1be1a
xorl %eax, %eax
subl -0x64(%rbp), %eax
movl %eax, -0x17c(%rbp)
movl -0x17c(%rbp), %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
addl $0x30, %edx
movb %dl, %cl
movl -0x6c(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x6c(%rbp)
cltq
movb %cl, -0x30(%rbp,%rax)
movl -0x70(%rbp), %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, -0x70(%rbp)
cmpl $0x0, -0x70(%rbp)
ja 0x1be23
cmpl $0x0, -0x64(%rbp)
jge 0x1be72
movl -0x6c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x6c(%rbp)
cltq
movb $0x2d, -0x30(%rbp,%rax)
movslq -0x6c(%rbp), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1bed1
movq -0x8(%rbp), %rdi
movl -0x6c(%rbp), %esi
callq 0x1c450
movl -0x6c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x68(%rbp)
cmpl $0x0, -0x68(%rbp)
jl 0x1becf
movslq -0x68(%rbp), %rax
movb -0x30(%rbp,%rax), %dl
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movb %dl, (%rax,%rcx)
movl -0x68(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x1be9a
jmp 0x1bed1
jmp 0x1c355
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x6c, %eax
jne 0x1c066
movq -0x38(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x64, %eax
jne 0x1c066
movl $0x0, -0x78(%rbp)
leaq -0x60(%rbp), %rax
movq %rax, -0x188(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x180(%rbp)
cmpl $0x28, %eax
ja 0x1bf39
movq -0x188(%rbp), %rcx
movl -0x180(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x190(%rbp)
jmp 0x1bf56
movq -0x188(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x190(%rbp)
movq -0x190(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
jl 0x1bf78
movq -0x80(%rbp), %rax
movq %rax, -0x198(%rbp)
jmp 0x1bf85
xorl %eax, %eax
subq -0x80(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0x198(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movl $0xa, %ecx
xorl %edx, %edx
divq %rcx
addq $0x30, %rdx
movb %dl, %cl
movl -0x78(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x78(%rbp)
cltq
movb %cl, -0x30(%rbp,%rax)
movq -0x88(%rbp), %rax
movl $0xa, %ecx
xorl %edx, %edx
divq %rcx
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x88(%rbp)
ja 0x1bf93
cmpq $0x0, -0x80(%rbp)
jge 0x1bff6
movl -0x78(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x78(%rbp)
cltq
movb $0x2d, -0x30(%rbp,%rax)
movslq -0x78(%rbp), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1c055
movq -0x8(%rbp), %rdi
movl -0x78(%rbp), %esi
callq 0x1c450
movl -0x78(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x74(%rbp)
cmpl $0x0, -0x74(%rbp)
jl 0x1c053
movslq -0x74(%rbp), %rax
movb -0x30(%rbp,%rax), %dl
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movb %dl, (%rax,%rcx)
movl -0x74(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x1c01e
jmp 0x1c055
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x1c353
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x75, %eax
jne 0x1c1ac
movl $0x0, -0x90(%rbp)
leaq -0x60(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x19c(%rbp)
cmpl $0x28, %eax
ja 0x1c0bb
movq -0x1a8(%rbp), %rcx
movl -0x19c(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x1b0(%rbp)
jmp 0x1c0d8
movq -0x1a8(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x1b0(%rbp)
movq -0x1b0(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
addl $0x30, %edx
movb %dl, %cl
movl -0x90(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x90(%rbp)
cltq
movb %cl, -0x30(%rbp,%rax)
movl -0x94(%rbp), %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, -0x94(%rbp)
cmpl $0x0, -0x94(%rbp)
ja 0x1c0e7
movslq -0x90(%rbp), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1c1a7
movq -0x8(%rbp), %rdi
movl -0x90(%rbp), %esi
callq 0x1c450
movl -0x90(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x8c(%rbp)
cmpl $0x0, -0x8c(%rbp)
jl 0x1c1a5
movslq -0x8c(%rbp), %rax
movb -0x30(%rbp,%rax), %dl
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movb %dl, (%rax,%rcx)
movl -0x8c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x1c164
jmp 0x1c1a7
jmp 0x1c351
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x73, %eax
jne 0x1c273
leaq -0x60(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x1b4(%rbp)
cmpl $0x28, %eax
ja 0x1c1f7
movq -0x1c0(%rbp), %rcx
movl -0x1b4(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x1c8(%rbp)
jmp 0x1c214
movq -0x1c0(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x1c8(%rbp)
movq -0x1c8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rdi
callq 0x2110
movl %eax, -0xa4(%rbp)
movslq -0xa4(%rbp), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1c26e
movq -0x8(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movq -0xa0(%rbp), %rdx
movslq -0xa4(%rbp), %rax
addq %rax, %rdx
callq 0x1c3e0
jmp 0x1c34f
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x63, %eax
jne 0x1c329
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1c327
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x1c450
leaq -0x60(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x1cc(%rbp)
cmpl $0x28, %eax
ja 0x1c2e3
movq -0x1d8(%rbp), %rcx
movl -0x1cc(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x1e0(%rbp)
jmp 0x1c300
movq -0x1d8(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x1e0(%rbp)
movq -0x1e0(%rbp), %rax
movl (%rax), %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movb %dl, (%rax,%rcx)
jmp 0x1c34d
movq 0x9cc8(%rip), %rax      # 0x25ff8
movq (%rax), %rdi
movq -0x38(%rbp), %rax
movsbl (%rax), %edx
leaq 0x5b3f(%rip), %rsi      # 0x21e80
movb $0x0, %al
callq 0x21f0
callq 0x2050
jmp 0x1c34f
jmp 0x1c351
jmp 0x1c353
jmp 0x1c355
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x1c363
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x1bd23
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
jbe 0x1c3ab
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rcx, %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1c3a9
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x1c3e0
jmp 0x1c3ab
leaq -0x60(%rbp), %rax
cmpq $0x0, -0x8(%rbp)
je 0x1c3c9
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movb $0x0, (%rax,%rcx)
movq -0x48(%rbp), %rax
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
nopw %cs:(%rax,%rax)