#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 */
double LetturaElemento(float *, int, int);
int /*<<< orphan*/ ScrivereElemento(float *, int, int, float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
void InserimentoNumeroRigheEColonne(float *matrice, int n) {
  float valore = 0;
  int righe = 0;
  int colonne = 0;
  ScrivereElemento(matrice, righe, colonne, valore);
  ScrivereElemento(matrice, righe, colonne + 1, valore);
  printf("\n==================================================================="
         "========\n");
  printf("\n\t\tInserire le Righe e le Colonne della Matrice numero: %d \n", n);
  printf(
      "\tNotaBene: una matrice non puo' essere composta 1 riga ed 1 colonna\n");
  printf("\n==================================================================="
         "========\n");
  while (LetturaElemento(matrice, righe, colonne) <= 1.000000 &&
         LetturaElemento(matrice, righe, colonne + 1) <= 1.000000) {
    printf("Per Cortesia inserire almeno una Riga ");
    scanf("%f", &valore);
    ScrivereElemento(matrice, righe, colonne, valore);
    printf("Per Cortesia inserire almeno una Colonna ");
    scanf("%f", &valore);
    ScrivereElemento(matrice, righe, colonne + 1, valore);
  }
  return;
}


x86 assembly (clang, -O0):
<InserimentoNumeroRigheEColonne>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
movss  -0x10(%rbp),%xmm0
call   1030 <ScrivereElemento@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
add    $0x1,%edx
movss  -0x10(%rbp),%xmm0
call   1030 <ScrivereElemento@plt>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1050 <LetturaElemento@plt>
movaps %xmm0,%xmm1
xor    %eax,%eax
movsd  0xe19(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x19(%rbp)
jb     121b <InserimentoNumeroRigheEColonne+0xdb>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
add    $0x1,%edx
call   1050 <LetturaElemento@plt>
movaps %xmm0,%xmm1
movsd  0xdef(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    122b <InserimentoNumeroRigheEColonne+0xeb>
jmp    1297 <InserimentoNumeroRigheEColonne+0x157>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
movss  -0x10(%rbp),%xmm0
call   1030 <ScrivereElemento@plt>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8d(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
add    $0x1,%edx
movss  -0x10(%rbp),%xmm0
call   1030 <ScrivereElemento@plt>
jmp    11cb <InserimentoNumeroRigheEColonne+0x8b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<InserimentoNumeroRigheEColonne>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
movl   $0x0,0x4(%rsp)
xorpd  %xmm0,%xmm0
xor    %esi,%esi
xor    %edx,%edx
call   1040 <ScrivereElemento@plt>
xorpd  %xmm0,%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <ScrivereElemento@plt>
lea    0xf4e(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xe6a(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeeb(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <LetturaElemento@plt>
movsd  0xe31(%rip),%xmm1
ucomisd %xmm0,%xmm1
jb     128c <InserimentoNumeroRigheEColonne+0x13c>
lea    0xe65(%rip),%r14
lea    0xe85(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xe7c(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1060 <LetturaElemento@plt>
movsd  0xde9(%rip),%xmm1
ucomisd %xmm0,%xmm1
jb     128c <InserimentoNumeroRigheEColonne+0x13c>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <scanf@plt>
movss  0x4(%rsp),%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <ScrivereElemento@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <scanf@plt>
movss  0x4(%rsp),%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <ScrivereElemento@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <LetturaElemento@plt>
movsd  0xd7e(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1200 <InserimentoNumeroRigheEColonne+0xb0>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [78 x i8] c"\0A===========================================================================\0A\00"
@.str.1 = [61 x i8] c"\0A\09\09Inserire le Righe e le Colonne della Matrice numero: %d \0A\00"
@.str.2 = [69 x i8] c"\09NotaBene: una matrice non puo' essere composta 1 riga ed 1 colonna\0A\00"
@.str.3 = [39 x i8] c"Per Cortesia inserire almeno una Riga \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [42 x i8] c"Per Cortesia inserire almeno una Colonna \00"
define void @InserimentoNumeroRigheEColonne(float* %0, i32 %1) {
%3 = alloca float*
%4 = alloca i32
%5 = alloca float
%6 = alloca i32
%7 = alloca i32
store float* %0, float** %3
store i32 %1, i32* %4
store float 0.000000e+00, float* %5
store i32 0, i32* %6
store i32 0, i32* %7
%8 = load float*, float** %3
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = load float, float* %5
%12 = call i32 @ScrivereElemento(float* %8, i32 %9, i32 %10, float %11)
%13 = load float*, float** %3
%14 = load i32, i32* %6
%15 = load i32, i32* %7
%16 = add nsw i32 %15, 1
%17 = load float, float* %5
%18 = call i32 @ScrivereElemento(float* %13, i32 %14, i32 %16, float %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0))
%20 = load i32, i32* %4
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.2, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %39, %2
%25 = load float*, float** %3
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = call double @LetturaElemento(float* %25, i32 %26, i32 %27)
%29 = fcmp ole double %28, 1.000000e+00
br i1 %29, label %30, label %37
30: ; preds = %24
%31 = load float*, float** %3
%32 = load i32, i32* %6
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
%35 = call double @LetturaElemento(float* %31, i32 %32, i32 %34)
%36 = fcmp ole double %35, 1.000000e+00
br label %37
37: ; preds = %30, %24
%38 = phi i1 [ false, %24 ], [ %36, %30 ]
br i1 %38, label %39, label %55
39: ; preds = %37
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%41 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %5)
%42 = load float*, float** %3
%43 = load i32, i32* %6
%44 = load i32, i32* %7
%45 = load float, float* %5
%46 = call i32 @ScrivereElemento(float* %42, i32 %43, i32 %44, float %45)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%48 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %5)
%49 = load float*, float** %3
%50 = load i32, i32* %6
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 1
%53 = load float, float* %5
%54 = call i32 @ScrivereElemento(float* %49, i32 %50, i32 %52, float %53)
br label %24
55: ; preds = %37
ret void
}

LLVM IR (-O2):
@.str.1 = [61 x i8] c"\0A\09\09Inserire le Righe e le Colonne della Matrice numero: %d \0A\00"
@.str.3 = [39 x i8] c"Per Cortesia inserire almeno una Riga \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [42 x i8] c"Per Cortesia inserire almeno una Colonna \00"
@str.6 = [68 x i8] c"\09NotaBene: una matrice non puo' essere composta 1 riga ed 1 colonna\00"
@str.7 = [77 x i8] c"\0A===========================================================================\00"
define void @InserimentoNumeroRigheEColonne(float* %0, i32 %1) {
%3 = alloca float
%4 = bitcast float* %3 to i8*
store float 0.000000e+00, float* %3
%5 = tail call i32 @ScrivereElemento(float* %0, i32 0, i32 0, float 0.000000e+00)
%6 = tail call i32 @ScrivereElemento(float* %0, i32 0, i32 1, float 0.000000e+00)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.7, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str.6, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.7, i64 0, i64 0))
%11 = call double @LetturaElemento(float* %0, i32 0, i32 0)
%12 = fcmp ugt double %11, 1.000000e+00
br i1 %12, label %27, label %13
13: ; preds = %2, %16
%14 = call double @LetturaElemento(float* %0, i32 0, i32 1)
%15 = fcmp ugt double %14, 1.000000e+00
br i1 %15, label %27, label %16
16: ; preds = %13
%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 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %3)
%19 = load float, float* %3
%20 = call i32 @ScrivereElemento(float* %0, i32 0, i32 0, float %19)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %3)
%23 = load float, float* %3
%24 = call i32 @ScrivereElemento(float* %0, i32 0, i32 1, float %23)
%25 = call double @LetturaElemento(float* %0, i32 0, i32 0)
%26 = fcmp ugt double %25, 1.000000e+00
br i1 %26, label %27, label %13
27: ; preds = %13, %16, %2
ret void
}