// File: /workspace/github_c_makefile_star2_O1/ccxvii[P]mujs/./json.c
// Function: JSON_stringify
static void JSON_stringify(js_State *J)
{
	js_Buffer *sb = NULL;
	char buf[12];
	/* NOTE: volatile to silence GCC warning about longjmp clobbering a variable */
	const char * volatile gap;
	const char *s;
	int n;

	gap = NULL;

	if (js_isnumber(J, 3) || js_isnumberobject(J, 3)) {
		n = js_tointeger(J, 3);
		if (n < 0) n = 0;
		if (n > 10) n = 10;
		memset(buf, ' ', n);
		buf[n] = 0;
		if (n > 0) gap = buf;
	} else if (js_isstring(J, 3) || js_isstringobject(J, 3)) {
		s = js_tostring(J, 3);
		n = strlen(s);
		if (n > 10) n = 10;
		memcpy(buf, s, n);
		buf[n] = 0;
		if (n > 0) gap = buf;
	}

	if (js_try(J)) {
		js_free(J, sb);
		js_throw(J);
	}

	js_newobject(J); /* wrapper */
	js_copy(J, 1);
	js_defproperty(J, -2, "", 0);
	if (!fmtvalue(J, &sb, "", gap, 0)) {
		js_pushundefined(J);
	} else {
		js_putc(J, &sb, 0);
		js_pushstring(J, sb ? sb->s : "");
		js_rot2pop1(J);
	}

	js_endtry(J);
	js_free(J, sb);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
xorl %eax, %eax
movq %rax, (%rsp)
movq %rax, 0x8(%rsp)
movl 0x144(%rdi), %ecx
leaq 0x2e5b8(%rip), %rax     # 0x403f8
cmpl $-0x3, %ecx
jl 0x11e5f
addl $0x3, %ecx
cmpl 0x140(%rbx), %ecx
jge 0x11e5f
movl %ecx, %ecx
movl %ecx, %eax
shlq $0x4, %rax
addq 0x148(%rbx), %rax
cmpb $0x4, 0xf(%rax)
je 0x11e7a
movq %rbx, %rdi
movl $0x3, %esi
callq 0x11bb5
testl %eax, %eax
je 0x11fa5
movq %rbx, %rdi
movl $0x3, %esi
callq 0x409b
movl %eax, %ebp
xorl %eax, %eax
testl %ebp, %ebp
cmovgl %ebp, %eax
cmpl $0xa, %eax
movl $0xa, %ecx
cmovll %eax, %ecx
movl %ecx, %r15d
leaq 0x14(%rsp), %r14
movq %r14, %rdi
movl $0x20, %esi
movq %r15, %rdx
callq 0x3060
movb $0x0, 0x14(%rsp,%r15)
testl %ebp, %ebp
jle 0x11ec2
movq %r14, 0x8(%rsp)
movq %rbx, %rdi
callq 0x13fbb
movq %rax, %rdi
callq 0x3100
testl %eax, %eax
jne 0x12071
movq %rbx, %rdi
callq 0x1a42b
movq %rbx, %rdi
movl $0x1, %esi
callq 0x14073
leaq 0x22490(%rip), %r14     # 0x34386
xorl %ebp, %ebp
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movq %r14, %rdx
movl %ebp, %ecx
callq 0x66df
movq 0x8(%rsp), %rcx
movq %rsp, %rsi
movq %rbx, %rdi
movq %r14, %rdx
movl %ebp, %r8d
callq 0x228c0
testl %eax, %eax
je 0x11f6e
movq %rsp, %r15
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xe0bc
movq (%r15), %rax
leaq 0x8(%rax), %rsi
testq %rax, %rax
cmoveq %r14, %rsi
movq %rbx, %rdi
callq 0x13665
movq 0x148(%rbx), %rax
movslq 0x140(%rbx), %rcx
shlq $0x4, %rcx
movups -0x10(%rax,%rcx), %xmm0
movups %xmm0, -0x20(%rax,%rcx)
decl 0x140(%rbx)
jmp 0x11f76
movq %rbx, %rdi
callq 0x89b6
movl 0x8198(%rbx), %eax
testl %eax, %eax
je 0x12085
decl %eax
movl %eax, 0x8198(%rbx)
movq (%rsp), %rsi
movq (%rbx), %rdi
xorl %edx, %edx
callq *0x10(%rbx)
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl 0x144(%rbx), %ecx
leaq 0x2e446(%rip), %rax     # 0x403f8
cmpl $-0x3, %ecx
jl 0x11fd1
addl $0x3, %ecx
cmpl 0x140(%rbx), %ecx
jge 0x11fd1
movl %ecx, %ecx
movl %ecx, %eax
shlq $0x4, %rax
addq 0x148(%rbx), %rax
movzbl 0xf(%rax), %eax
cmpl $0x6, %eax
ja 0x12057
movl $0x61, %ecx
btl %eax, %ecx
jae 0x12057
movl 0x144(%rbx), %ecx
leaq 0x2e407(%rip), %rax     # 0x403f8
cmpl $-0x3, %ecx
jl 0x12013
addl $0x3, %ecx
movq %rax, %rsi
cmpl 0x140(%rbx), %ecx
jge 0x12016
movl %ecx, %ecx
movl %ecx, %eax
shlq $0x4, %rax
addq 0x148(%rbx), %rax
movq %rax, %rsi
movq %rbx, %rdi
callq 0x1533b
movq %rax, %r15
movq %rax, %rdi
callq 0x3200
movl %eax, %ebp
cmpl $0xa, %eax
movl $0xa, %eax
cmovll %ebp, %eax
movslq %eax, %r12
leaq 0x14(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x33d0
movb $0x0, 0x14(%rsp,%r12)
jmp 0x11eb9
movq %rbx, %rdi
movl $0x3, %esi
callq 0x11c72
testl %eax, %eax
jne 0x11fe4
jmp 0x11ec2
movq (%rsp), %rsi
movq (%rbx), %rdi
xorl %edx, %edx
callq *0x10(%rbx)
movq %rbx, %rdi
callq 0x8ec6
leaq 0x2177d(%rip), %rsi     # 0x33809
xorl %eax, %eax
movq %rbx, %rdi
callq 0xc939