// File: /workspace/github_c_makefile_star2_O2/ArtifexSoftware[P]mujs/./json.c
// Function: fmtvalue
static int fmtvalue(js_State *J, js_Buffer **sb, const char *key, const char *gap, int level)
{
	/* replacer/property-list is in 2 */
	/* holder is in -1 */

	js_getproperty(J, -1, key);

	if (js_isobject(J, -1)) {
		if (js_hasproperty(J, -1, "toJSON")) {
			if (js_iscallable(J, -1)) {
				js_copy(J, -2);
				js_pushstring(J, key);
				js_call(J, 1);
				js_rot2pop1(J);
			} else {
				js_pop(J, 1);
			}
		}
	}

	if (js_iscallable(J, 2)) {
		js_copy(J, 2); /* replacer function */
		js_copy(J, -3); /* holder as this */
		js_pushstring(J, key); /* name */
		js_copy(J, -4); /* old value */
		js_call(J, 2);
		js_rot2pop1(J); /* pop old value, leave new value on stack */
	}

	if (js_isobject(J, -1) && !js_iscallable(J, -1)) {
		js_Object *obj = js_toobject(J, -1);
		switch (obj->type) {
		case JS_CNUMBER: fmtnum(J, sb, obj->u.number); break;
		case JS_CSTRING: fmtstr(J, sb, obj->u.s.string); break;
		case JS_CBOOLEAN: js_puts(J, sb, obj->u.boolean ? "true" : "false"); break;
		case JS_CARRAY: fmtarray(J, sb, gap, level); break;
		default: fmtobject(J, sb, obj, gap, level); break;
		}
	}
	else if (js_isboolean(J, -1))
		js_puts(J, sb, js_toboolean(J, -1) ? "true" : "false");
	else if (js_isnumber(J, -1))
		fmtnum(J, sb, js_tonumber(J, -1));
	else if (js_isstring(J, -1))
		fmtstr(J, sb, js_tostring(J, -1));
	else if (js_isnull(J, -1))
		js_puts(J, sb, "null");
	else {
		js_pop(J, 1);
		return 0;
	}

	js_pop(J, 1);
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r8d, %r12d
movq %rcx, 0x20(%rsp)
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
pushq $-0x1
popq %rbp
movl %ebp, %esi
callq 0x3eff
movq %rbx, %rdi
movl %ebp, %esi
callq 0xd489
testl %eax, %eax
je 0x19c07
leaq 0xe57d(%rip), %rdx      # 0x28116
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0x10c15
testl %eax, %eax
je 0x19c07
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xf950
testl %eax, %eax
je 0x19bfc
pushq $-0x2
popq %rsi
movq %rbx, %rdi
callq 0xeee2
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe7f7
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x110b0
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 0x19c07
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x3f3d
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0xf950
testl %eax, %eax
je 0x19c70
pushq $0x2
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0xeee2
pushq $-0x3
popq %rsi
movq %rbx, %rdi
callq 0xeee2
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe7f7
pushq $-0x4
popq %rsi
movq %rbx, %rdi
callq 0xeee2
movq %rbx, %rdi
movl %ebp, %esi
callq 0x110b0
movq 0x148(%rbx), %rax
movslq 0x140(%rbx), %rcx
shlq $0x4, %rcx
movups -0x10(%rax,%rcx), %xmm0
movups %xmm0, -0x20(%rax,%rcx)
decl 0x140(%rbx)
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xd489
testl %eax, %eax
je 0x19c8e
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xf950
testl %eax, %eax
je 0x19ce9
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xf8e1
pushq $-0x1
popq %rsi
movq %rbx, %rdi
testl %eax, %eax
je 0x19ccc
callq 0xfaca
testl %eax, %eax
leaq 0xeded(%rip), %rax      # 0x28a9e
leaq 0xede1(%rip), %rdx      # 0x28a99
cmoveq %rax, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xaa1e
jmp 0x1a10d
callq 0xf8f4
pushq $-0x1
popq %rsi
movq %rbx, %rdi
testl %eax, %eax
je 0x19d6f
callq 0xfb28
jmp 0x19d97
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xd49c
movl (%rax), %ecx
decl %ecx
cmpl $0x7, %ecx
movq %r14, 0x8(%rsp)
ja 0x19dc4
leaq 0x6e33(%rip), %rdx      # 0x20b40
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq %r12, 0x18(%rsp)
pushq $0x4
popq %rbp
movl 0x144(%rbx), %r12d
notl %r12d
addl 0x140(%rbx), %r12d
pushq $-0x1
popq %r14
cmpl %r12d, %ebp
jge 0x19e1d
movq %rbx, %rdi
movl %ebp, %esi
callq 0xd489
testl %eax, %eax
je 0x19d6b
movq %rbx, %rdi
movl %ebp, %esi
callq 0xd49c
movq %rax, %r15
movq %rbx, %rdi
movl %r14d, %esi
callq 0xd49c
cmpq %rax, %r15
je 0x1a14f
incl %ebp
jmp 0x19d33
callq 0xf907
pushq $-0x1
popq %rsi
movq %rbx, %rdi
testl %eax, %eax
je 0x1a12b
callq 0xf64d
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
jmp 0x19dba
movsd 0x20(%rax), %xmm0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1a160
jmp 0x1a10d
cmpl $0x0, 0x20(%rax)
jmp 0x19caa
movq 0x28(%rax), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1a1d8
jmp 0x1a10d
movq %r12, 0x18(%rsp)
movl 0x144(%rbx), %r12d
notl %r12d
addl 0x140(%rbx), %r12d
pushq $0x4
popq %rbp
pushq $-0x1
popq %r14
cmpl %r12d, %ebp
jge 0x19f04
movq %rbx, %rdi
movl %ebp, %esi
callq 0xd489
testl %eax, %eax
je 0x19e19
movq %rbx, %rdi
movl %ebp, %esi
callq 0xd49c
movq %rax, %r15
movq %rbx, %rdi
movl %r14d, %esi
callq 0xd49c
cmpq %rax, %r15
je 0x1a14f
incl %ebp
jmp 0x19de1
pushq $0x5b
popq %rdx
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
callq 0xa986
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0x3ecc
xorl %r14d, %r14d
testl %eax, %eax
movl $0x0, %ecx
movl %eax, 0x14(%rsp)
cmovgl %eax, %ecx
movl %ecx, 0x4(%rsp)
movq 0x18(%rsp), %rax
leal 0x1(%rax), %r15d
movq 0x20(%rsp), %rbp
movq 0x8(%rsp), %r12
cmpl %r14d, 0x4(%rsp)
je 0x19ed3
testl %r14d, %r14d
je 0x19e7c
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
pushq $0x2c
popq %rdx
callq 0xa986
testq %rbp, %rbp
je 0x19e92
movq %rbx, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movl %r15d, %ecx
callq 0x1a3a4
leaq 0x30(%rsp), %r13
movq %r13, %rdi
movl %r14d, %esi
callq 0xe0ad
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %rcx
movl %r15d, %r8d
callq 0x19b5b
testl %eax, %eax
jne 0x19ece
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
leaq 0xfcbd(%rip), %rdx      # 0x29b86
callq 0xaa1e
incl %r14d
jmp 0x19e60
testq %rbp, %rbp
sete %al
cmpl $0x0, 0x14(%rsp)
sete %cl
orb %al, %cl
movq 0x8(%rsp), %r14
jne 0x19efd
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq 0x18(%rsp), %rcx
callq 0x1a3a4
pushq $0x5d
jmp 0x1a101
pushq $0x7b
popq %rdx
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
callq 0xa986
pushq $-0x1
popq %rbp
pushq $0x1
popq %rdx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x1102e
movq 0x18(%rsp), %rax
incl %eax
movl %eax, 0x14(%rsp)
movl $0x0, 0x4(%rsp)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x1105b
testq %rax, %rax
je 0x1a0c5
movq %rax, %r12
movq %rbx, %rdi
pushq $0x2
popq %rsi
callq 0xf97f
testl %eax, %eax
je 0x1a000
movq %rbx, %rdi
pushq $0x2
popq %rsi
callq 0x3ecc
movl %eax, %r14d
xorl %r13d, %r13d
xorl %r15d, %r15d
cmpl %r14d, %r13d
jge 0x19ff7
testl %r15d, %r15d
jne 0x19ff7
movq %rbx, %rdi
pushq $0x2
popq %rsi
movl %r13d, %edx
callq 0x10e96
movq %rbx, %rdi
movl %ebp, %esi
callq 0xf907
testl %eax, %eax
jne 0x19fc4
movq %rbx, %rdi
movl %ebp, %esi
callq 0xf8f4
testl %eax, %eax
jne 0x19fc4
movq %rbx, %rdi
movl %ebp, %esi
callq 0xd4b1
testl %eax, %eax
jne 0x19fc4
movq %rbx, %rdi
movl %ebp, %esi
callq 0xd456
testl %eax, %eax
je 0x19ff2
movq %rbx, %rdi
movl %ebp, %esi
callq 0xf64d
movq %r12, %rdi
movq %rax, %rsi
callq 0x32f0
xorl %r15d, %r15d
testl %eax, %eax
sete %r15b
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0x3f3d
incl %r13d
jmp 0x19f74
xorl %r15d, %r15d
jmp 0x19fe2
testl %r15d, %r15d
je 0x19f37
movq 0x8(%rsp), %rsi
movq (%rsi), %rax
movl (%rax), %eax
movl %eax, 0x2c(%rsp)
cmpl $0x0, 0x4(%rsp)
je 0x1a020
movq %rbx, %rdi
pushq $0x2c
popq %rdx
callq 0xa986
movq 0x20(%rsp), %r13
movq %rbx, %rdi
testq %r13, %r13
je 0x1a066
movq 0x8(%rsp), %r15
movq %r15, %rsi
movq %r13, %rdx
movl 0x14(%rsp), %r14d
movl %r14d, %ecx
callq 0x1a3a4
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1a1d8
movq %rbx, %rdi
movq %r15, %rsi
pushq $0x3a
popq %rdx
callq 0xa986
pushq $0x20
popq %rdx
jmp 0x1a07e
movq 0x8(%rsp), %r15
movq %r15, %rsi
movq %r12, %rdx
callq 0x1a1d8
pushq $0x3a
popq %rdx
movl 0x14(%rsp), %r14d
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa986
movq %rbx, %rdi
callq 0x10070
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movl %r14d, %r8d
callq 0x19b5b
testl %eax, %eax
je 0x1a0af
incl 0x4(%rsp)
jmp 0x1a0b8
movq (%r15), %rax
movl 0x2c(%rsp), %ecx
movl %ecx, (%rax)
movq %rbx, %rdi
callq 0x10070
jmp 0x19f37
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x3f3d
movq 0x20(%rsp), %rdx
testq %rdx, %rdx
setne %al
cmpl $0x0, 0x4(%rsp)
setne %cl
andb %al, %cl
cmpb $0x1, %cl
movq 0x8(%rsp), %r14
jne 0x1a0ff
movq %rbx, %rdi
movq %r14, %rsi
movq 0x18(%rsp), %rcx
callq 0x1a3a4
pushq $0x7d
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa986
pushq $0x1
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3f3d
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xf8ce
testl %eax, %eax
je 0x1a140
leaq 0xfa4b(%rip), %rdx      # 0x29b86
jmp 0x19cbc
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x3f3d
xorl %ebp, %ebp
jmp 0x1a11a
leaq 0xfb00(%rip), %rsi      # 0x29c56
movq %rbx, %rdi
xorl %eax, %eax
callq 0x99a6