#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 */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fmax(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
double get_base(double error_slope, double error_offset) {
  if (error_offset <= 0) {
    printf("\nNon-positive error value detected: increase error values.\n");
    exit(EXIT_FAILURE);
  }
  double base = (1 + error_slope) / fmax(1 - error_slope, 0);
  return base;
}


x86 assembly (clang, -O0):
<get_base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     116a <get_base+0x3a>
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
movsd  0xe8e(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe7c(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%edi
xor    %esi,%esi
call   1040 <fmax@plt>
movsd  -0x20(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_base>:
push   %rax
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
jae    1171 <get_base+0x41>
movsd  0xebd(%rip),%xmm1
movapd %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
xor    %esi,%esi
call   1040 <fmax@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  (%rsp),%xmm0
divsd  %xmm1,%xmm0
pop    %rax
ret
lea    0xe90(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [60 x i8] c"\0ANon-positive error value detected: increase error values.\0A\00"
@EXIT_FAILURE = global i32 0
define double @get_base(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %4
%7 = fcmp ole double %6, 0.000000e+00
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %2
%13 = load double, double* %3
%14 = fadd double 1.000000e+00, %13
%15 = load double, double* %3
%16 = fsub double 1.000000e+00, %15
%17 = fptosi double %16 to i32
%18 = call i32 @fmax(i32 %17, i32 0)
%19 = sitofp i32 %18 to double
%20 = fdiv double %14, %19
store double %20, double* %5
%21 = load double, double* %5
ret double %21
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@str = [59 x i8] c"\0ANon-positive error value detected: increase error values.\00"
define double @get_base(double %0, double %1) {
%3 = fcmp ugt double %1, 0.000000e+00
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %2
%9 = fadd double %0, 1.000000e+00
%10 = fsub double 1.000000e+00, %0
%11 = fptosi double %10 to i32
%12 = tail call i32 @fmax(i32 %11, i32 0)
%13 = sitofp i32 %12 to double
%14 = fdiv double %9, %13
ret double %14
}