// File: rofl0r[P]ascc/main.cpp
// Function: usage(char*)
static int usage(char *argv0) {
	fprintf(stderr, "usage: %s [OPTIONS] FILE.asc\n"
	"compiles FILE.asc to FILE.o\n"
	"OPTIONS:\n"
	"-A API version : specify API version. this affects which functions\n"
	"   and data items are made available by global header agsdefns.sh.\n"
	"   supported values are:\n  ",
	argv0);
	for(unsigned i=0;apiv[i];++i) fprintf(stderr, " %s", apiv[i]);
	fprintf(stderr, "\n   default: 350\n"
	"-a ABI version: same as above, but restricts the emitted bytecode\n"
	"-f option=value: set a compiler option. recognized options:\n"
	);
	for(unsigned i=0; i < SCOPT_NUMOPTS; ++i)
		fprintf(stderr, "   %s (1/0) - %s\n",
			ccOptionNameString(1<<i),
			ccOptionHelpString(1<<i));
	for(unsigned i=0; cust_f_opts[i].name; ++i)
		fprintf(stderr, "   %s (---) - %s\n",
			cust_f_opts[i].name, cust_f_opts[i].help);
	fprintf(stderr,
	"-i systemheaderdir : provide path to system headers\n"
	"   this is the path containing implicitly included headers (atm only agsdefns.sh).\n"
	"-H 1.ash[:2.ash...] : colon-separated list of headers to include.\n"
	"   order matters. AGS editor automatically includes all headers\n"
	"   it finds in the game dir, but here you need to specify them.\n"
	"-o filename : explicitily specify output file name\n"
	"-P preprocessor : use `preprocessor` on files before running the built-in\n"
	"   one on them. example: -P \"cpp -P\". note that you if you use a\n"
	"   standard C preprocessor, linenumber directives need to be supressed\n"
	"   as in the example cpp command.\n"
	"-D macro[=val] : define preprocessor macro\n"
	"-E : run preprocessor only (create file with .i extension)\n"
	"-W : warn about non-fatal errors parsing system headers\n"
	"-g : turn on debug info\n"
	"-S : write textual assembly instead of binary (requires agsdisas)\n"
	);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq 0x3c7ad(%rip), %rax     # 0x41fc0
movq (%rax), %rdi
movq -0x8(%rbp), %rdx
leaq 0x2bb29(%rip), %rsi     # 0x3134a
movb $0x0, %al
callq 0x4550
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x3cb65(%rip), %rax     # 0x423a0
cmpq $0x0, (%rax,%rcx,8)
je 0x5875
movq 0x3c777(%rip), %rax     # 0x41fc0
movq (%rax), %rdi
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x3cb48(%rip), %rax     # 0x423a0
movq (%rax,%rcx,8), %rdx
leaq 0x2de64(%rip), %rsi     # 0x336c7
movb $0x0, %al
callq 0x4550
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x582f
movq 0x3c744(%rip), %rax     # 0x41fc0
movq (%rax), %rdi
leaq 0x2bba8(%rip), %rsi     # 0x3142e
movb $0x0, %al
callq 0x4550
movl $0x0, -0x10(%rbp)
cmpl $0xc, -0x10(%rbp)
jae 0x58ee
movq 0x3c71f(%rip), %rax     # 0x41fc0
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movl -0x10(%rbp), %ecx
movl $0x1, %edi
shll %cl, %edi
callq 0x264e0
movq %rax, -0x20(%rbp)
movl -0x10(%rbp), %ecx
movl $0x1, %edi
shll %cl, %edi
callq 0x26460
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq %rax, %rcx
leaq 0x2bbe2(%rip), %rsi     # 0x314be
movb $0x0, %al
callq 0x4550
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x5894
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0x3c29f(%rip), %rax     # 0x41ba0
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x595e
movq 0x3c6ab(%rip), %rax     # 0x41fc0
movq (%rax), %rdi
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0x3c27c(%rip), %rax     # 0x41ba0
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdx
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0x3c266(%rip), %rax     # 0x41ba0
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rcx
leaq 0x2bb84(%rip), %rsi     # 0x314d0
movb $0x0, %al
callq 0x4550
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x58f5
movq 0x3c65b(%rip), %rax     # 0x41fc0
movq (%rax), %rdi
leaq 0x2bb73(%rip), %rsi     # 0x314e2
movb $0x0, %al
callq 0x4550
movl $0x1, %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)