#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*/ exit(int);
scalar_t__ open_db(char const *const);
int /*<<< orphan*/ print_help();
int /*<<< orphan*/ puts(char *);
int main(int argc, const char *const *argv) {
  if (argc >= 2) {
    print_help();
  }
  if (argc == 1) {
    if (open_db(argv[1]) < 0) {
      puts("open_db() failed!");
      exit(-1);
    }
  } else {
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     1167 <main+0x27>
mov    $0x0,%al
call   1050 <print_help@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11a3 <main+0x63>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <open_db@plt>
cmp    $0x0,%rax
jge    119e <main+0x5e>
lea    0xe71(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
jmp    11a8 <main+0x68>
jmp    11a8 <main+0x68>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jl     114f <main+0xf>
xor    %eax,%eax
call   1050 <print_help@plt>
jmp    1162 <main+0x22>
cmp    $0x1,%edi
jne    1162 <main+0x22>
mov    0x8(%rsi),%rdi
call   1030 <open_db@plt>
test   %rax,%rax
js     1166 <main+0x26>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe93(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"open_db() failed!\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp sge i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (...) @print_help()
br label %10
10: ; preds = %8, %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @open_db(i8* %16)
%18 = icmp slt i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %13
%20 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%21 = call i32 @exit(i32 -1)
unreachable
22: ; preds = %13
br label %24
23: ; preds = %10
br label %24
24: ; preds = %23, %22
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"open_db() failed!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @print_help()
br label %16
6: ; preds = %2
%7 = icmp eq i32 %0, 1
br i1 %7, label %8, label %16
8: ; preds = %6
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @open_db(i8* %10)
%12 = icmp slt i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 @exit(i32 -1)
unreachable
16: ; preds = %4, %6, %8
ret i32 0
}