#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 /*<<< orphan*/ avrg(float *, int, float *);
int /*<<< orphan*/ printf(char *, int);
int str_cmp(char *, char *);
int /*<<< orphan*/ sum(int *, int, int *);
int main() {
  int array[] = {2, 4, 6, 8};
  int sumArr;
  sum(array, 4, &sumArr);
  printf("%d\n", sumArr);
  float farr[] = {1.5, 2.2, 1.8, 2.5, 1.3};
  float favrg;
  avrg(farr, 5, &favrg);
  printf("%f\n", favrg);
  char s1[] = "Gosho";
  char s2[] = "Gorge";
  printf("%d\n", str_cmp(s1, s2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x4,%esi
lea    -0x24(%rbp),%rdx
call   1060 <sum@plt>
mov    -0x24(%rbp),%esi
lea    0xe8f(%rip),%rdi
call   1040 <printf@plt>
mov    0xea3(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xea0(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe9e(%rip),%eax
mov    %eax,-0x30(%rbp)
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
lea    -0x44(%rbp),%rdx
call   1050 <avrg@plt>
cvttss2si -0x44(%rbp),%esi
lea    0xe51(%rip),%rdi
call   1040 <printf@plt>
mov    0xe4a(%rip),%eax
mov    %eax,-0x4a(%rbp)
mov    0xe44(%rip),%ax
mov    %ax,-0x46(%rbp)
mov    0xe3c(%rip),%eax
mov    %eax,-0x50(%rbp)
mov    0xe36(%rip),%ax
mov    %ax,-0x4c(%rbp)
lea    -0x4a(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1030 <str_cmp@plt>
mov    %eax,%esi
lea    0xe0a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
lea    0x40(%rsp),%rdi
lea    0x1c(%rsp),%rdx
mov    $0x4,%esi
call   1060 <sum@plt>
mov    0x1c(%rsp),%esi
lea    0xea0(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0xec2(%rip),%eax
mov    %eax,0x30(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x20(%rsp),%rdi
lea    0x18(%rsp),%rdx
mov    $0x5,%esi
call   1050 <avrg@plt>
cvttss2si 0x18(%rsp),%esi
lea    0xe65(%rip),%rdi
call   1040 <printf@plt>
movw   $0x6f,0x14(%rsp)
movl   $0x68736f47,0x10(%rsp)
68
movw   $0x65,0xc(%rsp)
movl   $0x67726f47,0x8(%rsp)
67
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <str_cmp@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.array = [4 x i32] [i32 2, i32 4, i32 6, i32 8]
@.str = [4 x i8] c"%d\0A\00"
@__const.main.farr = [5 x float] [float 1.500000e+00, float 0x40019999A0000000, float 0x3FFCCCCCC0000000, float 2.500000e+00, float 0x3FF4CCCCC0000000]
@.str.1 = [4 x i8] c"%f\0A\00"
@__const.main.s1 = [6 x i8] c"Gosho\00"
@__const.main.s2 = [6 x i8] c"Gorge\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
%3 = alloca i32
%4 = alloca [5 x float]
%5 = alloca float
%6 = alloca [6 x i8]
%7 = alloca [6 x i8]
store i32 0, i32* %1
%8 = bitcast [4 x i32]* %2 to i8*
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%10 = call i32 @sum(i32* %9, i32 4, i32* %3)
%11 = load i32, i32* %3
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = bitcast [5 x float]* %4 to i8*
%14 = getelementptr inbounds [5 x float], [5 x float]* %4, i64 0, i64 0
%15 = call i32 @avrg(float* %14, i32 5, float* %5)
%16 = load float, float* %5
%17 = fptosi float %16 to i32
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = bitcast [6 x i8]* %6 to i8*
%20 = bitcast [6 x i8]* %7 to i8*
%21 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%22 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%23 = call i32 @str_cmp(i8* %21, i8* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %23)
ret i32 0
}

LLVM IR (-O2):
@__const.main.array = [4 x i32] [i32 2, i32 4, i32 6, i32 8]
@.str = [4 x i8] c"%d\0A\00"
@__const.main.farr = [5 x float] [float 1.500000e+00, float 0x40019999A0000000, float 0x3FFCCCCCC0000000, float 2.500000e+00, float 0x3FF4CCCCC0000000]
@.str.1 = [4 x i8] c"%f\0A\00"
@__const.main.s1 = [6 x i8] c"Gosho\00"
@__const.main.s2 = [6 x i8] c"Gorge\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = alloca i32
%3 = alloca [5 x float]
%4 = alloca float
%5 = alloca [6 x i8]
%6 = alloca [6 x i8]
%7 = bitcast [4 x i32]* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%10 = call i32 @sum(i32* %9, i32 4, i32* %2)
%11 = load i32, i32* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = bitcast [5 x float]* %3 to i8*
%14 = bitcast float* %4 to i8*
%15 = getelementptr inbounds [5 x float], [5 x float]* %3, i64 0, i64 0
%16 = call i32 @avrg(float* %15, i32 5, float* %4)
%17 = load float, float* %4
%18 = fptosi float %17 to i32
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%21 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%22 = call i32 @str_cmp(i8* %20, i8* %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
ret i32 0
}