#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 */
int /*<<< orphan*/ EXIT_FAILURE;
scalar_t__ calloc(size_t, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
float *new_vector_float(size_t);
int /*<<< orphan*/ perror(char *);
float **new_matrix_float(size_t size_y, size_t size_x) {
  size_t i;
  float **retP;
  retP = (float **)calloc(size_y, sizeof(float *));
  if (!retP) {
    perror("Out of memory when initializing float matrix.\n");
    exit(EXIT_FAILURE);
  } else {
    for (i = 0; i < size_y; i++) {
      retP[i] = new_vector_float(size_x);
    }
  }
  return retP;
}


x86 assembly (clang, -O0):
<new_matrix_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1187 <new_matrix_float+0x47>
lea    0xe8c(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    11c6 <new_matrix_float+0x86>
mov    -0x10(%rbp),%rdi
call   1060 <new_vector_float@plt>
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    118f <new_matrix_float+0x4f>
jmp    11cb <new_matrix_float+0x8b>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<new_matrix_float>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x8,%esi
call   1030 <calloc@plt>
test   %rax,%rax
je     1194 <new_matrix_float+0x54>
mov    %rax,%r12
test   %r15,%r15
je     1185 <new_matrix_float+0x45>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1060 <new_vector_float@plt>
mov    %rax,(%r12,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1170 <new_matrix_float+0x30>
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe65(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"Out of memory when initializing float matrix.\0A\00"
@EXIT_FAILURE = global i32 0
define float** @new_matrix_float(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca float**
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = call i64 @calloc(i64 %7, i32 8)
%9 = inttoptr i64 %8 to float**
store float** %9, float*** %6
%10 = load float**, float*** %6
%11 = icmp ne float** %10, null
br i1 %11, label %16, label %12
12: ; preds = %2
%13 = call i32 @perror(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %2
store i64 0, i64* %5
br label %17
17: ; preds = %27, %16
%18 = load i64, i64* %5
%19 = load i64, i64* %3
%20 = icmp ult i64 %18, %19
br i1 %20, label %21, label %30
21: ; preds = %17
%22 = load i64, i64* %4
%23 = call float* @new_vector_float(i64 %22)
%24 = load float**, float*** %6
%25 = load i64, i64* %5
%26 = getelementptr inbounds float*, float** %24, i64 %25
store float* %23, float** %26
br label %27
27: ; preds = %21
%28 = load i64, i64* %5
%29 = add i64 %28, 1
store i64 %29, i64* %5
br label %17
30: ; preds = %17
br label %31
31: ; preds = %30
%32 = load float**, float*** %6
ret float** %32
}

LLVM IR (-O2):
@.str = [47 x i8] c"Out of memory when initializing float matrix.\0A\00"
@EXIT_FAILURE = global i32 0
define float** @new_matrix_float(i64 %0, i64 %1) {
%3 = tail call i64 @calloc(i64 %0, i32 8)
%4 = inttoptr i64 %3 to float**
%5 = icmp eq i64 %3, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = icmp eq i64 %0, 0
br i1 %7, label %18, label %12
8: ; preds = %2
%9 = tail call i32 @perror(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %6, %12
%13 = phi i64 [ %16, %12 ], [ 0, %6 ]
%14 = tail call float* @new_vector_float(i64 %1)
%15 = getelementptr inbounds float*, float** %4, i64 %13
store float* %14, float** %15
%16 = add nuw i64 %13, 1
%17 = icmp eq i64 %16, %0
br i1 %17, label %18, label %12
18: ; preds = %12, %6
ret float** %4
}