#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 **create_int_matrix(int, int);
int /*<<< orphan*/ free_int_matrix(int **, int);
int /*<<< orphan*/ print_int_matrix(int **, int, int);
int main() {
  int nrows = 10;
  int ncols = 10;
  int **m = create_int_matrix(nrows, ncols);
  for (int i = 0; i < nrows; i++) {
    for (int j = 0; j < ncols; j++) {
      m[i][j] = i * j;
    }
  }
  print_int_matrix(m, nrows, ncols);
  free_int_matrix(m, nrows);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <create_int_matrix@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11bd <main+0x8d>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11aa <main+0x7a>
mov    -0x1c(%rbp),%edx
imul   -0x20(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1176 <main+0x46>
jmp    11af <main+0x7f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1163 <main+0x33>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <print_int_matrix@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <free_int_matrix@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xa,%edi
mov    $0xa,%esi
call   1030 <create_int_matrix@plt>
mov    %rax,%rbx
mov    (%rax),%rax
xorps  %xmm0,%xmm0
movups %xmm0,(%rax)
movups %xmm0,0x10(%rax)
movq   $0x0,0x20(%rax)
mov    0x8(%rbx),%rax
movaps 0xe9d(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xea3(%rip),%xmm0
movups %xmm0,0x10(%rax)
movabs $0x900000008,%rcx
mov    %rcx,0x20(%rax)
mov    0x10(%rbx),%rax
movaps 0xe96(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xe9c(%rip),%xmm0
movups %xmm0,0x10(%rax)
movabs $0x1200000010,%rcx
mov    %rcx,0x20(%rax)
mov    0x18(%rbx),%rax
movaps 0xe8f(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xe95(%rip),%xmm0
movups %xmm0,0x10(%rax)
movabs $0x1b00000018,%rcx
mov    %rcx,0x20(%rax)
mov    0x20(%rbx),%rax
movaps 0xe88(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xe8e(%rip),%xmm0
movups %xmm0,0x10(%rax)
movabs $0x2400000020,%rcx
mov    %rcx,0x20(%rax)
mov    0x28(%rbx),%rax
movaps 0xe81(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xe87(%rip),%xmm0
movups %xmm0,0x10(%rax)
movabs $0x2d00000028,%rcx
mov    %rcx,0x20(%rax)
mov    0x30(%rbx),%rax
movaps 0xe7a(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xe80(%rip),%xmm0
movups %xmm0,0x10(%rax)
movabs $0x3600000030,%rcx
mov    %rcx,0x20(%rax)
mov    0x38(%rbx),%rax
movaps 0xe73(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xe79(%rip),%xmm0
movups %xmm0,0x10(%rax)
movabs $0x3f00000038,%rcx
mov    %rcx,0x20(%rax)
mov    0x40(%rbx),%rax
movaps 0xe6c(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xe72(%rip),%xmm0
movups %xmm0,0x10(%rax)
movabs $0x4800000040,%rcx
mov    %rcx,0x20(%rax)
mov    0x48(%rbx),%rax
movaps 0xe65(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xe6b(%rip),%xmm0
movups %xmm0,0x10(%rax)
movabs $0x5100000048,%rcx
mov    %rcx,0x20(%rax)
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0xa,%edx
call   1040 <print_int_matrix@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <free_int_matrix@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32**
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
store i32 10, i32* %3
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = call i32** @create_int_matrix(i32 %7, i32 %8)
store i32** %9, i32*** %4
store i32 0, i32* %5
br label %10
10: ; preds = %35, %0
%11 = load i32, i32* %5
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %38
14: ; preds = %10
store i32 0, i32* %6
br label %15
15: ; preds = %31, %14
%16 = load i32, i32* %6
%17 = load i32, i32* %3
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %34
19: ; preds = %15
%20 = load i32, i32* %5
%21 = load i32, i32* %6
%22 = mul nsw i32 %20, %21
%23 = load i32**, i32*** %4
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32*, i32** %23, i64 %25
%27 = load i32*, i32** %26
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
store i32 %22, i32* %30
br label %31
31: ; preds = %19
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %15
34: ; preds = %15
br label %35
35: ; preds = %34
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %10
38: ; preds = %10
%39 = load i32**, i32*** %4
%40 = load i32, i32* %2
%41 = load i32, i32* %3
%42 = call i32 @print_int_matrix(i32** %39, i32 %40, i32 %41)
%43 = load i32**, i32*** %4
%44 = load i32, i32* %2
%45 = call i32 @free_int_matrix(i32** %43, i32 %44)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32** @create_int_matrix(i32 10, i32 10)
%2 = bitcast i32** %1 to i8**
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i32*, i32** %1, i64 1
%5 = load i32*, i32** %4
%6 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %6
%7 = getelementptr inbounds i32, i32* %5, i64 4
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %8
%9 = getelementptr inbounds i32, i32* %5, i64 8
store i32 8, i32* %9
%10 = getelementptr inbounds i32, i32* %5, i64 9
store i32 9, i32* %10
%11 = getelementptr inbounds i32*, i32** %1, i64 2
%12 = load i32*, i32** %11
%13 = bitcast i32* %12 to <4 x i32>*
store <4 x i32> <i32 0, i32 2, i32 4, i32 6>, <4 x i32>* %13
%14 = getelementptr inbounds i32, i32* %12, i64 4
%15 = bitcast i32* %14 to <4 x i32>*
store <4 x i32> <i32 8, i32 10, i32 12, i32 14>, <4 x i32>* %15
%16 = getelementptr inbounds i32, i32* %12, i64 8
store i32 16, i32* %16
%17 = getelementptr inbounds i32, i32* %12, i64 9
store i32 18, i32* %17
%18 = getelementptr inbounds i32*, i32** %1, i64 3
%19 = load i32*, i32** %18
%20 = bitcast i32* %19 to <4 x i32>*
store <4 x i32> <i32 0, i32 3, i32 6, i32 9>, <4 x i32>* %20
%21 = getelementptr inbounds i32, i32* %19, i64 4
%22 = bitcast i32* %21 to <4 x i32>*
store <4 x i32> <i32 12, i32 15, i32 18, i32 21>, <4 x i32>* %22
%23 = getelementptr inbounds i32, i32* %19, i64 8
store i32 24, i32* %23
%24 = getelementptr inbounds i32, i32* %19, i64 9
store i32 27, i32* %24
%25 = getelementptr inbounds i32*, i32** %1, i64 4
%26 = load i32*, i32** %25
%27 = bitcast i32* %26 to <4 x i32>*
store <4 x i32> <i32 0, i32 4, i32 8, i32 12>, <4 x i32>* %27
%28 = getelementptr inbounds i32, i32* %26, i64 4
%29 = bitcast i32* %28 to <4 x i32>*
store <4 x i32> <i32 16, i32 20, i32 24, i32 28>, <4 x i32>* %29
%30 = getelementptr inbounds i32, i32* %26, i64 8
store i32 32, i32* %30
%31 = getelementptr inbounds i32, i32* %26, i64 9
store i32 36, i32* %31
%32 = getelementptr inbounds i32*, i32** %1, i64 5
%33 = load i32*, i32** %32
%34 = bitcast i32* %33 to <4 x i32>*
store <4 x i32> <i32 0, i32 5, i32 10, i32 15>, <4 x i32>* %34
%35 = getelementptr inbounds i32, i32* %33, i64 4
%36 = bitcast i32* %35 to <4 x i32>*
store <4 x i32> <i32 20, i32 25, i32 30, i32 35>, <4 x i32>* %36
%37 = getelementptr inbounds i32, i32* %33, i64 8
store i32 40, i32* %37
%38 = getelementptr inbounds i32, i32* %33, i64 9
store i32 45, i32* %38
%39 = getelementptr inbounds i32*, i32** %1, i64 6
%40 = load i32*, i32** %39
%41 = bitcast i32* %40 to <4 x i32>*
store <4 x i32> <i32 0, i32 6, i32 12, i32 18>, <4 x i32>* %41
%42 = getelementptr inbounds i32, i32* %40, i64 4
%43 = bitcast i32* %42 to <4 x i32>*
store <4 x i32> <i32 24, i32 30, i32 36, i32 42>, <4 x i32>* %43
%44 = getelementptr inbounds i32, i32* %40, i64 8
store i32 48, i32* %44
%45 = getelementptr inbounds i32, i32* %40, i64 9
store i32 54, i32* %45
%46 = getelementptr inbounds i32*, i32** %1, i64 7
%47 = load i32*, i32** %46
%48 = bitcast i32* %47 to <4 x i32>*
store <4 x i32> <i32 0, i32 7, i32 14, i32 21>, <4 x i32>* %48
%49 = getelementptr inbounds i32, i32* %47, i64 4
%50 = bitcast i32* %49 to <4 x i32>*
store <4 x i32> <i32 28, i32 35, i32 42, i32 49>, <4 x i32>* %50
%51 = getelementptr inbounds i32, i32* %47, i64 8
store i32 56, i32* %51
%52 = getelementptr inbounds i32, i32* %47, i64 9
store i32 63, i32* %52
%53 = getelementptr inbounds i32*, i32** %1, i64 8
%54 = load i32*, i32** %53
%55 = bitcast i32* %54 to <4 x i32>*
store <4 x i32> <i32 0, i32 8, i32 16, i32 24>, <4 x i32>* %55
%56 = getelementptr inbounds i32, i32* %54, i64 4
%57 = bitcast i32* %56 to <4 x i32>*
store <4 x i32> <i32 32, i32 40, i32 48, i32 56>, <4 x i32>* %57
%58 = getelementptr inbounds i32, i32* %54, i64 8
store i32 64, i32* %58
%59 = getelementptr inbounds i32, i32* %54, i64 9
store i32 72, i32* %59
%60 = getelementptr inbounds i32*, i32** %1, i64 9
%61 = load i32*, i32** %60
%62 = bitcast i32* %61 to <4 x i32>*
store <4 x i32> <i32 0, i32 9, i32 18, i32 27>, <4 x i32>* %62
%63 = getelementptr inbounds i32, i32* %61, i64 4
%64 = bitcast i32* %63 to <4 x i32>*
store <4 x i32> <i32 36, i32 45, i32 54, i32 63>, <4 x i32>* %64
%65 = getelementptr inbounds i32, i32* %61, i64 8
store i32 72, i32* %65
%66 = getelementptr inbounds i32, i32* %61, i64 9
store i32 81, i32* %66
%67 = tail call i32 @print_int_matrix(i32** %1, i32 10, i32 10)
%68 = tail call i32 @free_int_matrix(i32** %1, i32 10)
ret i32 0
}