#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
float *get_1d_mem_float(int dim1) {
  float *array_1d;
  if (!(array_1d = (float *)calloc(dim1, sizeof(float)))) {
    fprintf(stderr, "unable to allocate memory in get_1d_mem_float\n");
    fprintf(stderr, "dimension %d\n", dim1);
    exit(1);
  }
  return array_1d;
}


x86 assembly (clang, -O0):
<get_1d_mem_float>:
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    1191 <get_1d_mem_float+0x61>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
lea    0xe9a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xeaf(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_1d_mem_float>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x4,%esi
call   1030 <calloc@plt>
test   %rax,%rax
je     114d <get_1d_mem_float+0x1d>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e8c(%rip),%r14
mov    (%r14),%edi
lea    0xea2(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xec0(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [47 x i8] c"unable to allocate memory in get_1d_mem_float\0A\00"
@.str.1 = [14 x i8] c"dimension %d\0A\00"
define float* @get_1d_mem_float(i32 %0) {
%2 = alloca i32
%3 = alloca float*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 @calloc(i32 %4, i32 4)
%6 = inttoptr i64 %5 to float*
store float* %6, float** %3
%7 = icmp ne float* %6, null
br i1 %7, label %15, label %8
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = load i32, i32* %2
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %1
%16 = load float*, float** %3
ret float* %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [47 x i8] c"unable to allocate memory in get_1d_mem_float\0A\00"
@.str.1 = [14 x i8] c"dimension %d\0A\00"
define float* @get_1d_mem_float(i32 %0) {
%2 = tail call i64 @calloc(i32 %0, i32 4)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %1
%11 = inttoptr i64 %2 to float*
ret float* %11
}