#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*/ puts(char *);
unsigned int scanf(char *, ...);
unsigned int inputScanf(void) {
  unsigned int esitoScanf;
  unsigned int input;
  do {
    if ((esitoScanf = scanf("%u", &input)) == 0) {
      scanf("%*[^\n]");
      puts("Prego inserire un'intero senza segno.\n");
    }
  } while (esitoScanf == 0);
  return input;
}


x86 assembly (clang, -O0):
<inputScanf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jne    1160 <inputScanf+0x40>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
jmp    1165 <inputScanf+0x45>
cmpl   $0x0,-0x4(%rbp)
je     1128 <inputScanf+0x8>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inputScanf>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xed1(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
test   %eax,%eax
jne    1183 <inputScanf+0x63>
lea    0xebd(%rip),%r14
lea    0xebd(%rip),%r15
lea    0xeac(%rip),%r12
lea    0x4(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
test   %eax,%eax
je     1160 <inputScanf+0x40>
mov    0x4(%rsp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%u\00"
@.str.1 = [7 x i8] c"%*[^\0A]\00"
@.str.2 = [39 x i8] c"Prego inserire un'intero senza segno.\0A\00"
define i32 @inputScanf() {
%1 = alloca i32
%2 = alloca i32
br label %3
3: ; preds = %10, %0
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 %4, i32* %1
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @puts(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %6, %3
br label %10
10: ; preds = %9
%11 = load i32, i32* %1
%12 = icmp eq i32 %11, 0
br i1 %12, label %3, label %13
13: ; preds = %10
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [3 x i8] c"%u\00"
@.str.1 = [7 x i8] c"%*[^\0A]\00"
@.str.2 = [39 x i8] c"Prego inserire un'intero senza segno.\0A\00"
define i32 @inputScanf() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %0, %5
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%9 = icmp eq i32 %8, 0
br i1 %9, label %5, label %10
10: ; preds = %5, %0
%11 = load i32, i32* %1
ret i32 %11
}