#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*/ BspModels();
int /*<<< orphan*/ CopyQFiles(int /*<<< orphan*/);
int /*<<< orphan*/ Error(char *, char *);
int /*<<< orphan*/ ReadFiles();
int /*<<< orphan*/ SetQdirFromPath(char *);
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  if (argc == 1) {
    printf("qfiles -pak <0 / 1> : build a .pak file\n");
    printf("qfiles -bspmodels : regenerates all brush models\n");
    exit(1);
  }
  SetQdirFromPath("");
  ReadFiles();
  if (!strcmp(argv[1], "-pak")) {
    CopyQFiles(atoi(argv[2]));
  } else if (!strcmp(argv[1], "-bspmodels")) {
    BspModels();
  } else
    Error("unknown command: %s", argv[1]);
  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   $0x1,-0x8(%rbp)
jne    11d2 <main+0x42>
lea    0xe49(%rip),%rdi
call   1040 <printf@plt>
lea    0xe66(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    0xe4f(%rip),%rdi
call   1070 <SetQdirFromPath@plt>
mov    $0x0,%al
call   10b0 <ReadFiles@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe67(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    121b <main+0x8b>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,%edi
call   1080 <CopyQFiles@plt>
jmp    125d <main+0xcd>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe36(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1244 <main+0xb4>
mov    $0x0,%al
call   1060 <BspModels@plt>
jmp    1258 <main+0xc8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe18(%rip),%rdi
call   1030 <Error@plt>
jmp    125d <main+0xcd>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x1,%edi
je     120d <main+0x7d>
mov    %rsi,%r14
lea    0xea8(%rip),%rdi
call   1070 <SetQdirFromPath@plt>
xor    %eax,%eax
call   10b0 <ReadFiles@plt>
mov    0x8(%r14),%rbx
lea    0xe46(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11ea <main+0x5a>
lea    0xe38(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11fc <main+0x6c>
lea    0xe30(%rip),%rdi
mov    %rbx,%rsi
call   1040 <Error@plt>
jmp    1203 <main+0x73>
mov    0x10(%r14),%rdi
call   1090 <atoi@plt>
mov    %eax,%edi
call   1080 <CopyQFiles@plt>
jmp    1203 <main+0x73>
xor    %eax,%eax
call   1060 <BspModels@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe10(%rip),%rdi
call   1030 <puts@plt>
lea    0xe2c(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"qfiles -pak <0 / 1> : build a .pak file\0A\00"
@.str.1 = [50 x i8] c"qfiles -bspmodels : regenerates all brush models\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [5 x i8] c"-pak\00"
@.str.4 = [11 x i8] c"-bspmodels\00"
@.str.5 = [20 x i8] c"unknown command: %s\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 eq i32 %6, 1
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = call i32 @SetQdirFromPath(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (...) @ReadFiles()
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @strcmp(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp ne i32 %18, 0
br i1 %19, label %26, label %20
20: ; preds = %12
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
%25 = call i32 @CopyQFiles(i32 %24)
br label %40
26: ; preds = %12
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 @strcmp(i8* %29, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%31 = icmp ne i32 %30, 0
br i1 %31, label %34, label %32
32: ; preds = %26
%33 = call i32 (...) @BspModels()
br label %39
34: ; preds = %26
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = call i32 @Error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %37)
br label %39
39: ; preds = %34, %32
br label %40
40: ; preds = %39, %20
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [5 x i8] c"-pak\00"
@.str.4 = [11 x i8] c"-bspmodels\00"
@.str.5 = [20 x i8] c"unknown command: %s\00"
@str = [40 x i8] c"qfiles -pak <0 / 1> : build a .pak file\00"
@str.6 = [49 x i8] c"qfiles -bspmodels : regenerates all brush models\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.6, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = tail call i32 @SetQdirFromPath(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 (...) @ReadFiles()
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @strcmp(i8* dereferenceable(1) %12, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %8
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32 @atoi(i8* %17)
%19 = tail call i32 @CopyQFiles(i32 %18)
br label %27
20: ; preds = %8
%21 = tail call i32 @strcmp(i8* dereferenceable(1) %12, i8* dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = tail call i32 (...) @BspModels()
br label %27
25: ; preds = %20
%26 = tail call i32 @Error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %12)
br label %27
27: ; preds = %23, %25, %15
ret i32 0
}