#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);
char **initMat() {
  int i, j;
  char **mat = (char **)calloc(10, sizeof(char *));
  for (i = 0; i < 10; i++)
    mat[i] = (char *)calloc(10, sizeof(char));
  for (i = 0; i < 10; i++)
    for (j = 0; j < 10; j++) {
      mat[i][j] = '~';
    }
  return mat;
}


x86 assembly (clang, -O0):
<initMat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xa,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1168 <initMat+0x58>
mov    $0xa,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1132 <initMat+0x22>
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    11bf <initMat+0xaf>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11ac <initMat+0x9c>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x8(%rbp),%rcx
movb   $0x7e,(%rax,%rcx,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1180 <initMat+0x70>
jmp    11b1 <initMat+0xa1>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    116f <initMat+0x5f>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initMat>:
push   %rbx
mov    $0xa,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%rbx
mov    $0xa,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,(%rbx)
mov    $0xa,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,0x8(%rbx)
mov    $0xa,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,0x10(%rbx)
mov    $0xa,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,0x18(%rbx)
mov    $0xa,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,0x20(%rbx)
mov    $0xa,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,0x28(%rbx)
mov    $0xa,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,0x30(%rbx)
mov    $0xa,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,0x38(%rbx)
mov    $0xa,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,0x40(%rbx)
mov    $0xa,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,0x48(%rbx)
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rbx,%rax,8),%rcx
movb   $0x7e,(%rcx)
mov    (%rbx,%rax,8),%rcx
movb   $0x7e,0x1(%rcx)
mov    (%rbx,%rax,8),%rcx
movb   $0x7e,0x2(%rcx)
mov    (%rbx,%rax,8),%rcx
movb   $0x7e,0x3(%rcx)
mov    (%rbx,%rax,8),%rcx
movb   $0x7e,0x4(%rcx)
mov    (%rbx,%rax,8),%rcx
movb   $0x7e,0x5(%rcx)
mov    (%rbx,%rax,8),%rcx
movb   $0x7e,0x6(%rcx)
mov    (%rbx,%rax,8),%rcx
movb   $0x7e,0x7(%rcx)
mov    (%rbx,%rax,8),%rcx
movb   $0x7e,0x8(%rcx)
mov    (%rbx,%rax,8),%rcx
movb   $0x7e,0x9(%rcx)
add    $0x1,%rax
cmp    $0xa,%rax
jne    11f0 <initMat+0xe0>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8** @initMat() {
%1 = tail call i64 @calloc(i32 10, i32 8)
%2 = inttoptr i64 %1 to i8**
%3 = tail call i64 @calloc(i32 10, i32 1)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %2
%5 = tail call i64 @calloc(i32 10, i32 1)
%6 = inttoptr i64 %5 to i8*
%7 = getelementptr inbounds i8*, i8** %2, i64 1
store i8* %6, i8** %7
%8 = tail call i64 @calloc(i32 10, i32 1)
%9 = inttoptr i64 %8 to i8*
%10 = getelementptr inbounds i8*, i8** %2, i64 2
store i8* %9, i8** %10
%11 = tail call i64 @calloc(i32 10, i32 1)
%12 = inttoptr i64 %11 to i8*
%13 = getelementptr inbounds i8*, i8** %2, i64 3
store i8* %12, i8** %13
%14 = tail call i64 @calloc(i32 10, i32 1)
%15 = inttoptr i64 %14 to i8*
%16 = getelementptr inbounds i8*, i8** %2, i64 4
store i8* %15, i8** %16
%17 = tail call i64 @calloc(i32 10, i32 1)
%18 = inttoptr i64 %17 to i8*
%19 = getelementptr inbounds i8*, i8** %2, i64 5
store i8* %18, i8** %19
%20 = tail call i64 @calloc(i32 10, i32 1)
%21 = inttoptr i64 %20 to i8*
%22 = getelementptr inbounds i8*, i8** %2, i64 6
store i8* %21, i8** %22
%23 = tail call i64 @calloc(i32 10, i32 1)
%24 = inttoptr i64 %23 to i8*
%25 = getelementptr inbounds i8*, i8** %2, i64 7
store i8* %24, i8** %25
%26 = tail call i64 @calloc(i32 10, i32 1)
%27 = inttoptr i64 %26 to i8*
%28 = getelementptr inbounds i8*, i8** %2, i64 8
store i8* %27, i8** %28
%29 = tail call i64 @calloc(i32 10, i32 1)
%30 = inttoptr i64 %29 to i8*
%31 = getelementptr inbounds i8*, i8** %2, i64 9
store i8* %30, i8** %31
br label %32
32: ; preds = %0, %32
%33 = phi i64 [ 0, %0 ], [ %54, %32 ]
%34 = getelementptr inbounds i8*, i8** %2, i64 %33
%35 = load i8*, i8** %34
store i8 126, i8* %35
%36 = load i8*, i8** %34
%37 = getelementptr inbounds i8, i8* %36, i64 1
store i8 126, i8* %37
%38 = load i8*, i8** %34
%39 = getelementptr inbounds i8, i8* %38, i64 2
store i8 126, i8* %39
%40 = load i8*, i8** %34
%41 = getelementptr inbounds i8, i8* %40, i64 3
store i8 126, i8* %41
%42 = load i8*, i8** %34
%43 = getelementptr inbounds i8, i8* %42, i64 4
store i8 126, i8* %43
%44 = load i8*, i8** %34
%45 = getelementptr inbounds i8, i8* %44, i64 5
store i8 126, i8* %45
%46 = load i8*, i8** %34
%47 = getelementptr inbounds i8, i8* %46, i64 6
store i8 126, i8* %47
%48 = load i8*, i8** %34
%49 = getelementptr inbounds i8, i8* %48, i64 7
store i8 126, i8* %49
%50 = load i8*, i8** %34
%51 = getelementptr inbounds i8, i8* %50, i64 8
store i8 126, i8* %51
%52 = load i8*, i8** %34
%53 = getelementptr inbounds i8, i8* %52, i64 9
store i8 126, i8* %53
%54 = add nuw nsw i64 %33, 1
%55 = icmp eq i64 %54, 10
br i1 %55, label %56, label %32
56: ; preds = %32
ret i8** %2
}