// File: pixlark[P]Badge/src/files.cc
// Function: Files::init(char const*)
void init(const char * first_file)
	{
		Files::first_file = strdup(first_file);
		
		{ // set cwd
			char buf[path_max];
			getcwd(buf, path_max);

			String_Builder builder;
			builder.append(buf);
			builder.append("/");
			cwd = builder.final_string();
		}
		{ // set running_dir
			size_t i = strlen(first_file);
			while (i > 0 && first_file[i - 1] != '/') {
				i--;
			}
			
			String_Builder builder;
			builder.append(cwd);
			if (i == 0) {
				// @Hack kind of a hack
				builder.append("./");
			} else {
				builder.append_size(first_file, i);
			}
			
			running_dir = builder.final_string();
		}
		{ // set stdlib dir
			String_Builder builder;
			auto env_variable = getenv("BADGE_STDLIB_PATH");
			if (!env_variable) {
				fatal("$BADGE_STDLIB_PATH not set!");
			}
			builder.append(env_variable);
			if (builder.at(builder.size() - 1) != '/') {
				builder.append("/");
			}
			stdlib_dir = builder.final_string();
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10e0, %rsp           # imm = 0x10E0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x11d0
movq %rax, 0x15269(%rip)     # 0x17268
leaq -0x1010(%rbp), %rdi
movq %rdi, -0x10b0(%rbp)
movl $0x1000, %esi           # imm = 0x1000
callq 0x10a0
leaq -0x1038(%rbp), %rdi
movq %rdi, -0x10b8(%rbp)
callq 0x1450
movq -0x10b8(%rbp), %rdi
movq -0x10b0(%rbp), %rsi
callq 0x14f0
jmp 0x203f
leaq 0xe471(%rip), %rsi      # 0x104b7
leaq -0x1038(%rbp), %rdi
callq 0x14f0
jmp 0x2054
leaq -0x1038(%rbp), %rdi
callq 0x15c0
movq %rax, 0x15209(%rip)     # 0x17270
leaq -0x1038(%rbp), %rdi
callq 0x1490
movq -0x8(%rbp), %rdi
callq 0x1080
movq %rax, -0x1050(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x1050(%rbp)
movb %al, -0x10b9(%rbp)
jbe 0x20b4
movq -0x8(%rbp), %rax
movq -0x1050(%rbp), %rcx
subq $0x1, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
setne %al
movb %al, -0x10b9(%rbp)
movb -0x10b9(%rbp), %al
testb $0x1, %al
jne 0x20c0
jmp 0x20f7
movq -0x1050(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x1050(%rbp)
jmp 0x2083
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1040(%rbp)
movl %eax, -0x1044(%rbp)
leaq -0x1038(%rbp), %rdi
callq 0x1490
jmp 0x228a
leaq -0x1078(%rbp), %rdi
movq %rdi, -0x10c8(%rbp)
callq 0x1450
movq -0x10c8(%rbp), %rdi
movq 0x15158(%rip), %rsi     # 0x17270
callq 0x14f0
jmp 0x211f
cmpq $0x0, -0x1050(%rbp)
jne 0x2163
leaq 0xe386(%rip), %rsi      # 0x104b6
leaq -0x1078(%rbp), %rdi
callq 0x14f0
jmp 0x213e
jmp 0x217e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1040(%rbp)
movl %eax, -0x1044(%rbp)
leaq -0x1078(%rbp), %rdi
callq 0x1490
jmp 0x228a
movq -0x8(%rbp), %rsi
movq -0x1050(%rbp), %rdx
leaq -0x1078(%rbp), %rdi
callq 0x1560
jmp 0x217c
jmp 0x217e
leaq -0x1078(%rbp), %rdi
callq 0x15c0
movq %rax, 0x150e7(%rip)     # 0x17278
leaq -0x1078(%rbp), %rdi
callq 0x1490
leaq -0x10a0(%rbp), %rdi
callq 0x1450
leaq 0xe309(%rip), %rdi      # 0x104b9
callq 0x1140
movq %rax, -0x10a8(%rbp)
cmpq $0x0, -0x10a8(%rbp)
jne 0x21fb
leaq 0xe2fe(%rip), %rdi      # 0x104cb
xorl %eax, %eax
callq 0x1c50
jmp 0x21d6
jmp 0x21fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1040(%rbp)
movl %eax, -0x1044(%rbp)
leaq -0x10a0(%rbp), %rdi
callq 0x1490
jmp 0x228a
movq -0x10a8(%rbp), %rsi
leaq -0x10a0(%rbp), %rdi
callq 0x14f0
jmp 0x2210
leaq -0x10a0(%rbp), %rdi
movq %rdi, -0x10d8(%rbp)
callq 0x1620
movq -0x10d8(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x1640
movb %al, -0x10c9(%rbp)
jmp 0x223d
movb -0x10c9(%rbp), %al
movsbl %al, %eax
cmpl $0x2f, %eax
je 0x2262
leaq 0xe265(%rip), %rsi      # 0x104b7
leaq -0x10a0(%rbp), %rdi
callq 0x14f0
jmp 0x2260
jmp 0x2262
leaq -0x10a0(%rbp), %rdi
callq 0x15c0
movq %rax, 0x1500b(%rip)     # 0x17280
leaq -0x10a0(%rbp), %rdi
callq 0x1490
addq $0x10e0, %rsp           # imm = 0x10E0
popq %rbp
retq
movq -0x1040(%rbp), %rdi
callq 0x11c0
nopw %cs:(%rax,%rax)