#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*/ input(char *, int);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ verify_fn(char *);
void get_fac_no(char fac_no[9]) {
  printf("\n\nPlease enter your faculty number : ");
  input(fac_no, 9);
  while (!verify_fn(fac_no)) {
    printf("\nFaculty Number is invalid."
           "\nPlease enter a valid faculty number of length"
           " 8 characters with no spaces\nYou can type "
           "\'^cancel\' to cancel the issuing of book.\n\n");
    input(fac_no, 9);
    if (strcmp(fac_no, "^cancel") == 0)
      return;
  }
}


x86 assembly (clang, -O0):
<get_fac_no>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x9,%esi
call   1030 <input@plt>
mov    -0x8(%rbp),%rdi
call   1050 <verify_fn@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1184 <get_fac_no+0x44>
jmp    11c2 <get_fac_no+0x82>
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x9,%esi
call   1030 <input@plt>
mov    -0x8(%rbp),%rdi
lea    0xf1b(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11bd <get_fac_no+0x7d>
jmp    11c2 <get_fac_no+0x82>
jmp    1166 <get_fac_no+0x26>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_fac_no>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xea1(%rip),%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <input@plt>
lea    0xeb6(%rip),%r14
lea    0xea7(%rip),%r15
nop
mov    %rbx,%rdi
call   1060 <verify_fn@plt>
test   %eax,%eax
jne    11b1 <get_fac_no+0x61>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <input@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1180 <get_fac_no+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [38 x i8] c"\0A\0APlease enter your faculty number : \00"
@.str.1 = [158 x i8] c"\0AFaculty Number is invalid.\0APlease enter a valid faculty number of length 8 characters with no spaces\0AYou can type '^cancel' to cancel the issuing of book.\0A\0A\00"
@.str.2 = [8 x i8] c"^cancel\00"
define void @get_fac_no(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @input(i8* %4, i32 9)
br label %6
6: ; preds = %19, %1
%7 = load i8*, i8** %2
%8 = call i32 @verify_fn(i8* %7)
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
br i1 %10, label %11, label %20
11: ; preds = %6
%12 = call i32 @printf(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.1, i64 0, i64 0))
%13 = load i8*, i8** %2
%14 = call i32 @input(i8* %13, i32 9)
%15 = load i8*, i8** %2
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %11
br label %20
19: ; preds = %11
br label %6
20: ; preds = %18, %6
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"\0A\0APlease enter your faculty number : \00"
@.str.2 = [8 x i8] c"^cancel\00"
@str = [157 x i8] c"\0AFaculty Number is invalid.\0APlease enter a valid faculty number of length 8 characters with no spaces\0AYou can type '^cancel' to cancel the issuing of book.\0A\00"
define void @get_fac_no(i8* %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @input(i8* %0, i32 9)
br label %4
4: ; preds = %7, %1
%5 = tail call i32 @verify_fn(i8* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([157 x i8], [157 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @input(i8* %0, i32 9)
%10 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %7, %4
ret void
}