#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 average_values(int *, int);
int /*<<< orphan*/ get_integer(int *, int);
int /*<<< orphan*/ printf(char *, double);
main() {
  int i, table[6];
  printf("It's the \"Average %d Integer Numbers\" program!!!\n", 6);
  for (i = 0; i < 6; i++)
    get_integer(table, i);
  printf("Average is %.4f\n", average_values(table, 6));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
movsd  0xeb2(%rip),%xmm0
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jge    117e <main+0x4e>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <get_integer@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115a <main+0x2a>
lea    -0x20(%rbp),%rdi
mov    $0x6,%esi
call   1050 <average_values@plt>
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xecc(%rip),%rdi
movsd  0xebc(%rip),%xmm0
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <get_integer@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <get_integer@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <get_integer@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <get_integer@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <get_integer@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <get_integer@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1050 <average_values@plt>
lea    0xe8f(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [50 x i8] c"It's the \22Average %d Integer Numbers\22 program!!!\0A\00"
@.str.1 = [17 x i8] c"Average is %.4f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [6 x i32]
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), double 6.000000e+00)
store i32 0, i32* %2
br label %5
5: ; preds = %12, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 6
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%10 = load i32, i32* %2
%11 = call i32 @get_integer(i32* %9, i32 %10)
br label %12
12: ; preds = %8
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %5
15: ; preds = %5
%16 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%17 = call double @average_values(i32* %16, i32 6)
%18 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %17)
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@.str = [50 x i8] c"It's the \22Average %d Integer Numbers\22 program!!!\0A\00"
@.str.1 = [17 x i8] c"Average is %.4f\0A\00"
define i32 @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), double 6.000000e+00)
%4 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%5 = call i32 @get_integer(i32* %4, i32 0)
%6 = call i32 @get_integer(i32* %4, i32 1)
%7 = call i32 @get_integer(i32* %4, i32 2)
%8 = call i32 @get_integer(i32* %4, i32 3)
%9 = call i32 @get_integer(i32* %4, i32 4)
%10 = call i32 @get_integer(i32* %4, i32 5)
%11 = call double @average_values(i32* %4, i32 6)
%12 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %11)
ret i32 0
}