#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 expect(char *, char *, char *);
double fabs(double);
int /*<<< orphan*/ snprintf(char *, int, char *, double);
bool expect_float(char *expr, char *opts, double expected) {
  char value[512];
  if (fabs(expected) >= 1.e9 || (fabs(expected) > 0 && fabs(expected) < 1.e-6))
    snprintf(value, 512, "%e", expected);
  else
    snprintf(value, 512, "%f", expected);
  return expect(expr, opts, value);
}


x86 assembly (clang, -O0):
<expect_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movaps 0xecc(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xeb0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jae    1199 <expect_float+0x79>
movsd  -0x18(%rbp),%xmm0
movaps 0xeaa(%rip),%xmm1
pand   %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11bb <expect_float+0x9b>
movsd  -0x18(%rbp),%xmm1
movaps 0xe8d(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe79(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11bb <expect_float+0x9b>
lea    -0x220(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
mov    $0x200,%esi
lea    0xe6f(%rip),%rdx
call   1040 <snprintf@plt>
jmp    11d8 <expect_float+0xb8>
lea    -0x220(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
mov    $0x200,%esi
lea    0xe50(%rip),%rdx
call   1040 <snprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x220(%rbp),%rdx
call   1030 <expect@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expect_float>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
movapd 0xecc(%rip),%xmm1
andpd  %xmm0,%xmm1
movsd  0xed0(%rip),%xmm2
ucomisd %xmm1,%xmm2
lea    0xed5(%rip),%rax
lea    0xed1(%rip),%rcx
mov    %rcx,%rdx
cmova  %rax,%rdx
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
cmove  %rcx,%rdx
ucomisd 0xeab(%rip),%xmm1
mov    %rsi,%r14
mov    %rdi,%rbx
cmovae %rax,%rdx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x200,%esi
call   1040 <snprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <expect@plt>
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%e\00"
@.str.1 = [3 x i8] c"%f\00"
define i32 @expect_float(i8* %0, i8* %1, double %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
%7 = alloca [512 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store double %2, double* %6
%8 = load double, double* %6
%9 = call double @llvm.fabs.f64(double %8)
%10 = fcmp oge double %9, 1.000000e+09
br i1 %10, label %19, label %11
11: ; preds = %3
%12 = load double, double* %6
%13 = call double @llvm.fabs.f64(double %12)
%14 = fcmp ogt double %13, 0.000000e+00
br i1 %14, label %15, label %23
15: ; preds = %11
%16 = load double, double* %6
%17 = call double @llvm.fabs.f64(double %16)
%18 = fcmp olt double %17, 0x3EB0C6F7A0B5ED8D
br i1 %18, label %19, label %23
19: ; preds = %15, %3
%20 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%21 = load double, double* %6
%22 = call i32 @snprintf(i8* %20, i32 512, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double %21)
br label %27
23: ; preds = %15, %11
%24 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%25 = load double, double* %6
%26 = call i32 @snprintf(i8* %24, i32 512, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %25)
br label %27
27: ; preds = %23, %19
%28 = load i8*, i8** %4
%29 = load i8*, i8** %5
%30 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%31 = call i32 @expect(i8* %28, i8* %29, i8* %30)
ret i32 %31
}

LLVM IR (-O2):
@.str = [3 x i8] c"%e\00"
@.str.1 = [3 x i8] c"%f\00"
define i32 @expect_float(i8* %0, i8* %1, double %2) {
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%6 = tail call double @llvm.fabs.f64(double %2)
%7 = fcmp ult double %6, 1.000000e+09
%8 = fcmp one double %2, 0.000000e+00
%9 = fcmp olt double %6, 0x3EB0C6F7A0B5ED8D
%10 = select i1 %8, i1 %9, i1 false
%11 = select i1 %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%12 = select i1 %7, i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
%13 = call i32 @snprintf(i8* %5, i32 512, i8* %12, double %2)
%14 = call i32 @expect(i8* %0, i8* %1, i8* %5)
ret i32 %14
}