#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 */
char *Csv_readDoubles(char *, unsigned int const, unsigned int, int, double *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ halt(char *, unsigned int);
double *malloc(int);
double *readCsvNoHeader(unsigned nObservations, char *fileName) {
  double *dataP = malloc(sizeof(double) * nObservations);
  if (!dataP)
    halt("unable to allocate data: %u\n", nObservations);
  const unsigned expectHeader = 1;
  char *dataHeader =
      Csv_readDoubles(fileName, expectHeader, nObservations, 1, dataP);
  free(dataHeader);
  return dataP;
}


x86 assembly (clang, -O0):
<readCsvNoHeader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117b <readCsvNoHeader+0x3b>
mov    -0x4(%rbp),%esi
lea    0xe8a(%rip),%rdi
call   1060 <halt@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    -0x18(%rbp),%r8
mov    $0x1,%ecx
mov    %ecx,%esi
call   1040 <Csv_readDoubles@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readCsvNoHeader>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %edi,%r14d
lea    0x0(,%r14,8),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    116f <readCsvNoHeader+0x2f>
lea    0xe99(%rip),%rdi
mov    %r14d,%esi
call   1060 <halt@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    %r14d,%edx
mov    $0x1,%ecx
mov    %rbx,%r8
call   1040 <Csv_readDoubles@plt>
mov    %rax,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [29 x i8] c"unable to allocate data: %u\0A\00"
define double* @readCsvNoHeader(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca double*
%6 = alloca i32
%7 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%8 = load i32, i32* %3
%9 = zext i32 %8 to i64
%10 = mul i64 8, %9
%11 = trunc i64 %10 to i32
%12 = call double* @malloc(i32 %11)
store double* %12, double** %5
%13 = load double*, double** %5
%14 = icmp ne double* %13, null
br i1 %14, label %18, label %15
15: ; preds = %2
%16 = load i32, i32* %3
%17 = call i32 @halt(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %15, %2
store i32 1, i32* %6
%19 = load i8*, i8** %4
%20 = load i32, i32* %3
%21 = load double*, double** %5
%22 = call i8* @Csv_readDoubles(i8* %19, i32 1, i32 %20, i32 1, double* %21)
store i8* %22, i8** %7
%23 = load i8*, i8** %7
%24 = call i32 @free(i8* %23)
%25 = load double*, double** %5
ret double* %25
}

LLVM IR (-O2):
@.str = [29 x i8] c"unable to allocate data: %u\0A\00"
define double* @readCsvNoHeader(i32 %0, i8* %1) {
%3 = shl i32 %0, 3
%4 = tail call double* @malloc(i32 %3)
%5 = icmp eq double* %4, null
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @halt(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %8
8: ; preds = %6, %2
%9 = tail call i8* @Csv_readDoubles(i8* %1, i32 1, i32 %0, i32 1, double* %4)
%10 = tail call i32 @free(i8* %9)
ret double* %4
}