#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 *);
unsigned int qualityPoints(unsigned int);
unsigned int scanf(char *, ...);
int main(void) {
  unsigned int mediaVoto;
  unsigned int votoFinale;
  unsigned int esitoScanf;
  unsigned int valoreSentinella = 666;
  do {
    do {
      printf("%s", "Inserire la media dei voti dello studente( inserisci 666 "
                   "per uscire ): ");
      if ((esitoScanf = scanf("%u", &mediaVoto)) == 0) {
        scanf("%*[^\n]");
        puts("Attenzione, e' stato inserito un valore non valido. Sono "
             "accettati solo interi da 0 a 100");
      }
    } while (esitoScanf == 0);
    votoFinale = qualityPoints(mediaVoto);
    printf("Il voto finale dello studente e' pari a: %u\n", votoFinale);
  } while (mediaVoto != valoreSentinella);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x29a,-0x14(%rbp)
jmp    115b <main+0x1b>
lea    0xe9e(%rip),%rdi
lea    0xe9a(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jne    11a8 <main+0x68>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
jmp    11ad <main+0x6d>
cmpl   $0x0,-0x10(%rbp)
je     115b <main+0x1b>
mov    -0x8(%rbp),%edi
call   1060 <qualityPoints@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1156 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeae(%rip),%r14
lea    0xeaa(%rip),%r15
lea    0xeeb(%rip),%r12
lea    0x4(%rsp),%rbx
lea    0xee2(%rip),%r13
lea    0xee2(%rip),%rbp
jmp    1192 <main+0x52>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
test   %eax,%eax
je     1180 <main+0x40>
mov    0x4(%rsp),%edi
call   1060 <qualityPoints@plt>
lea    0xeef(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x29a,0x4(%rsp)
jne    1192 <main+0x52>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [72 x i8] c"Inserire la media dei voti dello studente( inserisci 666 per uscire ): \00"
@.str.2 = [3 x i8] c"%u\00"
@.str.3 = [7 x i8] c"%*[^\0A]\00"
@.str.4 = [90 x i8] c"Attenzione, e' stato inserito un valore non valido. Sono accettati solo interi da 0 a 100\00"
@.str.5 = [45 x i8] c"Il voto finale dello studente e' pari a: %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 666, i32* %5
br label %6
6: ; preds = %23, %0
br label %7
7: ; preds = %15, %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
store i32 %9, i32* %4
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @puts(i8* getelementptr inbounds ([90 x i8], [90 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %11, %7
br label %15
15: ; preds = %14
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 0
br i1 %17, label %7, label %18
18: ; preds = %15
%19 = load i32, i32* %2
%20 = call i32 @qualityPoints(i32 %19)
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %18
%24 = load i32, i32* %2
%25 = load i32, i32* %5
%26 = icmp ne i32 %24, %25
br i1 %26, label %6, label %27
27: ; preds = %23
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [72 x i8] c"Inserire la media dei voti dello studente( inserisci 666 per uscire ): \00"
@.str.2 = [3 x i8] c"%u\00"
@.str.3 = [7 x i8] c"%*[^\0A]\00"
@.str.4 = [90 x i8] c"Attenzione, e' stato inserito un valore non valido. Sono accettati solo interi da 0 a 100\00"
@.str.5 = [45 x i8] c"Il voto finale dello studente e' pari a: %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %13, %0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %3, %7
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([90 x i8], [90 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %7, label %13
13: ; preds = %7, %3
%14 = load i32, i32* %1
%15 = call i32 @qualityPoints(i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %1
%18 = icmp eq i32 %17, 666
br i1 %18, label %19, label %3
19: ; preds = %13
ret i32 0
}