#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*/ analyze_references_source(unsigned int, unsigned int);
int /*<<< orphan*/ assert(int);
unsigned int atoi(int /*<<< orphan*/);
int /*<<< orphan*/ close_database();
int /*<<< orphan*/ get_file2ref_ratio(unsigned int, unsigned int);
int getopt_long(int, char **, char *, int /*<<< orphan*/ *,
                int /*<<< orphan*/ *);
int /*<<< orphan*/ open_database();
int /*<<< orphan*/ optarg;
int main(int argc, char *argv[]) {
  int opt = 0;
  unsigned int lb = 2, rb = -1;
  int task = 0;
  while ((opt = getopt_long(argc, argv, "l:r:t", NULL, NULL)) != -1) {
    switch (opt) {
    case 'l':
      lb = atoi(optarg);
      break;
    case 'r':
      rb = atoi(optarg);
      break;
    case 't':
      task = 1;
      break;
    default:
      return -1;
    }
  }
  assert(lb > 1);
  open_database();
  if (task == 1)
    get_file2ref_ratio(lb, rb);
  else
    analyze_references_source(lb, rb);
  close_database();
  return 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)
movl   $0x0,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe50(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rcx
call   1040 <getopt_long@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1248 <main+0xd8>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x6c,%eax
je     11ff <main+0x8f>
jmp    11dd <main+0x6d>
mov    -0x24(%rbp),%eax
sub    $0x72,%eax
je     1215 <main+0xa5>
jmp    11ee <main+0x7e>
mov    -0x24(%rbp),%eax
sub    $0x74,%eax
je     122b <main+0xbb>
jmp    1237 <main+0xc7>
mov    0x2df2(%rip),%rax
mov    (%rax),%edi
call   1080 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    1243 <main+0xd3>
mov    0x2ddc(%rip),%rax
mov    (%rax),%edi
call   1080 <atoi@plt>
mov    %eax,-0x1c(%rbp)
jmp    1243 <main+0xd3>
movl   $0x1,-0x20(%rbp)
jmp    1243 <main+0xd3>
movl   $0xffffffff,-0x4(%rbp)
jmp    1293 <main+0x123>
jmp    11a2 <main+0x32>
cmpl   $0x1,-0x18(%rbp)
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x0,%al
call   1090 <open_database@plt>
cmpl   $0x1,-0x20(%rbp)
jne    127a <main+0x10a>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1030 <get_file2ref_ratio@plt>
jmp    1285 <main+0x115>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1070 <analyze_references_source@plt>
mov    $0x0,%al
call   1050 <close_database@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r13
mov    %edi,%ebp
xor    %ebx,%ebx
mov    $0xffffffff,%r14d
mov    $0x2,%r15d
lea    0xe6b(%rip),%r12
mov    %ebx,%ecx
nopw   0x0(%rax,%rax,1)
mov    %ecx,%ebx
mov    %ebp,%edi
mov    %r13,%rsi
mov    %r12,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <getopt_long@plt>
mov    $0x1,%ecx
cmp    $0x74,%eax
je     11a0 <main+0x30>
cmp    $0xffffffff,%eax
je     11f3 <main+0x83>
cmp    $0x72,%eax
je     11e0 <main+0x70>
cmp    $0x6c,%eax
jne    121b <main+0xab>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
call   1080 <atoi@plt>
mov    %eax,%r15d
jmp    1195 <main+0x25>
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
call   1080 <atoi@plt>
mov    %eax,%r14d
jmp    1195 <main+0x25>
xor    %edi,%edi
cmp    $0x2,%r15d
setae  %dil
call   1060 <assert@plt>
xor    %eax,%eax
call   1090 <open_database@plt>
mov    %r15d,%edi
mov    %r14d,%esi
cmp    $0x1,%ebx
jne    1222 <main+0xb2>
call   1030 <get_file2ref_ratio@plt>
jmp    1227 <main+0xb7>
mov    $0xffffffff,%ebx
jmp    1230 <main+0xc0>
call   1070 <analyze_references_source@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <close_database@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"l:r:t\00"
@optarg = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 2, i32* %7
store i32 -1, i32* %8
store i32 0, i32* %9
br label %10
10: ; preds = %25, %2
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @getopt_long(i32 %11, i8** %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* null, i32* null)
store i32 %13, i32* %6
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %26
15: ; preds = %10
%16 = load i32, i32* %6
switch i32 %16, label %24 [
i32 108, label %17
i32 114, label %20
i32 116, label %23
]
17: ; preds = %15
%18 = load i32, i32* @optarg
%19 = call i32 @atoi(i32 %18)
store i32 %19, i32* %7
br label %25
20: ; preds = %15
%21 = load i32, i32* @optarg
%22 = call i32 @atoi(i32 %21)
store i32 %22, i32* %8
br label %25
23: ; preds = %15
store i32 1, i32* %9
br label %25
24: ; preds = %15
store i32 -1, i32* %3
br label %44
25: ; preds = %23, %20, %17
br label %10
26: ; preds = %10
%27 = load i32, i32* %7
%28 = icmp ugt i32 %27, 1
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = call i32 (...) @open_database()
%32 = load i32, i32* %9
%33 = icmp eq i32 %32, 1
br i1 %33, label %34, label %38
34: ; preds = %26
%35 = load i32, i32* %7
%36 = load i32, i32* %8
%37 = call i32 @get_file2ref_ratio(i32 %35, i32 %36)
br label %42
38: ; preds = %26
%39 = load i32, i32* %7
%40 = load i32, i32* %8
%41 = call i32 @analyze_references_source(i32 %39, i32 %40)
br label %42
42: ; preds = %38, %34
%43 = call i32 (...) @close_database()
store i32 0, i32* %3
br label %44
44: ; preds = %42, %24
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
@.str = [6 x i8] c"l:r:t\00"
@optarg = global i32 0
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %13, %2
%4 = phi i32 [ %15, %13 ], [ 2, %2 ]
%5 = phi i32 [ %8, %13 ], [ -1, %2 ]
%6 = phi i32 [ %11, %13 ], [ 0, %2 ]
br label %7
7: ; preds = %3, %16
%8 = phi i32 [ %5, %3 ], [ %18, %16 ]
%9 = phi i32 [ %6, %3 ], [ %11, %16 ]
br label %10
10: ; preds = %7, %10
%11 = phi i32 [ 1, %10 ], [ %9, %7 ]
%12 = tail call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* null, i32* null)
switch i32 %12, label %31 [
i32 -1, label %19
i32 108, label %13
i32 114, label %16
i32 116, label %10
]
13: ; preds = %10
%14 = load i32, i32* @optarg
%15 = tail call i32 @atoi(i32 %14)
br label %3
16: ; preds = %10
%17 = load i32, i32* @optarg
%18 = tail call i32 @atoi(i32 %17)
br label %7
19: ; preds = %10
%20 = icmp ugt i32 %4, 1
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
%23 = tail call i32 (...) @open_database()
%24 = icmp eq i32 %11, 1
br i1 %24, label %25, label %27
25: ; preds = %19
%26 = tail call i32 @get_file2ref_ratio(i32 %4, i32 %8)
br label %29
27: ; preds = %19
%28 = tail call i32 @analyze_references_source(i32 %4, i32 %8)
br label %29
29: ; preds = %27, %25
%30 = tail call i32 (...) @close_database()
br label %31
31: ; preds = %10, %29
%32 = phi i32 [ 0, %29 ], [ -1, %10 ]
ret i32 %32
}