#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(char, int);
float **createMatrix(char rows, char cols) {
  float **matrix;
  char i;
  matrix = (float **)calloc(rows, sizeof(float *));
  for (i = 0; i < rows; i++) {
    matrix[i] = (float *)calloc(cols, sizeof(float));
  }
  return matrix;
}


x86 assembly (clang, -O0):
<createMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    $0x8,%esi
movsbl -0x1(%rbp),%edi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
movsbl -0x1(%rbp),%ecx
cmp    %ecx,%eax
jge    1175 <createMatrix+0x65>
mov    $0x4,%esi
movsbl -0x2(%rbp),%edi
call   1030 <calloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movsbq -0x11(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x11(%rbp),%al
add    $0x1,%al
mov    %al,-0x11(%rbp)
jmp    113a <createMatrix+0x2a>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%r15
test   %bpl,%bpl
jle    1159 <createMatrix+0x49>
movzbl %bpl,%r12d
xor    %ebx,%ebx
movsbl %r14b,%ebp
nopl   0x0(%rax)
mov    %ebp,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <createMatrix+0x30>
mov    %r15,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define float** @createMatrix(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca float**
%6 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%7 = load i8, i8* %3
%8 = call i64 @calloc(i8 signext %7, i32 8)
%9 = inttoptr i64 %8 to float**
store float** %9, float*** %5
store i8 0, i8* %6
br label %10
10: ; preds = %24, %2
%11 = load i8, i8* %6
%12 = sext i8 %11 to i32
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp slt i32 %12, %14
br i1 %15, label %16, label %27
16: ; preds = %10
%17 = load i8, i8* %4
%18 = call i64 @calloc(i8 signext %17, i32 4)
%19 = inttoptr i64 %18 to float*
%20 = load float**, float*** %5
%21 = load i8, i8* %6
%22 = sext i8 %21 to i64
%23 = getelementptr inbounds float*, float** %20, i64 %22
store float* %19, float** %23
br label %24
24: ; preds = %16
%25 = load i8, i8* %6
%26 = add i8 %25, 1
store i8 %26, i8* %6
br label %10
27: ; preds = %10
%28 = load float**, float*** %5
ret float** %28
}

LLVM IR (-O2):
define float** @createMatrix(i8 signext %0, i8 signext %1) {
%3 = tail call i64 @calloc(i8 signext %0, i32 8)
%4 = inttoptr i64 %3 to float**
%5 = icmp sgt i8 %0, 0
br i1 %5, label %6, label %15
6: ; preds = %2
%7 = zext i8 %0 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %13, %8 ]
%10 = tail call i64 @calloc(i8 signext %1, i32 4)
%11 = inttoptr i64 %10 to float*
%12 = getelementptr inbounds float*, float** %4, i64 %9
store float* %11, float** %12
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %7
br i1 %14, label %15, label %8
15: ; preds = %8, %2
ret float** %4
}