#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);
void stampaMatrice(int **a, int h, int w) {
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w - 1; j++) {
      printf("%d ", a[i][j]);
    }
    printf("%d\n", a[i][w - 1]);
  }
}


x86 assembly (clang, -O0):
<stampaMatrice>:
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    -0xc(%rbp),%eax
jge    11ac <stampaMatrice+0x9c>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    117a <stampaMatrice+0x6a>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113c <stampaMatrice+0x2c>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <stampaMatrice+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stampaMatrice>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,0x8(%rsp)
test   %esi,%esi
jle    119b <stampaMatrice+0x8b>
mov    %rdi,%r13
mov    0x8(%rsp),%rax
lea    -0x1(%rax),%ebx
movslq %ebx,%rax
mov    %rax,0x10(%rsp)
mov    %esi,%r12d
xor    %r14d,%r14d
lea    0xeb9(%rip),%r15
jmp    1172 <stampaMatrice+0x62>
nopl   0x0(%rax)
mov    0x0(%r13,%r14,8),%rax
mov    0x10(%rsp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
add    $0x1,%r14
cmp    %r12,%r14
je     119b <stampaMatrice+0x8b>
cmpl   $0x2,0x8(%rsp)
jl     1150 <stampaMatrice+0x40>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13,%r14,8),%rax
mov    (%rax,%rbp,4),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1180 <stampaMatrice+0x70>
jmp    1150 <stampaMatrice+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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