#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 */
unsigned long long calc_file_num(char *);
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ strcmp(char *, char *);
int verify_input(char *dir, unsigned long long num) {
  unsigned long long file_num = calc_file_num(dir);
  char isgo[20];
  if (num + 1 > file_num / 2) {
    printf("Error：The scope of your input MAC is %lld ,but only %lld files "
           "already searched,Please check your input MAC or files in directory "
           "\"files\"!\n",
           num + 1, file_num);
    return -1;
  } else if (num + 1 < file_num / 2) {
    printf("Warning: The scope of your input MAC is %lld ,but %lld files "
           "already searched,Make sure to extract only your input MAC ?[y/n]",
           num + 1, file_num);
    while (getchar() != '\n')
      ;
    scanf("%s", isgo);
    if (0 == strcmp(isgo, "y")) {
      return 1;
    } else {
      printf("Your choice is [%s],Program exits now!\n", isgo);
      return -1;
    }
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<verify_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <calc_file_num@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    -0x20(%rbp),%rcx
shr    $0x1,%rcx
cmp    %rcx,%rax
jbe    11ac <verify_input+0x5c>
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
mov    -0x20(%rbp),%rdx
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1256 <verify_input+0x106>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    -0x20(%rbp),%rcx
shr    $0x1,%rcx
cmp    %rcx,%rax
jae    124f <verify_input+0xff>
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
mov    -0x20(%rbp),%rdx
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11f7 <verify_input+0xa7>
jmp    11df <verify_input+0x8f>
lea    -0x40(%rbp),%rsi
lea    0xf0a(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x40(%rbp),%rdi
lea    0xefd(%rip),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1231 <verify_input+0xe1>
movl   $0x1,-0x4(%rbp)
jmp    1256 <verify_input+0x106>
lea    -0x40(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1256 <verify_input+0x106>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_input>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
call   1070 <calc_file_num@plt>
add    $0x1,%rbx
mov    %rax,%rcx
shr    %rcx
cmp    %rcx,%rbx
jbe    1183 <verify_input+0x33>
lea    0xe8c(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11e2 <verify_input+0x92>
mov    $0x1,%ebp
jae    11e7 <verify_input+0x97>
lea    0xefd(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    11a0 <verify_input+0x50>
lea    0xf5a(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
lea    0xf4b(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11e7 <verify_input+0x97>
lea    0xf39(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [142 x i8] c"Error\EF\BC\9AThe scope of your input MAC is %lld ,but only %lld files already searched,Please check your input MAC or files in directory \22files\22!\0A\00"
@.str.1 = [126 x i8] c"Warning: The scope of your input MAC is %lld ,but %lld files already searched,Make sure to extract only your input MAC ?[y/n]\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [2 x i8] c"y\00"
@.str.4 = [40 x i8] c"Your choice is [%s],Program exits now!\0A\00"
define i32 @verify_input(i8* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca [20 x i8]
store i8* %0, i8** %4
store i64 %1, i64* %5
%8 = load i8*, i8** %4
%9 = call i64 @calc_file_num(i8* %8)
store i64 %9, i64* %6
%10 = load i64, i64* %5
%11 = add i64 %10, 1
%12 = load i64, i64* %6
%13 = udiv i64 %12, 2
%14 = icmp ugt i64 %11, %13
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i64, i64* %5
%17 = add i64 %16, 1
%18 = load i64, i64* %6
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str, i64 0, i64 0), i64 %17, i64 %18)
store i32 -1, i32* %3
br label %47
20: ; preds = %2
%21 = load i64, i64* %5
%22 = add i64 %21, 1
%23 = load i64, i64* %6
%24 = udiv i64 %23, 2
%25 = icmp ult i64 %22, %24
br i1 %25, label %26, label %46
26: ; preds = %20
%27 = load i64, i64* %5
%28 = add i64 %27, 1
%29 = load i64, i64* %6
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([126 x i8], [126 x i8]* @.str.1, i64 0, i64 0), i64 %28, i64 %29)
br label %31
31: ; preds = %35, %26
%32 = call signext i8 (...) @getchar()
%33 = sext i8 %32 to i32
%34 = icmp ne i32 %33, 10
br i1 %34, label %35, label %36
35: ; preds = %31
br label %31
36: ; preds = %31
%37 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %37)
%39 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%41 = icmp eq i64 0, %40
br i1 %41, label %42, label %43
42: ; preds = %36
store i32 1, i32* %3
br label %47
43: ; preds = %36
%44 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8* %44)
store i32 -1, i32* %3
br label %47
46: ; preds = %20
store i32 1, i32* %3
br label %47
47: ; preds = %46, %43, %42, %15
%48 = load i32, i32* %3
ret i32 %48
}

LLVM IR (-O2):
@.str = [142 x i8] c"Error\EF\BC\9AThe scope of your input MAC is %lld ,but only %lld files already searched,Please check your input MAC or files in directory \22files\22!\0A\00"
@.str.1 = [126 x i8] c"Warning: The scope of your input MAC is %lld ,but %lld files already searched,Make sure to extract only your input MAC ?[y/n]\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [2 x i8] c"y\00"
@.str.4 = [40 x i8] c"Your choice is [%s],Program exits now!\0A\00"
define i32 @verify_input(i8* %0, i64 %1) {
%3 = alloca [20 x i8]
%4 = tail call i64 @calc_file_num(i8* %0)
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%6 = add i64 %1, 1
%7 = lshr i64 %4, 1
%8 = icmp ugt i64 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([142 x i8], [142 x i8]* @.str, i64 0, i64 0), i64 %6, i64 %4)
br label %24
11: ; preds = %2
%12 = icmp ult i64 %6, %7
br i1 %12, label %13, label %24
13: ; preds = %11
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([126 x i8], [126 x i8]* @.str.1, i64 0, i64 0), i64 %6, i64 %4)
br label %15
15: ; preds = %15, %13
%16 = tail call signext i8 (...) @getchar()
%17 = icmp eq i8 %16, 10
br i1 %17, label %18, label %15
18: ; preds = %15
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%20 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %18
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8* %5)
br label %24
24: ; preds = %11, %18, %22, %9
%25 = phi i32 [ -1, %9 ], [ -1, %22 ], [ 1, %18 ], [ 1, %11 ]
ret i32 %25
}