#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 *);
int setPriority() {
  int priority = 0;
  do {
    printf("\n\rInsert the priority (ascending order): ");
    scanf("%i", &priority);
    if (((priority < 0) || (priority > 9))) {
      printf("\n\rError! It must be a number between 1 and 9\n\r");
    }
  } while ((priority < 0) || (priority > 9));
  return priority;
}


x86 assembly (clang, -O0):
<setPriority>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x4(%rbp)
jl     115f <setPriority+0x3f>
cmpl   $0x9,-0x4(%rbp)
jle    116b <setPriority+0x4b>
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
jmp    1170 <setPriority+0x50>
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1189 <setPriority+0x69>
cmpl   $0x9,-0x4(%rbp)
setg   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    112f <setPriority+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setPriority>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xec9(%rip),%r14
lea    0xeec(%rip),%r15
lea    0x4(%rsp),%rbx
lea    0xee3(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0xa,%eax
jb     117d <setPriority+0x5d>
mov    %r12,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
cmp    $0x9,%eax
ja     1150 <setPriority+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [42 x i8] c"\0A\0DInsert the priority (ascending order): \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [47 x i8] c"\0A\0DError! It must be a number between 1 and 9\0A\0D\00"
define i32 @setPriority() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %19, %0
%3 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 9
br i1 %9, label %10, label %12
10: ; preds = %7, %2
%11 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
br label %13
13: ; preds = %12
%14 = load i32, i32* %1
%15 = icmp slt i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = load i32, i32* %1
%18 = icmp sgt i32 %17, 9
br label %19
19: ; preds = %16, %13
%20 = phi i1 [ true, %13 ], [ %18, %16 ]
br i1 %20, label %2, label %21
21: ; preds = %19
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str = [42 x i8] c"\0A\0DInsert the priority (ascending order): \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [47 x i8] c"\0A\0DError! It must be a number between 1 and 9\0A\0D\00"
define i32 @setPriority() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %8, %0
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp ugt i32 %6, 9
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* %1
%11 = icmp ugt i32 %10, 9
br i1 %11, label %3, label %12
12: ; preds = %3, %8
%13 = phi i32 [ %10, %8 ], [ %6, %3 ]
ret i32 %13
}