#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 fabs(double);
int /*<<< orphan*/ printf(char *, double);
int error_function(double data, double orig, double margin) {
  double error;
  if (fabs(orig) <= 500.0)
    error = fabs(fabs(data) - fabs(orig)) / 2000.0;
  else if (fabs(orig) <= 1000.0)
    error = fabs(data - orig) / 3000.0;
  else
    error = fabs(data - orig) / fabs(orig);
  if (error > margin) {
    printf("\n\n*******************\nError : %f\n", error);
    return 1;
  };
  return 0;
}


x86 assembly (clang, -O0):
<error_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm1
movaps 0xeed(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xec1(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     118e <error_function+0x7e>
movsd  -0x10(%rbp),%xmm0
movaps 0xecb(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movaps 0xebb(%rip),%xmm2
pand   %xmm2,%xmm1
subsd  %xmm1,%xmm0
movaps 0xeac(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe98(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    120e <error_function+0xfe>
movsd  -0x18(%rbp),%xmm1
movaps 0xe86(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe62(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     11db <error_function+0xcb>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movaps 0xe5f(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe43(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1209 <error_function+0xf9>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movaps 0xe34(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movaps 0xe24(%rip),%xmm2
pand   %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    120e <error_function+0xfe>
movsd  -0x28(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    123b <error_function+0x12b>
movsd  -0x28(%rbp),%xmm0
lea    0xe06(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1242 <error_function+0x132>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error_function>:
push   %rax
movapd 0xee7(%rip),%xmm3
andpd  %xmm1,%xmm3
movsd  0xeeb(%rip),%xmm4
ucomisd %xmm3,%xmm4
jae    114b <error_function+0x3b>
movsd  0xeed(%rip),%xmm4
ucomisd %xmm3,%xmm4
subsd  %xmm1,%xmm0
jae    1169 <error_function+0x59>
divsd  %xmm1,%xmm0
andpd  0xeb7(%rip),%xmm0
jmp    1179 <error_function+0x69>
movapd 0xead(%rip),%xmm1
andpd  %xmm1,%xmm0
subsd  %xmm3,%xmm0
andpd  %xmm1,%xmm0
divsd  0xeb1(%rip),%xmm0
jmp    1179 <error_function+0x69>
andpd  0xe8f(%rip),%xmm0
divsd  0xeaf(%rip),%xmm0
xor    %eax,%eax
ucomisd %xmm2,%xmm0
jbe    1192 <error_function+0x82>
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"\0A\0A*******************\0AError : %f\0A\00"
define i32 @error_function(double %0, double %1, double %2) {
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%9 = load double, double* %6
%10 = call double @llvm.fabs.f64(double %9)
%11 = fcmp ole double %10, 5.000000e+02
br i1 %11, label %12, label %20
12: ; preds = %3
%13 = load double, double* %5
%14 = call double @llvm.fabs.f64(double %13)
%15 = load double, double* %6
%16 = call double @llvm.fabs.f64(double %15)
%17 = fsub double %14, %16
%18 = call double @llvm.fabs.f64(double %17)
%19 = fdiv double %18, 2.000000e+03
store double %19, double* %8
br label %39
20: ; preds = %3
%21 = load double, double* %6
%22 = call double @llvm.fabs.f64(double %21)
%23 = fcmp ole double %22, 1.000000e+03
br i1 %23, label %24, label %30
24: ; preds = %20
%25 = load double, double* %5
%26 = load double, double* %6
%27 = fsub double %25, %26
%28 = call double @llvm.fabs.f64(double %27)
%29 = fdiv double %28, 3.000000e+03
store double %29, double* %8
br label %38
30: ; preds = %20
%31 = load double, double* %5
%32 = load double, double* %6
%33 = fsub double %31, %32
%34 = call double @llvm.fabs.f64(double %33)
%35 = load double, double* %6
%36 = call double @llvm.fabs.f64(double %35)
%37 = fdiv double %34, %36
store double %37, double* %8
br label %38
38: ; preds = %30, %24
br label %39
39: ; preds = %38, %12
%40 = load double, double* %8
%41 = load double, double* %7
%42 = fcmp ogt double %40, %41
br i1 %42, label %43, label %46
43: ; preds = %39
%44 = load double, double* %8
%45 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), double %44)
store i32 1, i32* %4
br label %47
46: ; preds = %39
store i32 0, i32* %4
br label %47
47: ; preds = %46, %43
%48 = load i32, i32* %4
ret i32 %48
}

LLVM IR (-O2):
@.str = [34 x i8] c"\0A\0A*******************\0AError : %f\0A\00"
define i32 @error_function(double %0, double %1, double %2) {
%4 = tail call double @llvm.fabs.f64(double %1)
%5 = fcmp ugt double %4, 5.000000e+02
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = tail call double @llvm.fabs.f64(double %0)
%8 = fsub double %7, %4
%9 = tail call double @llvm.fabs.f64(double %8)
%10 = fdiv double %9, 2.000000e+03
br label %20
11: ; preds = %3
%12 = fcmp ugt double %4, 1.000000e+03
%13 = fsub double %0, %1
br i1 %12, label %17, label %14
14: ; preds = %11
%15 = tail call double @llvm.fabs.f64(double %13)
%16 = fdiv double %15, 3.000000e+03
br label %20
17: ; preds = %11
%18 = fdiv double %13, %1
%19 = tail call double @llvm.fabs.f64(double %18)
br label %20
20: ; preds = %14, %17, %6
%21 = phi double [ %10, %6 ], [ %16, %14 ], [ %19, %17 ]
%22 = fcmp ogt double %21, %2
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), double %21)
br label %25
25: ; preds = %20, %23
%26 = phi i32 [ 1, %23 ], [ 0, %20 ]
ret i32 %26
}