#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 */
struct track {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ rig_clear();
int /*<<< orphan*/ rig_init();
int /*<<< orphan*/ rig_main();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ thread_global_clear();
int thread_global_init();
struct track *track_get_by_import(char *, char *);
int /*<<< orphan*/ track_put(struct track *);
int main(int argc, char *argv[]) {
  struct track *track;
  if (argc != 3) {
    fprintf(stderr, "usage: %s <command> <path>\n", argv[0]);
    return -1;
  }
  if (thread_global_init() == -1)
    return -1;
  rig_init();
  track = track_get_by_import(argv[1], argv[2]);
  if (track == NULL)
    return -1;
  rig_main();
  track_put(track);
  rig_clear();
  thread_global_clear();
  return 0;
}


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   $0x3,-0x8(%rbp)
je     11c8 <main+0x48>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe49(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1240 <main+0xc0>
mov    $0x0,%al
call   1060 <thread_global_init@plt>
cmp    $0xffffffff,%eax
jne    11e4 <main+0x64>
movl   $0xffffffff,-0x4(%rbp)
jmp    1240 <main+0xc0>
mov    $0x0,%al
call   1090 <rig_init@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   10a0 <track_get_by_import@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    121b <main+0x9b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1240 <main+0xc0>
mov    $0x0,%al
call   1050 <rig_main@plt>
mov    -0x18(%rbp),%rdi
call   1070 <track_put@plt>
mov    $0x0,%al
call   1080 <rig_clear@plt>
mov    $0x0,%al
call   1030 <thread_global_clear@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    11d9 <main+0x59>
xor    %eax,%eax
call   1060 <thread_global_init@plt>
mov    $0xffffffff,%ebp
cmp    $0xffffffff,%eax
je     11f6 <main+0x76>
xor    %eax,%eax
call   1090 <rig_init@plt>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
call   10a0 <track_get_by_import@plt>
test   %rax,%rax
je     11f6 <main+0x76>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <rig_main@plt>
mov    %rbx,%rdi
call   1070 <track_put@plt>
xor    %eax,%eax
call   1080 <rig_clear@plt>
xor    %eax,%eax
call   1030 <thread_global_clear@plt>
xor    %ebp,%ebp
jmp    11f6 <main+0x76>
mov    0x2e00(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe14(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.track = type { i32 }
@stderr = global i32 0
@.str = [28 x i8] c"usage: %s <command> <path>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.track*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 3
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %13)
store i32 -1, i32* %3
br label %37
15: ; preds = %2
%16 = call i32 (...) @thread_global_init()
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 -1, i32* %3
br label %37
19: ; preds = %15
%20 = call i32 (...) @rig_init()
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call %struct.track* @track_get_by_import(i8* %23, i8* %26)
store %struct.track* %27, %struct.track** %6
%28 = load %struct.track*, %struct.track** %6
%29 = icmp eq %struct.track* %28, null
br i1 %29, label %30, label %31
30: ; preds = %19
store i32 -1, i32* %3
br label %37
31: ; preds = %19
%32 = call i32 (...) @rig_main()
%33 = load %struct.track*, %struct.track** %6
%34 = call i32 @track_put(%struct.track* %33)
%35 = call i32 (...) @rig_clear()
%36 = call i32 (...) @thread_global_clear()
store i32 0, i32* %3
br label %37
37: ; preds = %31, %30, %18, %9
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
%struct.track = type { i32 }
@stderr = global i32 0
@.str = [28 x i8] c"usage: %s <command> <path>\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %24
8: ; preds = %2
%9 = tail call i32 (...) @thread_global_init()
%10 = icmp eq i32 %9, -1
br i1 %10, label %24, label %11
11: ; preds = %8
%12 = tail call i32 (...) @rig_init()
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = tail call %struct.track* @track_get_by_import(i8* %14, i8* %16)
%18 = icmp eq %struct.track* %17, null
br i1 %18, label %24, label %19
19: ; preds = %11
%20 = tail call i32 (...) @rig_main()
%21 = tail call i32 @track_put(%struct.track* %17)
%22 = tail call i32 (...) @rig_clear()
%23 = tail call i32 (...) @thread_global_clear()
br label %24
24: ; preds = %11, %8, %19, %4
%25 = phi i32 [ -1, %4 ], [ 0, %19 ], [ -1, %8 ], [ -1, %11 ]
ret i32 %25
}