// File: /workspace/github_c_makefile_star2_O0/FredTheDino[P]Fog/src/engine/unix_assets.cpp
// Function: main
int main(int nargs, char **vargs) {
    // Image file formats
    valid_endings[".psd"] = Asset::Type::TEXTURE;
    valid_endings[".png"] = Asset::Type::TEXTURE;
    valid_endings[".jpg"] = Asset::Type::TEXTURE;
    valid_endings[".bmp"] = Asset::Type::TEXTURE;
    // .sdf is for the font files, they are loaded
    // in the font pass only if there is a matching
    // .fnt file.

    // Fonts
    valid_endings[".fnt"] = Asset::Type::FONT;

    // Sprite
    valid_endings[".spr"] = Asset::Type::SPRITE;

    // Sound
    valid_endings[".wav"] = Asset::Type::SOUND;
    // TODO(ed): This might be nice to have
    // valid_endings[".ogg"] = Asset::Type::SOUND;

    // Shader
    valid_endings[".glsl"] = Asset::Type::SHADER;

    // Config files? Is this a good idea?
    valid_endings[".cfg"] = Asset::Type::CONFIG;

    printf("\n\t=== FINDING ===\n");

    // TODO(ed): Some form of compression on this data
    // would make it a lot less space savy
    AssetFile file = {};
    const char *out_path = "bin/data.fog";
    for (int i = 0; i < nargs; i++) {
        if (std::strcmp(vargs[i], "-o") == 0) {
            out_path = vargs[++i];
        } else {
            std::string path = vargs[i];
            process_asset(&file, &path);
        }
    }

    printf("\t=== WRITING ===\n");

    dump_asset_file(&file, out_path);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2c0, %rsp            # imm = 0x2C0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x2480
movq -0x218(%rbp), %rdx
leaq 0x1f82c(%rip), %rsi     # 0x28b53
leaq -0x30(%rbp), %rdi
callq 0x212f0
jmp 0x9332
leaq 0x2a02f(%rip), %rdi     # 0x33368
leaq -0x30(%rbp), %rsi
callq 0x21750
movq %rax, -0x220(%rbp)
jmp 0x934b
movq -0x220(%rbp), %rax
movl $0x1, (%rax)
leaq -0x30(%rbp), %rdi
callq 0x2170
leaq -0x31(%rbp), %rdi
callq 0x22b0
leaq -0x69(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0x2480
movq -0x228(%rbp), %rdx
leaq 0x1f7d0(%rip), %rsi     # 0x28b58
leaq -0x68(%rbp), %rdi
callq 0x212f0
jmp 0x9393
leaq 0x29fce(%rip), %rdi     # 0x33368
leaq -0x68(%rbp), %rsi
callq 0x21750
movq %rax, -0x230(%rbp)
jmp 0x93ac
movq -0x230(%rbp), %rax
movl $0x1, (%rax)
leaq -0x68(%rbp), %rdi
callq 0x2170
leaq -0x69(%rbp), %rdi
callq 0x22b0
leaq -0x91(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0x2480
movq -0x238(%rbp), %rdx
leaq 0x1f771(%rip), %rsi     # 0x28b5d
leaq -0x90(%rbp), %rdi
callq 0x212f0
jmp 0x93fa
leaq 0x29f67(%rip), %rdi     # 0x33368
leaq -0x90(%rbp), %rsi
callq 0x21750
movq %rax, -0x240(%rbp)
jmp 0x9416
movq -0x240(%rbp), %rax
movl $0x1, (%rax)
leaq -0x90(%rbp), %rdi
callq 0x2170
leaq -0x91(%rbp), %rdi
callq 0x22b0
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x2480
movq -0x248(%rbp), %rdx
leaq 0x1f706(%rip), %rsi     # 0x28b62
leaq -0xb8(%rbp), %rdi
callq 0x212f0
jmp 0x946a
leaq 0x29ef7(%rip), %rdi     # 0x33368
leaq -0xb8(%rbp), %rsi
callq 0x21750
movq %rax, -0x250(%rbp)
jmp 0x9486
movq -0x250(%rbp), %rax
movl $0x1, (%rax)
leaq -0xb8(%rbp), %rdi
callq 0x2170
leaq -0xb9(%rbp), %rdi
callq 0x22b0
leaq -0xe1(%rbp), %rdi
movq %rdi, -0x258(%rbp)
callq 0x2480
movq -0x258(%rbp), %rdx
leaq 0x1f69b(%rip), %rsi     # 0x28b67
leaq -0xe0(%rbp), %rdi
callq 0x212f0
jmp 0x94da
leaq 0x29e87(%rip), %rdi     # 0x33368
leaq -0xe0(%rbp), %rsi
callq 0x21750
movq %rax, -0x260(%rbp)
jmp 0x94f6
movq -0x260(%rbp), %rax
movl $0x2, (%rax)
leaq -0xe0(%rbp), %rdi
callq 0x2170
leaq -0xe1(%rbp), %rdi
callq 0x22b0
leaq -0x109(%rbp), %rdi
movq %rdi, -0x268(%rbp)
callq 0x2480
movq -0x268(%rbp), %rdx
leaq 0x1f630(%rip), %rsi     # 0x28b6c
leaq -0x108(%rbp), %rdi
callq 0x212f0
jmp 0x954a
leaq 0x29e17(%rip), %rdi     # 0x33368
leaq -0x108(%rbp), %rsi
callq 0x21750
movq %rax, -0x270(%rbp)
jmp 0x9566
movq -0x270(%rbp), %rax
movl $0x3, (%rax)
leaq -0x108(%rbp), %rdi
callq 0x2170
leaq -0x109(%rbp), %rdi
callq 0x22b0
leaq -0x131(%rbp), %rdi
movq %rdi, -0x278(%rbp)
callq 0x2480
movq -0x278(%rbp), %rdx
leaq 0x1f5c5(%rip), %rsi     # 0x28b71
leaq -0x130(%rbp), %rdi
callq 0x212f0
jmp 0x95ba
leaq 0x29da7(%rip), %rdi     # 0x33368
leaq -0x130(%rbp), %rsi
callq 0x21750
movq %rax, -0x280(%rbp)
jmp 0x95d6
movq -0x280(%rbp), %rax
movl $0x4, (%rax)
leaq -0x130(%rbp), %rdi
callq 0x2170
leaq -0x131(%rbp), %rdi
callq 0x22b0
leaq -0x159(%rbp), %rdi
movq %rdi, -0x288(%rbp)
callq 0x2480
movq -0x288(%rbp), %rdx
leaq 0x1f55a(%rip), %rsi     # 0x28b76
leaq -0x158(%rbp), %rdi
callq 0x212f0
jmp 0x962a
leaq 0x29d37(%rip), %rdi     # 0x33368
leaq -0x158(%rbp), %rsi
callq 0x21750
movq %rax, -0x290(%rbp)
jmp 0x9646
movq -0x290(%rbp), %rax
movl $0x5, (%rax)
leaq -0x158(%rbp), %rdi
callq 0x2170
leaq -0x159(%rbp), %rdi
callq 0x22b0
leaq -0x181(%rbp), %rdi
movq %rdi, -0x298(%rbp)
callq 0x2480
movq -0x298(%rbp), %rdx
leaq 0x1f4f0(%rip), %rsi     # 0x28b7c
leaq -0x180(%rbp), %rdi
callq 0x212f0
jmp 0x969a
leaq 0x29cc7(%rip), %rdi     # 0x33368
leaq -0x180(%rbp), %rsi
callq 0x21750
movq %rax, -0x2a0(%rbp)
jmp 0x96b6
movq -0x2a0(%rbp), %rax
movl $0x6, (%rax)
leaq -0x180(%rbp), %rdi
callq 0x2170
leaq -0x181(%rbp), %rdi
callq 0x22b0
leaq 0x1f49f(%rip), %rdi     # 0x28b81
movb $0x0, %al
callq 0x2050
leaq -0x1d8(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x2150
leaq -0x1d8(%rbp), %rdi
addq $0x20, %rdi
movq %rdi, -0x2b0(%rbp)
xorl %esi, %esi
movl $0x18, %edx
callq 0x2150
movq -0x2b0(%rbp), %rdi
callq 0x21780
leaq -0x1d8(%rbp), %rdi
addq $0x38, %rdi
movq %rdi, -0x2a8(%rbp)
xorl %esi, %esi
movl $0x18, %edx
callq 0x2150
movq -0x2a8(%rbp), %rdi
callq 0x217a0
leaq 0x1f43d(%rip), %rax     # 0x28b94
movq %rax, -0x1e0(%rbp)
movl $0x0, -0x1e4(%rbp)
movl -0x1e4(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x9a62
movq -0x10(%rbp), %rax
movslq -0x1e4(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x1f414(%rip), %rsi     # 0x28ba1
callq 0x2390
cmpl $0x0, %eax
jne 0x99a4
movq -0x10(%rbp), %rax
movl -0x1e4(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x1e4(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x1e0(%rbp)
jmp 0x9a4c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x97e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x2170
leaq -0x31(%rbp), %rdi
callq 0x22b0
jmp 0x9ab7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x9815
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x2170
leaq -0x69(%rbp), %rdi
callq 0x22b0
jmp 0x9ab7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x9849
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x2170
leaq -0x91(%rbp), %rdi
callq 0x22b0
jmp 0x9ab7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x9880
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x2170
leaq -0xb9(%rbp), %rdi
callq 0x22b0
jmp 0x9ab7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x98b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x2170
leaq -0xe1(%rbp), %rdi
callq 0x22b0
jmp 0x9ab7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x98ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x2170
leaq -0x109(%rbp), %rdi
callq 0x22b0
jmp 0x9ab7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x9925
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x2170
leaq -0x131(%rbp), %rdi
callq 0x22b0
jmp 0x9ab7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x995c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x2170
leaq -0x159(%rbp), %rdi
callq 0x22b0
jmp 0x9ab7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x9993
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x2170
leaq -0x181(%rbp), %rdi
callq 0x22b0
jmp 0x9ab7
movq -0x10(%rbp), %rax
movslq -0x1e4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x2c0(%rbp)
leaq -0x209(%rbp), %rdi
movq %rdi, -0x2b8(%rbp)
callq 0x2480
movq -0x2c0(%rbp), %rsi
movq -0x2b8(%rbp), %rdx
leaq -0x208(%rbp), %rdi
callq 0x212f0
jmp 0x99e9
leaq -0x209(%rbp), %rdi
callq 0x22b0
leaq -0x1d8(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x8730
jmp 0x9a0a
leaq -0x208(%rbp), %rdi
callq 0x2170
jmp 0x9a4c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x209(%rbp), %rdi
callq 0x22b0
jmp 0x9aab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x2170
jmp 0x9aab
jmp 0x9a4e
movl -0x1e4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1e4(%rbp)
jmp 0x9768
leaq 0x1f13b(%rip), %rdi     # 0x28ba4
xorl %eax, %eax
callq 0x2050
jmp 0x9a72
movq -0x1e0(%rbp), %rsi
leaq -0x1d8(%rbp), %rdi
callq 0x8be0
jmp 0x9a87
leaq -0x1d8(%rbp), %rdi
callq 0x217c0
movl -0x4(%rbp), %eax
addq $0x2c0, %rsp            # imm = 0x2C0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x217c0
movq -0x40(%rbp), %rdi
callq 0x2470