// File: /workspace/github_c_makefile_star2_O1/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, %r15
movq 0x10(%rdi), %rax
subq 0x18(%rdi), %rax
movq %rax, 0x18(%rsp)
leaq 0x38(%rsp), %r14
movl $0x1, %esi
movq %r14, %rdx
callq 0xa6a8
movq %rax, %rbx
movq (%r14), %r14
leaq 0x258(%rsp), %rax
movq %r15, -0x8(%rax)
movq %rax, -0x18(%rax)
movl $0x0, -0x10(%rax)
testq %r14, %r14
jle 0x11db3
shrq $0x4, 0x18(%rsp)
addq %rbx, %r14
leaq 0x2258(%rsp), %r12
movl $0x1, %r13d
leaq 0x38eb(%rip), %rbp      # 0x151b3
movq %r14, 0x28(%rsp)
cmpb $0x25, (%rbx)
jne 0x11909
cmpb $0x25, 0x1(%rbx)
jne 0x11951
cmpq %r12, 0x240(%rsp)
jb 0x11900
leaq 0x240(%rsp), %rdi
callq 0x1008f
testl %eax, %eax
je 0x11900
leaq 0x240(%rsp), %rdi
callq 0x100c5
movb 0x1(%rbx), %al
addq $0x2, %rbx
jmp 0x11936
cmpq %r12, 0x240(%rsp)
jb 0x11931
leaq 0x240(%rsp), %rdi
callq 0x1008f
testl %eax, %eax
je 0x11931
leaq 0x240(%rsp), %rdi
callq 0x100c5
movb (%rbx), %al
incq %rbx
movq 0x240(%rsp), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x240(%rsp)
movb %al, (%rcx)
jmp 0x11b59
leal 0x1(%r13), %r14d
cmpl 0x18(%rsp), %r13d
jge 0x11df1
incq %rbx
movb (%rbx), %al
movq %rbx, %r13
testb %al, %al
je 0x1198f
movq %rbx, %r13
movsbl %al, %esi
movl $0x6, %edx
movq %rbp, %rdi
callq 0x3140
testq %rax, %rax
je 0x1198f
movb 0x1(%r13), %al
incq %r13
testb %al, %al
jne 0x1196f
movq %r13, %rax
subq %rbx, %rax
cmpq $0x6, %rax
jae 0x11e0f
callq 0x32f0
movq (%rax), %rax
movzbl (%r13), %ecx
movzwl (%rax,%rcx,2), %ecx
shrl $0xb, %ecx
andl $0x1, %ecx
movzbl (%r13,%rcx), %edx
movzwl (%rax,%rdx,2), %edx
btl $0xb, %edx
adcq %rcx, %r13
cmpb $0x2e, (%r13)
jne 0x11a02
leaq 0x1(%r13), %rcx
movzbl 0x1(%r13), %edx
leaq 0x2(%r13), %rsi
xorl %edi, %edi
testb $0x8, 0x1(%rax,%rdx,2)
cmoveq %rcx, %rsi
sete %dil
negq %rdi
movzbl 0x2(%r13,%rdi), %ecx
movzwl (%rax,%rcx,2), %ecx
btl $0xb, %ecx
adcq $0x0, %rsi
movq %rsi, %r13
movq %r15, %r12
movzbl (%r13), %ecx
testb $0x8, 0x1(%rax,%rcx,2)
jne 0x11e03
movb $0x25, (%rsp)
movq %r13, %r15
subq %rbx, %r15
leaq 0x1(%r15), %rdx
leaq 0x1(%rsp), %rdi
movq %rbx, %rsi
callq 0x3060
movb $0x0, 0x2(%rsp,%r15)
movzbl (%r13), %eax
cmpl $0x62, %eax
jle 0x11a94
leal -0x63(%rax), %ecx
cmpl $0x15, %ecx
movq %r12, %r15
leaq 0x40(%rsp), %rbx
ja 0x11e20
leaq 0x292d(%rip), %rdx      # 0x14388
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq %rsp, %r12
movq %r12, %rdi
callq 0x30e0
movb -0x1(%rsp,%rax), %cl
movw $0x6c, -0x1(%rsp,%rax)
movb %cl, (%rsp,%rax)
movb $0x0, 0x1(%rsp,%rax)
movq %r15, %rdi
movl %r14d, %esi
callq 0x1319d
cvttsd2si %xmm0, %rdx
jmp 0x11af7
cmpl $0x45, %eax
movq %r12, %r15
leaq 0x40(%rsp), %rbx
je 0x11b06
cmpl $0x47, %eax
je 0x11b06
cmpl $0x58, %eax
jne 0x11e20
movq %rsp, %r12
movq %r12, %rdi
callq 0x30e0
movb -0x1(%rsp,%rax), %cl
movw $0x6c, -0x1(%rsp,%rax)
movb %cl, (%rsp,%rax)
movb $0x0, 0x1(%rsp,%rax)
movq %r15, %rdi
movl %r14d, %esi
callq 0x1319d
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x2ae4(%rip), %xmm0     # 0x145d0
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x3290
jmp 0x11b1e
movq %r15, %rdi
movl %r14d, %esi
callq 0x1319d
movq %rbx, %rdi
movq %rsp, %rsi
movb $0x1, %al
callq 0x3290
leaq 0x2258(%rsp), %r12
movq %rbx, %rdi
callq 0x30e0
leaq 0x240(%rsp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0xffb1
xorl %eax, %eax
testb $0x5, %al
jne 0x11ded
incq %r13
movq %r13, %rbx
movl %r14d, %r13d
movq 0x28(%rsp), %r14
cmpq %r14, %rbx
jb 0x118cd
jmp 0x11db3
movq %r15, %rdi
movl %r14d, %esi
movq %rbx, %rdx
callq 0xa6a8
movq %rax, %rbx
leaq 0x2258(%rsp), %r12
cmpq %r12, 0x240(%rsp)
jb 0x11ba8
leaq 0x240(%rsp), %rdi
callq 0x1008f
testl %eax, %eax
je 0x11ba8
leaq 0x240(%rsp), %rdi
callq 0x100c5
movq 0x240(%rsp), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x240(%rsp)
movb $0x22, (%rax)
subq $0x1, 0x40(%rsp)
jb 0x11cad
movzbl (%rbx), %eax
cmpl $0xc, %eax
jle 0x11be8
cmpl $0xd, %eax
je 0x11c76
cmpl $0x5c, %eax
je 0x11bf5
cmpl $0x22, %eax
je 0x11bf5
jmp 0x11c34
testl %eax, %eax
je 0x11c8c
cmpl $0xa, %eax
jne 0x11c34
cmpq %r12, 0x240(%rsp)
jb 0x11c1d
leaq 0x240(%rsp), %rdi
callq 0x1008f
testl %eax, %eax
je 0x11c1d
leaq 0x240(%rsp), %rdi
callq 0x100c5
movq 0x240(%rsp), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x240(%rsp)
movb $0x5c, (%rax)
cmpq %r12, 0x240(%rsp)
jb 0x11c5c
leaq 0x240(%rsp), %rdi
callq 0x1008f
testl %eax, %eax
je 0x11c5c
leaq 0x240(%rsp), %rdi
callq 0x100c5
movb (%rbx), %al
movq 0x240(%rsp), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x240(%rsp)
movb %al, (%rcx)
jmp 0x11ca5
movl $0x2, %edx
leaq 0x240(%rsp), %rdi
leaq 0x357c(%rip), %rsi      # 0x15206
jmp 0x11ca0
movl $0x4, %edx
leaq 0x240(%rsp), %rdi
leaq 0x3569(%rip), %rsi      # 0x15209
callq 0xffb1
incq %rbx
jmp 0x11bbf
cmpq %r12, 0x240(%rsp)
jb 0x11cd5
leaq 0x240(%rsp), %rdi
callq 0x1008f
testl %eax, %eax
je 0x11cd5
leaq 0x240(%rsp), %rdi
callq 0x100c5
movq 0x240(%rsp), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x240(%rsp)
movb $0x22, (%rax)
movl $0x2, %eax
jmp 0x11b43
movq %r15, %rdi
movl %r14d, %esi
leaq 0x30(%rsp), %rdx
callq 0xa6a8
movq %rax, 0x20(%rsp)
movq %rsp, %rdi
movl $0x2e, %esi
callq 0x30f0
testq %rax, %rax
setne %al
cmpq $0x64, 0x30(%rsp)
setb %bl
orb %al, %bl
leaq 0x2258(%rsp), %r12
je 0x11d6f
leaq 0x40(%rsp), %rdi
movq %rsp, %rsi
movq 0x20(%rsp), %rdx
xorl %eax, %eax
callq 0x3290
movl $0x4, %eax
jmp 0x11da1
movq %r15, %rdi
movl %r14d, %esi
callq 0x1319d
cvttsd2si %xmm0, %edx
movq %rbx, %rdi
movq %rsp, %rsi
xorl %eax, %eax
callq 0x3290
jmp 0x11b1e
movq %r15, %rdi
movl %r14d, %esi
callq 0x975f
movq 0x10(%r15), %rcx
movq (%rax), %rdx
movq %rdx, (%rcx)
movl 0x8(%rax), %eax
movl %eax, 0x8(%rcx)
addq $0x10, 0x10(%r15)
leaq 0x240(%rsp), %rdi
callq 0x1000d
movl $0x2, %eax
testb %bl, %bl
leaq 0x40(%rsp), %rbx
jne 0x11b26
jmp 0x11b43
leaq 0x240(%rsp), %rbx
movq %rbx, %rdi
callq 0x1008f
movq 0x10(%rbx), %rdi
movl 0x8(%rbx), %esi
callq 0xa57b
movl $0x1, 0x8(%rbx)
movl $0x1, %eax
addq $0x2258, %rsp           # imm = 0x2258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x11ddb
leaq 0x2c3e(%rip), %rdx      # 0x14a36
movq %r15, %rdi
movl %r14d, %esi
callq 0xa173
leaq 0x33cf(%rip), %rsi      # 0x151d9
movq %r12, %rdi
jmp 0x11e19
leaq 0x33a3(%rip), %rsi      # 0x151b9
movq %r15, %rdi
xorl %eax, %eax
callq 0xa049
movsbl %al, %edx
leaq 0x3367(%rip), %rsi      # 0x15191
movq %r15, %rdi
xorl %eax, %eax
callq 0xa049