#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 /*<<< orphan*/ printf(char *, ...);
int rand();
void initTab(int **tab, int i, int j) {
  printf("initTab");
  for (int y = 0; y < j; y++) {
    printf("%d", y);
    for (int x = 0; x < i; x++) {
      printf(" [%d]", x);
      tab[y][x] = (rand() % 20);
      printf(" %d", tab[y][x]);
    }
  }
}


x86 assembly (clang, -O0):
<initTab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11ec <initTab+0xcc>
mov    -0x14(%rbp),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d9 <initTab+0xb9>
mov    -0x18(%rbp),%esi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116b <initTab+0x4b>
jmp    11de <initTab+0xbe>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <initTab+0x27>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initTab>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,%ebp
mov    %esi,0xc(%rsp)
mov    %rdi,%rbx
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebp,%ebp
jle    11f0 <initTab+0xd0>
mov    %ebp,%eax
mov    %rax,0x10(%rsp)
mov    0xc(%rsp),%r15d
lea    0xea8(%rip),%r12
lea    0xea7(%rip),%r13
xor    %ebp,%ebp
jmp    117b <initTab+0x5b>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    0x10(%rsp),%rbp
je     11f0 <initTab+0xd0>
lea    0xe8d(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1170 <initTab+0x50>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <rand@plt>
movslq %eax,%rsi
imul   $0x66666667,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
add    %ecx,%eax
shl    $0x2,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    (%rbx,%rbp,8),%rax
mov    %esi,(%rax,%r14,4)
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%r14
cmp    %r14,%r15
jne    11a0 <initTab+0x80>
jmp    1170 <initTab+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"initTab\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c" [%d]\00"
@.str.3 = [4 x i8] c" %d\00"
define void @initTab(i32** %0, i32 %1, i32 %2) {
%4 = alloca i32**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32** %0, i32*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %10
10: ; preds = %48, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %51
14: ; preds = %10
%15 = load i32, i32* %7
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %15)
store i32 0, i32* %8
br label %17
17: ; preds = %44, %14
%18 = load i32, i32* %8
%19 = load i32, i32* %5
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %47
21: ; preds = %17
%22 = load i32, i32* %8
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = call i32 (...) @rand()
%25 = srem i32 %24, 20
%26 = load i32**, i32*** %4
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32*, i32** %26, i64 %28
%30 = load i32*, i32** %29
%31 = load i32, i32* %8
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
store i32 %25, i32* %33
%34 = load i32**, i32*** %4
%35 = load i32, i32* %7
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32*, i32** %34, i64 %36
%38 = load i32*, i32** %37
%39 = load i32, i32* %8
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i32, i32* %38, i64 %40
%42 = load i32, i32* %41
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %21
%45 = load i32, i32* %8
%46 = add nsw i32 %45, 1
store i32 %46, i32* %8
br label %17
47: ; preds = %17
br label %48
48: ; preds = %47
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 1
store i32 %50, i32* %7
br label %10
51: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"initTab\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c" [%d]\00"
@.str.3 = [4 x i8] c" %d\00"
define void @initTab(i32** nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = icmp sgt i32 %1, 0
%8 = zext i32 %2 to i64
%9 = zext i32 %1 to i64
br label %11
10: ; preds = %17, %3
ret void
11: ; preds = %6, %17
%12 = phi i64 [ 0, %6 ], [ %18, %17 ]
%13 = trunc i64 %12 to i32
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br i1 %7, label %15, label %17
15: ; preds = %11
%16 = getelementptr inbounds i32*, i32** %0, i64 %12
br label %20
17: ; preds = %20, %11
%18 = add nuw nsw i64 %12, 1
%19 = icmp eq i64 %18, %8
br i1 %19, label %10, label %11
20: ; preds = %15, %20
%21 = phi i64 [ 0, %15 ], [ %29, %20 ]
%22 = trunc i64 %21 to i32
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = tail call i32 (...) @rand()
%25 = srem i32 %24, 20
%26 = load i32*, i32** %16
%27 = getelementptr inbounds i32, i32* %26, i64 %21
store i32 %25, i32* %27
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %25)
%29 = add nuw nsw i64 %21, 1
%30 = icmp eq i64 %29, %9
br i1 %30, label %17, label %20
}