// File: /workspace/github_c_makefile_star2_O3/ArtifexSoftware[P]mujs/./jsvalue.c
// Function: js_equal
int js_equal(js_State *J)
{
	js_Value *x = js_tovalue(J, -2);
	js_Value *y = js_tovalue(J, -1);

retry:
	if (JSV_ISSTRING(x) && JSV_ISSTRING(y))
		return !strcmp(JSV_TOSTRING(x), JSV_TOSTRING(y));
	if (x->t.type == y->t.type) {
		if (x->t.type == JS_TUNDEFINED) return 1;
		if (x->t.type == JS_TNULL) return 1;
		if (x->t.type == JS_TNUMBER) return x->u.number == y->u.number;
		if (x->t.type == JS_TBOOLEAN) return x->u.boolean == y->u.boolean;
		if (x->t.type == JS_TOBJECT) return x->u.object == y->u.object;
		return 0;
	}

	if (x->t.type == JS_TNULL && y->t.type == JS_TUNDEFINED) return 1;
	if (x->t.type == JS_TUNDEFINED && y->t.type == JS_TNULL) return 1;

	if (x->t.type == JS_TNUMBER && JSV_ISSTRING(y))
		return x->u.number == jsV_tonumber(J, y);
	if (JSV_ISSTRING(x) && y->t.type == JS_TNUMBER)
		return jsV_tonumber(J, x) == y->u.number;

	if (x->t.type == JS_TBOOLEAN) {
		x->t.type = JS_TNUMBER;
		x->u.number = x->u.boolean ? 1 : 0;
		goto retry;
	}
	if (y->t.type == JS_TBOOLEAN) {
		y->t.type = JS_TNUMBER;
		y->u.number = y->u.boolean ? 1 : 0;
		goto retry;
	}
	if ((JSV_ISSTRING(x) || x->t.type == JS_TNUMBER) && y->t.type == JS_TOBJECT) {
		jsV_toprimitive(J, y, JS_HNONE);
		goto retry;
	}
	if (x->t.type == JS_TOBJECT && (JSV_ISSTRING(y) || y->t.type == JS_TNUMBER)) {
		jsV_toprimitive(J, x, JS_HNONE);
		goto retry;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
movslq 0x140(%rdi), %rax
cmpq $0x2, %rax
jge 0x1ac20
leaq 0x257e2(%rip), %rbx     # 0x403f8
movq %rbx, %r14
cmpl $0x1, %eax
je 0x1ac36
jmp 0x1ac49
movq 0x148(%r15), %rcx
movq %rax, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rbx
addq $-0x20, %rbx
movq 0x148(%r15), %rcx
shlq $0x4, %rax
leaq (%rcx,%rax), %r14
addq $-0x10, %r14
movsd 0x10867(%rip), %xmm1    # 0x2b4b8
leaq 0x10c74(%rip), %r12     # 0x2b8cc
leaq 0x10c89(%rip), %r13     # 0x2b8e8
movl $0x61, %ebp
movzbl 0xf(%rbx), %edx
cmpl $0x6, %edx
ja 0x1ac86
btl %edx, %ebp
jae 0x1ac86
movzbl 0xf(%r14), %ecx
cmpl $0x6, %ecx
ja 0x1ac8a
btl %ecx, %ebp
jae 0x1ac8a
jmp 0x1ad74
movb 0xf(%r14), %cl
cmpb %cl, %dl
je 0x1ad87
movl %edx, %eax
xorb $0x2, %al
movl %ecx, %esi
xorb $0x1, %sil
orb %al, %sil
sete %al
je 0x1ae3f
cmpl $0x6, %edx
ja 0x1acdd
movl %edx, %esi
movslq (%r12,%rsi,4), %rsi
addq %r12, %rsi
jmpq *%rsi
cmpb $0x4, %cl
je 0x1adee
cmpl $0x3, %edx
jne 0x1acdd
movb $0x4, 0xf(%rbx)
cmpl $0x0, (%rbx)
movapd %xmm1, %xmm0
jne 0x1acd7
xorpd %xmm0, %xmm0
movsd %xmm0, (%rbx)
jmp 0x1ac64
cmpb $0x3, %cl
je 0x1ad3c
movl %edx, %esi
addl $-0x4, %esi
cmpl $0x3, %esi
jb 0x1acf9
cmpl $0x7, %edx
je 0x1ad59
testl %edx, %edx
jne 0x1ae3f
cmpb $0x7, %cl
je 0x1ad19
jmp 0x1ae3f
cmpb $0x7, %cl
ja 0x1ae3f
movzbl %cl, %ecx
movslq (%r13,%rcx,4), %rcx
addq %r13, %rcx
jmpq *%rcx
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x1515d
movsd 0x1078a(%rip), %xmm1    # 0x2b4b8
jmp 0x1ac64
cmpb $0x3, %cl
jne 0x1ae01
movb $0x4, 0xf(%r14)
cmpl $0x0, (%r14)
movapd %xmm1, %xmm0
jne 0x1ad4f
xorpd %xmm0, %xmm0
movsd %xmm0, (%r14)
jmp 0x1ac64
movzbl %cl, %ecx
leal -0x4(%rcx), %edx
cmpl $0x3, %edx
jb 0x1ad6c
testl %ecx, %ecx
jne 0x1ae3f
movq %r15, %rdi
movq %rbx, %rsi
jmp 0x1ad1f
testl %edx, %edx
je 0x1adb9
cmpl $0x6, %edx
je 0x1ada9
cmpl $0x5, %edx
jne 0x1adb2
movq (%rbx), %rbx
jmp 0x1adb9
decl %edx
cmpl $0x6, %edx
ja 0x1ae29
leaq 0x10b6f(%rip), %rax     # 0x2b908
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl (%rbx), %eax
cmpl (%r14), %eax
jmp 0x1ade9
movq (%rbx), %rbx
addq $0x9, %rbx
jmp 0x1adb9
leaq 0x195fd(%rip), %rbx     # 0x343b6
testl %ecx, %ecx
je 0x1addc
cmpl $0x6, %ecx
je 0x1adcc
cmpl $0x5, %ecx
jne 0x1add5
movq (%r14), %r14
jmp 0x1addc
movq (%r14), %r14
addq $0x9, %r14
jmp 0x1addc
leaq 0x195da(%rip), %r14     # 0x343b6
movq %rbx, %rdi
movq %r14, %rsi
callq 0x32f0
testl %eax, %eax
sete %al
jmp 0x1ae3f
movq %r15, %rdi
movq %rbx, %rsi
callq 0x14c75
cmpeqsd (%r14), %xmm0
jmp 0x1ae37
movzbl %cl, %ecx
cmpl $0x2, %ecx
jne 0x1ae3f
movb $0x1, %al
jmp 0x1ae3f
movsd (%rbx), %xmm0
movsd %xmm0, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x14c75
cmpeqsd (%rsp), %xmm0
jmp 0x1ae37
xorl %eax, %eax
jmp 0x1ae3f
movsd (%r14), %xmm0
cmpeqsd (%rbx), %xmm0
movq %xmm0, %rax
andl $0x1, %eax
movzbl %al, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rax
cmpq (%r14), %rax
jmp 0x1ade9