#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 log(double volatile);
double log1p(double x) {
  volatile double y, z;
  y = 1 + x;
  z = y - 1;
  return z == 0 ? x : x * log(y) / z;
}


x86 assembly (clang, -O0):
<log1p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xec4(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    116c <log1p+0x5c>
jp     116c <log1p+0x5c>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    119a <log1p+0x8a>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log1p>:
sub    $0x18,%rsp
movapd %xmm0,%xmm2
movsd  0xee0(%rip),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xed0(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    114e <log1p+0x3e>
jnp    116e <log1p+0x5e>
movsd  0x8(%rsp),%xmm0
movsd  %xmm2,0x10(%rsp)
call   1030 <log@plt>
movapd %xmm0,%xmm2
mulsd  0x10(%rsp),%xmm2
divsd  (%rsp),%xmm2
movapd %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @log1p(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = fadd double 1.000000e+00, %5
store volatile double %6, double* %3
%7 = load volatile double, double* %3
%8 = fsub double %7, 1.000000e+00
store volatile double %8, double* %4
%9 = load volatile double, double* %4
%10 = fcmp oeq double %9, 0.000000e+00
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = load double, double* %2
br label %20
13: ; preds = %1
%14 = load double, double* %2
%15 = load volatile double, double* %3
%16 = call double @log(double %15)
%17 = fmul double %14, %16
%18 = load volatile double, double* %4
%19 = fdiv double %17, %18
br label %20
20: ; preds = %13, %11
%21 = phi double [ %12, %11 ], [ %19, %13 ]
ret double %21
}

LLVM IR (-O2):
define double @log1p(double %0) {
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %2 to i8*
%5 = bitcast double* %3 to i8*
%6 = fadd double %0, 1.000000e+00
store volatile double %6, double* %2
%7 = load volatile double, double* %2
%8 = fadd double %7, -1.000000e+00
store volatile double %8, double* %3
%9 = load volatile double, double* %3
%10 = fcmp oeq double %9, 0.000000e+00
br i1 %10, label %17, label %11
11: ; preds = %1
%12 = load volatile double, double* %2
%13 = tail call double @log(double %12)
%14 = fmul double %13, %0
%15 = load volatile double, double* %3
%16 = fdiv double %14, %15
br label %17
17: ; preds = %1, %11
%18 = phi double [ %16, %11 ], [ %0, %1 ]
ret double %18
}