#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 */
typedef int /*<<< orphan*/ array;

/* Variables and functions */
int /*<<< orphan*/ calculateTotal(float *, float);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  int x = 3;
  float array[3];
  float len = sizeof(array) / sizeof(float);
  for (int i = 0; i < len; i++) {
    scanf("%f", &array[i]);
    x--;
  }
  calculateTotal(array, len);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movss  0xec2(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cvtsi2ssl -0x1c(%rbp),%xmm1
movss  -0x18(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    118f <main+0x6f>
movslq -0x1c(%rbp),%rax
lea    -0x14(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe91(%rip),%rdi
call   1030 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114a <main+0x2a>
lea    -0x14(%rbp),%rdi
movss  -0x18(%rbp),%xmm0
call   1040 <calculateTotal@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xed6(%rip),%rbx
lea    0xc(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <scanf@plt>
movss  0xea0(%rip),%xmm0
mov    %r14,%rdi
call   1040 <calculateTotal@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [3 x float]
%4 = alloca float
%5 = alloca i32
store i32 0, i32* %1
store i32 3, i32* %2
store float 3.000000e+00, float* %4
store i32 0, i32* %5
br label %6
6: ; preds = %18, %0
%7 = load i32, i32* %5
%8 = sitofp i32 %7 to float
%9 = load float, float* %4
%10 = fcmp olt float %8, %9
br i1 %10, label %11, label %21
11: ; preds = %6
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 %13
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %14)
%16 = load i32, i32* %2
%17 = add nsw i32 %16, -1
store i32 %17, i32* %2
br label %18
18: ; preds = %11
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
%22 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 0
%23 = load float, float* %4
%24 = call i32 @calculateTotal(float* %22, float %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca [3 x float]
%2 = bitcast [3 x float]* %1 to i8*
%3 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %3)
%5 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 1
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %5)
%7 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 2
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %7)
%9 = call i32 @calculateTotal(float* %3, float 3.000000e+00)
ret i32 0
}