#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__ malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char const *argv[]) {
  int cols = 1, rows = 10, i, j;
  char **note = (char **)malloc(sizeof(char *) * rows);
  for (i = 0; i < rows; ++i) {
    *(note + i) = (char *)malloc(sizeof(char) * cols);
  }
  for (i = 0; i < rows; ++i) {
    for (j = 0; j < cols; ++j) {
      note[i][j] = '3';
    }
  }
  for (i = 0; i < rows; ++i) {
    printf("%s\n", note[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0xa,-0x18(%rbp)
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1196 <main+0x76>
movslq -0x14(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rdx
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115e <main+0x3e>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11f1 <main+0xd1>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11de <main+0xbe>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movb   $0x33,(%rax,%rcx,1)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11b0 <main+0x90>
jmp    11e3 <main+0xc3>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    119d <main+0x7d>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    122a <main+0x10a>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xde9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11f8 <main+0xd8>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x50,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,(%rbx)
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,0x8(%rbx)
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,0x10(%rbx)
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,0x18(%rbx)
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,0x20(%rbx)
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,0x28(%rbx)
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,0x30(%rbx)
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,0x38(%rbx)
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,0x40(%rbx)
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,0x48(%rbx)
mov    (%rbx),%rax
movb   $0x33,(%rax)
mov    0x8(%rbx),%rax
movb   $0x33,(%rax)
mov    0x10(%rbx),%rax
movb   $0x33,(%rax)
mov    0x18(%rbx),%rax
movb   $0x33,(%rax)
mov    0x20(%rbx),%rax
movb   $0x33,(%rax)
mov    0x28(%rbx),%rax
movb   $0x33,(%rax)
mov    0x30(%rbx),%rax
movb   $0x33,(%rax)
mov    0x38(%rbx),%rax
movb   $0x33,(%rax)
mov    0x40(%rbx),%rax
movb   $0x33,(%rax)
mov    0x48(%rbx),%rax
movb   $0x33,(%rax)
mov    (%rbx),%rsi
lea    0xdf5(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x8(%rbx),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x10(%rbx),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x18(%rbx),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x20(%rbx),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x28(%rbx),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x30(%rbx),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x38(%rbx),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x40(%rbx),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x48(%rbx),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i32 10, i32* %7
%11 = load i32, i32* %7
%12 = sext i32 %11 to i64
%13 = mul i64 8, %12
%14 = trunc i64 %13 to i32
%15 = call i64 @malloc(i32 %14)
%16 = inttoptr i64 %15 to i8**
store i8** %16, i8*** %10
store i32 0, i32* %8
br label %17
17: ; preds = %32, %2
%18 = load i32, i32* %8
%19 = load i32, i32* %7
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %35
21: ; preds = %17
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = mul i64 1, %23
%25 = trunc i64 %24 to i32
%26 = call i64 @malloc(i32 %25)
%27 = inttoptr i64 %26 to i8*
%28 = load i8**, i8*** %10
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
store i8* %27, i8** %31
br label %32
32: ; preds = %21
%33 = load i32, i32* %8
%34 = add nsw i32 %33, 1
store i32 %34, i32* %8
br label %17
35: ; preds = %17
store i32 0, i32* %8
br label %36
36: ; preds = %58, %35
%37 = load i32, i32* %8
%38 = load i32, i32* %7
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %61
40: ; preds = %36
store i32 0, i32* %9
br label %41
41: ; preds = %54, %40
%42 = load i32, i32* %9
%43 = load i32, i32* %6
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %57
45: ; preds = %41
%46 = load i8**, i8*** %10
%47 = load i32, i32* %8
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8*, i8** %46, i64 %48
%50 = load i8*, i8** %49
%51 = load i32, i32* %9
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8, i8* %50, i64 %52
store i8 51, i8* %53
br label %54
54: ; preds = %45
%55 = load i32, i32* %9
%56 = add nsw i32 %55, 1
store i32 %56, i32* %9
br label %41
57: ; preds = %41
br label %58
58: ; preds = %57
%59 = load i32, i32* %8
%60 = add nsw i32 %59, 1
store i32 %60, i32* %8
br label %36
61: ; preds = %36
store i32 0, i32* %8
br label %62
62: ; preds = %73, %61
%63 = load i32, i32* %8
%64 = load i32, i32* %7
%65 = icmp slt i32 %63, %64
br i1 %65, label %66, label %76
66: ; preds = %62
%67 = load i8**, i8*** %10
%68 = load i32, i32* %8
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8*, i8** %67, i64 %69
%71 = load i8*, i8** %70
%72 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %71)
br label %73
73: ; preds = %66
%74 = load i32, i32* %8
%75 = add nsw i32 %74, 1
store i32 %75, i32* %8
br label %62
76: ; preds = %62
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 80)
%4 = inttoptr i64 %3 to i8**
%5 = tail call i64 @malloc(i32 1)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %4
%7 = tail call i64 @malloc(i32 1)
%8 = inttoptr i64 %7 to i8*
%9 = getelementptr inbounds i8*, i8** %4, i64 1
store i8* %8, i8** %9
%10 = tail call i64 @malloc(i32 1)
%11 = inttoptr i64 %10 to i8*
%12 = getelementptr inbounds i8*, i8** %4, i64 2
store i8* %11, i8** %12
%13 = tail call i64 @malloc(i32 1)
%14 = inttoptr i64 %13 to i8*
%15 = getelementptr inbounds i8*, i8** %4, i64 3
store i8* %14, i8** %15
%16 = tail call i64 @malloc(i32 1)
%17 = inttoptr i64 %16 to i8*
%18 = getelementptr inbounds i8*, i8** %4, i64 4
store i8* %17, i8** %18
%19 = tail call i64 @malloc(i32 1)
%20 = inttoptr i64 %19 to i8*
%21 = getelementptr inbounds i8*, i8** %4, i64 5
store i8* %20, i8** %21
%22 = tail call i64 @malloc(i32 1)
%23 = inttoptr i64 %22 to i8*
%24 = getelementptr inbounds i8*, i8** %4, i64 6
store i8* %23, i8** %24
%25 = tail call i64 @malloc(i32 1)
%26 = inttoptr i64 %25 to i8*
%27 = getelementptr inbounds i8*, i8** %4, i64 7
store i8* %26, i8** %27
%28 = tail call i64 @malloc(i32 1)
%29 = inttoptr i64 %28 to i8*
%30 = getelementptr inbounds i8*, i8** %4, i64 8
store i8* %29, i8** %30
%31 = tail call i64 @malloc(i32 1)
%32 = inttoptr i64 %31 to i8*
%33 = getelementptr inbounds i8*, i8** %4, i64 9
store i8* %32, i8** %33
%34 = load i8*, i8** %4
store i8 51, i8* %34
%35 = load i8*, i8** %9
store i8 51, i8* %35
%36 = load i8*, i8** %12
store i8 51, i8* %36
%37 = load i8*, i8** %15
store i8 51, i8* %37
%38 = load i8*, i8** %18
store i8 51, i8* %38
%39 = load i8*, i8** %21
store i8 51, i8* %39
%40 = load i8*, i8** %24
store i8 51, i8* %40
%41 = load i8*, i8** %27
store i8 51, i8* %41
%42 = load i8*, i8** %30
store i8 51, i8* %42
%43 = load i8*, i8** %33
store i8 51, i8* %43
%44 = load i8*, i8** %4
%45 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %44)
%46 = load i8*, i8** %9
%47 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %46)
%48 = load i8*, i8** %12
%49 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %48)
%50 = load i8*, i8** %15
%51 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %50)
%52 = load i8*, i8** %18
%53 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %52)
%54 = load i8*, i8** %21
%55 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %54)
%56 = load i8*, i8** %24
%57 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %56)
%58 = load i8*, i8** %27
%59 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %58)
%60 = load i8*, i8** %30
%61 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %60)
%62 = load i8*, i8** %33
%63 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %62)
ret i32 0
}