// File: /workspace/github_c_makefile_star2_O1/azhai[P]mlite/mlite.c
// Function: real_normalize
cell real_normalize(cell x, char *who) {
	cell	m, e, r;
	int	dgs;
	char	buf[50];

	save(x);
	e = x_real_exponent(x);
	m = new_atom(T_INTEGER, x_real_mantissa(x));
	save(m);
	dgs = count_digits(cdr(m));
	while (dgs > MANTISSA_SIZE) {
		r = bignum_shift_right(m);
		m = car(r);
		car(Stack) = m;
		dgs--;
		e++;
	}
	while (!x_bignum_zero_p(m)) {
		r = bignum_shift_right(m);
		if (!x_bignum_zero_p(cdr(r)))
			break;
		m = car(r);
		car(Stack) = m;
		e++;
	}
	if (x_bignum_zero_p(m))
		e = 0;
	r = new_atom(e, NIL);
	unsave(2);
	if (count_digits(r) > DIGITS_PER_WORD) {
		sprintf(buf, "%s: real number overflow",
			who? who: "internal");
		error(buf, NOEXPR);
	}
	return make_real(x_real_flags(x), e, cdr(m));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, -0x30(%rbp)
movq %rdi, %rbx
movq 0x188eb(%rip), %rsi     # 0x1e128
xorl %r13d, %r13d
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x188da(%rip)     # 0x1e128
movq 0x1891b(%rip), %rax     # 0x1e170
movq 0x18d64(%rip), %rcx     # 0x1e5c0
movq (%rcx,%rbx,8), %rdx
movq (%rcx,%rdx,8), %rdx
movq (%rax,%rdx,8), %r14
movq (%rcx,%rdx,8), %rsi
movq $-0x18, %rdi
movl $0x1, %edx
callq 0x36e8
movq %rax, %r12
movq 0x188a1(%rip), %rsi     # 0x1e128
movq %rax, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x18890(%rip)     # 0x1e128
movq 0x18d21(%rip), %rsi     # 0x1e5c0
movq (%rsi,%r12,8), %rdi
movq 0x188c6(%rip), %rax     # 0x1e170
movq (%rax,%rdi,8), %rcx
movabsq $0x6666666666666667, %r15 # imm = 0x6666666666666667
testq %rcx, %rcx
je 0x58e4
xorl %r13d, %r13d
movq %rcx, %rax
imulq %r15
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x2, %rdx
addq %rax, %rdx
incl %r13d
addq $0x9, %rcx
cmpq $0x12, %rcx
movq %rdx, %rcx
ja 0x58c0
cmpl $0x1, %r13d
adcl $-0x9, %r13d
movq (%rsi,%rdi,8), %rdi
addl $0x9, %r13d
cmpq $-0x1, %rdi
jne 0x58ec
cmpl $0x25, %r13d
jl 0x592d
incl %r13d
movq %r12, %rdi
callq 0x4dd6
movq 0x1885e(%rip), %rcx     # 0x1e170
movq (%rcx,%rax,8), %r12
movq 0x1880b(%rip), %rax     # 0x1e128
movq %r12, (%rcx,%rax,8)
incq %r14
decl %r13d
cmpl $0x25, %r13d
jg 0x5903
movq 0x1883c(%rip), %rdx     # 0x1e170
movq 0x18c85(%rip), %rax     # 0x1e5c0
movq (%rax,%r12,8), %rcx
cmpq $0x0, (%rdx,%rcx,8)
jne 0x594d
cmpq $-0x1, (%rax,%rcx,8)
je 0x598d
movq %r12, %rdi
callq 0x4dd6
movq 0x18814(%rip), %rcx     # 0x1e170
movq 0x18c5d(%rip), %rdx     # 0x1e5c0
movq (%rdx,%rax,8), %rsi
movq (%rdx,%rsi,8), %rsi
cmpq $0x0, (%rcx,%rsi,8)
jne 0x598d
cmpq $-0x1, (%rdx,%rsi,8)
jne 0x598d
movq (%rcx,%rax,8), %r12
movq 0x187a4(%rip), %rax     # 0x1e128
movq %r12, (%rcx,%rax,8)
incq %r14
jmp 0x592d
movq 0x187dc(%rip), %rdx     # 0x1e170
movq 0x18c25(%rip), %rax     # 0x1e5c0
movq (%rax,%r12,8), %rcx
cmpq $0x0, (%rdx,%rcx,8)
jne 0x59b1
xorl %edx, %edx
cmpq $-0x1, (%rax,%rcx,8)
cmoveq %rdx, %r14
movq %r14, %rdi
movq $-0x1, %rsi
movl $0x1, %edx
callq 0x36e8
movq %rax, %r13
movl $0x2, %edi
callq 0x3851
movq 0x18797(%rip), %rax     # 0x1e170
movq (%rax,%r13,8), %rcx
xorl %esi, %esi
testq %rcx, %rcx
je 0x5a07
movq %rcx, %rax
imulq %r15
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x2, %rdx
addq %rax, %rdx
incl %esi
addq $0x9, %rcx
cmpq $0x12, %rcx
movq %rdx, %rcx
ja 0x59e4
cmpl $0x1, %esi
adcl $-0x9, %esi
movq 0x18bac(%rip), %rax     # 0x1e5c0
movq (%rax,%r13,8), %r13
addl $0x9, %esi
cmpq $-0x1, %r13
jne 0x5a14
cmpl $0xa, %esi
jb 0x5a5c
movq -0x30(%rbp), %rax
testq %rax, %rax
leaq 0x10964(%rip), %rdx     # 0x16398
cmovneq %rax, %rdx
leaq 0x10940(%rip), %rsi     # 0x1637f
leaq -0x70(%rbp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x31f0
movq %r15, %rdi
movq $-0x8, %rsi
callq 0x33eb
movq 0x1870d(%rip), %rax     # 0x1e170
movq 0x18b56(%rip), %rcx     # 0x1e5c0
movq (%rcx,%rbx,8), %rdx
movl (%rax,%rdx,8), %edi
movq (%rcx,%r12,8), %rdx
movq %r14, %rsi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5778