// File: /workspace/github_c_makefile_star2_O2/azhai[P]mlite/mlite.c
// Function: real_equal
int real_equal(cell a, cell b, int approx) {
	cell	ma, mb;

	if (integer_p(a) && integer_p(b))
		return bignum_equal_p(a, b);
	if (integer_p(a))
		a = bignum_to_real(a);
	if (integer_p(b)) {
		save(a);
		b = bignum_to_real(b);
		unsave(1);
	}
	if (x_real_negative_p(a) != x_real_negative_p(b))
		return 0;
	if (!approx) {
		if (x_real_exponent(a) != x_real_exponent(b))
			return 0;
		if (x_real_zero_p(a) && x_real_zero_p(b))
			return 1;
		ma = x_real_mantissa(a);
		mb = x_real_mantissa(b);
	}
	if (approx) {
		Tmp = b;
		save(a);
		save(b);
		Tmp = NIL;
		autoscale(&a, &b);
		if (a == NIL || b == NIL) {
			unsave(2);
			return 0;
		}
		ma = x_real_mantissa(a);
		mb = x_real_mantissa(b);
		ma = shift_mantissa(ma);
		mb = shift_mantissa(mb);
		unsave(2);
	}
	while (ma != NIL && mb != NIL) {
		if (car(ma) != car(mb))
			return 0;
		ma = cdr(ma);
		mb = cdr(mb);
	}
	if (ma != mb)
		return 0;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
movq %rdi, -0x28(%rbp)
movq %rsi, -0x20(%rbp)
testq %rdi, %rdi
js 0x5ac2
movq 0x16b77(%rip), %rax     # 0x1c5e0
testb $0x1, (%rax,%r14)
je 0x5ac2
testq %rbx, %rbx
js 0x5aa5
movq 0x166f4(%rip), %rcx     # 0x1c170
cmpq $-0x18, (%rcx,%r14,8)
jne 0x5aa5
testb $0x1, (%rax,%rbx)
je 0x5aa5
cmpq $-0x18, (%rcx,%rbx,8)
jne 0x5aa5
movq %r14, %rdi
movq %rbx, %rsi
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x46e1
movq 0x166c4(%rip), %rax     # 0x1c170
cmpq $-0x18, (%rax,%r14,8)
jne 0x5ac2
movq %r14, %rdi
callq 0x5580
movq %rax, %r14
movq %rax, -0x28(%rbp)
testq %rbx, %rbx
js 0x5b11
movq 0x16b12(%rip), %rax     # 0x1c5e0
testb $0x1, (%rax,%rbx)
je 0x5b11
movq 0x16695(%rip), %rax     # 0x1c170
cmpq $-0x18, (%rax,%rbx,8)
jne 0x5b11
movq 0x1663f(%rip), %rsi     # 0x1c128
movq %r14, %rdi
xorl %edx, %edx
callq 0x3613
movq %rax, 0x1662e(%rip)     # 0x1c128
movq %rbx, %rdi
callq 0x5580
movq %rax, %rbx
movq %rax, -0x20(%rbp)
pushq $0x1
popq %rdi
callq 0x3775
movq 0x16658(%rip), %rax     # 0x1c170
movq 0x16aa1(%rip), %rcx     # 0x1c5c0
movq (%rcx,%r14,8), %rdx
xorl %esi, %esi
testb $0x1, (%rax,%rdx,8)
movl $0x0, %edi
je 0x5b4f
movq (%rcx,%rdx,8), %rdi
movq (%rcx,%rdi,8), %r8
cmpq $0x0, (%rax,%r8,8)
je 0x5b44
pushq $0x1
popq %rdi
jmp 0x5b4f
xorl %edi, %edi
cmpq $-0x1, (%rcx,%r8,8)
setne %dil
movq (%rcx,%rbx,8), %r8
testb $0x1, (%rax,%r8,8)
je 0x5b79
movq (%rcx,%r8,8), %rsi
movq (%rcx,%rsi,8), %r9
cmpq $0x0, (%rax,%r9,8)
je 0x5b6e
pushq $0x1
popq %rsi
jmp 0x5b79
xorl %esi, %esi
cmpq $-0x1, (%rcx,%r9,8)
setne %sil
cmpl %esi, %edi
jne 0x5cae
testl %r15d, %r15d
je 0x5c02
movq %rbx, 0x16583(%rip)     # 0x1c110
movq 0x16594(%rip), %rsi     # 0x1c128
xorl %r15d, %r15d
movq %r14, %rdi
xorl %edx, %edx
callq 0x3613
movq %rax, 0x16580(%rip)     # 0x1c128
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq %rax, 0x1656c(%rip)     # 0x1c128
orq $-0x1, 0x1654c(%rip)    # 0x1c110
leaq -0x28(%rbp), %rbx
leaq -0x20(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x59dc
movq (%rbx), %rax
cmpq $-0x1, %rax
sete %dl
movq (%r14), %rcx
cmpq $-0x1, %rcx
sete %sil
orb %dl, %sil
cmpb $0x1, %sil
jne 0x5c46
pushq $0x2
popq %rdi
callq 0x3775
jmp 0x5cb1
movq (%rcx,%rdx,8), %rsi
movq (%rax,%rsi,8), %rdi
movq (%rcx,%r8,8), %rdx
cmpq (%rax,%rdx,8), %rdi
jne 0x5cae
movq (%rcx,%rsi,8), %rbx
cmpq $0x0, (%rax,%rbx,8)
jne 0x5c40
cmpq $-0x1, (%rcx,%rbx,8)
jne 0x5c40
movq (%rcx,%rdx,8), %rsi
cmpq $0x0, (%rax,%rsi,8)
jne 0x5c40
cmpq $-0x1, (%rcx,%rsi,8)
je 0x5ccb
movq (%rcx,%rdx,8), %r14
jmp 0x5c8e
movq 0x16973(%rip), %rdx     # 0x1c5c0
movq (%rdx,%rax,8), %rax
movq (%rdx,%rax,8), %rax
movq (%rdx,%rax,8), %rdi
movq (%rdx,%rcx,8), %rax
movq (%rdx,%rax,8), %rax
movq (%rdx,%rax,8), %r14
callq 0x5869
movq %rax, %rbx
movq %r14, %rdi
callq 0x5869
movq %rax, %r14
pushq $0x2
popq %rdi
callq 0x3775
movq 0x164e9(%rip), %rax     # 0x1c170
movq 0x16932(%rip), %rcx     # 0x1c5c0
cmpq $-0x1, %rbx
je 0x5cbf
cmpq $-0x1, %r14
je 0x5cbf
movq (%rax,%rbx,8), %rdx
cmpq (%rax,%r14,8), %rdx
jne 0x5cae
movq (%rcx,%rbx,8), %rbx
movq (%rcx,%r14,8), %r14
jmp 0x5c8e
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
cmpq %r14, %rbx
sete %r15b
jmp 0x5cb1
pushq $0x1
popq %r15
jmp 0x5cb1