#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*/ clear();
int /*<<< orphan*/ error();
int /*<<< orphan*/ printf(char *);
int scanf(char *, int *, char *);
int getInteger(int min, int max) {
  int numDaysFunction1;
  int validateInput;
  int exitLoop = 0;
  char endInputFunction1;
  do {
    printf("Enter an integer between 1 and 14: ");
    validateInput = scanf("%d%c", &numDaysFunction1, &endInputFunction1);
    if (validateInput != 2) {
      error();
      clear();
    } else if (endInputFunction1 != '\n') {
      error();
      clear();
    } else if (numDaysFunction1 < min || numDaysFunction1 > max)
      error();
    else
      exitLoop++;
  } while (exitLoop == 0);
  return numDaysFunction1;
}


x86 assembly (clang, -O0):
<getInteger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x15(%rbp),%rdx
call   1040 <scanf@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x2,-0x10(%rbp)
je     1195 <getInteger+0x55>
mov    $0x0,%al
call   1050 <error@plt>
mov    $0x0,%al
call   1060 <clear@plt>
jmp    11ec <getInteger+0xac>
movsbl -0x15(%rbp),%eax
cmp    $0xa,%eax
je     11b5 <getInteger+0x75>
mov    $0x0,%al
call   1050 <error@plt>
mov    $0x0,%al
call   1060 <clear@plt>
jmp    11e7 <getInteger+0xa7>
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jl     11cd <getInteger+0x8d>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11d9 <getInteger+0x99>
mov    $0x0,%al
call   1050 <error@plt>
jmp    11e2 <getInteger+0xa2>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e7 <getInteger+0xa7>
jmp    11ec <getInteger+0xac>
jmp    11f1 <getInteger+0xb1>
cmpl   $0x0,-0x14(%rbp)
je     1155 <getInteger+0x15>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getInteger>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%r15d
lea    0xea8(%rip),%r12
lea    0xec5(%rip),%r13
lea    0x4(%rsp),%rbx
lea    0x3(%rsp),%rbp
jmp    117e <getInteger+0x3e>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <error@plt>
xor    %eax,%eax
call   1060 <clear@plt>
mov    %r12,%rdi
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    1170 <getInteger+0x30>
cmpb   $0xa,0x3(%rsp)
jne    1170 <getInteger+0x30>
mov    0x4(%rsp),%eax
cmp    %r15d,%eax
jl     11ae <getInteger+0x6e>
cmp    %r14d,%eax
jle    11b7 <getInteger+0x77>
xor    %eax,%eax
call   1050 <error@plt>
jmp    117e <getInteger+0x3e>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Enter an integer between 1 and 14: \00"
@.str.1 = [5 x i8] c"%d%c\00"
define i32 @getInteger(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %7
br label %9
9: ; preds = %40, %2
%10 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %5, i8* %8)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = icmp ne i32 %12, 2
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = call i32 (...) @error()
%16 = call i32 (...) @clear()
br label %39
17: ; preds = %9
%18 = load i8, i8* %8
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 10
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = call i32 (...) @error()
%23 = call i32 (...) @clear()
br label %38
24: ; preds = %17
%25 = load i32, i32* %5
%26 = load i32, i32* %3
%27 = icmp slt i32 %25, %26
br i1 %27, label %32, label %28
28: ; preds = %24
%29 = load i32, i32* %5
%30 = load i32, i32* %4
%31 = icmp sgt i32 %29, %30
br i1 %31, label %32, label %34
32: ; preds = %28, %24
%33 = call i32 (...) @error()
br label %37
34: ; preds = %28
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %37
37: ; preds = %34, %32
br label %38
38: ; preds = %37, %21
br label %39
39: ; preds = %38, %14
br label %40
40: ; preds = %39
%41 = load i32, i32* %7
%42 = icmp eq i32 %41, 0
br i1 %42, label %9, label %43
43: ; preds = %40
%44 = load i32, i32* %5
ret i32 %44
}

LLVM IR (-O2):
@.str = [36 x i8] c"Enter an integer between 1 and 14: \00"
@.str.1 = [5 x i8] c"%d%c\00"
define i32 @getInteger(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8
%5 = bitcast i32* %3 to i8*
br label %6
6: ; preds = %13, %2
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %3, i8* %4)
%9 = icmp eq i32 %8, 2
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = call i32 (...) @error()
%12 = call i32 (...) @clear()
br label %13
13: ; preds = %10, %25, %17
br label %6
14: ; preds = %6
%15 = load i8, i8* %4
%16 = icmp eq i8 %15, 10
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = call i32 (...) @error()
%19 = call i32 (...) @clear()
br label %13
20: ; preds = %14
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, %0
%23 = icmp sgt i32 %21, %1
%24 = or i1 %22, %23
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = call i32 (...) @error()
br label %13
27: ; preds = %20
ret i32 %21
}