#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 /*<<< orphan*/ puts(char *);
void stampaTotali(float sales[][(4 + 1)], unsigned int numeroDiAgentiInServizio,
                  unsigned int numeroArticoliInVendita) {
  unsigned int indiceAgenti;
  unsigned int indiceProdotto;
  puts("\n\n\n");
  puts("Prodotti\t\tAgenti");
  puts("\t\t1.\t2.\t3.\t4.\t\tTotli Prodotti");
  indiceProdotto = 0;
  do {
    if (indiceProdotto == 5) {
      printf("%s", "\n");
      printf("%s", "Tot. Vendite");
    } else {
      printf("%u.", (indiceProdotto + 1));
      printf("%s", "\t");
    }
    indiceAgenti = 0;
    do {
      if (indiceAgenti == 4) {
        printf("%s", "\t");
      }
      printf("\t%.2f", sales[indiceProdotto][indiceAgenti]);
      indiceAgenti++;
    } while (indiceAgenti < (numeroDiAgentiInServizio + 1));
    puts("");
    indiceProdotto++;
  } while (indiceProdotto < (numeroArticoliInVendita + 1));
  return;
}


x86 assembly (clang, -O0):
<stampaTotali>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x5,-0x18(%rbp)
jne    1196 <stampaTotali+0x76>
lea    0xec5(%rip),%rdi
lea    0xe8d(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    0xeac(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11bf <stampaTotali+0x9f>
mov    -0x18(%rbp),%esi
add    $0x1,%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe82(%rip),%rdi
lea    0xe8f(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jne    11e5 <stampaTotali+0xc5>
lea    0xe5c(%rip),%rdi
lea    0xe69(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
mov    -0x14(%rbp),%ecx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe43(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jb     11c6 <stampaTotali+0xa6>
lea    0xe1a(%rip),%rdi
call   1030 <puts@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jb     115d <stampaTotali+0x3d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stampaTotali>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
lea    0xeb4(%rip),%rdi
call   1040 <puts@plt>
lea    0xeac(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb1(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%ebp
add    $0x1,%ebx
cmp    $0x2,%ebp
mov    $0x1,%eax
mov    $0x1,%ecx
mov    %ebp,0xc(%rsp)
cmovae %ebp,%ecx
mov    %rcx,(%rsp)
cmp    $0x2,%ebx
cmovb  %eax,%ebx
mov    %rbx,0x10(%rsp)
lea    0xeae(%rip),%r15
mov    %r14,%r12
mov    %r14,%rbp
xor    %r14d,%r14d
jmp    11cd <stampaTotali+0x9d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
add    $0x14,%rbp
cmp    0x10(%rsp),%r14
je     12f3 <stampaTotali+0x1c3>
cmp    $0x5,%r14
jne    1200 <stampaTotali+0xd0>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe4f(%rip),%rdi
lea    0xe4b(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    121c <stampaTotali+0xec>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0x1(%r14),%esi
lea    0xe38(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x9,%edi
call   1030 <putchar@plt>
lea    (%r14,%r14,4),%r13
movss  (%r12,%r13,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
cmpl   $0x2,0xc(%rsp)
jb     11b0 <stampaTotali+0x80>
movss  0x4(%r12,%r13,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
cmpl   $0x2,(%rsp)
je     11b0 <stampaTotali+0x80>
movss  0x8(%r12,%r13,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
cmpl   $0x3,(%rsp)
je     11b0 <stampaTotali+0x80>
movss  0xc(%r12,%r13,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
cmpl   $0x4,(%rsp)
je     11b0 <stampaTotali+0x80>
mov    $0x9,%edi
call   1030 <putchar@plt>
movss  0x10(%r12,%r13,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
cmpl   $0x5,(%rsp)
je     11b0 <stampaTotali+0x80>
mov    $0x5,%ebx
nopw   0x0(%rax,%rax,1)
movss  0x0(%rbp,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,(%rsp)
jne    12d0 <stampaTotali+0x1a0>
jmp    11b0 <stampaTotali+0x80>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"\0A\0A\0A\00"
@.str.1 = [17 x i8] c"Prodotti\09\09Agenti\00"
@.str.2 = [30 x i8] c"\09\091.\092.\093.\094.\09\09Totli Prodotti\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [13 x i8] c"Tot. Vendite\00"
@.str.6 = [4 x i8] c"%u.\00"
@.str.7 = [2 x i8] c"\09\00"
@.str.8 = [6 x i8] c"\09%.2f\00"
@.str.9 = [1 x i8] zeroinitializer
define void @stampaTotali([5 x float]* %0, i32 %1, i32 %2) {
%4 = alloca [5 x float]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store [5 x float]* %0, [5 x float]** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @puts(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %8
br label %12
12: ; preds = %51, %3
%13 = load i32, i32* %8
%14 = icmp eq i32 %13, 5
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %23
18: ; preds = %12
%19 = load i32, i32* %8
%20 = add i32 %19, 1
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %23
23: ; preds = %18, %15
store i32 0, i32* %7
br label %24
24: ; preds = %42, %23
%25 = load i32, i32* %7
%26 = icmp eq i32 %25, 4
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %29
29: ; preds = %27, %24
%30 = load [5 x float]*, [5 x float]** %4
%31 = load i32, i32* %8
%32 = zext i32 %31 to i64
%33 = getelementptr inbounds [5 x float], [5 x float]* %30, i64 %32
%34 = load i32, i32* %7
%35 = zext i32 %34 to i64
%36 = getelementptr inbounds [5 x float], [5 x float]* %33, i64 0, i64 %35
%37 = load float, float* %36
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), double %38)
%40 = load i32, i32* %7
%41 = add i32 %40, 1
store i32 %41, i32* %7
br label %42
42: ; preds = %29
%43 = load i32, i32* %7
%44 = load i32, i32* %5
%45 = add i32 %44, 1
%46 = icmp ult i32 %43, %45
br i1 %46, label %24, label %47
47: ; preds = %42
%48 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.9, i64 0, i64 0))
%49 = load i32, i32* %8
%50 = add i32 %49, 1
store i32 %50, i32* %8
br label %51
51: ; preds = %47
%52 = load i32, i32* %8
%53 = load i32, i32* %6
%54 = add i32 %53, 1
%55 = icmp ult i32 %52, %54
br i1 %55, label %12, label %56
56: ; preds = %51
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"\0A\0A\0A\00"
@.str.1 = [17 x i8] c"Prodotti\09\09Agenti\00"
@.str.2 = [30 x i8] c"\09\091.\092.\093.\094.\09\09Totli Prodotti\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.5 = [13 x i8] c"Tot. Vendite\00"
@.str.6 = [4 x i8] c"%u.\00"
@.str.8 = [6 x i8] c"\09%.2f\00"
define void @stampaTotali([5 x float]* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%7 = add i32 %1, 1
%8 = add i32 %2, 1
%9 = call i32 @llvm.umax.i32(i32 %7, i32 1)
%10 = call i32 @llvm.umax.i32(i32 %8, i32 1)
%11 = zext i32 %10 to i64
%12 = zext i32 %9 to i64
%13 = icmp ult i32 %7, 2
%14 = icmp eq i32 %9, 2
%15 = icmp eq i32 %9, 3
%16 = icmp eq i32 %9, 4
%17 = icmp eq i32 %9, 5
br label %18
18: ; preds = %63, %3
%19 = phi i64 [ %65, %63 ], [ 0, %3 ]
%20 = icmp eq i64 %19, 5
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = tail call i32 @putchar(i32 10)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %29
24: ; preds = %18
%25 = trunc i64 %19 to i32
%26 = add i32 %25, 1
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %26)
%28 = tail call i32 @putchar(i32 9)
br label %29
29: ; preds = %24, %21
%30 = getelementptr inbounds [5 x float], [5 x float]* %0, i64 %19, i64 0
%31 = load float, float* %30
%32 = fpext float %31 to double
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), double %32)
br i1 %13, label %63, label %34
34: ; preds = %29
%35 = getelementptr inbounds [5 x float], [5 x float]* %0, i64 %19, i64 1
%36 = load float, float* %35
%37 = fpext float %36 to double
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), double %37)
br i1 %14, label %63, label %39
39: ; preds = %34
%40 = getelementptr inbounds [5 x float], [5 x float]* %0, i64 %19, i64 2
%41 = load float, float* %40
%42 = fpext float %41 to double
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), double %42)
br i1 %15, label %63, label %44
44: ; preds = %39
%45 = getelementptr inbounds [5 x float], [5 x float]* %0, i64 %19, i64 3
%46 = load float, float* %45
%47 = fpext float %46 to double
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), double %47)
br i1 %16, label %63, label %49
49: ; preds = %44
%50 = tail call i32 @putchar(i32 9)
%51 = getelementptr inbounds [5 x float], [5 x float]* %0, i64 %19, i64 4
%52 = load float, float* %51
%53 = fpext float %52 to double
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), double %53)
br i1 %17, label %63, label %55
55: ; preds = %49, %55
%56 = phi i64 [ %61, %55 ], [ 5, %49 ]
%57 = getelementptr inbounds [5 x float], [5 x float]* %0, i64 %19, i64 %56
%58 = load float, float* %57
%59 = fpext float %58 to double
%60 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), double %59)
%61 = add nuw nsw i64 %56, 1
%62 = icmp eq i64 %61, %12
br i1 %62, label %63, label %55
63: ; preds = %55, %49, %44, %39, %34, %29
%64 = tail call i32 @putchar(i32 10)
%65 = add nuw nsw i64 %19, 1
%66 = icmp eq i64 %65, %11
br i1 %66, label %67, label %18
67: ; preds = %63
ret void
}