#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 */
char *get_db_path();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int remove(char *);
int /*<<< orphan*/ scanf(char *, char *);
void wipe_data() {
  char answer;
  printf("This option will wipe all stored countries, do you want to continue "
         "(y/N)? ");
  scanf("%c", &answer);
  if (answer == 'y') {
    char *file_path = get_db_path();
    int status = remove(file_path);
    if (status != 0) {
      printf("Unable to delete the file %s\n", file_path);
      perror("Error");
    }
  }
}


x86 assembly (clang, -O0):
<wipe_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xedf(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1060 <scanf@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x79,%eax
jne    11c7 <wipe_data+0x77>
mov    $0x0,%al
call   1030 <get_db_path@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <remove@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11c2 <wipe_data+0x72>
mov    -0x10(%rbp),%rsi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1070 <perror@plt>
jmp    11c7 <wipe_data+0x77>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wipe_data>:
push   %rbx
sub    $0x10,%rsp
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xee2(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1060 <scanf@plt>
cmpb   $0x79,0xf(%rsp)
jne    1191 <wipe_data+0x41>
xor    %eax,%eax
call   1030 <get_db_path@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <remove@plt>
test   %eax,%eax
jne    1197 <wipe_data+0x47>
add    $0x10,%rsp
pop    %rbx
ret
lea    0xeb1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebe(%rip),%rdi
call   1070 <perror@plt>
jmp    1191 <wipe_data+0x41>

LLVM IR (-O0):
@.str = [76 x i8] c"This option will wipe all stored countries, do you want to continue (y/N)? \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [30 x i8] c"Unable to delete the file %s\0A\00"
@.str.3 = [6 x i8] c"Error\00"
define void @wipe_data() {
%1 = alloca i8
%2 = alloca i8*
%3 = alloca i32
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%6 = load i8, i8* %1
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 121
br i1 %8, label %9, label %20
9: ; preds = %0
%10 = call i8* (...) @get_db_path()
store i8* %10, i8** %2
%11 = load i8*, i8** %2
%12 = call i32 @remove(i8* %11)
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %9
%16 = load i8*, i8** %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %19
19: ; preds = %15, %9
br label %20
20: ; preds = %19, %0
ret void
}

LLVM IR (-O2):
@.str = [76 x i8] c"This option will wipe all stored countries, do you want to continue (y/N)? \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [30 x i8] c"Unable to delete the file %s\0A\00"
@.str.3 = [6 x i8] c"Error\00"
define void @wipe_data() {
%1 = alloca i8
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 121
br i1 %5, label %6, label %13
6: ; preds = %0
%7 = call i8* (...) @get_db_path()
%8 = call i32 @remove(i8* %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%12 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %13
13: ; preds = %6, %10, %0
ret void
}