#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 getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
int process(char const *, char const *, char const *, char const *);
int /*<<< orphan*/ set_column_format(int /*<<< orphan*/);
char *strdup(int /*<<< orphan*/);
int /*<<< orphan*/ syntax(char *);
int main(int argc, char *argv[]) {
  const char *dbname = NULL, *sql = NULL, *line_length = "6.5", *format = "box";
  int opt;
  while ((opt = getopt(argc, argv, "d:f:p:q:w:")) != -1) {
    switch (opt) {
    case 'd':
      dbname = strdup(optarg);
      break;
    case 'f':
      format = strdup(optarg);
      break;
    case 'p':
      set_column_format(optarg);
      break;
    case 'q':
      sql = strdup(optarg);
      break;
    case 'w':
      line_length = strdup(optarg);
      break;
    default:
      syntax(argv[0]);
    }
  }
  if (!dbname || !sql)
    syntax(argv[0]);
  return process(dbname, sql, line_length, format);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    0xed3(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xecc(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xebe(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x34(%rbp)
cmp    $0xffffffff,%eax
je     1254 <main+0x104>
mov    -0x34(%rbp),%eax
add    $0xffffff9c,%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0x13,%eax
ja     1243 <main+0xf3>
mov    -0x40(%rbp),%rax
lea    0xe35(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e1d(%rip),%rax
mov    (%rax),%edi
call   1070 <strdup@plt>
mov    %rax,-0x18(%rbp)
jmp    124f <main+0xff>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
call   1070 <strdup@plt>
mov    %rax,-0x30(%rbp)
jmp    124f <main+0xff>
mov    0x2def(%rip),%rax
mov    (%rax),%edi
call   1050 <set_column_format@plt>
jmp    124f <main+0xff>
mov    0x2ddc(%rip),%rax
mov    (%rax),%edi
call   1070 <strdup@plt>
mov    %rax,-0x20(%rbp)
jmp    124f <main+0xff>
mov    0x2dc5(%rip),%rax
mov    (%rax),%edi
call   1070 <strdup@plt>
mov    %rax,-0x28(%rbp)
jmp    124f <main+0xff>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <syntax@plt>
jmp    118c <main+0x3c>
cmpq   $0x0,-0x18(%rbp)
je     126a <main+0x11a>
cmpq   $0x0,-0x20(%rbp)
jne    1276 <main+0x126>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <syntax@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1030 <process@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xeea(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xeda(%rip),%rax
mov    %rax,0x8(%rsp)
xor    %eax,%eax
mov    %rax,(%rsp)
lea    0xed0(%rip),%r14
lea    0xe71(%rip),%r15
mov    0x2e62(%rip),%r12
xor    %r13d,%r13d
jmp    11ad <main+0x5d>
nopl   0x0(%rax,%rax,1)
cmp    $0xffffffff,%eax
je     1213 <main+0xc3>
mov    (%rbx),%rdi
call   1040 <syntax@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1060 <getopt@plt>
lea    -0x64(%rax),%ecx
cmp    $0x13,%ecx
ja     11a0 <main+0x50>
movslq (%r15,%rcx,4),%rax
add    %r15,%rax
jmp    *%rax
mov    (%r12),%edi
call   1050 <set_column_format@plt>
jmp    11ad <main+0x5d>
mov    (%r12),%edi
call   1070 <strdup@plt>
mov    %rax,%r13
jmp    11ad <main+0x5d>
mov    (%r12),%edi
call   1070 <strdup@plt>
mov    %rax,0x10(%rsp)
jmp    11ad <main+0x5d>
mov    (%r12),%edi
call   1070 <strdup@plt>
mov    %rax,(%rsp)
jmp    11ad <main+0x5d>
mov    (%r12),%edi
call   1070 <strdup@plt>
mov    %rax,0x8(%rsp)
jmp    11ad <main+0x5d>
test   %r13,%r13
mov    (%rsp),%rbp
je     1221 <main+0xd1>
test   %rbp,%rbp
jne    1229 <main+0xd9>
mov    (%rbx),%rdi
call   1040 <syntax@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%rcx
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <process@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"6.5\00"
@.str.1 = [4 x i8] c"box\00"
@.str.2 = [11 x i8] c"d:f:p:q:w:\00"
@optarg = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %8
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %9
br label %11
11: ; preds = %38, %2
%12 = load i32, i32* %4
%13 = load i8**, i8*** %5
%14 = call i32 @getopt(i32 %12, i8** %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
store i32 %14, i32* %10
%15 = icmp ne i32 %14, -1
br i1 %15, label %16, label %39
16: ; preds = %11
%17 = load i32, i32* %10
switch i32 %17, label %33 [
i32 100, label %18
i32 102, label %21
i32 112, label %24
i32 113, label %27
i32 119, label %30
]
18: ; preds = %16
%19 = load i32, i32* @optarg
%20 = call i8* @strdup(i32 %19)
store i8* %20, i8** %6
br label %38
21: ; preds = %16
%22 = load i32, i32* @optarg
%23 = call i8* @strdup(i32 %22)
store i8* %23, i8** %9
br label %38
24: ; preds = %16
%25 = load i32, i32* @optarg
%26 = call i32 @set_column_format(i32 %25)
br label %38
27: ; preds = %16
%28 = load i32, i32* @optarg
%29 = call i8* @strdup(i32 %28)
store i8* %29, i8** %7
br label %38
30: ; preds = %16
%31 = load i32, i32* @optarg
%32 = call i8* @strdup(i32 %31)
store i8* %32, i8** %8
br label %38
33: ; preds = %16
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 0
%36 = load i8*, i8** %35
%37 = call i32 @syntax(i8* %36)
br label %38
38: ; preds = %33, %30, %27, %24, %21, %18
br label %11
39: ; preds = %11
%40 = load i8*, i8** %6
%41 = icmp ne i8* %40, null
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load i8*, i8** %7
%44 = icmp ne i8* %43, null
br i1 %44, label %50, label %45
45: ; preds = %42, %39
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 0
%48 = load i8*, i8** %47
%49 = call i32 @syntax(i8* %48)
br label %50
50: ; preds = %45, %42
%51 = load i8*, i8** %6
%52 = load i8*, i8** %7
%53 = load i8*, i8** %8
%54 = load i8*, i8** %9
%55 = call i32 @process(i8* %51, i8* %52, i8* %53, i8* %54)
ret i32 %55
}

LLVM IR (-O2):
@.str = [4 x i8] c"6.5\00"
@.str.1 = [4 x i8] c"box\00"
@.str.2 = [11 x i8] c"d:f:p:q:w:\00"
@optarg = global i32 0
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %28, %2
%4 = phi i8* [ %30, %28 ], [ null, %2 ]
%5 = phi i8* [ %9, %28 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %2 ]
%6 = phi i8* [ %13, %28 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %2 ]
%7 = phi i8* [ %16, %28 ], [ null, %2 ]
br label %8
8: ; preds = %3, %31
%9 = phi i8* [ %5, %3 ], [ %33, %31 ]
%10 = phi i8* [ %6, %3 ], [ %13, %31 ]
%11 = phi i8* [ %7, %3 ], [ %16, %31 ]
br label %12
12: ; preds = %8, %22
%13 = phi i8* [ %10, %8 ], [ %24, %22 ]
%14 = phi i8* [ %11, %8 ], [ %16, %22 ]
br label %15
15: ; preds = %12, %19
%16 = phi i8* [ %14, %12 ], [ %21, %19 ]
br label %17
17: ; preds = %37, %15
%18 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
switch i32 %18, label %34 [
i32 -1, label %38
i32 100, label %19
i32 102, label %22
i32 112, label %25
i32 113, label %28
i32 119, label %31
]
19: ; preds = %17
%20 = load i32, i32* @optarg
%21 = tail call i8* @strdup(i32 %20)
br label %15
22: ; preds = %17
%23 = load i32, i32* @optarg
%24 = tail call i8* @strdup(i32 %23)
br label %12
25: ; preds = %17
%26 = load i32, i32* @optarg
%27 = tail call i32 @set_column_format(i32 %26)
br label %37
28: ; preds = %17
%29 = load i32, i32* @optarg
%30 = tail call i8* @strdup(i32 %29)
br label %3
31: ; preds = %17
%32 = load i32, i32* @optarg
%33 = tail call i8* @strdup(i32 %32)
br label %8
34: ; preds = %17
%35 = load i8*, i8** %1
%36 = tail call i32 @syntax(i8* %35)
br label %37
37: ; preds = %34, %25
br label %17
38: ; preds = %17
%39 = icmp ne i8* %16, null
%40 = icmp ne i8* %4, null
%41 = select i1 %39, i1 %40, i1 false
br i1 %41, label %45, label %42
42: ; preds = %38
%43 = load i8*, i8** %1
%44 = tail call i32 @syntax(i8* %43)
br label %45
45: ; preds = %38, %42
%46 = tail call i32 @process(i8* %16, i8* %4, i8* %9, i8* %13)
ret i32 %46
}