#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 absoluteValue(double);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  float f1 = -15.5, f2 = 20.0, f3 = -5.0;
  int i1 = -716;
  float result;
  result = absoluteValue(f1);
  printf("result = %.2f\n", result);
  printf("f1 = %.2f\n", f1);
  result = absoluteValue(f2) + absoluteValue(f3);
  printf("result = %.2f\n", result);
  result = absoluteValue((float)i1);
  printf("result = %.2f\n", result);
  result = absoluteValue(i1);
  printf("result = %.2f\n", result);
  printf("%.2f\n", absoluteValue(-6.0) / 4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xed9(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xec8(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xeb7(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0xfffffd34,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1040 <absoluteValue@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
cvttss2si -0x18(%rbp),%esi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
cvttss2si -0x8(%rbp),%esi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1040 <absoluteValue@plt>
mov    %eax,-0x1c(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1040 <absoluteValue@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
cvttss2si -0x18(%rbp),%esi
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
cvtsi2ssl -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1040 <absoluteValue@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
cvttss2si -0x18(%rbp),%esi
lea    0xe1b(%rip),%rdi
call   1030 <printf@plt>
cvtsi2sdl -0x14(%rbp),%xmm0
call   1040 <absoluteValue@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
cvttss2si -0x18(%rbp),%esi
lea    0xdf7(%rip),%rdi
call   1030 <printf@plt>
movsd  0xdd6(%rip),%xmm0
call   1040 <absoluteValue@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xde8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
movsd  0xed5(%rip),%xmm0
call   1040 <absoluteValue@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
cvttss2si %xmm0,%esi
lea    0xee6(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
mov    $0xfffffff1,%esi
call   1030 <printf@plt>
movsd  0xea5(%rip),%xmm0
call   1040 <absoluteValue@plt>
mov    %eax,%ebp
movsd  0xe9e(%rip),%xmm0
call   1040 <absoluteValue@plt>
add    %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
cvttss2si %xmm0,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xe84(%rip),%xmm0
call   1040 <absoluteValue@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
cvttss2si %xmm0,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xe64(%rip),%xmm0
call   1040 <absoluteValue@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
cvttss2si %xmm0,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xe4c(%rip),%xmm0
call   1040 <absoluteValue@plt>
lea    0x3(%rax),%esi
test   %eax,%eax
cmovns %eax,%esi
sar    $0x2,%esi
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"result = %.2f\0A\00"
@.str.1 = [11 x i8] c"f1 = %.2f\0A\00"
@.str.2 = [6 x i8] c"%.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca i32
%6 = alloca float
store i32 0, i32* %1
store float -1.550000e+01, float* %2
store float 2.000000e+01, float* %3
store float -5.000000e+00, float* %4
store i32 -716, i32* %5
%7 = load float, float* %2
%8 = fpext float %7 to double
%9 = call i32 @absoluteValue(double %8)
%10 = sitofp i32 %9 to float
store float %10, float* %6
%11 = load float, float* %6
%12 = fptosi float %11 to i32
%13 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load float, float* %2
%15 = fptosi float %14 to i32
%16 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = load float, float* %3
%18 = fpext float %17 to double
%19 = call i32 @absoluteValue(double %18)
%20 = load float, float* %4
%21 = fpext float %20 to double
%22 = call i32 @absoluteValue(double %21)
%23 = add nsw i32 %19, %22
%24 = sitofp i32 %23 to float
store float %24, float* %6
%25 = load float, float* %6
%26 = fptosi float %25 to i32
%27 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %5
%29 = sitofp i32 %28 to float
%30 = fpext float %29 to double
%31 = call i32 @absoluteValue(double %30)
%32 = sitofp i32 %31 to float
store float %32, float* %6
%33 = load float, float* %6
%34 = fptosi float %33 to i32
%35 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %5
%37 = sitofp i32 %36 to double
%38 = call i32 @absoluteValue(double %37)
%39 = sitofp i32 %38 to float
store float %39, float* %6
%40 = load float, float* %6
%41 = fptosi float %40 to i32
%42 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %41)
%43 = call i32 @absoluteValue(double -6.000000e+00)
%44 = sdiv i32 %43, 4
%45 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %44)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"result = %.2f\0A\00"
@.str.1 = [11 x i8] c"f1 = %.2f\0A\00"
@.str.2 = [6 x i8] c"%.2f\0A\00"
define i32 @main() {
%1 = tail call i32 @absoluteValue(double -1.550000e+01)
%2 = sitofp i32 %1 to float
%3 = fptosi float %2 to i32
%4 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 -15)
%6 = tail call i32 @absoluteValue(double 2.000000e+01)
%7 = tail call i32 @absoluteValue(double -5.000000e+00)
%8 = add nsw i32 %7, %6
%9 = sitofp i32 %8 to float
%10 = fptosi float %9 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = tail call i32 @absoluteValue(double -7.160000e+02)
%13 = sitofp i32 %12 to float
%14 = fptosi float %13 to i32
%15 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = tail call i32 @absoluteValue(double -7.160000e+02)
%17 = sitofp i32 %16 to float
%18 = fptosi float %17 to i32
%19 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = tail call i32 @absoluteValue(double -6.000000e+00)
%21 = sdiv i32 %20, 4
%22 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %21)
ret i32 0
}