#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 LetturaElemento(float *, int, int);
int /*<<< orphan*/ ScrivereElemento(float *, int, int, float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
void InserimentoElementiMatrice(float *matrice, int n) {
  int i = 0;
  int j = 0;
  float valore = 0;
  int righe = 0;
  int colonne = 0;
  printf("\n\n\n\n*************************************************************"
         "*******************\n");
  printf(
      "\n\tProcedere all'inserimento degli Elementi della Matrice numero %d \n",
      n);
  printf("\n*******************************************************************"
         "*************\n\n\n\n");
  i = 0;
  while (i < LetturaElemento(matrice, righe, colonne)) {
    j = 0;
    while (j < LetturaElemento(matrice, righe, colonne + 1)) {
      printf("Inserire il numero in posizione Riga: ");
      printf("%d", i + 1);
      printf(" e Colonna: ");
      printf("%d", j + 1);
      printf(" e premere invio. ");
      scanf("%f", &valore);
      ScrivereElemento(matrice, i, j + 2, valore);
      j++;
    }
    i++;
  }
  return;
}


x86 assembly (clang, -O0):
<InserimentoElementiMatrice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf02(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1050 <LetturaElemento@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
jge    128a <InserimentoElementiMatrice+0x14a>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
add    $0x1,%edx
call   1050 <LetturaElemento@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
cmp    %ecx,%eax
jge    127c <InserimentoElementiMatrice+0x13c>
lea    0xef5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xf08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xefd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeed(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
add    $0x2,%edx
movss  -0x18(%rbp),%xmm0
call   1030 <ScrivereElemento@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d0 <InserimentoElementiMatrice+0x90>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11a7 <InserimentoElementiMatrice+0x67>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<InserimentoElementiMatrice>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebp
mov    %rdi,%r15
movl   $0x0,(%rsp)
lea    0xf21(%rip),%rdi
call   1030 <puts@plt>
lea    0xe83(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf5a(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <LetturaElemento@plt>
test   %eax,%eax
jle    12c2 <InserimentoElementiMatrice+0x172>
lea    0xe98(%rip),%rbx
lea    0xeb8(%rip),%r14
lea    0xeb4(%rip),%r13
xor    %ebp,%ebp
mov    %r15,0x8(%rsp)
jmp    11ed <InserimentoElementiMatrice+0x9d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x8(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <LetturaElemento@plt>
mov    %r12d,%ebp
cmp    %eax,%r12d
jge    12c2 <InserimentoElementiMatrice+0x172>
mov    %rbp,0x10(%rsp)
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1060 <LetturaElemento@plt>
lea    0x1(%rbp),%r12d
test   %eax,%eax
lea    0xe6e(%rip),%r15
jle    11d0 <InserimentoElementiMatrice+0x80>
mov    $0x2,%ebp
mov    %r12d,0x4(%rsp)
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rbx
mov    %r14,%r13
lea    -0x1(%rbp),%r14d
mov    %r13,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe26(%rip),%rdi
mov    %rsp,%rsi
call   1070 <scanf@plt>
movss  (%rsp),%xmm0
mov    %r15,%r12
mov    0x8(%rsp),%r15
mov    %r15,%rdi
mov    0x10(%rsp),%rsi
mov    %ebp,%edx
call   1040 <ScrivereElemento@plt>
mov    %r15,%rdi
mov    %r12,%r15
xor    %esi,%esi
mov    $0x1,%edx
call   1060 <LetturaElemento@plt>
add    $0x1,%ebp
cmp    %eax,%r14d
mov    %r13,%r14
mov    %rbx,%r13
mov    0x4(%rsp),%r12d
lea    0xd8e(%rip),%rbx
jl     1220 <InserimentoElementiMatrice+0xd0>
jmp    11d0 <InserimentoElementiMatrice+0x80>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [86 x i8] c"\0A\0A\0A\0A********************************************************************************\0A\00"
@.str.1 = [69 x i8] c"\0A\09Procedere all'inserimento degli Elementi della Matrice numero %d \0A\00"
@.str.2 = [86 x i8] c"\0A********************************************************************************\0A\0A\0A\0A\00"
@.str.3 = [39 x i8] c"Inserire il numero in posizione Riga: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [13 x i8] c" e Colonna: \00"
@.str.6 = [19 x i8] c" e premere invio. \00"
@.str.7 = [3 x i8] c"%f\00"
define void @InserimentoElementiMatrice(float* %0, i32 %1) {
%3 = alloca float*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca i32
%9 = alloca i32
store float* %0, float** %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store float 0.000000e+00, float* %7
store i32 0, i32* %8
store i32 0, i32* %9
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %5
br label %14
14: ; preds = %49, %2
%15 = load i32, i32* %5
%16 = load float*, float** %3
%17 = load i32, i32* %8
%18 = load i32, i32* %9
%19 = call i32 @LetturaElemento(float* %16, i32 %17, i32 %18)
%20 = icmp slt i32 %15, %19
br i1 %20, label %21, label %52
21: ; preds = %14
store i32 0, i32* %6
br label %22
22: ; preds = %30, %21
%23 = load i32, i32* %6
%24 = load float*, float** %3
%25 = load i32, i32* %8
%26 = load i32, i32* %9
%27 = add nsw i32 %26, 1
%28 = call i32 @LetturaElemento(float* %24, i32 %25, i32 %27)
%29 = icmp slt i32 %23, %28
br i1 %29, label %30, label %49
30: ; preds = %22
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %33)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%40 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), float* %7)
%41 = load float*, float** %3
%42 = load i32, i32* %5
%43 = load i32, i32* %6
%44 = add nsw i32 %43, 2
%45 = load float, float* %7
%46 = call i32 @ScrivereElemento(float* %41, i32 %42, i32 %44, float %45)
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
store i32 %48, i32* %6
br label %22
49: ; preds = %22
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
store i32 %51, i32* %5
br label %14
52: ; preds = %14
ret void
}

LLVM IR (-O2):
@.str.1 = [69 x i8] c"\0A\09Procedere all'inserimento degli Elementi della Matrice numero %d \0A\00"
@.str.3 = [39 x i8] c"Inserire il numero in posizione Riga: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [13 x i8] c" e Colonna: \00"
@.str.6 = [19 x i8] c" e premere invio. \00"
@.str.7 = [3 x i8] c"%f\00"
@str = [85 x i8] c"\0A\0A\0A\0A********************************************************************************\00"
@str.8 = [85 x i8] c"\0A********************************************************************************\0A\0A\0A\00"
define void @InserimentoElementiMatrice(float* %0, i32 %1) {
%3 = alloca float
%4 = bitcast float* %3 to i8*
store float 0.000000e+00, float* %3
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @str.8, i64 0, i64 0))
%8 = call i32 @LetturaElemento(float* %0, i32 0, i32 0)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %32
10: ; preds = %2, %29
%11 = phi i32 [ %14, %29 ], [ 0, %2 ]
%12 = call i32 @LetturaElemento(float* %0, i32 0, i32 1)
%13 = icmp sgt i32 %12, 0
%14 = add nuw nsw i32 %11, 1
br i1 %13, label %15, label %29
15: ; preds = %10, %15
%16 = phi i32 [ %20, %15 ], [ 0, %10 ]
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %14)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%20 = add nuw nsw i32 %16, 1
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), float* %3)
%24 = add nuw nsw i32 %16, 2
%25 = load float, float* %3
%26 = call i32 @ScrivereElemento(float* %0, i32 %11, i32 %24, float %25)
%27 = call i32 @LetturaElemento(float* %0, i32 0, i32 1)
%28 = icmp slt i32 %20, %27
br i1 %28, label %15, label %29
29: ; preds = %15, %10
%30 = call i32 @LetturaElemento(float* %0, i32 0, i32 0)
%31 = icmp slt i32 %14, %30
br i1 %31, label %10, label %32
32: ; preds = %29, %2
ret void
}