#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 *);
int /*<<< orphan*/ scanf(char *, int *);
int getNumData() {
  int count;
  for (;;) {
    printf("Give the number of data, (n <= %d) :  \n", 10);
    printf(">> ");
    scanf(" %d", &count);
    if (count <= 10 && count >= 0)
      break;
    else
      puts("Invalid Input! Please try again...\n");
  }
  return count;
}


x86 assembly (clang, -O0):
<getNumData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0xa,-0x4(%rbp)
jg     1182 <getNumData+0x52>
cmpl   $0x0,-0x4(%rbp)
jl     1182 <getNumData+0x52>
jmp    1193 <getNumData+0x63>
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
jmp    1138 <getNumData+0x8>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNumData>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebc(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec7(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0xb,%eax
jb     11d5 <getNumData+0xa5>
lea    0xeb1(%rip),%r14
lea    0xe7a(%rip),%r15
lea    0xe9b(%rip),%r12
lea    0xe98(%rip),%r13
lea    0xc(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0xa,%eax
ja     11a0 <getNumData+0x70>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Give the number of data, (n <= %d) : \0A\00"
@.str.1 = [4 x i8] c">> \00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [36 x i8] c"Invalid Input! Please try again...\0A\00"
define i32 @getNumData() {
%1 = alloca i32
br label %2
2: ; preds = %14, %0
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 10)
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp sle i32 %6, 10
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* %1
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %8
br label %15
12: ; preds = %8, %2
%13 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
br label %14
14: ; preds = %12
br label %2
15: ; preds = %11
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@.str = [40 x i8] c"Give the number of data, (n <= %d) : \0A\00"
@.str.1 = [4 x i8] c">> \00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [36 x i8] c"Invalid Input! Please try again...\0A\00"
define i32 @getNumData() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 10)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp ult i32 %6, 11
br i1 %7, label %15, label %8
8: ; preds = %0, %8
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 10)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
%14 = icmp ult i32 %13, 11
br i1 %14, label %15, label %8
15: ; preds = %8, %0
%16 = phi i32 [ %6, %0 ], [ %13, %8 ]
ret i32 %16
}