#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 *, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int n, i, j;
  int **pm;
  srand(time(NULL));
  pm = (int **)malloc(3 * sizeof(sizeof(int *)));
  for (n = 0; n < 3; n++) {
    pm[n] = (int *)malloc(3 * sizeof(int));
  }
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      pm[i][j] = rand() % 10;
    }
  }
  pm[1][1] = 99;
  for (i = 0; i < 3; i++) {
    printf("\n\t");
    for (j = 0; j < 3; j++) {
      printf("%3d ", pm[i][j]);
    }
    printf("\n");
  }
  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)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x18,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    11bc <main+0x6c>
mov    $0xc,%edi
call   1060 <malloc@plt>
mov    %rax,%rdx
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118b <main+0x3b>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    1221 <main+0xd1>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    120e <main+0xbe>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11d4 <main+0x84>
jmp    1213 <main+0xc3>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11c3 <main+0x73>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x63,0x4(%rax)
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    12ab <main+0x15b>
lea    0xdb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    128f <main+0x13f>
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1256 <main+0x106>
lea    0xd72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1237 <main+0xe7>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x18,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    $0xc,%edi
call   1070 <malloc@plt>
mov    %rax,(%rbx)
mov    $0xc,%edi
call   1070 <malloc@plt>
mov    %rax,0x8(%rbx)
mov    $0xc,%edi
call   1070 <malloc@plt>
mov    %rax,0x10(%rbx)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    (%rbx),%rcx
mov    %eax,(%rcx)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    (%rbx),%rcx
mov    %eax,0x4(%rcx)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    (%rbx),%rcx
mov    %eax,0x8(%rcx)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    0x8(%rbx),%rcx
mov    %eax,(%rcx)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    0x8(%rbx),%rcx
mov    %eax,0x4(%rcx)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    0x8(%rbx),%rcx
mov    %eax,0x8(%rcx)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    0x10(%rbx),%rcx
mov    %eax,(%rcx)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    0x10(%rbx),%rcx
mov    %eax,0x4(%rcx)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    0x10(%rbx),%rcx
mov    %eax,0x8(%rcx)
mov    0x8(%rbx),%rax
movl   $0x63,0x4(%rax)
lea    0xcc8(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%rax
mov    (%rax),%esi
lea    0xcb5(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%rax
mov    0x4(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%rax
mov    0x8(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    (%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    0x4(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    0x8(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rbx),%rax
mov    (%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rbx),%rax
mov    0x4(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rbx),%rax
mov    0x8(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"\0A\09\00"
@.str.1 = [5 x i8] c"%3d \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call i64 @malloc(i32 24)
%6 = inttoptr i64 %5 to i32**
%7 = tail call i64 @malloc(i32 12)
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %6
%9 = tail call i64 @malloc(i32 12)
%10 = inttoptr i64 %9 to i32*
%11 = getelementptr inbounds i32*, i32** %6, i64 1
store i32* %10, i32** %11
%12 = tail call i64 @malloc(i32 12)
%13 = inttoptr i64 %12 to i32*
%14 = getelementptr inbounds i32*, i32** %6, i64 2
store i32* %13, i32** %14
%15 = tail call i32 (...) @rand()
%16 = srem i32 %15, 10
%17 = load i32*, i32** %6
store i32 %16, i32* %17
%18 = tail call i32 (...) @rand()
%19 = srem i32 %18, 10
%20 = load i32*, i32** %6
%21 = getelementptr inbounds i32, i32* %20, i64 1
store i32 %19, i32* %21
%22 = tail call i32 (...) @rand()
%23 = srem i32 %22, 10
%24 = load i32*, i32** %6
%25 = getelementptr inbounds i32, i32* %24, i64 2
store i32 %23, i32* %25
%26 = tail call i32 (...) @rand()
%27 = srem i32 %26, 10
%28 = load i32*, i32** %11
store i32 %27, i32* %28
%29 = tail call i32 (...) @rand()
%30 = srem i32 %29, 10
%31 = load i32*, i32** %11
%32 = getelementptr inbounds i32, i32* %31, i64 1
store i32 %30, i32* %32
%33 = tail call i32 (...) @rand()
%34 = srem i32 %33, 10
%35 = load i32*, i32** %11
%36 = getelementptr inbounds i32, i32* %35, i64 2
store i32 %34, i32* %36
%37 = tail call i32 (...) @rand()
%38 = srem i32 %37, 10
%39 = load i32*, i32** %14
store i32 %38, i32* %39
%40 = tail call i32 (...) @rand()
%41 = srem i32 %40, 10
%42 = load i32*, i32** %14
%43 = getelementptr inbounds i32, i32* %42, i64 1
store i32 %41, i32* %43
%44 = tail call i32 (...) @rand()
%45 = srem i32 %44, 10
%46 = load i32*, i32** %14
%47 = getelementptr inbounds i32, i32* %46, i64 2
store i32 %45, i32* %47
%48 = load i32*, i32** %11
%49 = getelementptr inbounds i32, i32* %48, i64 1
store i32 99, i32* %49
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%51 = load i32*, i32** %6
%52 = load i32, i32* %51
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %52)
%54 = load i32*, i32** %6
%55 = getelementptr inbounds i32, i32* %54, i64 1
%56 = load i32, i32* %55
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %56)
%58 = load i32*, i32** %6
%59 = getelementptr inbounds i32, i32* %58, i64 2
%60 = load i32, i32* %59
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %60)
%62 = tail call i32 @putchar(i32 10)
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%64 = load i32*, i32** %11
%65 = load i32, i32* %64
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %65)
%67 = load i32*, i32** %11
%68 = getelementptr inbounds i32, i32* %67, i64 1
%69 = load i32, i32* %68
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %69)
%71 = load i32*, i32** %11
%72 = getelementptr inbounds i32, i32* %71, i64 2
%73 = load i32, i32* %72
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %73)
%75 = tail call i32 @putchar(i32 10)
%76 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%77 = load i32*, i32** %14
%78 = load i32, i32* %77
%79 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %78)
%80 = load i32*, i32** %14
%81 = getelementptr inbounds i32, i32* %80, i64 1
%82 = load i32, i32* %81
%83 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %82)
%84 = load i32*, i32** %14
%85 = getelementptr inbounds i32, i32* %84, i64 2
%86 = load i32, i32* %85
%87 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %86)
%88 = tail call i32 @putchar(i32 10)
ret i32 0
}