#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 */
scalar_t__ calc_file_num(char *);
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ strcmp(char *, char *);
int verify_output(char *dir) {
  char isgo[20];
  if (0 != calc_file_num(dir)) {
    printf("Warning: Out directory is not empty,If there is a file have the "
           "same name, all of them will be covered!\nAre you sure go on?[y/n]");
    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_output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <calc_file_num@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     11f1 <verify_output+0xa1>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1199 <verify_output+0x49>
jmp    1181 <verify_output+0x31>
lea    -0x30(%rbp),%rsi
lea    0xedd(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x30(%rbp),%rdi
lea    0xed0(%rip),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    11d3 <verify_output+0x83>
movl   $0x1,-0x4(%rbp)
jmp    11f8 <verify_output+0xa8>
lea    -0x30(%rbp),%rsi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f8 <verify_output+0xa8>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_output>:
push   %r14
push   %rbx
sub    $0x18,%rsp
call   1070 <calc_file_num@plt>
mov    $0x1,%ebx
test   %rax,%rax
je     11c7 <verify_output+0x77>
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    1180 <verify_output+0x30>
lea    0xeef(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
call   1060 <scanf@plt>
lea    0xee0(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11c7 <verify_output+0x77>
lea    0xece(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [129 x i8] c"Warning: Out directory is not empty,If there is a file have the same name, all of them will be covered!\0AAre you sure go on?[y/n]\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"y\00"
@.str.3 = [40 x i8] c"Your choice is [%s],Program exits now!\0A\00"
define i32 @verify_output(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [20 x i8]
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @calc_file_num(i8* %5)
%7 = icmp ne i64 0, %6
br i1 %7, label %8, label %25
8: ; preds = %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %14, %8
%11 = call signext i8 (...) @getchar()
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 10
br i1 %13, label %14, label %15
14: ; preds = %10
br label %10
15: ; preds = %10
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i64 0, %19
br i1 %20, label %21, label %22
21: ; preds = %15
store i32 1, i32* %2
br label %26
22: ; preds = %15
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* %23)
store i32 -1, i32* %2
br label %26
25: ; preds = %1
store i32 1, i32* %2
br label %26
26: ; preds = %25, %22, %21
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
@.str = [129 x i8] c"Warning: Out directory is not empty,If there is a file have the same name, all of them will be covered!\0AAre you sure go on?[y/n]\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"y\00"
@.str.3 = [40 x i8] c"Your choice is [%s],Program exits now!\0A\00"
define i32 @verify_output(i8* %0) {
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%4 = tail call i64 @calc_file_num(i8* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %8, %6
%9 = tail call signext i8 (...) @getchar()
%10 = icmp eq i8 %9, 10
br i1 %10, label %11, label %8
11: ; preds = %8
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%13 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %11
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* %3)
br label %17
17: ; preds = %1, %11, %15
%18 = phi i32 [ -1, %15 ], [ 1, %11 ], [ 1, %1 ]
ret i32 %18
}