// File: /workspace/github_c_makefile_star2_O0/ccxvii[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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x4380
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x11730
cmpl $0x0, %eax
je 0x26c34
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
leaq 0x14bd9(%rip), %rdx     # 0x3b7aa
callq 0x17710
cmpl $0x0, %eax
je 0x26c32
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15290
cmpl $0x0, %eax
je 0x26c22
movq -0x10(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x14410
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x13880
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x17ea0
movq -0x10(%rbp), %rdi
callq 0x16600
jmp 0x26c30
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x4400
jmp 0x26c32
jmp 0x26c34
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x15290
cmpl $0x0, %eax
je 0x26c95
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x14410
movq -0x10(%rbp), %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
callq 0x14410
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x13880
movq -0x10(%rbp), %rdi
movl $0xfffffffc, %esi       # imm = 0xFFFFFFFC
callq 0x14410
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x17ea0
movq -0x10(%rbp), %rdi
callq 0x16600
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x11730
cmpl $0x0, %eax
je 0x26d8e
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15290
cmpl $0x0, %eax
jne 0x26d8e
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x11760
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl (%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x40(%rbp)
subl $0x7, %eax
ja 0x26d70
movq -0x40(%rbp), %rax
leaq 0xd2b1(%rip), %rcx      # 0x33fa8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x38(%rbp), %rax
movsd 0x20(%rax), %xmm0
callq 0x26ee0
jmp 0x26d89
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rdx
callq 0x26ff0
jmp 0x26d89
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x38(%rbp), %rax
movl 0x20(%rax), %ecx
leaq 0x15404(%rip), %rdx     # 0x3c149
leaq 0x153f8(%rip), %rax     # 0x3c144
cmpl $0x0, %ecx
cmovneq %rax, %rdx
callq 0xda70
jmp 0x26d89
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
movl -0x2c(%rbp), %ecx
callq 0x27290
jmp 0x26d89
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %r8d
callq 0x27430
jmp 0x26eb6
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15160
cmpl $0x0, %eax
je 0x26de8
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15620
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl %eax, %ecx
leaq 0x15379(%rip), %rdx     # 0x3c149
leaq 0x1536d(%rip), %rax     # 0x3c144
cmpl $0x0, %ecx
cmovneq %rax, %rdx
callq 0xda70
jmp 0x26eb4
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15190
cmpl $0x0, %eax
je 0x26e2b
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15750
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x26ee0
jmp 0x26eb2
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x151c0
cmpl $0x0, %eax
je 0x26e6e
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x14b80
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq %rax, %rdx
callq 0x26ff0
jmp 0x26eb0
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15130
cmpl $0x0, %eax
je 0x26e97
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0x163a1(%rip), %rdx     # 0x3d231
callq 0xda70
jmp 0x26eae
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x4400
movl $0x0, -0x4(%rbp)
jmp 0x26ecb
jmp 0x26eb0
jmp 0x26eb2
jmp 0x26eb4
jmp 0x26eb6
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x4400
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)