// File: /workspace/github_c_makefile_star2_O2/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 $0x2268, %rsp           # imm = 0x2268
movq %rdi, %r12
movq 0x10(%rdi), %rax
subq 0x18(%rdi), %rax
shrq $0x4, %rax
movq %rax, 0x38(%rsp)
pushq $0x1
popq %r13
leaq 0x40(%rsp), %r15
movl %r13d, %esi
movq %r15, %rdx
callq 0x9b97
movq %rax, %r14
movq %rax, %rbx
addq (%r15), %rbx
leaq 0x60(%rsp), %rax
movq %r12, 0x8(%rsp)
movq %r12, -0x8(%rax)
movq %rax, -0x18(%rax)
andl $0x0, -0x10(%rax)
leaq 0x2060(%rsp), %rbp
cmpq %rbx, %r14
jae 0x10173
movb (%r14), %al
cmpb $0x25, %al
jne 0xfdaa
leaq 0x1(%r14), %r15
movb 0x1(%r14), %r12b
cmpb $0x25, %r12b
jne 0xfdd6
movq 0x48(%rsp), %rax
movb $0x25, %cl
cmpq %rbp, %rax
jb 0xfd99
leaq 0x48(%rsp), %rdi
callq 0xe979
movb (%r15), %cl
movq 0x48(%rsp), %rax
addq $0x2, %r14
leaq 0x1(%rax), %rdx
movq %rdx, 0x48(%rsp)
movb %cl, (%rax)
jmp 0xfd5d
movq 0x48(%rsp), %rcx
cmpq %rbp, %rcx
jb 0xfdc6
leaq 0x48(%rsp), %rdi
callq 0xe979
movb (%r14), %al
movq 0x48(%rsp), %rcx
incq %r14
leaq 0x1(%rcx), %rdx
movq %rdx, 0x48(%rsp)
movb %al, (%rcx)
jmp 0xfd5d
leal 0x1(%r13), %eax
movl %eax, 0x4(%rsp)
cmpl 0x38(%rsp), %r13d
jge 0x101ae
xorl %r13d, %r13d
testb %r12b, %r12b
je 0xfe13
movsbl %r12b, %esi
leaq 0x33df(%rip), %rdi      # 0x131db
pushq $0x6
popq %rdx
callq 0x3130
testq %rax, %rax
je 0xfe13
movb 0x2(%r14,%r13), %r12b
incq %r13
jmp 0xfdec
cmpq $0x6, %r13
jae 0x10192
callq 0x32e0
movq (%rax), %rax
movzbl %r12b, %ecx
movzwl (%rax,%rcx,2), %ecx
shrl $0xb, %ecx
andl $0x1, %ecx
leaq (%r14,%rcx), %rdx
movzbl 0x1(%r13,%rdx), %esi
movzwl (%rax,%rsi,2), %edi
shrl $0xb, %edi
andl $0x1, %edi
addq %rdi, %rdx
movb 0x1(%r13,%rdx), %sil
cmpb $0x2e, %sil
jne 0xfe89
addq %rdi, %rcx
addq %rcx, %r14
leaq (%r14,%r13), %rcx
addq $0x2, %rcx
movzbl (%rcx), %edx
testb $0x8, 0x1(%rax,%rdx,2)
leaq 0x3(%r13,%r14), %r14
cmoveq %rcx, %r14
movzbl (%r14), %ecx
movzwl (%rax,%rcx,2), %ecx
btl $0xb, %ecx
adcq $0x0, %r14
movb (%r14), %sil
jmp 0xfe90
leaq (%rdx,%r13), %r14
incq %r14
movzbl %sil, %ecx
testb $0x8, 0x1(%rax,%rcx,2)
leaq 0x2060(%rsp), %r13
jne 0x1019b
movb $0x25, 0x10(%rsp)
movq %r14, %r12
subq %r15, %r12
leaq 0x1(%r12), %rdx
leaq 0x11(%rsp), %rdi
movq %r15, %rsi
callq 0x3060
movb $0x0, 0x12(%rsp,%r12)
movzbl (%r14), %eax
incq %r14
leal -0x63(%rax), %ecx
cmpl $0x15, %ecx
ja 0xff0b
leaq 0x24b0(%rip), %rdx      # 0x12390
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x1130a
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %esi
callq 0x112c3
cvttsd2si %xmm0, %rdx
jmp 0xff58
cmpl $0x45, %eax
je 0xff67
cmpl $0x47, %eax
je 0xff67
cmpl $0x58, %eax
jne 0x101c3
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x1130a
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %esi
callq 0x112c3
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x26ab(%rip), %xmm0     # 0x125f8
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq %r13, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x3280
jmp 0xff84
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %esi
callq 0x112c3
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
movb $0x1, %al
callq 0x3280
movq %r13, %rdi
callq 0x30e0
leaq 0x48(%rsp), %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0xe7bc
movl 0x4(%rsp), %r13d
jmp 0xfd5d
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %esi
callq 0x112c3
cvttsd2si %xmm0, %edx
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x3280
jmp 0xff84
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %esi
leaq 0x30(%rsp), %rdx
callq 0x9b97
movq %rax, %r15
leaq 0x10(%rsp), %rdi
pushq $0x2e
popq %rsi
callq 0x30f0
testq %rax, %rax
jne 0x10163
cmpq $0x63, 0x30(%rsp)
jbe 0x10163
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %r13d
movl %r13d, %esi
callq 0x8917
leaq 0x48(%rsp), %rdi
callq 0xe82a
jmp 0xfd5d
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %esi
leaq 0x30(%rsp), %rdx
callq 0x9b97
movq %rax, %r15
movq 0x48(%rsp), %rax
cmpq %rbp, %rax
jb 0x10051
leaq 0x48(%rsp), %rdi
callq 0xe979
movq 0x48(%rsp), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x48(%rsp)
movb $0x22, (%rax)
leaq 0x31cd(%rip), %r12      # 0x13231
pushq $0x4
popq %r13
subq $0x1, 0x30(%rsp)
jb 0x10134
movzbl (%r15), %eax
testl %eax, %eax
je 0x1011c
cmpl $0xa, %eax
je 0x10094
cmpl $0xd, %eax
je 0x100e2
cmpl $0x5c, %eax
je 0x10094
cmpl $0x22, %eax
jne 0x100f3
movq 0x48(%rsp), %rax
cmpq %rbp, %rax
jb 0x100ad
leaq 0x48(%rsp), %rdi
callq 0xe979
movq 0x48(%rsp), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x48(%rsp)
movb $0x5c, (%rax)
movq 0x48(%rsp), %rax
cmpq %rbp, %rax
jb 0x100d2
leaq 0x48(%rsp), %rdi
callq 0xe979
movq 0x48(%rsp), %rax
movb (%r15), %cl
leaq 0x1(%rax), %rdx
movq %rdx, 0x48(%rsp)
movb %cl, (%rax)
jmp 0x1012c
leaq 0x48(%rsp), %rdi
leaq 0x3140(%rip), %rsi      # 0x1322e
pushq $0x2
popq %rdx
jmp 0x10127
movq 0x48(%rsp), %rcx
cmpq %rbp, %rcx
jb 0x1010f
leaq 0x48(%rsp), %rdi
callq 0xe979
movb (%r15), %al
movq 0x48(%rsp), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x48(%rsp)
movb %al, (%rcx)
jmp 0x1012c
leaq 0x48(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xe7bc
incq %r15
jmp 0x10068
movq 0x48(%rsp), %rax
cmpq %rbp, %rax
jb 0x1014d
leaq 0x48(%rsp), %rdi
callq 0xe979
movq 0x48(%rsp), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x48(%rsp)
movb $0x22, (%rax)
movl 0x4(%rsp), %r13d
jmp 0xfd5d
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
movq %r15, %rdx
jmp 0xff5e
leaq 0x48(%rsp), %rdi
callq 0xe80c
pushq $0x1
popq %rax
addq $0x2268, %rsp           # imm = 0x2268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3048(%rip), %rsi      # 0x131e1
jmp 0x101a2
leaq 0x305f(%rip), %rsi      # 0x13201
movq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x9546
leaq 0x28a9(%rip), %rdx      # 0x12a5e
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %esi
callq 0x967a
movsbl %al, %edx
leaq 0x2fec(%rip), %rsi      # 0x131b9
movq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x9546