#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*/ scanf(char *, ...);
int main() {
  int i;
  int dim;
  int min_idx = 0;
  int max_idx = 0;
  float valori[10];
  do {
    printf("Quanti elementi vuoi inserire (max: %d)? ", 10);
    scanf("%d", &dim);
    if (dim > 10)
      printf("Il valore inserito e' troppo grande!\n");
  } while (dim > 10);
  for (i = 0; i < dim; i++) {
    printf("Inserire il %do valore: ", i + 1);
    scanf("%f", &valori[i]);
    if (valori[i] < valori[min_idx])
      min_idx = i;
    if (valori[i] > valori[max_idx])
      max_idx = i;
  }
  for (i = 0; i < dim; i++) {
    if (i == min_idx && i == max_idx)
      printf("- +|");
    else {
      if (i == min_idx)
        printf("-  |");
      if (i == max_idx)
        printf("  +|");
    }
    if (i != min_idx && i != max_idx)
      printf("   |");
    printf(" %.2f\n", valori[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xebc(%rip),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0xa,-0xc(%rbp)
jle    117a <main+0x5a>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117f <main+0x5f>
cmpl   $0xa,-0xc(%rbp)
jg     113d <main+0x1d>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1222 <main+0x102>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0x40(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
movslq -0x8(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm1
movslq -0x10(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm0
ucomiss %xmm1,%xmm0
jbe    11f0 <main+0xd0>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
movslq -0x8(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm0
movslq -0x14(%rbp),%rax
ucomiss -0x40(%rbp,%rax,4),%xmm0
jbe    120f <main+0xef>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1214 <main+0xf4>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1190 <main+0x70>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12e9 <main+0x1c9>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1260 <main+0x140>
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1260 <main+0x140>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1299 <main+0x179>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    127a <main+0x15a>
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1294 <main+0x174>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1299 <main+0x179>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     12bf <main+0x19f>
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     12bf <main+0x19f>
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x8(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdaf(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1229 <main+0x109>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xebb(%rip),%r14
lea    0xede(%rip),%r15
lea    0xc(%rsp),%rbx
lea    0xf0c(%rip),%r12
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0xb,%eax
jl     1196 <main+0x66>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%eax
cmp    $0xa,%eax
jg     1160 <main+0x30>
test   %eax,%eax
jle    12ca <main+0x19a>
lea    0x10(%rsp),%rbx
lea    0xe9c(%rip),%r15
xor    %r12d,%r12d
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    11d4 <main+0xa4>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movslq 0xc(%rsp),%rcx
add    $0x4,%rbx
mov    %r13d,%ebp
mov    %eax,%r14d
cmp    %rcx,%r12
jge    1220 <main+0xf0>
mov    %r12,%r13
add    $0x1,%r12
lea    0xe4b(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  (%rbx),%xmm0
movslq %r14d,%rax
movss  0x10(%rsp,%rax,4),%xmm1
ucomiss %xmm0,%xmm1
mov    %r13d,%eax
ja     1211 <main+0xe1>
mov    %r14d,%eax
movslq %ebp,%rcx
ucomiss 0x10(%rsp,%rcx,4),%xmm0
ja     11c0 <main+0x90>
mov    %ebp,%r13d
jmp    11c0 <main+0x90>
test   %ecx,%ecx
jle    12ca <main+0x19a>
mov    %r13d,%r13d
mov    %eax,%ebx
lea    0xe24(%rip),%rbp
lea    0xe22(%rip),%r12
lea    0xe11(%rip),%r15
xor    %r14d,%r14d
jmp    127a <main+0x14a>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <printf@plt>
movss  0x10(%rsp,%r14,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%r14
movslq 0xc(%rsp),%rax
cmp    %rax,%r14
jge    12ca <main+0x19a>
cmp    %r14,%rbx
jne    12a0 <main+0x170>
cmp    %r14,%r13
jne    12a0 <main+0x170>
lea    0xdbe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    12bb <main+0x18b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    %r14,%rbx
jne    12b3 <main+0x183>
lea    0xda2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
cmp    %r14,%r13
je     1250 <main+0x120>
cmp    %r14,%rbx
je     1257 <main+0x127>
mov    %rbp,%rdi
cmp    %r14,%r13
jne    1250 <main+0x120>
jmp    1257 <main+0x127>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Quanti elementi vuoi inserire (max: %d)? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [38 x i8] c"Il valore inserito e' troppo grande!\0A\00"
@.str.3 = [25 x i8] c"Inserire il %do valore: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [5 x i8] c"- +|\00"
@.str.6 = [5 x i8] c"- |\00"
@.str.7 = [5 x i8] c" +|\00"
@.str.8 = [5 x i8] c" |\00"
@.str.9 = [7 x i8] c" %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [10 x float]
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %15, %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 10)
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 10
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %12, %7
br label %15
15: ; preds = %14
%16 = load i32, i32* %3
%17 = icmp sgt i32 %16, 10
br i1 %17, label %7, label %18
18: ; preds = %15
store i32 0, i32* %2
br label %19
19: ; preds = %55, %18
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %58
23: ; preds = %19
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %2
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [10 x float], [10 x float]* %6, i64 0, i64 %28
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %29)
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [10 x float], [10 x float]* %6, i64 0, i64 %32
%34 = load float, float* %33
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [10 x float], [10 x float]* %6, i64 0, i64 %36
%38 = load float, float* %37
%39 = fcmp olt float %34, %38
br i1 %39, label %40, label %42
40: ; preds = %23
%41 = load i32, i32* %2
store i32 %41, i32* %4
br label %42
42: ; preds = %40, %23
%43 = load i32, i32* %2
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [10 x float], [10 x float]* %6, i64 0, i64 %44
%46 = load float, float* %45
%47 = load i32, i32* %5
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [10 x float], [10 x float]* %6, i64 0, i64 %48
%50 = load float, float* %49
%51 = fcmp ogt float %46, %50
br i1 %51, label %52, label %54
52: ; preds = %42
%53 = load i32, i32* %2
store i32 %53, i32* %5
br label %54
54: ; preds = %52, %42
br label %55
55: ; preds = %54
%56 = load i32, i32* %2
%57 = add nsw i32 %56, 1
store i32 %57, i32* %2
br label %19
58: ; preds = %19
store i32 0, i32* %2
br label %59
59: ; preds = %103, %58
%60 = load i32, i32* %2
%61 = load i32, i32* %3
%62 = icmp slt i32 %60, %61
br i1 %62, label %63, label %106
63: ; preds = %59
%64 = load i32, i32* %2
%65 = load i32, i32* %4
%66 = icmp eq i32 %64, %65
br i1 %66, label %67, label %73
67: ; preds = %63
%68 = load i32, i32* %2
%69 = load i32, i32* %5
%70 = icmp eq i32 %68, %69
br i1 %70, label %71, label %73
71: ; preds = %67
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %86
73: ; preds = %67, %63
%74 = load i32, i32* %2
%75 = load i32, i32* %4
%76 = icmp eq i32 %74, %75
br i1 %76, label %77, label %79
77: ; preds = %73
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %79
79: ; preds = %77, %73
%80 = load i32, i32* %2
%81 = load i32, i32* %5
%82 = icmp eq i32 %80, %81
br i1 %82, label %83, label %85
83: ; preds = %79
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %85
85: ; preds = %83, %79
br label %86
86: ; preds = %85, %71
%87 = load i32, i32* %2
%88 = load i32, i32* %4
%89 = icmp ne i32 %87, %88
br i1 %89, label %90, label %96
90: ; preds = %86
%91 = load i32, i32* %2
%92 = load i32, i32* %5
%93 = icmp ne i32 %91, %92
br i1 %93, label %94, label %96
94: ; preds = %90
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %96
96: ; preds = %94, %90, %86
%97 = load i32, i32* %2
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [10 x float], [10 x float]* %6, i64 0, i64 %98
%100 = load float, float* %99
%101 = fpext float %100 to double
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), double %101)
br label %103
103: ; preds = %96
%104 = load i32, i32* %2
%105 = add nsw i32 %104, 1
store i32 %105, i32* %2
br label %59
106: ; preds = %59
%107 = load i32, i32* %1
ret i32 %107
}

LLVM IR (-O2):
@.str = [42 x i8] c"Quanti elementi vuoi inserire (max: %d)? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [25 x i8] c"Inserire il %do valore: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [5 x i8] c"- +|\00"
@.str.6 = [5 x i8] c"- |\00"
@.str.7 = [5 x i8] c" +|\00"
@.str.8 = [5 x i8] c" |\00"
@.str.9 = [7 x i8] c" %.2f\0A\00"
@str = [37 x i8] c"Il valore inserito e' troppo grande!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x float]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [10 x float]* %2 to i8*
br label %5
5: ; preds = %10, %0
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 10)
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 10
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%12 = load i32, i32* %1
%13 = icmp sgt i32 %12, 10
br i1 %13, label %5, label %14
14: ; preds = %5, %10
%15 = phi i32 [ %12, %10 ], [ %8, %5 ]
%16 = icmp sgt i32 %15, 0
br i1 %16, label %21, label %70
17: ; preds = %21
%18 = zext i32 %41 to i64
%19 = zext i32 %36 to i64
%20 = icmp sgt i32 %42, 0
br i1 %20, label %45, label %70
21: ; preds = %14, %21
%22 = phi i64 [ %25, %21 ], [ 0, %14 ]
%23 = phi i32 [ %41, %21 ], [ 0, %14 ]
%24 = phi i32 [ %36, %21 ], [ 0, %14 ]
%25 = add nuw nsw i64 %22, 1
%26 = trunc i64 %25 to i32
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 %22
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %28)
%30 = load float, float* %28
%31 = sext i32 %24 to i64
%32 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 %31
%33 = load float, float* %32
%34 = fcmp olt float %30, %33
%35 = trunc i64 %22 to i32
%36 = select i1 %34, i32 %35, i32 %24
%37 = sext i32 %23 to i64
%38 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 %37
%39 = load float, float* %38
%40 = fcmp ogt float %30, %39
%41 = select i1 %40, i32 %35, i32 %23
%42 = load i32, i32* %1
%43 = sext i32 %42 to i64
%44 = icmp slt i64 %25, %43
br i1 %44, label %21, label %17
45: ; preds = %17, %61
%46 = phi i64 [ %66, %61 ], [ 0, %17 ]
%47 = icmp eq i64 %46, %19
%48 = icmp eq i64 %46, %18
%49 = select i1 %47, i1 %48, i1 false
br i1 %49, label %50, label %52
50: ; preds = %45
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %56
52: ; preds = %45
br i1 %47, label %53, label %55
53: ; preds = %52
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %55
55: ; preds = %53, %52
br i1 %48, label %58, label %56
56: ; preds = %55, %50
%57 = select i1 %47, i1 true, i1 %48
br i1 %57, label %61, label %58
58: ; preds = %56, %55
%59 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), %55 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), %56 ]
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %59)
br label %61
61: ; preds = %58, %56
%62 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 %46
%63 = load float, float* %62
%64 = fpext float %63 to double
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), double %64)
%66 = add nuw nsw i64 %46, 1
%67 = load i32, i32* %1
%68 = sext i32 %67 to i64
%69 = icmp slt i64 %66, %68
br i1 %69, label %45, label %70
70: ; preds = %61, %14, %17
ret i32 0
}