// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x40(%rsp), %rsi
movq %rdx, 0x10(%rsi)
movq %rcx, 0x18(%rsi)
movq %r8, 0x20(%rsi)
movq %r9, 0x28(%rsi)
testb %al, %al
je 0xf925
movaps %xmm0, 0x70(%rsp)
movaps %xmm1, 0x80(%rsp)
movaps %xmm2, 0x90(%rsp)
movaps %xmm3, 0xa0(%rsp)
movaps %xmm4, 0xb0(%rsp)
movaps %xmm5, 0xc0(%rsp)
movaps %xmm6, 0xd0(%rsp)
movaps %xmm7, 0xe0(%rsp)
movq %rsi, 0x10(%rsp)
leaq 0x130(%rsp), %rax
movq %rax, 0x8(%rsp)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rsp)
xorl %r8d, %r8d
movl $0xcccccccd, %ebp       # imm = 0xCCCCCCCD
movabsq $-0x3333333333333333, %r14 # imm = 0xCCCCCCCCCCCCCCCD
movq %r15, %r12
movzbl (%r12), %eax
cmpl $0x25, %eax
je 0xf971
testl %eax, %eax
jne 0xff48
jmp 0xff50
movq %r12, %r13
subq %r15, %r13
jbe 0xfa18
addq %r13, %r8
testq %rbx, %rbx
je 0xfa18
movq %r8, %r14
movq (%rbx), %rdi
movslq %r13d, %rax
leaq (%rdi,%rax), %rcx
incq %rcx
cmpq 0x8(%rbx), %rcx
jbe 0xf9f6
addq %rax, %rdi
movq %rdi, %rax
shrq %rax
orq %rdi, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x10, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x20, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rbx)
movq 0x10(%rbx), %rdi
callq 0x2230
movq %rax, 0x10(%rbx)
movq (%rbx), %rdi
jmp 0xf9fa
movq 0x10(%rbx), %rax
addq %rax, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x21e0
addq %r13, (%rbx)
movq %r14, %r8
movabsq $-0x3333333333333333, %r14 # imm = 0xCCCCCCCCCCCCCCCD
leaq 0x1(%r12), %r13
movzbl 0x1(%r12), %edi
cmpl $0x6b, %edi
jle 0xfa5f
cmpl $0x6c, %edi
je 0xfa8d
cmpl $0x73, %edi
je 0xfab9
cmpl $0x75, %edi
jne 0x1000d
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0xfc0f
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0xfc1d
cmpl $0x63, %edi
je 0xfade
cmpl $0x64, %edi
jne 0x1000d
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0xfcf6
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0xfd04
cmpb $0x64, 0x2(%r12)
jne 0x1000d
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0xfdf6
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0xfe04
movl (%rsp), %ecx
cmpq $0x28, %rcx
movq %r8, 0x18(%rsp)
ja 0xfb7c
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0xfb8a
movl $0x1, %r15d
testq %rbx, %rbx
je 0xff3e
movq (%rbx), %rax
leaq 0x2(%rax), %rcx
cmpq 0x8(%rbx), %rcx
jbe 0xfb5c
incq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
movq %rcx, %rsi
shrq $0x20, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, 0x8(%rbx)
movq 0x10(%rbx), %rdi
movq %r8, %r14
callq 0x2230
movq %r14, %r8
movabsq $-0x3333333333333333, %r14 # imm = 0xCCCCCCCCCCCCCCCD
movq %rax, 0x10(%rbx)
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0xff1d
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0xff2b
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq (%rax), %r12
movq %r12, %rdi
callq 0x2100
movslq %eax, %r15
testq %rbx, %rbx
je 0xff16
movq (%rbx), %rdi
leaq (%rdi,%r15), %rax
incq %rax
cmpq 0x8(%rbx), %rax
jbe 0xff01
addq %r15, %rdi
movq %rdi, %rax
shrq %rax
orq %rdi, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x10, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x20, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rbx)
movq 0x10(%rbx), %rdi
callq 0x2230
movq %rax, 0x10(%rbx)
movq (%rbx), %rdi
jmp 0xff05
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movl (%rax), %ecx
movl $0x1, %edx
xorl %eax, %eax
movq %rdx, %r12
movl %ecx, %esi
imulq %rbp, %rsi
shrq $0x23, %rsi
leal (%rsi,%rsi), %edx
leal (%rdx,%rdx,4), %edx
movl %ecx, %edi
subl %edx, %edi
orb $0x30, %dil
movb %dil, 0x20(%rsp,%rax)
incq %rax
leaq 0x1(%r12), %rdx
cmpl $0x9, %ecx
movl %esi, %ecx
ja 0xfc26
movl %eax, %r15d
testq %rbx, %rbx
je 0xff3e
movq (%rbx), %rax
leaq (%rax,%r15), %rcx
incq %rcx
cmpq 0x8(%rbx), %rcx
jbe 0xfcd3
addq %r15, %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
movq %rcx, %rsi
shrq $0x20, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, 0x8(%rbx)
movq 0x10(%rbx), %rdi
movq %r8, %r14
callq 0x2230
movq %r14, %r8
movabsq $-0x3333333333333333, %r14 # imm = 0xCCCCCCCCCCCCCCCD
movq %rax, 0x10(%rbx)
movb 0x1f(%rsp,%r12), %al
movq (%rbx), %rcx
movq 0x10(%rbx), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%rbx)
movb %al, (%rdx,%rcx)
decq %r12
testq %r12, %r12
jg 0xfcd3
jmp 0xff3e
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movl (%rax), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
xorl %r12d, %r12d
movl %ecx, %edx
imulq %rbp, %rdx
shrq $0x23, %rdx
leal (%rdx,%rdx), %esi
leal (%rsi,%rsi,4), %esi
movl %ecx, %edi
subl %esi, %edi
orb $0x30, %dil
movb %dil, 0x20(%rsp,%r12)
incq %r12
cmpl $0x9, %ecx
movl %edx, %ecx
ja 0xfd10
testl %eax, %eax
jns 0xfd46
movl %r12d, %eax
incl %r12d
movb $0x2d, 0x20(%rsp,%rax)
movslq %r12d, %r15
testq %rbx, %rbx
je 0xff3e
movq (%rbx), %rax
leaq (%rax,%r15), %rcx
incq %rcx
cmpq 0x8(%rbx), %rcx
jbe 0xfdc4
addq %r15, %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
movq %rcx, %rsi
shrq $0x20, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, 0x8(%rbx)
movq 0x10(%rbx), %rdi
movq %r8, %r14
callq 0x2230
movq %r14, %r8
movabsq $-0x3333333333333333, %r14 # imm = 0xCCCCCCCCCCCCCCCD
movq %rax, 0x10(%rbx)
movl %r12d, %eax
incl %r12d
leaq 0x1f(%rsp), %rcx
addq %rcx, %rax
movb (%rax), %cl
movq (%rbx), %rdx
movq 0x10(%rbx), %rsi
leaq 0x1(%rdx), %rdi
movq %rdi, (%rbx)
movb %cl, (%rsi,%rdx)
decl %r12d
decq %rax
cmpl $0x1, %r12d
jg 0xfdd2
jmp 0xff3e
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
addq $0x2, %r12
movq (%rax), %rsi
movq %rsi, %rcx
negq %rcx
cmovsq %rsi, %rcx
xorl %r13d, %r13d
movq %rcx, %rax
mulq %r14
shrq $0x3, %rdx
leal (%rdx,%rdx), %eax
leal (%rax,%rax,4), %eax
movl %ecx, %edi
subl %eax, %edi
orb $0x30, %dil
movb %dil, 0x20(%rsp,%r13)
incq %r13
cmpq $0x9, %rcx
movq %rdx, %rcx
ja 0xfe18
testq %rsi, %rsi
jns 0xfe51
movl %r13d, %eax
incl %r13d
movb $0x2d, 0x20(%rsp,%rax)
movslq %r13d, %r15
testq %rbx, %rbx
je 0xfefc
movq (%rbx), %rax
leaq (%rax,%r15), %rcx
incq %rcx
cmpq 0x8(%rbx), %rcx
jbe 0xfecf
addq %r15, %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
movq %rcx, %rsi
shrq $0x20, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, 0x8(%rbx)
movq 0x10(%rbx), %rdi
movq %r8, %r14
callq 0x2230
movq %r14, %r8
movabsq $-0x3333333333333333, %r14 # imm = 0xCCCCCCCCCCCCCCCD
movq %rax, 0x10(%rbx)
movl %r13d, %eax
incl %r13d
leaq 0x1f(%rsp), %rcx
addq %rcx, %rax
movb (%rax), %cl
movq (%rbx), %rdx
movq 0x10(%rbx), %rsi
leaq 0x1(%rdx), %rdi
movq %rdi, (%rbx)
movb %cl, (%rsi,%rdx)
decl %r13d
decq %rax
cmpl $0x1, %r13d
jg 0xfedd
movq %r12, %r13
jmp 0xff3e
movq 0x10(%rbx), %rax
addq %rax, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x21e0
addq %r15, (%rbx)
movq 0x18(%rsp), %r8
jmp 0xff3e
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movb (%rax), %al
movq (%rbx), %rcx
movq 0x10(%rbx), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%rbx)
movb %al, (%rdx,%rcx)
addq %r15, %r8
leaq 0x1(%r13), %r15
movq %r13, %r12
incq %r12
jmp 0xf95a
subq %r15, %r12
jbe 0xffce
addq %r12, %r8
testq %rbx, %rbx
je 0xfff8
movq %r8, %r14
movq (%rbx), %rdi
movslq %r12d, %rax
leaq (%rdi,%rax), %rcx
incq %rcx
cmpq 0x8(%rbx), %rcx
jbe 0xffd5
addq %rax, %rdi
movq %rdi, %rax
shrq %rax
orq %rdi, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x10, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x20, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rbx)
movq 0x10(%rbx), %rdi
callq 0x2230
movq %rax, 0x10(%rbx)
movq (%rbx), %rdi
jmp 0xffd9
testq %rbx, %rbx
jne 0xffed
jmp 0xfff8
movq 0x10(%rbx), %rax
addq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x21e0
addq %r12, (%rbx)
movq %r14, %r8
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
movb $0x0, (%rcx,%rax)
movq %r8, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2cee