#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*/ printf(char *);
int validate(int resultFunction1, int numFunction1, int endInputFunction1) {
  int result;
  if (resultFunction1 != 2) {
    printf("** Invalid Input! Try Again! **\n");
    result = 0;
    clear();
  } else if (endInputFunction1 != '\n') {
    printf("** Invalid Input! Try Again! **\n");
    result = 0;
    clear();
  } else if (numFunction1 > 12 || numFunction1 <= 1) {
    printf("** Invalid Input! Try Again! **\n");
    result = 0;
  } else
    result = 1;
  return result;
}


x86 assembly (clang, -O0):
<validate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x2,-0x4(%rbp)
je     115a <validate+0x3a>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <clear@plt>
jmp    11c0 <validate+0xa0>
cmpl   $0xa,-0xc(%rbp)
je     1183 <validate+0x63>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <clear@plt>
jmp    11bb <validate+0x9b>
cmpl   $0xc,-0x8(%rbp)
jg     1197 <validate+0x77>
cmpl   $0x1,-0x8(%rbp)
jg     11af <validate+0x8f>
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
jmp    11b6 <validate+0x96>
movl   $0x1,-0x10(%rbp)
jmp    11bb <validate+0x9b>
jmp    11c0 <validate+0xa0>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate>:
push   %rbx
cmp    $0x2,%edi
jne    1148 <validate+0x28>
cmp    $0xa,%edx
jne    1148 <validate+0x28>
add    $0xfffffff3,%esi
mov    $0x1,%ebx
cmp    $0xfffffff4,%esi
ja     115d <validate+0x3d>
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
jmp    115d <validate+0x3d>
lea    0xeb1(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <clear@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"** Invalid Input! Try Again! **\0A\00"
define i32 @validate(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
%12 = call i32 (...) @clear()
br label %30
13: ; preds = %3
%14 = load i32, i32* %6
%15 = icmp ne i32 %14, 10
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
%18 = call i32 (...) @clear()
br label %29
19: ; preds = %13
%20 = load i32, i32* %5
%21 = icmp sgt i32 %20, 12
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load i32, i32* %5
%24 = icmp sle i32 %23, 1
br i1 %24, label %25, label %27
25: ; preds = %22, %19
%26 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %28
27: ; preds = %22
store i32 1, i32* %7
br label %28
28: ; preds = %27, %25
br label %29
29: ; preds = %28, %16
br label %30
30: ; preds = %29, %10
%31 = load i32, i32* %7
ret i32 %31
}

LLVM IR (-O2):
@str.2 = [32 x i8] c"** Invalid Input! Try Again! **\00"
define i32 @validate(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 2
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.2, i64 0, i64 0))
%7 = tail call i32 (...) @clear()
br label %18
8: ; preds = %3
%9 = icmp eq i32 %2, 10
br i1 %9, label %13, label %10
10: ; preds = %8
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.2, i64 0, i64 0))
%12 = tail call i32 (...) @clear()
br label %18
13: ; preds = %8
%14 = add i32 %1, -13
%15 = icmp ult i32 %14, -11
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.2, i64 0, i64 0))
br label %18
18: ; preds = %13, %10, %16, %5
%19 = phi i32 [ 0, %5 ], [ 0, %10 ], [ 0, %16 ], [ 1, %13 ]
ret i32 %19
}