#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[][(100)], 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([100 x float]* %0, i32 %1) {
%3 = alloca [100 x float]*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca i32
%9 = alloca i32
store [100 x float]* %0, [100 x 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 = %52, %2
%15 = load i32, i32* %5
%16 = load [100 x float]*, [100 x float]** %3
%17 = bitcast [100 x float]* %16 to float**
%18 = load i32, i32* %8
%19 = load i32, i32* %9
%20 = call i32 @LetturaElemento(float** %17, i32 %18, i32 %19)
%21 = icmp slt i32 %15, %20
br i1 %21, label %22, label %55
22: ; preds = %14
store i32 0, i32* %6
br label %23
23: ; preds = %32, %22
%24 = load i32, i32* %6
%25 = load [100 x float]*, [100 x float]** %3
%26 = bitcast [100 x float]* %25 to float**
%27 = load i32, i32* %8
%28 = load i32, i32* %9
%29 = add nsw i32 %28, 1
%30 = call i32 @LetturaElemento(float** %26, i32 %27, i32 %29)
%31 = icmp slt i32 %24, %30
br i1 %31, label %32, label %52
32: ; preds = %23
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %35)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%42 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), float* %7)
%43 = load [100 x float]*, [100 x float]** %3
%44 = bitcast [100 x float]* %43 to float**
%45 = load i32, i32* %5
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 2
%48 = load float, float* %7
%49 = call i32 @ScrivereElemento(float** %44, i32 %45, i32 %47, float %48)
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %23
52: ; preds = %23
%53 = load i32, i32* %5
%54 = add nsw i32 %53, 1
store i32 %54, i32* %5
br label %14
55: ; 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([100 x 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 = bitcast [100 x float]* %0 to float**
%9 = call i32 @LetturaElemento(float** %8, i32 0, i32 0)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %33
11: ; preds = %2, %30
%12 = phi i32 [ %15, %30 ], [ 0, %2 ]
%13 = call i32 @LetturaElemento(float** %8, i32 0, i32 1)
%14 = icmp sgt i32 %13, 0
%15 = add nuw nsw i32 %12, 1
br i1 %14, label %16, label %30
16: ; preds = %11, %16
%17 = phi i32 [ %21, %16 ], [ 0, %11 ]
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %15)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%21 = add nuw nsw i32 %17, 1
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), float* %3)
%25 = add nuw nsw i32 %17, 2
%26 = load float, float* %3
%27 = call i32 @ScrivereElemento(float** %8, i32 %12, i32 %25, float %26)
%28 = call i32 @LetturaElemento(float** %8, i32 0, i32 1)
%29 = icmp slt i32 %21, %28
br i1 %29, label %16, label %30
30: ; preds = %16, %11
%31 = call i32 @LetturaElemento(float** %8, i32 0, i32 0)
%32 = icmp slt i32 %15, %31
br i1 %32, label %11, label %33
33: ; preds = %30, %2
ret void
}