#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 */
char *dbget(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  int ret = 0;
  char *value = NULL;
  value = dbget(argv[1], (argc == 3) ? argv[2] : "");
  if (value != NULL) {
    fputs(value, stdout);
    free(value);
  }
  return ret;
}


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)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    117c <main+0x4c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    118c <main+0x5c>
lea    0xe7d(%rip),%rax
mov    %rax,-0x30(%rbp)
jmp    118c <main+0x5c>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <dbget@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11c3 <main+0x93>
mov    -0x20(%rbp),%rdi
mov    0x2e2d(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %edi,%eax
mov    0x8(%rsi),%rdi
cmp    $0x3,%eax
jne    1142 <main+0x12>
mov    0x10(%rsi),%rsi
jmp    1149 <main+0x19>
lea    0xeb7(%rip),%rsi
call   1040 <dbget@plt>
test   %rax,%rax
je     116f <main+0x3f>
mov    %rax,%rbx
mov    0x2e83(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <fputs@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i8* null, i8** %7
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 3
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 2
%16 = load i8*, i8** %15
br label %18
17: ; preds = %2
br label %18
18: ; preds = %17, %13
%19 = phi i8* [ %16, %13 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %17 ]
%20 = call i8* @dbget(i8* %10, i8* %19)
store i8* %20, i8** %7
%21 = load i8*, i8** %7
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %29
23: ; preds = %18
%24 = load i8*, i8** %7
%25 = load i32, i32* @stdout
%26 = call i32 @fputs(i8* %24, i32 %25)
%27 = load i8*, i8** %7
%28 = call i32 @free(i8* %27)
br label %29
29: ; preds = %23, %18
%30 = load i32, i32* %6
ret i32 %30
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = icmp eq i32 %0, 3
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
br label %9
9: ; preds = %2, %6
%10 = phi i8* [ %8, %6 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %2 ]
%11 = tail call i8* @dbget(i8* %4, i8* %10)
%12 = icmp eq i8* %11, null
br i1 %12, label %17, label %13
13: ; preds = %9
%14 = load i32, i32* @stdout
%15 = tail call i32 @fputs(i8* %11, i32 %14)
%16 = tail call i32 @free(i8* %11)
br label %17
17: ; preds = %13, %9
ret i32 0
}