#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*/ db_create();
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ stdout;
int db_create_with_prompt() {
  char c;
  printf("Create a new inventory file? (Yes, Quit): ");
  fflush(stdout);
  scanf("%c", &c);
  if (c == 'Y' || c == 'y') {
    db_create();
    return 1;
  }
  if (c != 'Q' && c != 'q') {
    printf("Invalid response\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<db_create_with_prompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
lea    0xec2(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1060 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x59,%eax
je     118c <db_create_with_prompt+0x4c>
movsbl -0x5(%rbp),%eax
cmp    $0x79,%eax
jne    119f <db_create_with_prompt+0x5f>
mov    $0x0,%al
call   1050 <db_create@plt>
movl   $0x1,-0x4(%rbp)
jmp    11cc <db_create_with_prompt+0x8c>
movsbl -0x5(%rbp),%eax
cmp    $0x51,%eax
je     11c5 <db_create_with_prompt+0x85>
movsbl -0x5(%rbp),%eax
cmp    $0x71,%eax
je     11c5 <db_create_with_prompt+0x85>
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_create_with_prompt>:
push   %rbx
sub    $0x10,%rsp
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    0xeb5(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xf(%rsp),%al
and    $0xdf,%al
xor    %ebx,%ebx
cmp    $0x51,%al
je     11aa <db_create_with_prompt+0x5a>
cmp    $0x59,%al
jne    119e <db_create_with_prompt+0x4e>
xor    %eax,%eax
call   1060 <db_create@plt>
mov    $0x1,%ebx
jmp    11aa <db_create_with_prompt+0x5a>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Create a new inventory file? (Yes, Quit): \00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [18 x i8] c"Invalid response\0A\00"
define i32 @db_create_with_prompt() {
%1 = alloca i32
%2 = alloca i8
%3 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdout
%5 = call i32 @fflush(i32 %4)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 89
br i1 %9, label %14, label %10
10: ; preds = %0
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 121
br i1 %13, label %14, label %16
14: ; preds = %10, %0
%15 = call i32 (...) @db_create()
store i32 1, i32* %1
br label %27
16: ; preds = %10
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 81
br i1 %19, label %20, label %26
20: ; preds = %16
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 113
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %26
26: ; preds = %24, %20, %16
store i32 0, i32* %1
br label %27
27: ; preds = %26, %14
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@.str = [43 x i8] c"Create a new inventory file? (Yes, Quit): \00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"%c\00"
@str = [17 x i8] c"Invalid response\00"
define i32 @db_create_with_prompt() {
%1 = alloca i8
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
%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 = and i8 %6, -33
switch i8 %7, label %10 [
i8 89, label %8
i8 81, label %12
]
8: ; preds = %0
%9 = call i32 (...) @db_create()
br label %12
10: ; preds = %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %12
12: ; preds = %0, %10, %8
%13 = phi i32 [ 1, %8 ], [ 0, %10 ], [ 0, %0 ]
ret i32 %13
}