// File: /workspace/github_c_makefile_star2_O3/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 0x188fb(%rip), %rsi     # 0x1e128
xorl %r13d, %r13d
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x188ea(%rip)     # 0x1e128
movq 0x1892b(%rip), %rax     # 0x1e170
movq 0x18d74(%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 0x188b1(%rip), %rsi     # 0x1e128
movq %rax, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x188a0(%rip)     # 0x1e128
movq 0x18d31(%rip), %rdi     # 0x1e5c0
movq (%rdi,%r12,8), %r8
movq 0x188d6(%rip), %rsi     # 0x1e170
movq (%rsi,%r8,8), %rcx
movabsq $0x6666666666666667, %r15 # imm = 0x6666666666666667
testq %rcx, %rcx
je 0x58d4
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 0x58b0
cmpl $0x1, %r13d
adcl $-0x9, %r13d
movq (%rdi,%r8,8), %r8
addl $0x9, %r13d
cmpq $-0x1, %r8
jne 0x58dc
cmpl $0x25, %r13d
jl 0x5924
incl %r13d
movq %r12, %rdi
callq 0x4dca
movq 0x1886e(%rip), %rsi     # 0x1e170
movq (%rsi,%rax,8), %r12
movq 0x1881b(%rip), %rax     # 0x1e128
movq %r12, (%rsi,%rax,8)
incq %r14
decl %r13d
cmpl $0x25, %r13d
ja 0x58f3
movq 0x18c9c(%rip), %rdi     # 0x1e5c0
movq (%rdi,%r12,8), %rax
cmpq $0x0, (%rsi,%rax,8)
jne 0x5936
cmpq $-0x1, (%rdi,%rax,8)
je 0x5976
movq %r12, %rdi
callq 0x4dca
movq 0x1882b(%rip), %rsi     # 0x1e170
movq 0x18c74(%rip), %rdi     # 0x1e5c0
movq (%rdi,%rax,8), %rcx
movq (%rdi,%rcx,8), %rcx
cmpq $0x0, (%rsi,%rcx,8)
jne 0x5976
cmpq $-0x1, (%rdi,%rcx,8)
jne 0x5976
movq (%rsi,%rax,8), %r12
movq 0x187bb(%rip), %rax     # 0x1e128
movq %r12, (%rsi,%rax,8)
incq %r14
jmp 0x5924
movq (%rdi,%r12,8), %rax
cmpq $0x0, (%rsi,%rax,8)
jne 0x598c
xorl %ecx, %ecx
cmpq $-0x1, (%rdi,%rax,8)
cmoveq %rcx, %r14
movq %r14, %rdi
movq $-0x1, %rsi
movl $0x1, %edx
callq 0x36e8
movq %rax, %r13
movl $0x2, %edi
callq 0x384f
movq 0x187bc(%rip), %rsi     # 0x1e170
movq (%rsi,%r13,8), %rcx
xorl %edi, %edi
testq %rcx, %rcx
je 0x59e2
movq %rcx, %rax
imulq %r15
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x2, %rdx
addq %rax, %rdx
incl %edi
addq $0x9, %rcx
cmpq $0x12, %rcx
movq %rdx, %rcx
ja 0x59bf
cmpl $0x1, %edi
adcl $-0x9, %edi
movq 0x18bd1(%rip), %rax     # 0x1e5c0
movq (%rax,%r13,8), %r13
addl $0x9, %edi
cmpq $-0x1, %r13
jne 0x59ef
cmpl $0xa, %edi
jb 0x5a45
movq -0x30(%rbp), %rax
testq %rax, %rax
leaq 0x10971(%rip), %rdx     # 0x16380
cmovneq %rax, %rdx
leaq 0x1094d(%rip), %rsi     # 0x16367
leaq -0x70(%rbp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x31f0
movq %r15, %rdi
movq $-0x8, %rsi
callq 0x33eb
movq 0x18732(%rip), %rsi     # 0x1e170
movq 0x18b7b(%rip), %rax     # 0x1e5c0
movq (%rax,%rbx,8), %rcx
movl (%rsi,%rcx,8), %edi
movq (%rax,%r12,8), %rdx
movq %r14, %rsi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5768