#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 bail(char *, char *);
int qconv(char *, char *);
int rconv(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  return (argc < 4) ? bail("usage: %s <qdb|rdb> <old db> <new db>\n", argv[0])
         : !strcmp(argv[1], "qdb") ? qconv(argv[2], argv[3])
         : !strcmp(argv[1], "rdb") ? rconv(argv[2], argv[3])
                                   : 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    117b <main+0x3b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe92(%rip),%rdi
call   1050 <bail@plt>
mov    %eax,-0x14(%rbp)
jmp    1208 <main+0xc8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe9d(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11b5 <main+0x75>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1060 <qconv@plt>
mov    %eax,-0x18(%rbp)
jmp    1202 <main+0xc2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe67(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11ef <main+0xaf>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1030 <rconv@plt>
mov    %eax,-0x1c(%rbp)
jmp    11fc <main+0xbc>
mov    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11fc <main+0xbc>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
jg     1162 <main+0x22>
mov    (%rbx),%rsi
lea    0xeaa(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <bail@plt>
mov    0x8(%rbx),%r14
lea    0xeba(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1199 <main+0x59>
lea    0xeab(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11ad <main+0x6d>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <qconv@plt>
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <rconv@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"usage: %s <qdb|rdb> <old db> <new db>\0A\00"
@.str.1 = [4 x i8] c"qdb\00"
@.str.2 = [4 x i8] c"rdb\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 slt i32 %6, 4
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @bail(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %46
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strcmp(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp ne i32 %17, 0
br i1 %18, label %27, label %19
19: ; preds = %13
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 3
%25 = load i8*, i8** %24
%26 = call i32 @qconv(i8* %22, i8* %25)
br label %44
27: ; preds = %13
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @strcmp(i8* %30, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp ne i32 %31, 0
br i1 %32, label %41, label %33
33: ; preds = %27
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 3
%39 = load i8*, i8** %38
%40 = call i32 @rconv(i8* %36, i8* %39)
br label %42
41: ; preds = %27
br label %42
42: ; preds = %41, %33
%43 = phi i32 [ %40, %33 ], [ 1, %41 ]
br label %44
44: ; preds = %42, %19
%45 = phi i32 [ %26, %19 ], [ %43, %42 ]
br label %46
46: ; preds = %44, %8
%47 = phi i32 [ %12, %8 ], [ %45, %44 ]
ret i32 %47
}

LLVM IR (-O2):
@.str = [39 x i8] c"usage: %s <qdb|rdb> <old db> <new db>\0A\00"
@.str.1 = [4 x i8] c"qdb\00"
@.str.2 = [4 x i8] c"rdb\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 4
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @bail(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %27
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %7
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8*, i8** %1, i64 3
%16 = load i8*, i8** %15
%17 = tail call i32 @qconv(i8* %14, i8* %16)
br label %27
18: ; preds = %7
%19 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = getelementptr inbounds i8*, i8** %1, i64 2
%23 = load i8*, i8** %22
%24 = getelementptr inbounds i8*, i8** %1, i64 3
%25 = load i8*, i8** %24
%26 = tail call i32 @rconv(i8* %23, i8* %25)
br label %27
27: ; preds = %12, %18, %21, %4
%28 = phi i32 [ %6, %4 ], [ %17, %12 ], [ %26, %21 ], [ 1, %18 ]
ret i32 %28
}