#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*/ CDB_RemoveIntEntry(char *);
int /*<<< orphan*/ CDB_RemoveStringEntry(char *);
int /*<<< orphan*/ CDB_Save();
int /*<<< orphan*/ CDB_StartUp(int);
scalar_t__ CheckCmdSwitch(char *, int, char **);
char *GetCmdOpt(char *, int, char **);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void main(int argc, char *argv[]) {
  char *arg_key;
  arg_key = GetCmdOpt("-k", argc, argv);
  if (arg_key == NULL) {
    printf("you must give me a key.\n");
    exit(0);
  }
  if (CheckCmdSwitch("-q", argc, argv)) {
    CDB_StartUp(0);
  } else {
    CDB_StartUp(1);
  }
  if (CheckCmdSwitch("-s", argc, argv)) {
    CDB_RemoveStringEntry(arg_key);
  }
  if (CheckCmdSwitch("-i", argc, argv)) {
    CDB_RemoveIntEntry(arg_key);
  }
  CDB_Save();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xe63(%rip),%rdi
call   1030 <GetCmdOpt@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11c4 <main+0x44>
lea    0xe4b(%rip),%rdi
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xe4a(%rip),%rdi
call   1040 <CheckCmdSwitch@plt>
cmp    $0x0,%rax
je     11ed <main+0x6d>
xor    %edi,%edi
call   1080 <CDB_StartUp@plt>
jmp    11f7 <main+0x77>
mov    $0x1,%edi
call   1080 <CDB_StartUp@plt>
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xe1a(%rip),%rdi
call   1040 <CheckCmdSwitch@plt>
cmp    $0x0,%rax
je     121d <main+0x9d>
mov    -0x18(%rbp),%rdi
call   1070 <CDB_RemoveStringEntry@plt>
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xdf7(%rip),%rdi
call   1040 <CheckCmdSwitch@plt>
cmp    $0x0,%rax
je     1243 <main+0xc3>
mov    -0x18(%rbp),%rdi
call   10a0 <CDB_RemoveIntEntry@plt>
mov    $0x0,%al
call   1060 <CDB_Save@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe70(%rip),%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <GetCmdOpt@plt>
test   %rax,%rax
je     1208 <main+0x88>
mov    %rax,%r14
lea    0xe5a(%rip),%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1050 <CheckCmdSwitch@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <CDB_StartUp@plt>
lea    0xe3e(%rip),%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1050 <CheckCmdSwitch@plt>
test   %rax,%rax
je     11df <main+0x5f>
mov    %r14,%rdi
call   1070 <CDB_RemoveStringEntry@plt>
lea    0xe23(%rip),%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1050 <CheckCmdSwitch@plt>
test   %rax,%rax
je     11fd <main+0x7d>
mov    %r14,%rdi
call   10a0 <CDB_RemoveIntEntry@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <CDB_Save@plt>
lea    0xdfd(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-k\00"
@.str.1 = [25 x i8] c"you must give me a key.\0A\00"
@.str.2 = [3 x i8] c"-q\00"
@.str.3 = [3 x i8] c"-s\00"
@.str.4 = [3 x i8] c"-i\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i32, i32* %3
%7 = load i8**, i8*** %4
%8 = call i8* @GetCmdOpt(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6, i8** %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @exit(i32 0)
unreachable
14: ; preds = %2
%15 = load i32, i32* %3
%16 = load i8**, i8*** %4
%17 = call i64 @CheckCmdSwitch(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %15, i8** %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = call i32 @CDB_StartUp(i32 0)
br label %23
21: ; preds = %14
%22 = call i32 @CDB_StartUp(i32 1)
br label %23
23: ; preds = %21, %19
%24 = load i32, i32* %3
%25 = load i8**, i8*** %4
%26 = call i64 @CheckCmdSwitch(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %24, i8** %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = load i8*, i8** %5
%30 = call i32 @CDB_RemoveStringEntry(i8* %29)
br label %31
31: ; preds = %28, %23
%32 = load i32, i32* %3
%33 = load i8**, i8*** %4
%34 = call i64 @CheckCmdSwitch(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %32, i8** %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %31
%37 = load i8*, i8** %5
%38 = call i32 @CDB_RemoveIntEntry(i8* %37)
br label %39
39: ; preds = %36, %31
%40 = call i32 (...) @CDB_Save()
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"-k\00"
@.str.2 = [3 x i8] c"-q\00"
@.str.3 = [3 x i8] c"-s\00"
@.str.4 = [3 x i8] c"-i\00"
@str = [24 x i8] c"you must give me a key.\00"
define void @main(i32 %0, i8** %1) {
%3 = tail call i8* @GetCmdOpt(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0, i8** %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %2
%9 = tail call i64 @CheckCmdSwitch(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %0, i8** %1)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
%12 = tail call i32 @CDB_StartUp(i32 %11)
%13 = tail call i64 @CheckCmdSwitch(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %0, i8** %1)
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %8
%16 = tail call i32 @CDB_RemoveStringEntry(i8* %3)
br label %17
17: ; preds = %15, %8
%18 = tail call i64 @CheckCmdSwitch(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %0, i8** %1)
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = tail call i32 @CDB_RemoveIntEntry(i8* %3)
br label %22
22: ; preds = %20, %17
%23 = tail call i32 (...) @CDB_Save()
ret void
}