#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double fxp_log10_low(double);
double fxp_log10(double x) {
  if (x > 32767.0) {
    if (x > 1073676289.0) {
      x = x / 1073676289.0;
      return fxp_log10_low(x) + 9.030873362;
    }
    x = x / 32767.0;
    return fxp_log10_low(x) + 4.515436681;
  }
  return fxp_log10_low(x);
}


x86 assembly (clang, -O0):
<fxp_log10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11b7 <fxp_log10+0xa7>
movsd  -0x10(%rbp),%xmm0
movsd  0xec7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1181 <fxp_log10+0x71>
movsd  -0x10(%rbp),%xmm0
movsd  0xeb0(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <fxp_log10_low@plt>
movsd  0xea5(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11c6 <fxp_log10+0xb6>
movsd  -0x10(%rbp),%xmm0
movsd  0xe72(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <fxp_log10_low@plt>
movsd  0xe67(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11c6 <fxp_log10+0xb6>
movsd  -0x10(%rbp),%xmm0
call   1030 <fxp_log10_low@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fxp_log10>:
push   %rax
ucomisd 0xee7(%rip),%xmm0
jbe    113c <fxp_log10+0x2c>
ucomisd 0xee5(%rip),%xmm0
jbe    1142 <fxp_log10+0x32>
divsd  0xedb(%rip),%xmm0
call   1030 <fxp_log10_low@plt>
addsd  0xede(%rip),%xmm0
pop    %rax
ret
pop    %rax
jmp    1030 <fxp_log10_low@plt>
divsd  0xeb6(%rip),%xmm0
call   1030 <fxp_log10_low@plt>
addsd  0xeb9(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @fxp_log10(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp ogt double %4, 3.276700e+04
br i1 %5, label %6, label %21
6: ; preds = %1
%7 = load double, double* %3
%8 = fcmp ogt double %7, 0x41CFFF8000800000
br i1 %8, label %9, label %15
9: ; preds = %6
%10 = load double, double* %3
%11 = fdiv double %10, 0x41CFFF8000800000
store double %11, double* %3
%12 = load double, double* %3
%13 = call double @fxp_log10_low(double %12)
%14 = fadd double %13, 0x40220FCEA2203713
store double %14, double* %2
br label %24
15: ; preds = %6
%16 = load double, double* %3
%17 = fdiv double %16, 3.276700e+04
store double %17, double* %3
%18 = load double, double* %3
%19 = call double @fxp_log10_low(double %18)
%20 = fadd double %19, 0x40120FCEA2203713
store double %20, double* %2
br label %24
21: ; preds = %1
%22 = load double, double* %3
%23 = call double @fxp_log10_low(double %22)
store double %23, double* %2
br label %24
24: ; preds = %21, %15, %9
%25 = load double, double* %2
ret double %25
}

LLVM IR (-O2):
define double @fxp_log10(double %0) {
%2 = fcmp ogt double %0, 3.276700e+04
br i1 %2, label %3, label %13
3: ; preds = %1
%4 = fcmp ogt double %0, 0x41CFFF8000800000
br i1 %4, label %5, label %9
5: ; preds = %3
%6 = fdiv double %0, 0x41CFFF8000800000
%7 = tail call double @fxp_log10_low(double %6)
%8 = fadd double %7, 0x40220FCEA2203713
br label %15
9: ; preds = %3
%10 = fdiv double %0, 3.276700e+04
%11 = tail call double @fxp_log10_low(double %10)
%12 = fadd double %11, 0x40120FCEA2203713
br label %15
13: ; preds = %1
%14 = tail call double @fxp_log10_low(double %0)
br label %15
15: ; preds = %13, %9, %5
%16 = phi double [ %8, %5 ], [ %12, %9 ], [ %14, %13 ]
ret double %16
}