#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 absolute_error(double, double);
int /*<<< orphan*/ printf(char *, double, ...);
double relative_error(double, double);
int main(int argc, char *argv[]) {
  double measured = 5.1;
  double actual = 5.2;
  printf("Measured: %f, Actual: %f\n", measured, actual);
  printf("Absolute Error: %f\n", absolute_error(measured, actual));
  printf("Relative Error: %f\n", relative_error(measured, actual));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xec1(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeac(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xea6(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1030 <absolute_error@plt>
lea    0xea3(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1050 <relative_error@plt>
lea    0xe9a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
movsd  0xec0(%rip),%xmm0
movsd  0xec0(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xea9(%rip),%xmm0
movsd  0xea9(%rip),%xmm1
call   1030 <absolute_error@plt>
lea    0xebf(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xe86(%rip),%xmm0
movsd  0xe86(%rip),%xmm1
call   1050 <relative_error@plt>
lea    0xeb0(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Measured: %f, Actual: %f\0A\00"
@.str.1 = [20 x i8] c"Absolute Error: %f\0A\00"
@.str.2 = [20 x i8] c"Relative Error: %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca double
%6 = alloca double
store i32 %0, i32* %3
store i8** %1, i8*** %4
store double 5.100000e+00, double* %5
store double 5.200000e+00, double* %6
%7 = load double, double* %5
%8 = load double, double* %6
%9 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), double %7, double %8)
%10 = load double, double* %5
%11 = load double, double* %6
%12 = call double @absolute_error(double %10, double %11)
%13 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %12)
%14 = load double, double* %5
%15 = load double, double* %6
%16 = call double @relative_error(double %14, double %15)
%17 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), double %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"Measured: %f, Actual: %f\0A\00"
@.str.1 = [20 x i8] c"Absolute Error: %f\0A\00"
@.str.2 = [20 x i8] c"Relative Error: %f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), double 5.100000e+00, double 5.200000e+00)
%4 = tail call double @absolute_error(double 5.100000e+00, double 5.200000e+00)
%5 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %4)
%6 = tail call double @relative_error(double 5.100000e+00, double 5.200000e+00)
%7 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), double %6)
ret i32 0
}