#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 stampa(char **m, int n) {
  int i, j;
  for (i = 0; i < 4; i++) {
    if (i == 0)
      printf("RESTO\t");
    if (i == 1)
      printf("NUM1 \t");
    if (i == 2)
      printf("NUM2 \t");
    if (i == 3)
      printf("SOMMA\t");
    for (j = 0; j < n; j++) {
      printf(" %c", m[i][j]);
    }
    printf("\n\n");
  }
}


x86 assembly (clang, -O0):
<stampa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    11ef <stampa+0xdf>
cmpl   $0x0,-0x10(%rbp)
jne    1148 <stampa+0x38>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x10(%rbp)
jne    1160 <stampa+0x50>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x2,-0x10(%rbp)
jne    1178 <stampa+0x68>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3,-0x10(%rbp)
jne    1190 <stampa+0x80>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d3 <stampa+0xc3>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1197 <stampa+0x87>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <stampa+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stampa>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r12
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14d,%ebp
test   %r14d,%r14d
jle    11be <stampa+0x9e>
lea    0xed1(%rip),%r15
xor    %ebx,%ebx
nopl   (%rax)
mov    (%r12),%rax
movsbl (%rax,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <stampa+0x30>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
jle    123a <stampa+0x11a>
lea    0xe87(%rip),%r15
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    0x8(%r12),%rax
movsbl (%rax,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11a0 <stampa+0x80>
jmp    11d8 <stampa+0xb8>
lea    0xe5b(%rip),%rdi
call   1030 <puts@plt>
lea    0xe36(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe41(%rip),%rdi
call   1030 <puts@plt>
lea    0xe23(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
jle    121e <stampa+0xfe>
lea    0xe1e(%rip),%r15
xor    %ebx,%ebx
mov    0x10(%r12),%rax
movsbl (%rax,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1200 <stampa+0xe0>
jmp    1254 <stampa+0x134>
lea    0xdfb(%rip),%rdi
call   1030 <puts@plt>
lea    0xde4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    129c <stampa+0x17c>
lea    0xddf(%rip),%rdi
call   1030 <puts@plt>
lea    0xdc1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdc5(%rip),%rdi
call   1030 <puts@plt>
lea    0xdae(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
jle    129c <stampa+0x17c>
lea    0xda2(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    0x18(%r12),%rax
movsbl (%rax,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1280 <stampa+0x160>
lea    0xd7d(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"RESTO\09\00"
@.str.1 = [7 x i8] c"NUM1 \09\00"
@.str.2 = [7 x i8] c"NUM2 \09\00"
@.str.3 = [7 x i8] c"SOMMA\09\00"
@.str.4 = [4 x i8] c" %c\00"
@str = [2 x i8] c"\0A\00"
define void @stampa(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br i1 %3, label %5, label %31
5: ; preds = %2
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %14, %7 ]
%9 = load i8*, i8** %0
%10 = getelementptr inbounds i8, i8* %9, i64 %8
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %12)
%14 = add nuw nsw i64 %8, 1
%15 = icmp eq i64 %14, %6
br i1 %15, label %16, label %7
16: ; preds = %7
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br i1 %3, label %19, label %49
19: ; preds = %16
%20 = getelementptr inbounds i8*, i8** %0, i64 1
%21 = zext i32 %1 to i64
br label %22
22: ; preds = %22, %19
%23 = phi i64 [ 0, %19 ], [ %29, %22 ]
%24 = load i8*, i8** %20
%25 = getelementptr inbounds i8, i8* %24, i64 %23
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %27)
%29 = add nuw nsw i64 %23, 1
%30 = icmp eq i64 %29, %21
br i1 %30, label %34, label %22
31: ; preds = %2
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %34
34: ; preds = %22, %31
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br i1 %3, label %37, label %67
37: ; preds = %34
%38 = getelementptr inbounds i8*, i8** %0, i64 2
%39 = zext i32 %1 to i64
br label %40
40: ; preds = %40, %37
%41 = phi i64 [ 0, %37 ], [ %47, %40 ]
%42 = load i8*, i8** %38
%43 = getelementptr inbounds i8, i8* %42, i64 %41
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %45)
%47 = add nuw nsw i64 %41, 1
%48 = icmp eq i64 %47, %39
br i1 %48, label %52, label %40
49: ; preds = %16
%50 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %52
52: ; preds = %40, %49
%53 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br i1 %3, label %55, label %70
55: ; preds = %52
%56 = getelementptr inbounds i8*, i8** %0, i64 3
%57 = zext i32 %1 to i64
br label %58
58: ; preds = %58, %55
%59 = phi i64 [ 0, %55 ], [ %65, %58 ]
%60 = load i8*, i8** %56
%61 = getelementptr inbounds i8, i8* %60, i64 %59
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %63)
%65 = add nuw nsw i64 %59, 1
%66 = icmp eq i64 %65, %57
br i1 %66, label %70, label %58
67: ; preds = %34
%68 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %70
70: ; preds = %58, %67, %52
%71 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}