// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/host/minilua.c
// Function: str_format
static int str_format(lua_State*L){
int top=lua_gettop(L);
int arg=1;
size_t sfl;
const char*strfrmt=luaL_checklstring(L,arg,&sfl);
const char*strfrmt_end=strfrmt+sfl;
luaL_Buffer b;
luaL_buffinit(L,&b);
while(strfrmt<strfrmt_end){
if(*strfrmt!='%')
luaL_addchar(&b,*strfrmt++);
else if(*++strfrmt=='%')
luaL_addchar(&b,*strfrmt++);
else{
char form[(sizeof("-+ #0")+sizeof("l")+10)];
char buff[512];
if(++arg>top)
luaL_argerror(L,arg,"no value");
strfrmt=scanformat(L,strfrmt,form);
switch(*strfrmt++){
case'c':{
sprintf(buff,form,(int)luaL_checknumber(L,arg));
break;
}
case'd':case'i':{
addintlen(form);
sprintf(buff,form,(long)luaL_checknumber(L,arg));
break;
}
case'o':case'u':case'x':case'X':{
addintlen(form);
sprintf(buff,form,(unsigned long)luaL_checknumber(L,arg));
break;
}
case'e':case'E':case'f':
case'g':case'G':{
sprintf(buff,form,(double)luaL_checknumber(L,arg));
break;
}
case'q':{
addquoted(L,&b,arg);
continue;
}
case's':{
size_t l;
const char*s=luaL_checklstring(L,arg,&l);
if(!strchr(form,'.')&&l>=100){
lua_pushvalue(L,arg);
luaL_addvalue(&b);
continue;
}
else{
sprintf(buff,form,s);
break;
}
}
default:{
return luaL_error(L,"invalid option "LUA_QL("%%%c")" to "
LUA_QL("format"),*(strfrmt-1));
}
}
luaL_addlstring(&b,buff,strlen(buff));
}
}
luaL_pushresult(&b);
return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2258, %rsp           # imm = 0x2258
movq %rdi, %r12
movq 0x10(%rdi), %rax
subq 0x18(%rdi), %rax
movq %rax, 0x30(%rsp)
movl $0x1, %r15d
leaq 0x38(%rsp), %r14
movl $0x1, %esi
movq %r14, %rdx
callq 0xb00c
movq %rax, %rbx
movq (%r14), %rcx
leaq 0x258(%rsp), %rax
movq %r12, (%rsp)
movq %r12, -0x8(%rax)
movq %rax, -0x18(%rax)
movl $0x0, -0x10(%rax)
testq %rcx, %rcx
jle 0x12b63
movq %rcx, %r12
shrq $0x4, 0x30(%rsp)
addq %rbx, %r12
leaq 0x240(%rsp), %rbp
cmpb $0x25, (%rbx)
jne 0x126f2
movq %rbp, %r14
movq %r12, %rbp
movb 0x1(%rbx), %r12b
cmpb $0x25, %r12b
jne 0x1273b
leaq 0x2258(%rsp), %rax
cmpq %rax, 0x240(%rsp)
movq %rbp, %r12
movq %r14, %rbp
jb 0x126e9
movq %rbp, %rdi
callq 0x10d41
testl %eax, %eax
je 0x126e9
movq %rbp, %rdi
callq 0x10d77
movb 0x1(%rbx), %al
addq $0x2, %rbx
jmp 0x1271d
leaq 0x2258(%rsp), %rax
cmpq %rax, 0x240(%rsp)
jb 0x12718
movq %rbp, %rdi
callq 0x10d41
testl %eax, %eax
je 0x12718
movq %rbp, %rdi
callq 0x10d77
movb (%rbx), %al
incq %rbx
movq 0x240(%rsp), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x240(%rsp)
movb %al, (%rcx)
movq %rbx, %r13
jmp 0x1294a
leal 0x1(%r15), %eax
movl %eax, 0xc(%rsp)
cmpl 0x30(%rsp), %r15d
jge 0x12b96
incq %rbx
testb %r12b, %r12b
leaq 0x3a80(%rip), %r15      # 0x161db
je 0x1278b
movq %rbx, %r13
movsbl %r12b, %esi
movl $0x6, %edx
movq %r15, %rdi
callq 0x3140
testq %rax, %rax
je 0x12785
movb 0x1(%r13), %r12b
incq %r13
testb %r12b, %r12b
jne 0x12760
xorl %r12d, %r12d
movzbl %r12b, %r15d
jmp 0x12791
xorl %r15d, %r15d
movq %rbx, %r13
movq %r13, %rax
subq %rbx, %rax
cmpq $0x6, %rax
jae 0x12bb3
movq %rbp, %r12
callq 0x32f0
movq (%rax), %rax
movzwl (%rax,%r15,2), %ecx
shrl $0xb, %ecx
andl $0x1, %ecx
movzbl (%r13,%rcx), %edx
movzwl (%rax,%rdx,2), %edx
btl $0xb, %edx
adcq %rcx, %r13
movb (%r13), %cl
cmpb $0x2e, %cl
movq %r14, %rbp
jne 0x1280a
leaq 0x1(%r13), %rcx
movzbl 0x1(%r13), %edx
xorl %esi, %esi
testb $0x8, 0x1(%rax,%rdx,2)
leaq 0x2(%r13), %rdx
sete %sil
cmoveq %rcx, %rdx
negq %rsi
movzbl 0x2(%r13,%rsi), %ecx
movzwl (%rax,%rcx,2), %ecx
btl $0xb, %ecx
adcq $0x0, %rdx
movb (%rdx), %cl
movq %rdx, %r13
movzbl %cl, %ecx
testb $0x8, 0x1(%rax,%rcx,2)
jne 0x12baa
movb $0x25, 0x10(%rsp)
movq %r13, %r15
subq %rbx, %r15
leaq 0x1(%r15), %rdx
leaq 0x11(%rsp), %rdi
movq %rbx, %rsi
callq 0x3060
movb $0x0, 0x12(%rsp,%r15)
movzbl (%r13), %eax
incq %r13
cmpl $0x62, %eax
jle 0x128a1
leal -0x63(%rax), %ecx
cmpl $0x15, %ecx
leaq 0x40(%rsp), %r14
movl 0xc(%rsp), %r15d
ja 0x12bc5
leaq 0x2b9c(%rip), %rdx      # 0x15400
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x30e0
movb 0xf(%rsp,%rax), %cl
movw $0x6c, 0xf(%rsp,%rax)
movb %cl, 0x10(%rsp,%rax)
movb $0x0, 0x11(%rsp,%rax)
movq (%rsp), %rdi
movl %r15d, %esi
callq 0x13fd0
cvttsd2si %xmm0, %rdx
jmp 0x1290a
cmpl $0x45, %eax
leaq 0x40(%rsp), %r14
movl 0xc(%rsp), %r15d
je 0x12919
cmpl $0x47, %eax
je 0x12919
cmpl $0x58, %eax
jne 0x12bc5
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x30e0
movb 0xf(%rsp,%rax), %cl
movw $0x6c, 0xf(%rsp,%rax)
movb %cl, 0x10(%rsp,%rax)
movb $0x0, 0x11(%rsp,%rax)
movq (%rsp), %rdi
movl %r15d, %esi
callq 0x13fd0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x2cf9(%rip), %xmm0     # 0x155f8
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq %r14, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3290
jmp 0x12934
movq (%rsp), %rdi
movl %r15d, %esi
callq 0x13fd0
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
movb $0x1, %al
callq 0x3290
movq %r14, %rdi
callq 0x30e0
movq %rbp, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x10c63
movq %r13, %rbx
cmpq %r12, %r13
jb 0x126a8
jmp 0x12b63
movq (%rsp), %rdi
movl %r15d, %esi
leaq 0x28(%rsp), %rdx
callq 0xb00c
movq %rax, %rbx
leaq 0x2258(%rsp), %rax
cmpq %rax, 0x240(%rsp)
jb 0x12995
movq %rbp, %rdi
callq 0x10d41
testl %eax, %eax
je 0x12995
movq %rbp, %rdi
callq 0x10d77
movq 0x240(%rsp), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x240(%rsp)
movb $0x22, (%rax)
subq $0x1, 0x28(%rsp)
jb 0x12a8c
movzbl (%rbx), %eax
cmpl $0xc, %eax
jle 0x129d5
cmpl $0xd, %eax
je 0x12a5f
cmpl $0x5c, %eax
je 0x129e2
cmpl $0x22, %eax
je 0x129e2
jmp 0x12a1f
testl %eax, %eax
je 0x12a70
cmpl $0xa, %eax
jne 0x12a1f
leaq 0x2258(%rsp), %rax
cmpq %rax, 0x240(%rsp)
jb 0x12a08
movq %rbp, %rdi
callq 0x10d41
testl %eax, %eax
je 0x12a08
movq %rbp, %rdi
callq 0x10d77
movq 0x240(%rsp), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x240(%rsp)
movb $0x5c, (%rax)
leaq 0x2258(%rsp), %rax
cmpq %rax, 0x240(%rsp)
jb 0x12a45
movq %rbp, %rdi
callq 0x10d41
testl %eax, %eax
je 0x12a45
movq %rbp, %rdi
callq 0x10d77
movb (%rbx), %al
movq 0x240(%rsp), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x240(%rsp)
movb %al, (%rcx)
jmp 0x12a84
movl $0x2, %edx
movq %rbp, %rdi
leaq 0x37c0(%rip), %rsi      # 0x1622e
jmp 0x12a7f
movl $0x4, %edx
movq %rbp, %rdi
leaq 0x37b2(%rip), %rsi      # 0x16231
callq 0x10c63
incq %rbx
jmp 0x129ac
leaq 0x2258(%rsp), %rax
cmpq %rax, 0x240(%rsp)
jb 0x12ab2
movq %rbp, %rdi
callq 0x10d41
testl %eax, %eax
je 0x12ab2
movq %rbp, %rdi
callq 0x10d77
movq 0x240(%rsp), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x240(%rsp)
movb $0x22, (%rax)
jmp 0x1294a
movq (%rsp), %rdi
movl %r15d, %esi
leaq 0x28(%rsp), %rdx
callq 0xb00c
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
movl $0x2e, %esi
callq 0x30f0
testq %rax, %rax
jne 0x12b53
cmpq $0x63, 0x28(%rsp)
jbe 0x12b53
movq (%rsp), %rbx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x9d4e
movq 0x10(%rbx), %rcx
movq (%rax), %rdx
movq %rdx, (%rcx)
movl 0x8(%rax), %eax
movl %eax, 0x8(%rcx)
addq $0x10, 0x10(%rbx)
movq %rbp, %rdi
callq 0x10cbf
jmp 0x1294a
movq (%rsp), %rdi
movl %r15d, %esi
callq 0x13fd0
cvttsd2si %xmm0, %edx
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x3290
jmp 0x12934
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
movq %rbx, %rdx
jmp 0x12910
leaq 0x240(%rsp), %rbx
movq %rbx, %rdi
callq 0x10d41
movq 0x10(%rbx), %rdi
movl 0x8(%rbx), %esi
callq 0xaedf
movl $0x1, %eax
addq $0x2258, %rsp           # imm = 0x2258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2ec1(%rip), %rdx      # 0x15a5e
movq (%rsp), %rdi
movl 0xc(%rsp), %esi
callq 0xaa6a
leaq 0x3650(%rip), %rsi      # 0x16201
jmp 0x12bba
leaq 0x3627(%rip), %rsi      # 0x161e1
movq (%rsp), %rdi
xorl %eax, %eax
callq 0xa940
movsbl %al, %edx
leaq 0x35ea(%rip), %rsi      # 0x161b9
movq (%rsp), %rdi
xorl %eax, %eax
callq 0xa940