#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*/ FILE;

/* Variables and functions */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fread(float *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ memoryCheck();
int /*<<< orphan*/ *openFile(char *, char *, char *);
float *readFloatData(char *pathName, char *fileName, int n) {
  FILE *fp;
  float *data;
  fp = openFile(pathName, fileName, "rb");
  if ((data = (float *)calloc(n, sizeof(float))) == NULL)
    memoryCheck();
  fread(data, sizeof(float), n, fp);
  fclose(fp);
  return data;
}


x86 assembly (clang, -O0):
<readFloatData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xe8e(%rip),%rdx
call   1050 <openFile@plt>
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    119d <readFloatData+0x4d>
mov    $0x0,%al
call   1070 <memoryCheck@plt>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    $0x4,%esi
call   1030 <fread@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readFloatData>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
lea    0xea2(%rip),%rdx
call   1050 <openFile@plt>
mov    %rax,%rbx
mov    %r14d,%edi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1182 <readFloatData+0x32>
xor    %eax,%eax
call   1070 <memoryCheck@plt>
mov    %rbp,%rdi
mov    $0x4,%esi
mov    %r14d,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
define float* @readFloatData(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca float*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = call i32* @openFile(i8* %9, i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %11, i32** %7
%12 = load i32, i32* %6
%13 = call i64 @calloc(i32 %12, i32 4)
%14 = inttoptr i64 %13 to float*
store float* %14, float** %8
%15 = icmp eq float* %14, null
br i1 %15, label %16, label %18
16: ; preds = %3
%17 = call i32 (...) @memoryCheck()
br label %18
18: ; preds = %16, %3
%19 = load float*, float** %8
%20 = load i32, i32* %6
%21 = load i32*, i32** %7
%22 = call i32 @fread(float* %19, i32 4, i32 %20, i32* %21)
%23 = load i32*, i32** %7
%24 = call i32 @fclose(i32* %23)
%25 = load float*, float** %8
ret float* %25
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
define float* @readFloatData(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32* @openFile(i8* %0, i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = tail call i64 @calloc(i32 %2, i32 4)
%6 = inttoptr i64 %5 to float*
%7 = icmp eq i64 %5, 0
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = tail call i32 (...) @memoryCheck()
br label %10
10: ; preds = %8, %3
%11 = tail call i32 @fread(float* %6, i32 4, i32 %2, i32* %4)
%12 = tail call i32 @fclose(i32* %4)
ret float* %6
}