#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 */
float average(double, double, double);
int /*<<< orphan*/ printf(char *, int);
int sum(int, int);
main() {
  int theSum = sum(8, 12);
  float theAverage = average(16.9, 7.86, 3.4);
  printf("the sum is: %i ", theSum);
  printf("and the average is: %f \n", theAverage);
  printf("average casted to an int is: %i \n", (int)theAverage);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x8,%edi
mov    $0xc,%esi
call   1040 <sum@plt>
mov    %eax,-0x4(%rbp)
movsd  0xeae(%rip),%xmm0
movsd  0xeae(%rip),%xmm1
movsd  0xeae(%rip),%xmm2
call   1050 <average@plt>
movss  %xmm0,-0x8(%rbp)
mov    -0x4(%rbp),%esi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
cvttss2si -0x8(%rbp),%esi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
cvttss2si -0x8(%rbp),%esi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    $0x8,%edi
mov    $0xc,%esi
call   1040 <sum@plt>
mov    %eax,%ebx
movsd  0xeb2(%rip),%xmm0
movsd  0xeb2(%rip),%xmm1
movsd  0xeb2(%rip),%xmm2
call   1050 <average@plt>
movss  %xmm0,0xc(%rsp)
lea    0xea8(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
cvttss2si 0xc(%rsp),%ebx
lea    0xea4(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"the sum is: %i \00"
@.str.1 = [25 x i8] c"and the average is: %f \0A\00"
@.str.2 = [34 x i8] c"average casted to an int is: %i \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = call i32 @sum(i32 8, i32 12)
store i32 %3, i32* %1
%4 = call float @average(double 1.690000e+01, double 7.860000e+00, double 3.400000e+00)
store float %4, float* %2
%5 = load i32, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load float, float* %2
%8 = fptosi float %7 to i32
%9 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = load float, float* %2
%11 = fptosi float %10 to i32
%12 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"the sum is: %i \00"
@.str.1 = [25 x i8] c"and the average is: %f \0A\00"
@.str.2 = [34 x i8] c"average casted to an int is: %i \0A\00"
define i32 @main() {
%1 = tail call i32 @sum(i32 8, i32 12)
%2 = tail call float @average(double 1.690000e+01, double 7.860000e+00, double 3.400000e+00)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %1)
%4 = fptosi float %2 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %4)
ret i32 0
}