#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 CDB_GetIntValue(char *);
char *CDB_GetString(char *);
int /*<<< orphan*/ CDB_StartUp(int /*<<< orphan*/);
scalar_t__ CheckCmdSwitch(char *, int, char **);
char *GetCmdOpt(char *, int, char **);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  char *arg_key;
  int value;
  char *data;
  arg_key = GetCmdOpt("-k", argc, argv);
  CDB_StartUp(0);
  if (CheckCmdSwitch("-i", argc, argv)) {
    value = CDB_GetIntValue(arg_key);
    printf("%i", value);
  }
  if (CheckCmdSwitch("-s", argc, argv)) {
    data = CDB_GetString(arg_key);
    if (data != NULL) {
      printf("%s", data);
    }
  }
  if (CheckCmdSwitch("-nl", argc, argv)) {
    printf("\n");
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xe6c(%rip),%rdi
call   1030 <GetCmdOpt@plt>
mov    %rax,-0x18(%rbp)
xor    %edi,%edi
call   1080 <CDB_StartUp@plt>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xe51(%rip),%rdi
call   1040 <CheckCmdSwitch@plt>
cmp    $0x0,%rax
je     11de <main+0x6e>
mov    -0x18(%rbp),%rdi
call   1060 <CDB_GetIntValue@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xe1d(%rip),%rdi
call   1040 <CheckCmdSwitch@plt>
cmp    $0x0,%rax
je     122a <main+0xba>
mov    -0x18(%rbp),%rdi
call   1070 <CDB_GetString@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1225 <main+0xb5>
mov    -0x28(%rbp),%rsi
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    122a <main+0xba>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xdd7(%rip),%rdi
call   1040 <CheckCmdSwitch@plt>
cmp    $0x0,%rax
je     1255 <main+0xe5>
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>

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   1040 <GetCmdOpt@plt>
mov    %rax,%r14
xor    %edi,%edi
call   1090 <CDB_StartUp@plt>
lea    0xe58(%rip),%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1050 <CheckCmdSwitch@plt>
test   %rax,%rax
je     11d2 <main+0x52>
mov    %r14,%rdi
call   1070 <CDB_GetIntValue@plt>
lea    0xe3d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe30(%rip),%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1050 <CheckCmdSwitch@plt>
test   %rax,%rax
je     1206 <main+0x86>
mov    %r14,%rdi
call   1080 <CDB_GetString@plt>
test   %rax,%rax
je     1206 <main+0x86>
lea    0xe10(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe02(%rip),%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1050 <CheckCmdSwitch@plt>
test   %rax,%rax
je     1226 <main+0xa6>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"-k\00"
@.str.1 = [3 x i8] c"-i\00"
@.str.2 = [3 x i8] c"%i\00"
@.str.3 = [3 x i8] c"-s\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [4 x i8] c"-nl\00"
define i32 @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 = tail call i32 @CDB_StartUp(i32 0)
%5 = tail call i64 @CheckCmdSwitch(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %0, i8** %1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = tail call i32 @CDB_GetIntValue(i8* %3)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %7, %2
%11 = tail call i64 @CheckCmdSwitch(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %0, i8** %1)
%12 = icmp eq i64 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %10
%14 = tail call i8* @CDB_GetString(i8* %3)
%15 = icmp eq i8* %14, null
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %14)
br label %18
18: ; preds = %13, %16, %10
%19 = tail call i64 @CheckCmdSwitch(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %0, i8** %1)
%20 = icmp eq i64 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = tail call i32 @putchar(i32 10)
br label %23
23: ; preds = %21, %18
%24 = tail call i32 @exit(i32 0)
unreachable
}