#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*/ F_OK;
int /*<<< orphan*/ access(char *, int /*<<< orphan*/);
int getchar();
int /*<<< orphan*/ pit_db_initialize();
char *pit_file_name();
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strcmp(char *, char *);
void pit_init(char *argv[]) {
  char **arg = &argv[1];
  char *file_name = pit_file_name();
  int reply = 'Y';
  if (!access(file_name, F_OK)) {
    if (!*arg || strcmp(*arg, "-f")) {
      printf("%s already exists, do you want to override it [y/N]: ",
             file_name);
      reply = getchar();
    }
  }
  if (reply == 'y' || reply == 'Y') {
    pit_db_initialize();
    printf("Created empty %s\n", file_name);
  }
}


x86 assembly (clang, -O0):
<pit_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1080 <pit_file_name@plt>
mov    %rax,-0x18(%rbp)
movl   $0x59,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2e43(%rip),%rax
mov    (%rax),%esi
call   1070 <access@plt>
cmp    $0x0,%eax
jne    11ef <pit_init+0x8f>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     11d0 <pit_init+0x70>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe3f(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11ea <pit_init+0x8a>
mov    -0x18(%rbp),%rsi
lea    0xe28(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,-0x1c(%rbp)
jmp    11ef <pit_init+0x8f>
cmpl   $0x79,-0x1c(%rbp)
je     1203 <pit_init+0xa3>
cmpl   $0x59,-0x1c(%rbp)
jne    121a <pit_init+0xba>
mov    $0x0,%al
call   1040 <pit_db_initialize@plt>
mov    -0x18(%rbp),%rsi
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pit_init>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1080 <pit_file_name@plt>
mov    %rax,%rbx
mov    0x2e60(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1070 <access@plt>
test   %eax,%eax
jne    11be <pit_init+0x5e>
mov    0x8(%r14),%rdi
test   %rdi,%rdi
je     11a0 <pit_init+0x40>
lea    0xe6a(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11be <pit_init+0x5e>
lea    0xe5c(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
and    $0xffffffdf,%eax
cmp    $0x59,%eax
jne    11db <pit_init+0x7b>
xor    %eax,%eax
call   1040 <pit_db_initialize@plt>
lea    0xe6d(%rip),%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@F_OK = global i32 0
@.str = [3 x i8] c"-f\00"
@.str.1 = [54 x i8] c"%s already exists, do you want to override it [y/N]: \00"
@.str.2 = [18 x i8] c"Created empty %s\0A\00"
define void @pit_init(i8** %0) {
%2 = alloca i8**
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i32
store i8** %0, i8*** %2
%6 = load i8**, i8*** %2
%7 = getelementptr inbounds i8*, i8** %6, i64 1
store i8** %7, i8*** %3
%8 = call i8* (...) @pit_file_name()
store i8* %8, i8** %4
store i32 89, i32* %5
%9 = load i8*, i8** %4
%10 = load i32, i32* @F_OK
%11 = call i32 @access(i8* %9, i32 %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %27, label %13
13: ; preds = %1
%14 = load i8**, i8*** %3
%15 = load i8*, i8** %14
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = load i8**, i8*** %3
%19 = load i8*, i8** %18
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %17, %13
%23 = load i8*, i8** %4
%24 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i8* %23)
%25 = call i32 (...) @getchar()
store i32 %25, i32* %5
br label %26
26: ; preds = %22, %17
br label %27
27: ; preds = %26, %1
%28 = load i32, i32* %5
%29 = icmp eq i32 %28, 121
br i1 %29, label %33, label %30
30: ; preds = %27
%31 = load i32, i32* %5
%32 = icmp eq i32 %31, 89
br i1 %32, label %33, label %37
33: ; preds = %30, %27
%34 = call i32 (...) @pit_db_initialize()
%35 = load i8*, i8** %4
%36 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %35)
br label %37
37: ; preds = %33, %30
ret void
}

LLVM IR (-O2):
@F_OK = global i32 0
@.str = [3 x i8] c"-f\00"
@.str.1 = [54 x i8] c"%s already exists, do you want to override it [y/N]: \00"
@.str.2 = [18 x i8] c"Created empty %s\0A\00"
define void @pit_init(i8** nocapture %0) {
%2 = tail call i8* (...) @pit_file_name()
%3 = load i32, i32* @F_OK
%4 = tail call i32 @access(i8* %2, i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %18
6: ; preds = %1
%7 = getelementptr inbounds i8*, i8** %0, i64 1
%8 = load i8*, i8** %7
%9 = icmp eq i8* %8, null
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %10, %6
%14 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%15 = tail call i32 (...) @getchar()
%16 = and i32 %15, -33
%17 = icmp eq i32 %16, 89
br i1 %17, label %18, label %21
18: ; preds = %10, %1, %13
%19 = tail call i32 (...) @pit_db_initialize()
%20 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %2)
br label %21
21: ; preds = %13, %18
ret void
}