#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 *, ...);
void printTab(int **tab, int i, int j) {
  for (int y = 0; y < j; y++) {
    printf("[");
    for (int x = 0; x < i - 1; x++)
      printf("%d, ", tab[y][x]);
    printf("%d]\n", tab[y][i - 1]);
  }
}


x86 assembly (clang, -O0):
<printTab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11be <printTab+0xae>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    118a <printTab+0x7a>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114a <printTab+0x3a>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <printTab+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printTab>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,0x8(%rsp)
test   %edx,%edx
jle    11bd <printTab+0x9d>
mov    %rdi,%r13
mov    0x8(%rsp),%rax
lea    -0x1(%rax),%ebx
movslq %ebx,%rax
mov    %rax,0x10(%rsp)
mov    %edx,%r12d
lea    0xea8(%rip),%r15
xor    %r14d,%r14d
jmp    1184 <printTab+0x64>
nopl   (%rax)
mov    0x0(%r13,%r14,8),%rax
mov    0x10(%rsp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe91(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r14
cmp    %r12,%r14
je     11bd <printTab+0x9d>
mov    $0x5b,%edi
call   1030 <putchar@plt>
cmpl   $0x2,0x8(%rsp)
jl     1160 <printTab+0x40>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13,%r14,8),%rax
mov    (%rax,%rbp,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11a0 <printTab+0x80>
jmp    1160 <printTab+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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