// File: /workspace/github_c_makefile_star2_O2/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
pushq $-0x2
popq %rsi
callq 0xf87b
movq %rax, %r14
pushq $-0x1
popq %rsi
movq %r15, %rdi
callq 0xf87b
movq %rax, %rbx
movsd 0xc5cf(%rip), %xmm1     # 0x20410
leaq 0xca58(%rip), %r12      # 0x208a0
leaq 0xca6d(%rip), %r13      # 0x208bc
pushq $0x61
popq %rbp
movzbl 0xf(%r14), %edx
cmpl $0x6, %edx
ja 0x13e74
btl %edx, %ebp
jae 0x13e74
movzbl 0xf(%rbx), %ecx
cmpl $0x6, %ecx
ja 0x13e77
btl %ecx, %ebp
jae 0x13e77
jmp 0x13f63
movb 0xf(%rbx), %cl
cmpb %cl, %dl
je 0x13f76
movl %edx, %eax
xorb $0x2, %al
movl %ecx, %esi
xorb $0x1, %sil
orb %al, %sil
sete %al
je 0x1402b
movzbl %cl, %esi
cmpl $0x6, %edx
ja 0x13ed0
movl %edx, %edi
movslq (%r12,%rdi,4), %rdi
addq %r12, %rdi
jmpq *%rdi
cmpb $0x4, %cl
je 0x13fdd
cmpl $0x3, %edx
jne 0x13ed0
movb $0x4, 0xf(%r14)
cmpl $0x0, (%r14)
movapd %xmm1, %xmm0
jne 0x13ec9
xorpd %xmm0, %xmm0
movsd %xmm0, (%r14)
jmp 0x13e52
cmpb $0x3, %cl
je 0x13f2c
movl %edx, %edi
addl $-0x4, %edi
cmpl $0x3, %edi
jb 0x13eec
cmpl $0x7, %edx
je 0x13f46
testl %edx, %edx
jne 0x1402b
cmpb $0x7, %cl
je 0x13f09
jmp 0x1402b
cmpb $0x7, %cl
ja 0x1402b
movslq (%r13,%rsi,4), %rcx
addq %r13, %rcx
jmpq *%rcx
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0xfe35
movsd 0xc4f2(%rip), %xmm1     # 0x20410
jmp 0x13e52
cmpb $0x3, %cl
jne 0x13fef
movb $0x4, 0xf(%rbx)
cmpl $0x0, (%rbx)
movapd %xmm1, %xmm0
jne 0x13f3d
xorpd %xmm0, %xmm0
movsd %xmm0, (%rbx)
jmp 0x13e52
cmpb $0x6, %cl
ja 0x1402b
pushq $0x71
popq %rcx
btl %esi, %ecx
jae 0x1402b
movq %r15, %rdi
movq %r14, %rsi
jmp 0x13f0f
testl %edx, %edx
je 0x13fa8
cmpl $0x6, %edx
je 0x13f98
cmpl $0x5, %edx
jne 0x13fa1
movq (%r14), %r14
jmp 0x13fa8
decl %edx
cmpl $0x6, %edx
ja 0x14015
leaq 0xc954(%rip), %rax      # 0x208dc
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl (%r14), %eax
cmpl (%rbx), %eax
jmp 0x13fd8
movq (%r14), %r14
addq $0x9, %r14
jmp 0x13fa8
leaq 0x153e9(%rip), %r14     # 0x29391
testl %ecx, %ecx
je 0x13fcb
cmpl $0x6, %ecx
je 0x13fbb
cmpl $0x5, %ecx
jne 0x13fc4
movq (%rbx), %rbx
jmp 0x13fcb
movq (%rbx), %rbx
addq $0x9, %rbx
jmp 0x13fcb
leaq 0x153c6(%rip), %rbx     # 0x29391
movq %r14, %rdi
movq %rbx, %rsi
callq 0x32f0
testl %eax, %eax
sete %al
jmp 0x1402b
movq %r15, %rdi
movq %r14, %rsi
callq 0xfb3d
cmpeqsd (%rbx), %xmm0
jmp 0x14023
cmpl $0x2, %esi
jne 0x1402b
movb $0x1, %al
jmp 0x1402b
movsd (%r14), %xmm0
movsd %xmm0, (%rsp)
movq %r15, %rdi
movq %rbx, %rsi
callq 0xfb3d
cmpeqsd (%rsp), %xmm0
jmp 0x14023
xorl %eax, %eax
jmp 0x1402b
movsd (%rbx), %xmm0
cmpeqsd (%r14), %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 (%r14), %rax
cmpq (%rbx), %rax
jmp 0x13fd8