#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(char *);
int /*<<< orphan*/ db_repair(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getchar();
int /*<<< orphan*/ printf(char *);
char db_err(char filename[]) {
  printf("(C)reate new/(A)bort/(R)epair/(E)xit?\n");
  switch (getchar()) {
  case 'C':
    db_create(filename);
    break;
  case 'c':
    db_create(filename);
    break;
  case 'R':
    db_repair(filename);
    break;
  case 'r':
    db_repair(filename);
    break;
  case 'E':
    exit(0);
    break;
  case 'e':
    exit(0);
    break;
  default:
    return -1;
    break;
  }
}


x86 assembly (clang, -O0):
<db_err>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xf5d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffbd,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x2f,%eax
ja     11db <db_err+0x8b>
mov    -0x18(%rbp),%rax
lea    0xe74(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
call   1050 <db_create@plt>
jmp    11df <db_err+0x8f>
mov    -0x10(%rbp),%rdi
call   1050 <db_create@plt>
jmp    11df <db_err+0x8f>
mov    -0x10(%rbp),%rdi
call   1060 <db_repair@plt>
jmp    11df <db_err+0x8f>
mov    -0x10(%rbp),%rdi
call   1060 <db_repair@plt>
jmp    11df <db_err+0x8f>
xor    %edi,%edi
call   1070 <exit@plt>
xor    %edi,%edi
call   1070 <exit@plt>
movb   $0xff,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_err>:
push   %rbx
mov    %rdi,%rbx
lea    0xf65(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffbd,%eax
cmp    $0x2f,%eax
ja     1191 <db_err+0x41>
lea    0xe8a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %rbx,%rdi
call   1050 <db_create@plt>
jmp    1191 <db_err+0x41>
mov    %rbx,%rdi
call   1060 <db_repair@plt>
mov    $0xff,%al
pop    %rbx
ret
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"(C)reate new/(A)bort/(R)epair/(E)xit?\0A\00"
define signext i8 @db_err(i8* %0) {
%2 = alloca i8
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (...) @getchar()
switch i32 %5, label %22 [
i32 67, label %6
i32 99, label %9
i32 82, label %12
i32 114, label %15
i32 69, label %18
i32 101, label %20
]
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = call i32 @db_create(i8* %7)
br label %23
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i32 @db_create(i8* %10)
br label %23
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = call i32 @db_repair(i8* %13)
br label %23
15: ; preds = %1
%16 = load i8*, i8** %3
%17 = call i32 @db_repair(i8* %16)
br label %23
18: ; preds = %1
%19 = call i32 @exit(i32 0)
unreachable
20: ; preds = %1
%21 = call i32 @exit(i32 0)
unreachable
22: ; preds = %1
store i8 -1, i8* %2
br label %23
23: ; preds = %22, %15, %12, %9, %6
%24 = load i8, i8* %2
ret i8 %24
}

LLVM IR (-O2):
@str = [38 x i8] c"(C)reate new/(A)bort/(R)epair/(E)xit?\00"
define signext i8 @db_err(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (...) @getchar()
switch i32 %3, label %16 [
i32 67, label %4
i32 99, label %6
i32 82, label %8
i32 114, label %10
i32 69, label %12
i32 101, label %14
]
4: ; preds = %1
%5 = tail call i32 @db_create(i8* %0)
br label %16
6: ; preds = %1
%7 = tail call i32 @db_create(i8* %0)
br label %16
8: ; preds = %1
%9 = tail call i32 @db_repair(i8* %0)
br label %16
10: ; preds = %1
%11 = tail call i32 @db_repair(i8* %0)
br label %16
12: ; preds = %1
%13 = tail call i32 @exit(i32 0)
unreachable
14: ; preds = %1
%15 = tail call i32 @exit(i32 0)
unreachable
16: ; preds = %1, %10, %8, %6, %4
ret i8 -1
}