#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 compute(double, double);
int /*<<< orphan*/ printf(char *, double, double);
int main(void) {
  double a = 1.2345678e-5;
  double b = 9.8765432e12;
  double c = compute(a, b);
  double ref = (a - b) + (a * b) + (a / b);
  if (c == ref) {
    printf("result is correct %g == %g (ref)\n", c, ref);
    return 0;
  } else {
    printf("result is not correct %g != %g (ref)\n", c, ref);
    return 1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xebc(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <compute@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
divsd  -0x18(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jne    11c4 <main+0xa4>
jp     11c4 <main+0xa4>
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xe5d(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11e1 <main+0xc1>
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xe5d(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xed7(%rip),%xmm0
movsd  0xed7(%rip),%xmm1
call   1040 <compute@plt>
ucomisd 0xed2(%rip),%xmm0
jne    115d <main+0x3d>
jp     115d <main+0x3d>
lea    0xecf(%rip),%rdi
movsd  0xebf(%rip),%xmm0
movaps %xmm0,%xmm1
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xed6(%rip),%rdi
movsd  0xea4(%rip),%xmm1
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"result is correct %g == %g (ref)\0A\00"
@.str.1 = [38 x i8] c"result is not correct %g != %g (ref)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
store double 0x3EE9E4091070DF4C, double* %2
store double 0x42A1F71FB2B60000, double* %3
%6 = load double, double* %2
%7 = load double, double* %3
%8 = call double @compute(double %6, double %7)
store double %8, double* %4
%9 = load double, double* %2
%10 = load double, double* %3
%11 = fsub double %9, %10
%12 = load double, double* %2
%13 = load double, double* %3
%14 = call double @llvm.fmuladd.f64(double %12, double %13, double %11)
%15 = load double, double* %2
%16 = load double, double* %3
%17 = fdiv double %15, %16
%18 = fadd double %14, %17
store double %18, double* %5
%19 = load double, double* %4
%20 = load double, double* %5
%21 = fcmp oeq double %19, %20
br i1 %21, label %22, label %26
22: ; preds = %0
%23 = load double, double* %4
%24 = load double, double* %5
%25 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), double %23, double %24)
store i32 0, i32* %1
br label %30
26: ; preds = %0
%27 = load double, double* %4
%28 = load double, double* %5
%29 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), double %27, double %28)
store i32 1, i32* %1
br label %30
30: ; preds = %26, %22
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@.str = [34 x i8] c"result is correct %g == %g (ref)\0A\00"
@.str.1 = [38 x i8] c"result is not correct %g != %g (ref)\0A\00"
define i32 @main() {
%1 = tail call double @compute(double 0x3EE9E4091070DF4C, double 0x42A1F71FB2B60000)
%2 = fcmp oeq double %1, 0xC2A1F711299F63CD
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), double 0xC2A1F711299F63CD, double 0xC2A1F711299F63CD)
br label %7
5: ; preds = %0
%6 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), double %1, double 0xC2A1F711299F63CD)
br label %7
7: ; preds = %5, %3
%8 = phi i32 [ 0, %3 ], [ 1, %5 ]
ret i32 %8
}