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


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

x86 assembly (clang, -O2):
<getPolyOrder>:
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    0xed9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecf(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0xa,%eax
jb     11d5 <getPolyOrder+0xa5>
lea    0xeb9(%rip),%r14
lea    0xe7a(%rip),%r15
lea    0xea3(%rip),%r12
lea    0xea0(%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    $0x9,%eax
ja     11a0 <getPolyOrder+0x70>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Give the order of the polynomial, (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 @getPolyOrder() {
%1 = alloca i32
br label %2
2: ; preds = %14, %0
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 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 slt 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 = [48 x i8] c"Give the order of the polynomial, (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 @getPolyOrder() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 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, 10
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 ([48 x i8], [48 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, 10
br i1 %14, label %15, label %8
15: ; preds = %8, %0
%16 = phi i32 [ %6, %0 ], [ %13, %8 ]
ret i32 %16
}