#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ memoryCheck();
float *allocateFloatVector(int n) {
  int i;
  float *vector;
  if ((vector = (float *)calloc(n, sizeof(float))) == NULL)
    memoryCheck();
  for (i = 0; i < n; i++)
    vector[i] = 0.0;
  return vector;
}


x86 assembly (clang, -O0):
<allocateFloatVector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    114d <allocateFloatVector+0x2d>
mov    $0x0,%al
call   1040 <memoryCheck@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    117e <allocateFloatVector+0x5e>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <allocateFloatVector+0x34>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocateFloatVector>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1165 <allocateFloatVector+0x35>
test   %ebp,%ebp
jle    115b <allocateFloatVector+0x2b>
mov    %ebp,%edx
shl    $0x2,%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %eax,%eax
call   1050 <memoryCheck@plt>
test   %ebp,%ebp
jg     114b <allocateFloatVector+0x1b>
jmp    115b <allocateFloatVector+0x2b>

LLVM IR (-O0):
define float* @allocateFloatVector(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca float*
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i64 @calloc(i32 %5, i32 4)
%7 = inttoptr i64 %6 to float*
store float* %7, float** %4
%8 = icmp eq float* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 (...) @memoryCheck()
br label %11
11: ; preds = %9, %1
store i32 0, i32* %3
br label %12
12: ; preds = %21, %11
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load float*, float** %4
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds float, float* %17, i64 %19
store float 0.000000e+00, float* %20
br label %21
21: ; preds = %16
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %12
24: ; preds = %12
%25 = load float*, float** %4
ret float* %25
}

LLVM IR (-O2):
define float* @allocateFloatVector(i32 %0) {
%2 = tail call i64 @calloc(i32 %0, i32 4)
%3 = inttoptr i64 %2 to i8*
%4 = icmp eq i64 %2, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 (...) @memoryCheck()
br label %7
7: ; preds = %5, %1
%8 = icmp sgt i32 %0, 0
br i1 %8, label %9, label %12
9: ; preds = %7
%10 = zext i32 %0 to i64
%11 = shl nuw nsw i64 %10, 2
br label %12
12: ; preds = %9, %7
%13 = inttoptr i64 %2 to float*
ret float* %13
}