#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*/ abort();
int /*<<< orphan*/ init(double *, double *, double *, int);
double work(double *, double *, int);
double work_ref(double *, double *, int);
int main() {
  double a[100], a_ref[100], b[100], res, ref, diff;
  init(a, a_ref, b, 100);
  res = work(a, b, 100);
  ref = work_ref(a_ref, b, 100);
  diff = res - ref;
  if (diff > 0.0000000000000001 || -diff > 0.0000000000000001)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x990,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x330(%rbp),%rdi
lea    -0x650(%rbp),%rsi
lea    -0x970(%rbp),%rdx
mov    $0x64,%ecx
call   1050 <init@plt>
lea    -0x330(%rbp),%rdi
lea    -0x970(%rbp),%rsi
mov    $0x64,%edx
call   1040 <work@plt>
movsd  %xmm0,-0x978(%rbp)
ff
lea    -0x650(%rbp),%rdi
lea    -0x970(%rbp),%rsi
mov    $0x64,%edx
call   1060 <work_ref@plt>
movsd  %xmm0,-0x980(%rbp)
ff
movsd  -0x978(%rbp),%xmm0
ff
subsd  -0x980(%rbp),%xmm0
ff
movsd  %xmm0,-0x988(%rbp)
ff
movsd  -0x988(%rbp),%xmm0
ff
movsd  0xe27(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     1214 <main+0xd4>
movsd  -0x988(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xdf6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    121b <main+0xdb>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x990,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x970,%rsp
lea    0x650(%rsp),%r15
lea    0x330(%rsp),%r14
lea    0x10(%rsp),%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    $0x64,%ecx
call   1050 <init@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x64,%edx
call   1040 <work@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x64,%edx
call   1060 <work_ref@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
ucomisd 0xe54(%rip),%xmm1
ja     11cb <main+0x8b>
movsd  0xe52(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     11cb <main+0x8b>
xor    %eax,%eax
add    $0x970,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x double]
%3 = alloca [100 x double]
%4 = alloca [100 x double]
%5 = alloca double
%6 = alloca double
%7 = alloca double
store i32 0, i32* %1
%8 = getelementptr inbounds [100 x double], [100 x double]* %2, i64 0, i64 0
%9 = getelementptr inbounds [100 x double], [100 x double]* %3, i64 0, i64 0
%10 = getelementptr inbounds [100 x double], [100 x double]* %4, i64 0, i64 0
%11 = call i32 @init(double* %8, double* %9, double* %10, i32 100)
%12 = getelementptr inbounds [100 x double], [100 x double]* %2, i64 0, i64 0
%13 = getelementptr inbounds [100 x double], [100 x double]* %4, i64 0, i64 0
%14 = call double @work(double* %12, double* %13, i32 100)
store double %14, double* %5
%15 = getelementptr inbounds [100 x double], [100 x double]* %3, i64 0, i64 0
%16 = getelementptr inbounds [100 x double], [100 x double]* %4, i64 0, i64 0
%17 = call double @work_ref(double* %15, double* %16, i32 100)
store double %17, double* %6
%18 = load double, double* %5
%19 = load double, double* %6
%20 = fsub double %18, %19
store double %20, double* %7
%21 = load double, double* %7
%22 = fcmp ogt double %21, 0x3C9CD2B297D889BC
br i1 %22, label %27, label %23
23: ; preds = %0
%24 = load double, double* %7
%25 = fneg double %24
%26 = fcmp ogt double %25, 0x3C9CD2B297D889BC
br i1 %26, label %27, label %29
27: ; preds = %23, %0
%28 = call i32 (...) @abort()
unreachable
29: ; preds = %23
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [100 x double]
%2 = alloca [100 x double]
%3 = alloca [100 x double]
%4 = bitcast [100 x double]* %1 to i8*
%5 = bitcast [100 x double]* %2 to i8*
%6 = bitcast [100 x double]* %3 to i8*
%7 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 0
%8 = getelementptr inbounds [100 x double], [100 x double]* %2, i64 0, i64 0
%9 = getelementptr inbounds [100 x double], [100 x double]* %3, i64 0, i64 0
%10 = call i32 @init(double* %7, double* %8, double* %9, i32 100)
%11 = call double @work(double* %7, double* %9, i32 100)
%12 = call double @work_ref(double* %8, double* %9, i32 100)
%13 = fsub double %11, %12
%14 = fcmp ogt double %13, 0x3C9CD2B297D889BC
%15 = fcmp olt double %13, 0xBC9CD2B297D889BC
%16 = or i1 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %0
%18 = call i32 (...) @abort()
unreachable
19: ; preds = %0
ret i32 0
}