LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/stream.cpp
// Function: addpackagedir(char const*)
const char *addpackagedir(const char *dir)
{
    string pdir;
    copystring(pdir, dir);
    if(!subhomedir(pdir, sizeof(pdir), dir) || !fixpackagedir(pdir)) return NULL;
    char *filter = pdir;
    for(;;)
    {
        static int len = strlen("packages");
        filter = strstr(filter, "packages");
        if(!filter) break;
        if(filter > pdir && filter[-1] == PATHDIV && filter[len] == PATHDIV) break;
        filter += len;
    }    
    packagedir &pf = packagedirs.add();
    pf.dir = filter ? newstring(pdir, filter-pdir) : newstring(pdir);
    pf.dirlen = filter ? filter-pdir : strlen(pdir);
    pf.filter = filter ? newstring(filter) : NULL;
    pf.filterlen = filter ? strlen(filter) : 0;
    return pf.dir;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, %rbx
leaq -0x120(%rbp), %r14
movl $0x104, %edx            # imm = 0x104
movq %r14, %rdi
movq %rbx, %rsi
callq 0xd24d
movq %r14, %rdi
movl $0x104, %esi            # imm = 0x104
movq %rbx, %rdx
callq 0xe3ae
testb %al, %al
je 0xe564
leaq -0x120(%rbp), %rbx
movq %rbx, %rdi
callq 0xe37f
testq %rax, %rax
je 0xe564
leaq 0x4284(%rip), %r15      # 0x127b9
movq %rbx, %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x2040
movq %rax, %r14
testq %rax, %rax
je 0xe569
cmpq %rbx, %r14
jbe 0xe55e
cmpb $0x2f, -0x1(%r14)
jne 0xe55e
cmpb $0x2f, 0x8(%r14)
je 0xe569
addq $0x8, %r14
jmp 0xe538
xorl %r14d, %r14d
jmp 0xe5de
leaq 0xbce8(%rip), %rdi      # 0x1a258
callq 0xef78
movq %rax, %rbx
testq %r14, %r14
je 0xe5b2
leaq -0x120(%rbp), %rdi
movq %r14, %r15
subq %rdi, %r15
movq %r15, %rsi
callq 0xd339
movq %rax, (%rbx)
movq %r15, 0x10(%rbx)
movq %r14, %rdi
callq 0xd0ec
movq %rax, 0x8(%rbx)
movq %r14, %rdi
callq 0x20a0
movq (%rbx), %r14
jmp 0xe5da
leaq -0x120(%rbp), %r15
movq %r15, %rdi
callq 0xd0ec
movq %rax, %r14
movq %rax, (%rbx)
movq %r15, %rdi
callq 0x20a0
movq %rax, 0x10(%rbx)
andq $0x0, 0x8(%rbx)
xorl %eax, %eax
movq %rax, 0x18(%rbx)
movq %r14, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/stream.cpp
// Function: listfiles(char const*, char const*, vector<char*>&)
int listfiles(const char *dir, const char *ext, vector<char *> &files)
{
    string dirname;
    copystring(dirname, dir);
    path(dirname);
    size_t dirlen = strlen(dirname);
    while(dirlen > 1 && dirname[dirlen-1] == PATHDIV) dirname[--dirlen] = '\0';
    int dirs = 0;
    if(listdir(dirname, true, ext, files)) dirs++;
    string s;
    if(homedir[0])
    {
        formatstring(s)("%s%s", homedir, dirname);
        if(listdir(s, false, ext, files)) dirs++;
    }
    loopv(packagedirs)
    {
        packagedir &pf = packagedirs[i];
        if(pf.filter && strncmp(dirname, pf.filter, dirlen == pf.filterlen-1 ? dirlen : pf.filterlen))
            continue;
        formatstring(s)("%s%s", pf.dir, dirname);
        if(listdir(s, false, ext, files)) dirs++;
    }

    return dirs;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rsi
leaq -0x150(%rbp), %rbx
movl $0x104, %edx            # imm = 0x104
movq %rbx, %rdi
callq 0xd24d
movq %rbx, %rdi
callq 0xe156
movq %rbx, %rdi
callq 0x20a0
movq %rax, %r15
cmpq $0x2, %r15
jb 0xe912
cmpb $0x2f, -0x151(%rbp,%r15)
jne 0xe912
movb $0x0, -0x151(%rbp,%r15)
decq %r15
jmp 0xe8f3
leaq -0x150(%rbp), %rdi
pushq $0x1
popq %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0xe79d
movzbl %al, %r13d
cmpb $0x0, 0xb81e(%rip)      # 0x1a150
movq %r14, -0x48(%rbp)
movq %r12, -0x40(%rbp)
je 0xe988
leaq -0x260(%rbp), %rbx
leaq -0x38(%rbp), %rdi
movq %rbx, (%rdi)
leaq 0x3e71(%rip), %rsi      # 0x127c2
leaq 0xb7f8(%rip), %rdx      # 0x1a150
leaq -0x150(%rbp), %rcx
xorl %eax, %eax
callq 0xd450
movq %rbx, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r14, %rcx
callq 0xe79d
leal 0x1(%r13), %ecx
testb %al, %al
cmovel %r13d, %ecx
movl %ecx, %eax
movq %rax, -0x30(%rbp)
jmp 0xe98c
movq %r13, -0x30(%rbp)
movl 0xb8d2(%rip), %ebx      # 0x1a264
xorl %r14d, %r14d
xorl %r13d, %r13d
movslq %ebx, %rax
cmpq %rax, %r13
jge 0xea2e
movq 0xb8ad(%rip), %r12      # 0x1a258
movq 0x8(%r12,%r14), %rsi
testq %rsi, %rsi
je 0xe9d5
movq 0x18(%r12,%r14), %rdx
leaq -0x1(%rdx), %rax
cmpq %r15, %rax
cmoveq %r15, %rdx
leaq -0x150(%rbp), %rdi
callq 0x20c0
testl %eax, %eax
jne 0xea22
leaq -0x260(%rbp), %rbx
movq %rbx, -0x38(%rbp)
movq (%r12,%r14), %rdx
leaq -0x38(%rbp), %rdi
leaq 0x3dd3(%rip), %rsi      # 0x127c2
leaq -0x150(%rbp), %rcx
xorl %eax, %eax
callq 0xd450
movq %rbx, %rdi
xorl %esi, %esi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rcx
callq 0xe79d
movzbl %al, %eax
movq -0x30(%rbp), %rcx
addl %eax, %ecx
movq %rcx, -0x30(%rbp)
movl 0xb842(%rip), %ebx      # 0x1a264
incq %r13
addq $0x20, %r14
jmp 0xe998
movq -0x30(%rbp), %rax
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/stream.cpp
// Function: stream::size()
stream::offset stream::size()
{
    offset pos = tell(), endpos;
    if(pos < 0 || !seek(0, SEEK_END)) return -1;
    endpos = tell();
    return pos == endpos || seek(pos, SEEK_SET) ? endpos : -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
movq (%rdi), %rax
callq *0x20(%rax)
pushq $-0x1
popq %rbx
testq %rax, %rax
js 0xea9b
movq %rax, %r15
movq (%r14), %rax
pushq $0x2
popq %rdx
movq %r14, %rdi
xorl %esi, %esi
callq *0x30(%rax)
testb %al, %al
je 0xea9b
movq (%r14), %rax
movq %r14, %rdi
callq *0x20(%rax)
movq %rax, %r12
cmpq %rax, %r15
je 0xea98
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq *0x30(%rax)
testb %al, %al
je 0xea9b
movq %r12, %rbx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/stream.cpp
// Function: stream::getline(char*, unsigned long)
bool stream::getline(char *str, size_t len)
{
    loopi(len-1)
    {
        if(read(&str[i], 1) != 1) { str[i] = '\0'; return i > 0; }
        else if(str[i] == '\n') { str[i+1] = '\0'; return true; }
    }
    if(len > 0) str[len-1] = '\0';
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r15
movq %rdx, -0x38(%rbp)
leaq -0x1(%rdx), %rcx
xorl %r14d, %r14d
testl %ecx, %ecx
movl $0x0, %r12d
movq %rcx, -0x30(%rbp)
cmovgl %ecx, %r12d
cmpq %r14, %r12
je 0xeb04
leaq (%rbx,%r14), %r13
movq (%r15), %rax
movq %r15, %rdi
movq %r13, %rsi
pushq $0x1
popq %rdx
callq *0x48(%rax)
cmpq $0x1, %rax
jne 0xeb17
cmpb $0xa, (%r13)
je 0xeb24
incq %r14
jmp 0xeada
movb $0x1, %al
cmpq $0x0, -0x38(%rbp)
je 0xeb2c
movq -0x30(%rbp), %rcx
movb $0x0, (%rbx,%rcx)
jmp 0xeb2c
movb $0x0, (%rbx,%r14)
testq %r14, %r14
setne %al
jmp 0xeb2c
movb $0x0, 0x1(%rbx,%r14)
movb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/stream.cpp
// Function: stream::printf(char const*, ...)
size_t stream::printf(const char *fmt, ...)
{
    char buf[512];
    char *str = buf;
    va_list args;
#if defined(WIN32) && !defined(__GNUC__)
    va_start(args, fmt);
    int len = _vscprintf(fmt, args);
    if(len <= 0) { va_end(args); return 0; }
    if(len >= (int)sizeof(buf)) str = new char[len+1];
    _vsnprintf(str, len+1, fmt, args);
    va_end(args);
#else
    va_start(args, fmt);
    int len = vsnprintf(buf, sizeof(buf), fmt, args);
    va_end(args);
    if(len <= 0) return 0;
    if(len >= (int)sizeof(buf))
    {
        str = new char[len+1];
        va_start(args, fmt);
        vsnprintf(str, len+1, fmt, args);
        va_end(args);
    }
#endif
    size_t n = write(str, len);
    if(str != buf) delete[] str;
    return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2d8, %rsp            # imm = 0x2D8
movq %rsi, %r15
movq %rdi, %rbx
leaq -0x100(%rbp), %r14
movq %rdx, 0x10(%r14)
movq %rcx, 0x18(%r14)
movq %r8, 0x20(%r14)
movq %r9, 0x28(%r14)
testb %al, %al
je 0xeba0
movaps %xmm0, -0xd0(%rbp)
movaps %xmm1, -0xc0(%rbp)
movaps %xmm2, -0xb0(%rbp)
movaps %xmm3, -0xa0(%rbp)
movaps %xmm4, -0x90(%rbp)
movaps %xmm5, -0x80(%rbp)
movaps %xmm6, -0x70(%rbp)
movaps %xmm7, -0x60(%rbp)
leaq -0x50(%rbp), %rcx
movq %r14, 0x10(%rcx)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rcx)
leaq -0x300(%rbp), %r12
movl $0x200, %esi            # imm = 0x200
movq %r12, %rdi
movq %r15, %rdx
callq 0x2100
testl %eax, %eax
jle 0xec46
movl %eax, %r13d
cmpl $0x200, %eax            # imm = 0x200
jb 0xec1e
leal 0x1(%r13), %edi
movq %rdi, -0x30(%rbp)
callq 0xf989
movq %rax, %r12
leaq -0x50(%rbp), %rcx
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rcx)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%rcx)
movq %r14, 0x10(%rcx)
movq %r12, %rdi
movq -0x30(%rbp), %rsi
movq %r15, %rdx
callq 0x2100
movl %r13d, %edx
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
callq *0x50(%rax)
movq %rax, %rbx
leaq -0x300(%rbp), %rax
cmpq %rax, %r12
je 0xec48
movq %r12, %rdi
callq 0xf9a8
jmp 0xec48
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x2d8, %rsp            # imm = 0x2D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/stream.cpp
// Function: openrawfile(char const*, char const*)
stream *openrawfile(const char *filename, const char *mode)
{
    const char *found = findfile(filename, mode);
    if(!found) return NULL;
    filestream *file = new filestream;
    if(!file->open(found, mode)) { delete file; return NULL; }
    return file;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
callq 0xe5ef
testq %rax, %rax
je 0xecac
movq %rax, %r15
pushq $0x10
popq %rdi
callq 0xf974
movq %rax, %rbx
leaq 0x9fc7(%rip), %rax      # 0x18c50
movq %rax, (%rbx)
andq $0x0, 0x8(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xefae
testb %al, %al
jne 0xecae
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/stream.cpp
// Function: opentempfile(char const*, char const*)
stream *opentempfile(const char *name, const char *mode)
{
    const char *found = findfile(name, mode);
    filestream *file = new filestream;
    if(!file->opentemp(found ? found : name, mode)) { delete file; return NULL; }
    return file;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0xe5ef
movq %rax, %r12
pushq $0x10
popq %rdi
callq 0xf974
movq %rax, %rbx
leaq 0x9f5f(%rip), %rax      # 0x18c50
movq %rax, (%rbx)
andq $0x0, 0x8(%rbx)
testq %r12, %r12
cmoveq %r15, %r12
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0xefde
testb %al, %al
jne 0xed1d
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/stream.cpp
// Function: openutf8file(char const*, char const*, stream*)
stream *openutf8file(const char *filename, const char *mode, stream *file)
{
    stream *source = file ? file : openfile(filename, mode);
    if(!source) return NULL;
    utf8stream *utf8 = new utf8stream;
    if(!utf8->open(source, mode, !file)) { if(!file) delete source; return NULL; }
    return utf8;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdx, %rbx
testq %rdx, %rdx
jne 0xed55
movq %r14, %rsi
callq 0xec5d
movq %rax, %rbx
testq %rax, %rax
je 0xedb8
xorl %r12d, %r12d
testq %r15, %r15
setne %r13b
sete %r12b
movl $0x1038, %edi           # imm = 0x1038
callq 0xf974
movq %rax, %r15
leaq 0x9f99(%rip), %rax      # 0x18d10
movq %rax, (%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%r15)
movups %xmm0, 0x18(%r15)
movups %xmm0, 0x23(%r15)
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movl %r12d, %ecx
callq 0xf008
movl %eax, %ecx
orb %al, %r13b
xorl %eax, %eax
testb %cl, %cl
cmovneq %r15, %rax
testb %r13b, %r13b
jne 0xedba
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/stream.cpp
// Function: loadfile(char const*, unsigned long*, bool)
char *loadfile(const char *fn, size_t *size, bool utf8)
{
    stream *f = openfile(fn, "rb");
    if(!f) return NULL;
    size_t len = f->size();
    if(len <= 0) { delete f; return NULL; }
    char *buf = new char[len+1];
    if(!buf) { delete f; return NULL; }
    size_t offset = 0;
    if(utf8 && len >= 3)
    {
        if(f->read(buf, 3) != 3) { delete f; delete[] buf; return NULL; }
        if(((uchar *)buf)[0] == 0xEF && ((uchar *)buf)[1] == 0xBB && ((uchar *)buf)[2] == 0xBF) len -= 3;
        else offset += 3;
    } 
    size_t rlen = f->read(&buf[offset], len-offset);
    delete f;
    if(rlen != len-offset) { delete[] buf; return NULL; }
    if(utf8) len = decodeutf8((uchar *)buf, len, (uchar *)buf, len);
    buf[len] = '\0';
    if(size!=NULL) *size = len;
    return buf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r14d
movq %rsi, %r15
leaq 0x39e5(%rip), %rsi      # 0x127cc
callq 0xec5d
testq %rax, %rax
je 0xeeef
movq %rax, %r13
movq (%rax), %rax
movq %r13, %rdi
callq *0x38(%rax)
testq %rax, %rax
je 0xee6f
movq %rax, %r12
leaq 0x1(%rax), %rdi
callq 0xf989
movq %rax, %rbx
cmpq $0x3, %r12
setb %al
movl %r14d, -0x34(%rbp)
movl %r14d, %ecx
xorb $0x1, %cl
orb %al, %cl
jne 0xee7b
movq (%r13), %rax
pushq $0x3
popq %r14
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq *0x48(%rax)
cmpq $0x3, %rax
jne 0xeedd
cmpb $-0x11, (%rbx)
movq %r15, -0x30(%rbp)
jne 0xee82
cmpb $-0x45, 0x1(%rbx)
jne 0xee82
leaq -0x3(%r12), %rax
xorl %ecx, %ecx
cmpb $-0x41, 0x2(%rbx)
setne %cl
cmoveq %rax, %r12
leaq (%rcx,%rcx,2), %r14
jmp 0xee82
movq (%r13), %rax
movq %r13, %rdi
callq *0x8(%rax)
jmp 0xeeef
movq %r15, -0x30(%rbp)
xorl %r14d, %r14d
movq %rbx, %rsi
addq %r14, %rsi
movq %r12, %r15
subq %r14, %r15
movq (%r13), %rax
movq %r13, %rdi
movq %r15, %rdx
callq *0x48(%rax)
movq %rax, %r14
movq (%r13), %rax
movq %r13, %rdi
callq *0x8(%rax)
cmpq %r15, %r14
jne 0xeee7
cmpb $0x0, -0x34(%rbp)
je 0xeeca
movq %rbx, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0xdc48
movq %rax, %r12
movq -0x30(%rbp), %rax
movb $0x0, (%rbx,%r12)
testq %rax, %rax
je 0xeef1
movq %r12, (%rax)
jmp 0xeef1
movq (%r13), %rax
movq %r13, %rdi
callq *0x8(%rax)
movq %rbx, %rdi
callq 0xf9a8
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/stream.cpp
// Function: utf8stream::open(stream*, char const*, bool)
bool open(stream *f, const char *mode, bool needclose)
    {
        if(file) return false;
        for(; *mode; mode++)
        {
            if(*mode=='r') { reading = true; break; }
            else if(*mode=='w') { writing = true; break; }
        }
        if(!reading && !writing) return false;
       
        autoclose = needclose;
        file = f;
       
        if(reading) checkheader();
 
        return true;
    }

// Assembly:
cmpq $0x0, 0x8(%rdi)
je 0xf012
xorl %eax, %eax
retq
pushq %rbp
movq %rsp, %rbp
movzbl (%rdx), %eax
testl %eax, %eax
je 0xf036
cmpl $0x77, %eax
je 0xf032
cmpl $0x72, %eax
je 0xf02c
incq %rdx
jmp 0xf016
movb $0x1, 0x30(%rdi)
jmp 0xf036
movb $0x1, 0x31(%rdi)
cmpb $0x0, 0x30(%rdi)
je 0xf04a
movb %cl, 0x32(%rdi)
movq %rsi, 0x8(%rdi)
callq 0xf786
jmp 0xf057
cmpb $0x1, 0x31(%rdi)
jne 0xf05b
movb %cl, 0x32(%rdi)
movq %rsi, 0x8(%rdi)
movb $0x1, %al
jmp 0xf05d
xorl %eax, %eax
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/stream.cpp
// Function: utf8stream::seek(long, int)
bool seek(offset off, int whence)
    {
        if(writing || !reading) return false;

        if(whence == SEEK_END)
        {
            uchar skip[512];
            while(read(skip, sizeof(skip)) == sizeof(skip));
            return !off;
        }
        else if(whence == SEEK_CUR) off += pos;
       
        if(off >= pos) off -= pos;
        else if(off < 0 || !file->seek(0, SEEK_SET)) return false;
        else
        {
            bufread = bufcarry = buflen = 0;
            pos = 0;
            checkheader(); 
        }

        uchar skip[512];
        while(off > 0)
        {
            size_t skipped = (size_t)min(off, (offset)sizeof(skip));
            if(read(skip, skipped) != skipped) { stopreading(); return false; }
            off -= skipped;
        }
        
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
cmpb $0x0, 0x31(%rdi)
jne 0xf4e9
movq %rdi, %rbx
cmpb $0x1, 0x30(%rdi)
jne 0xf4e9
movq %rsi, %r14
cmpl $0x1, %edx
je 0xf45c
cmpl $0x2, %edx
jne 0xf465
leaq -0x230(%rbp), %r15
movq (%rbx), %rax
movl $0x200, %edx            # imm = 0x200
movq %rbx, %rdi
movq %r15, %rsi
callq *0x48(%rax)
cmpq $0x200, %rax            # imm = 0x200
je 0xf437
testq %r14, %r14
sete %r15b
jmp 0xf4ec
movq 0x10(%rbx), %rax
addq %rax, %r14
jmp 0xf469
movq 0x10(%rbx), %rax
movq %r14, %r13
subq %rax, %r13
jge 0xf4a4
testq %r14, %r14
js 0xf4e9
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
xorl %r15d, %r15d
xorl %esi, %esi
xorl %edx, %edx
callq *0x30(%rax)
testb %al, %al
je 0xf4ec
leaq 0x10(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq %rbx, %rdi
callq 0xf786
movq %r14, %r13
leaq -0x230(%rbp), %r14
testq %r13, %r13
setle %r15b
jle 0xf4ec
movl $0x200, %eax            # imm = 0x200
cmpq %rax, %r13
movl $0x200, %r12d           # imm = 0x200
cmovbq %r13, %r12
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq *0x48(%rax)
subq %r12, %r13
cmpq %r12, %rax
je 0xf4ab
cmpb $0x1, 0x30(%rbx)
jne 0xf4ec
movb $0x0, 0x30(%rbx)
jmp 0xf4ec
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/stream.cpp
// Function: utf8stream::read(void*, unsigned long)
size_t read(void *dst, size_t len)
    {
        if(!reading || !dst || !len) return 0;
        size_t next = 0;
        while(next < len)
        {
            if(bufread >= bufcarry) { if(readbuf(BUFSIZE)) continue; stopreading(); break; }
            size_t n = min(len - next, bufcarry - bufread);
            memcpy(&((uchar *)dst)[next], &buf[bufread], n);
            next += n;
            bufread += n;
        }
        pos += next;
        return next;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
xorl %ebx, %ebx
testq %rdx, %rdx
je 0xf595
testq %rsi, %rsi
je 0xf595
movq %rdi, %r14
cmpb $0x0, 0x30(%rdi)
je 0xf595
movq %rdx, %r12
movq %rsi, -0x38(%rbp)
leaq 0x33(%r14), %rax
movq %rax, -0x30(%rbp)
xorl %ebx, %ebx
movq %r12, %r15
subq %rbx, %r15
jbe 0xf591
movq 0x18(%r14), %rsi
movq 0x20(%r14), %r13
subq %rsi, %r13
ja 0xf561
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rdi
callq 0xf7d4
testb %al, %al
jne 0xf541
jmp 0xf585
cmpq %r13, %r15
cmovbq %r15, %r13
movq -0x38(%rbp), %rax
leaq (%rax,%rbx), %rdi
addq -0x30(%rbp), %rsi
movq %r13, %rdx
callq 0x2150
addq %r13, %rbx
addq %r13, 0x18(%r14)
jmp 0xf539
cmpb $0x1, 0x30(%r14)
jne 0xf591
movb $0x0, 0x30(%r14)
addq %rbx, 0x10(%r14)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/stream.cpp
// Function: utf8stream::write(void const*, unsigned long)
size_t write(const void *src, size_t len)
    {
        if(!writing || !src || !len) return 0;
        uchar dst[512];
        size_t next = 0;
        while(next < len)
        {
            size_t carry = 0, n = encodeutf8(dst, sizeof(dst), &((uchar *)src)[next], len - next, &carry);
            if(n > 0 && file->write(dst, n) != n) { stopwriting(); break; }
            next += carry;
        }
        pos += next;
        return next;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rdi, -0x30(%rbp)
xorl %ebx, %ebx
testq %rdx, %rdx
je 0xf64c
movq %rsi, %r12
testq %rsi, %rsi
je 0xf64c
movq -0x30(%rbp), %rax
cmpb $0x0, 0x31(%rax)
je 0xf64c
movq %rdx, %r15
xorl %ebx, %ebx
leaq -0x240(%rbp), %r13
movq %r15, %rcx
subq %rbx, %rcx
jbe 0xf644
andq $0x0, -0x38(%rbp)
leaq (%r12,%rbx), %rdx
movl $0x200, %esi            # imm = 0x200
movq %r13, %rdi
leaq -0x38(%rbp), %r8
callq 0xde93
testq %rax, %rax
je 0xf62c
movq %rax, %r14
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
movq %r13, %rsi
movq %r14, %rdx
callq *0x50(%rax)
cmpq %r14, %rax
jne 0xf632
addq -0x38(%rbp), %rbx
jmp 0xf5e9
movq -0x30(%rbp), %rax
cmpb $0x1, 0x31(%rax)
jne 0xf644
movq -0x30(%rbp), %rax
movb $0x0, 0x31(%rax)
movq -0x30(%rbp), %rax
addq %rbx, 0x10(%rax)
movq %rbx, %rax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/stream.cpp
// Function: utf8stream::getline(char*, unsigned long)
bool getline(char *dst, size_t len)
    {
        if(!reading || !dst || !len) return false;
        --len;
        size_t next = 0;
        while(next < len)
        {
            if(bufread >= bufcarry) { if(readbuf(BUFSIZE)) continue; stopreading(); if(!next) return false; break; }
            size_t n = min(len - next, bufcarry - bufread);
            uchar *endline = (uchar *)memchr(&buf[bufread], '\n', n);
            if(endline) { n = endline+1 - &buf[bufread]; len = next + n; } 
            memcpy(&((uchar *)dst)[next], &buf[bufread], n);
            next += n;
            bufread += n;
        }
        dst[next] = '\0';
        pos += next;
        return true;
    }

// Assembly:
xorl %eax, %eax
testq %rdx, %rdx
je 0xf784
testq %rsi, %rsi
je 0xf784
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
cmpb $0x0, 0x30(%rdi)
je 0xf776
movq %rdx, %r15
movq %rsi, -0x38(%rbp)
decq %r15
leaq 0x33(%rbx), %rax
movq %rax, -0x48(%rbp)
xorl %ecx, %ecx
movq %r15, %r14
subq %rcx, %r14
jbe 0xf764
movq %rcx, -0x40(%rbp)
movq 0x18(%rbx), %r13
movq 0x20(%rbx), %r12
subq %r13, %r12
ja 0xf6e8
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
callq 0xf7d4
testb %al, %al
jne 0xf6c8
jmp 0xf751
cmpq %r12, %r14
cmovbq %r14, %r12
addq -0x48(%rbp), %r13
movq %r13, %rdi
pushq $0xa
popq %rsi
movq %r12, %rdx
callq 0x21f0
movq %rax, %rcx
subq %r13, %rcx
testq %rax, %rax
movq %r15, -0x30(%rbp)
movq -0x40(%rbp), %r15
leaq 0x1(%rcx,%r15), %rax
movq -0x30(%rbp), %rdx
cmovneq %rax, %rdx
movq %rdx, -0x30(%rbp)
leaq 0x1(%rcx), %r14
cmoveq %r12, %r14
movq -0x38(%rbp), %rax
leaq (%rax,%r15), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x2150
movq %r15, %rcx
movq -0x30(%rbp), %r15
addq %r14, %rcx
addq %r14, 0x18(%rbx)
jmp 0xf6b8
cmpb $0x1, 0x30(%rbx)
jne 0xf75b
movb $0x0, 0x30(%rbx)
movq -0x40(%rbp), %rcx
testq %rcx, %rcx
je 0xf774
movq -0x38(%rbp), %rax
movb $0x0, (%rax,%rcx)
addq %rcx, 0x10(%rbx)
movb $0x1, %al
jmp 0xf776
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/stream.cpp
// Function: utf8stream::readbuf(unsigned long)
bool readbuf(size_t size = BUFSIZE)
    {
        if(bufread >= bufcarry) { if(bufcarry > 0 && bufcarry < buflen) memmove(buf, &buf[bufcarry], buflen - bufcarry); buflen -= bufcarry; bufread = bufcarry = 0; }
        size_t n = file->read(&buf[buflen], min(size, BUFSIZE - buflen));
        if(n <= 0) return false;
        buflen += n;
        size_t carry = bufcarry;
        bufcarry += decodeutf8(&buf[bufcarry], BUFSIZE-bufcarry, &buf[bufcarry], buflen-bufcarry, &carry);
        if(carry > bufcarry && carry < buflen) { memmove(&buf[bufcarry], &buf[carry], buflen - carry); buflen -= carry - bufcarry; }
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x20(%rdi), %rax
cmpq %rax, 0x18(%rdi)
jae 0xf7f8
movq 0x28(%rbx), %r15
jmp 0xf839
leaq 0x18(%rbx), %r12
testq %rax, %rax
setne %cl
movq 0x28(%rbx), %rdx
movq %rdx, %r15
subq %rax, %r15
seta %sil
andb %cl, %sil
cmpb $0x1, %sil
jne 0xf82d
leaq 0x33(%rbx), %rdi
leaq (%rbx,%rax), %rsi
addq $0x33, %rsi
subq %rax, %rdx
callq 0x2360
movq %r15, 0x28(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%r12)
movq 0x8(%rbx), %rdi
leaq (%rbx,%r15), %rsi
addq $0x33, %rsi
movl $0x1000, %r12d          # imm = 0x1000
movl $0x1000, %edx           # imm = 0x1000
subq %r15, %rdx
cmpq %rdx, %r14
cmovbq %r14, %rdx
movq (%rdi), %rax
callq *0x48(%rax)
movq %rax, %r14
testq %rax, %rax
je 0xf8d1
leaq 0x33(%rbx), %r15
movq 0x28(%rbx), %rcx
addq %r14, %rcx
movq %rcx, 0x28(%rbx)
movq 0x20(%rbx), %rax
leaq -0x30(%rbp), %r13
movq %rax, (%r13)
leaq (%r15,%rax), %rdi
subq %rax, %r12
subq %rax, %rcx
movq %r12, %rsi
movq %rdi, %rdx
movq %r13, %r8
callq 0xdc48
addq 0x20(%rbx), %rax
movq %rax, 0x20(%rbx)
movq (%r13), %r12
cmpq %rax, %r12
jbe 0xf8d1
movq 0x28(%rbx), %rdx
subq %r12, %rdx
jbe 0xf8d1
addq %r15, %rax
addq %r12, %r15
movq %rax, %rdi
movq %r15, %rsi
callq 0x2360
movq 0x20(%rbx), %rax
subq %r12, %rax
addq %rax, 0x28(%rbx)
testq %r14, %r14
setne %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/tools.cpp
// Function: seedMT(unsigned int)
void seedMT(uint seed)
{
    state[0] = seed;
    for(uint i = 1; i < N; i++)
        state[i] = seed = 1812433253U * (seed ^ (seed >> 30)) + i;
    next = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, 0xaded(%rip)      # 0x1a7c0
movabsq $0x1, %rax
leaq 0xaddc(%rip), %rcx      # 0x1a7c0
cmpq $0x270, %rax            # imm = 0x270
je 0xfa03
movl %edi, %edx
shrl $0x1e, %edx
xorl %edi, %edx
imull $0x6c078965, %edx, %edi # imm = 0x6C078965
addl %eax, %edi
movl %edi, (%rcx,%rax,4)
incq %rax
jmp 0xf9e4
andl $0x0, 0x984e(%rip)      # 0x19258
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/tools.cpp
// Function: randomMT()
uint randomMT()
{
    int cur = next;
    if(++next >= N)
    {
        if(next > N) { seedMT(5489U + time(NULL)); cur = next++; }
        else next = 0;
    }
    uint y = (state[cur] & 0x80000000U) | (state[next] & 0x7FFFFFFFU);
    state[cur] = y = state[cur < N-M ? cur + M : cur + M-N] ^ (y >> 1) ^ (-int(y & 1U) & K);
    y ^= (y >> 11);
    y ^= (y <<  7) & 0x9D2C5680U;
    y ^= (y << 15) & 0xEFC60000U;
    y ^= (y >> 18);
    return y;
}

// Assembly:
movl 0x9846(%rip), %ecx      # 0x19258
leal 0x1(%rcx), %eax
movl %eax, 0x983d(%rip)      # 0x19258
cmpl $0x26f, %ecx            # imm = 0x26F
jl 0xfa54
jne 0xfa2e
movl $0x26f, %ecx            # imm = 0x26F
xorl %eax, %eax
jmp 0xfa4e
pushq %rbp
movq %rsp, %rbp
xorl %edi, %edi
callq 0x2190
leal 0x1571(%rax), %edi
callq 0xf9c9
movl 0x980e(%rip), %ecx      # 0x19258
leal 0x1(%rcx), %eax
popq %rbp
movl %eax, 0x9804(%rip)      # 0x19258
movslq %ecx, %rcx
leaq 0xad62(%rip), %rdx      # 0x1a7c0
leal -0xe3(%rcx), %esi
leal 0x18d(%rcx), %edi
cmpl $0xe3, %ecx
cmovgel %esi, %edi
cltq
movl $0x80000000, %esi       # imm = 0x80000000
andl (%rdx,%rcx,4), %esi
movl (%rdx,%rax,4), %eax
movl %eax, %r8d
andl $0x7ffffffe, %r8d       # imm = 0x7FFFFFFE
orl %esi, %r8d
movslq %edi, %rsi
shrl %r8d
xorl (%rdx,%rsi,4), %r8d
andl $0x1, %eax
negl %eax
andl $0x9908b0df, %eax       # imm = 0x9908B0DF
xorl %r8d, %eax
movl %eax, (%rdx,%rcx,4)
movl %eax, %ecx
shrl $0xb, %ecx
xorl %eax, %ecx
movl %ecx, %eax
shll $0x7, %eax
andl $0x9d2c5680, %eax       # imm = 0x9D2C5680
xorl %ecx, %eax
movl %eax, %ecx
shll $0xf, %ecx
andl $0xefc60000, %ecx       # imm = 0xEFC60000
xorl %eax, %ecx
movl %ecx, %eax
shrl $0x12, %eax
xorl %ecx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/tools.cpp
// Function: getuint(databuf<unsigned char>&)
int getuint(ucharbuf &p)
{
    int n = p.get();
    if(n & 0x80)
    {
        n += (p.get() << 7) - 0x80;
        if(n & (1<<14)) n += (p.get() << 14) - (1<<14);
        if(n & (1<<21)) n += (p.get() << 21) - (1<<21);
        if(n & (1<<28)) n |= -1<<28;
    }
    return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x1007a
movzbl (%rax), %r14d
testb %r14b, %r14b
jns 0xff10
movq %rbx, %rdi
callq 0x1007a
movzbl (%rax), %eax
movl %eax, %ecx
shll $0x7, %ecx
leal (%r14,%rcx), %r15d
addl $-0x80, %r15d
testb %al, %al
jns 0xfede
movq %rbx, %rdi
callq 0x1007a
movzbl (%rax), %eax
shll $0xe, %eax
addl %eax, %r15d
addl $0xffffc000, %r15d      # imm = 0xFFFFC000
btl $0x15, %r15d
jae 0xfefd
movq %rbx, %rdi
callq 0x1007a
movzbl (%rax), %eax
shll $0x15, %eax
addl %eax, %r15d
addl $0xffe00000, %r15d      # imm = 0xFFE00000
movl %r15d, %r14d
orl $0xf0000000, %r14d      # imm = 0xF0000000
btl $0x1c, %r15d
cmovael %r15d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/tools.cpp
// Function: getstring(char*, databuf<unsigned char>&, unsigned long)
void getstring(char *text, ucharbuf &p, size_t len)
{
    char *t = text;
    do
    {
        if(t>=&text[len]) { text[len-1] = 0; return; }
        if(!p.remaining()) { *t = 0; return; }
        *t = getint(p);
    }
    while(*t++);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
addq %rdi, %r14
cmpq %r14, %rbx
jae 0x10012
movl 0xc(%r15), %eax
cmpl 0x8(%r15), %eax
je 0x10018
movq %r15, %rdi
callq 0xfc49
movb %al, (%rbx)
incq %rbx
testb %al, %al
jne 0xfff0
jmp 0x1001b
decq %r14
movq %r14, %rbx
movb $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/tools.cpp
// Function: filtertext(char*, char const*, bool, unsigned long)
void filtertext(char *dst, const char *src, bool whitespace, size_t len)
{
    for(int c = uchar(*src); c; c = uchar(*++src))
    {
        if(c == '\f')
        {
            if(!*++src) break;
            continue;
        }
        if(iscubeprint(c) || (iscubespace(c) && whitespace))
        {
            *dst++ = c;
            if(!--len) break;
        }
    }
    *dst = '\0';
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x1cdf(%rip), %rax      # 0x11d10
xorb $0x1, %dl
movzbl (%rsi), %r8d
cmpl $0xc, %r8d
je 0x10067
testl %r8d, %r8d
je 0x10075
movb (%rax,%r8), %r9b
testb $0x1, %r9b
jne 0x1005a
testb $0x2, %r9b
sete %r9b
orb %dl, %r9b
jne 0x10070
movb %r8b, (%rdi)
incq %rdi
decq %rcx
jne 0x10070
jmp 0x10075
cmpb $0x0, 0x1(%rsi)
je 0x10075
incq %rsi
incq %rsi
jmp 0x10034
movb $0x0, (%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Fohlen[P]cubescript-standalone/./tools.h
// Function: databuf<unsigned char>::get(unsigned char*, int)
int get(T *vals, int numvals)
    {
        int read = min(maxlen-len, numvals);
        if(read<numvals) flags |= OVERREAD;
        memcpy(vals, (void *)&buf[len], read*sizeof(T));
        len += read;
        return read;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rax
movq %rdi, %rbx
movl 0xc(%rdi), %ecx
movslq 0x8(%rdi), %rsi
subl %esi, %ecx
cmpl %edx, %ecx
jge 0x100be
orb $0x1, 0x10(%rbx)
cmpl %edx, %ecx
cmovll %ecx, %edx
addq (%rbx), %rsi
movslq %edx, %r14
movq %rax, %rdi
movq %r14, %rdx
callq 0x2150
addl %r14d, 0x8(%rbx)
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/malcolmyeh[P]CC3K/main.cc
// Function: readFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char (*) [89])
void readFile(std::string file, char display[27][89]) {
	std::string str;
	std::ifstream in (file);
	for (int i = 0; i < 27; i++)
    {
        getline(in, str);
        for (int j = 0; j < 89; j++)
        {
            display[i][j] = str[j];
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x230, %rsp            # imm = 0x230
movq %rsi, %rbx
movq %rdi, %rsi
leaq -0x30(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x248(%rbp), %rdi
pushq $0x8
popq %rdx
callq 0x4250
xorl %r12d, %r12d
leaq -0x248(%rbp), %r14
leaq -0x40(%rbp), %r15
cmpq $0x1b, %r12
je 0x4562
movq %r14, %rdi
movq %r15, %rsi
callq 0x4040
movq -0x40(%rbp), %rax
xorl %ecx, %ecx
cmpq $0x59, %rcx
je 0x4559
movb (%rax,%rcx), %dl
movb %dl, (%rbx,%rcx)
incq %rcx
jmp 0x4548
incq %r12
addq $0x59, %rbx
jmp 0x4531
leaq -0x248(%rbp), %rdi
callq 0x4060
leaq -0x40(%rbp), %rdi
callq 0x40e0
addq $0x230, %rsp            # imm = 0x230
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x459b
movq %rax, %rbx
leaq -0x248(%rbp), %rdi
callq 0x4060
leaq -0x40(%rbp), %rdi
callq 0x40e0
movq %rbx, %rdi
callq 0x4280
// File: /workspace/github_cpp_makefile_star2_O2/malcolmyeh[P]CC3K/main.cc
// Function: printDisplay(char (*) [89])
void printDisplay(char display[27][89]) {
	std::cout << "\033[2J\033[1;1H";
	for (int i = 0; i < 27; i++) {
		for (int j = 0; j < 89; j++) {
			std::cout << display[i][j];
		}
		std::cout << std::endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x12a0f(%rip), %r14     # 0x16fd0
leaq 0xba3c(%rip), %rsi      # 0x10004
movq %r14, %rdi
callq 0x4180
xorl %r15d, %r15d
cmpq $0x1b, %r15
je 0x4605
xorl %r12d, %r12d
cmpq $0x59, %r12
je 0x45f4
movsbl (%rbx,%r12), %esi
movq %r14, %rdi
callq 0x41c0
incq %r12
jmp 0x45dc
movq %r14, %rdi
callq 0x40f0
incq %r15
addq $0x59, %rbx
jmp 0x45d3
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/malcolmyeh[P]CC3K/main.cc
// Function: printEnd()
void printEnd() {
	std::cout << "\033[2J\033[1;1H";
	std::cout << "Thanks for playing Chamber Crawler 3000 +" << std::endl << std::endl;
	std::cout << "Project by Malcolm Yeh, Zayaan Moez, Kai Lu for CS246" << std::endl;
	std::cout << std::endl << std::endl << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x129b5(%rip), %rbx     # 0x16fd0
leaq 0xb9e2(%rip), %rsi      # 0x10004
movq %rbx, %rdi
callq 0x4180
leaq 0xb9de(%rip), %rsi      # 0x1000f
movq %rbx, %rdi
callq 0x4180
movq %rax, %rdi
callq 0x40f0
movq %rax, %rdi
callq 0x40f0
leaq 0xb9e9(%rip), %rsi      # 0x10039
movq %rbx, %rdi
callq 0x4180
movq %rax, %rdi
callq 0x40f0
movq %rbx, %rdi
callq 0x40f0
movq %rax, %rdi
callq 0x40f0
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x40f0
// File: /workspace/github_cpp_makefile_star2_O2/malcolmyeh[P]CC3K/posn.cc
// Function: Posn::getNew(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Posn Posn::getNew(std::string dir) {
	Posn p;
	if (dir == "ea") {
		p.x = this->x + 1;
		p.y = this->y;
	} else if (dir == "we") {
		p.x = this->x - 1;
		p.y = this->y;
	} else if (dir == "no") {
		p.x = this->x;
		p.y = this->y-1;
	} else if (dir == "so") {
		p.x = this->x;
		p.y = this->y+1;
	} else if (dir == "ne") {
		p.x = this->x + 1;
		p.y = this->y - 1;
	} else if (dir == "nw") {
		p.x = this->x - 1;
		p.y = this->y - 1;
	} else if (dir == "se") {
		p.x = this->x + 1;
		p.y = this->y + 1;
	} else if (dir == "sw") {
		p.x = this->x - 1;
		p.y = this->y + 1;
	}
	return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xb6b7(%rip), %rsi      # 0x101a3
movq %r14, %rdi
callq 0x4ac7
testb %al, %al
je 0x4b01
movl (%rbx), %ecx
movl 0x4(%rbx), %edx
incl %ecx
jmp 0x4b53
leaq 0xb69e(%rip), %rsi      # 0x101a6
movq %r14, %rdi
callq 0x4ac7
testb %al, %al
je 0x4b1d
movl (%rbx), %ecx
movl 0x4(%rbx), %edx
decl %ecx
jmp 0x4b53
leaq 0xb685(%rip), %rsi      # 0x101a9
movq %r14, %rdi
callq 0x4ac7
testb %al, %al
je 0x4b39
movl (%rbx), %ecx
movl 0x4(%rbx), %edx
decl %edx
jmp 0x4b53
leaq 0xb66c(%rip), %rsi      # 0x101ac
movq %r14, %rdi
callq 0x4ac7
testb %al, %al
je 0x4b61
movl (%rbx), %ecx
movl 0x4(%rbx), %edx
incl %edx
shlq $0x20, %rdx
movl %ecx, %eax
orq %rdx, %rax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xb647(%rip), %rsi      # 0x101af
movq %r14, %rdi
callq 0x4ac7
testb %al, %al
je 0x4b7d
movl (%rbx), %ecx
movl 0x4(%rbx), %edx
incl %ecx
jmp 0x4b35
leaq 0xb62e(%rip), %rsi      # 0x101b2
movq %r14, %rdi
callq 0x4ac7
testb %al, %al
je 0x4b99
movl (%rbx), %ecx
movl 0x4(%rbx), %edx
decl %ecx
jmp 0x4b35
leaq 0xb615(%rip), %rsi      # 0x101b5
movq %r14, %rdi
callq 0x4ac7
testb %al, %al
je 0x4bb5
movl (%rbx), %ecx
movl 0x4(%rbx), %edx
incl %ecx
jmp 0x4b51
leaq 0xb5fc(%rip), %rsi      # 0x101b8
movq %r14, %rdi
callq 0x4ac7
testb %al, %al
je 0x4b53
movl (%rbx), %ecx
movl 0x4(%rbx), %edx
decl %ecx
jmp 0x4b51
nop
// File: /workspace/github_cpp_makefile_star2_O2/malcolmyeh[P]CC3K/chamber.cc
// Function: Chamber::checkRange(Posn)
bool Chamber::checkRange(Posn p) {
	int x = p.x;
	int y = p.y;
	if (num == 1 || num == 2 || num == 4) {
		return (x >= col && x <= maxCol && y >= row && y <= maxRow);
	} else if (num == 3) {
		if (x >= col && y >= row && x <= 60 && y <= 6) {
			return true;
		} else if (x == 61 && y >= 3 && y <= 12) {
			return true;
		} else if (x >= 62 && y >= 5 && x <= 69 && y <= 12) {
			return true;
		} else if (x >= 70 && y >= 6 && x <= 72 && y <= 12) {
			return true;
		} else if (x >= 73 && y >= 7 && x <= 75 && y <= 12) {
			return true;
		}
	} else if (num == 5) {
		if (x >= 37 && y >= 19 && x <= 64 && y <= 21) {
			return true;
		} else if (x >= 65 && y >= 16 && x <= 75 && y <= 21) {
			return true;
		}
	}
	return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl (%rdi), %eax
decl %eax
cmpl $0x4, %eax
ja 0x4d16
movq %rsi, %rcx
shrq $0x20, %rcx
leaq 0xb50b(%rip), %rdx      # 0x101bc
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
xorl %eax, %eax
cmpl %esi, 0x10(%rdi)
jg 0x4d85
cmpl %esi, 0x8(%rdi)
jl 0x4d85
cmpl %ecx, 0xc(%rdi)
jg 0x4d85
cmpl %ecx, 0x4(%rdi)
setge %al
jmp 0x4d85
leal -0x25(%rsi), %eax
cmpl $0x1c, %eax
setb %dl
leal -0x13(%rcx), %eax
cmpl $0x3, %eax
setb %dil
movb $0x1, %al
testb %dil, %dl
jne 0x4d85
leal -0x41(%rsi), %edx
cmpl $0xb, %edx
setb %dl
addl $-0x10, %ecx
cmpl $0x6, %ecx
setb %cl
testb %cl, %dl
jne 0x4d85
xorl %eax, %eax
jmp 0x4d85
cmpl %esi, 0x10(%rdi)
jle 0x4d74
cmpl $0x3d, %esi
sete %dl
leal -0x3(%rcx), %eax
cmpl $0xa, %eax
setb %dil
movb $0x1, %al
testb %dil, %dl
jne 0x4d85
leal -0x3e(%rsi), %edx
cmpl $0x8, %edx
setb %dl
leal -0x5(%rcx), %edi
cmpl $0x8, %edi
setb %dil
testb %dil, %dl
jne 0x4d85
leal -0x46(%rsi), %edx
cmpl $0x3, %edx
setb %dl
leal -0x6(%rcx), %edi
cmpl $0x7, %edi
setb %dil
testb %dil, %dl
jne 0x4d85
leal -0x49(%rsi), %edx
cmpl $0x3, %edx
setb %dl
addl $-0x7, %ecx
jmp 0x4d0c
cmpl $0x6, %ecx
jg 0x4d1f
cmpl %ecx, 0xc(%rdi)
jg 0x4d1f
movb $0x1, %al
cmpl $0x3d, %esi
jge 0x4d1f
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/malcolmyeh[P]CC3K/chamber.cc
// Function: Chamber::getPosition()
Posn Chamber::getPosition() {
	Posn p;
	do {

		int r = rand() % maxRow;
		int c = rand() % maxCol;
		p.x = c;
		p.y = r;
	} while (!checkRange(p));

	return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x4070
cltd
idivl 0x4(%rbx)
movl %edx, %r15d
callq 0x4070
cltd
idivl 0x8(%rbx)
movl %edx, %r14d
shlq $0x20, %r15
orq %r15, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4c96
testb %al, %al
je 0x4d95
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/malcolmyeh[P]CC3K/display.cc
// Function: Display::readFloor(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Display::readFloor(std::string file) {
	std::ifstream in (file);
	std::string str;
	for (int i = 0; i < 25; i++) {
		getline(in, str);
		for (int j = 0; j < 79; j++) {
			this->displayGrid[i][j] = str[j];
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x230, %rsp            # imm = 0x230
movq %rdi, %rbx
leaq -0x248(%rbp), %r14
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x4250
leaq -0x30(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorl %r12d, %r12d
leaq -0x40(%rbp), %r15
cmpq $0x19, %r12
je 0x4e43
movq %r14, %rdi
movq %r15, %rsi
callq 0x4040
movq -0x40(%rbp), %rax
xorl %ecx, %ecx
cmpq $0x4f, %rcx
je 0x4e3a
movb (%rax,%rcx), %dl
movb %dl, (%rbx,%rcx)
incq %rcx
jmp 0x4e29
incq %r12
addq $0x4f, %rbx
jmp 0x4e12
leaq -0x40(%rbp), %rdi
callq 0x40e0
leaq -0x248(%rbp), %rdi
callq 0x4060
addq $0x230, %rsp            # imm = 0x230
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x40e0
leaq -0x248(%rbp), %rdi
callq 0x4060
movq %rbx, %rdi
callq 0x4280
// File: /workspace/github_cpp_makefile_star2_O2/malcolmyeh[P]CC3K/display.cc
// Function: Display::printFloor(Floor*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Display::printFloor(Floor *floor, std::string log){
	std::cout << "\033[2J\033[1;1H";
	for (int i = 0; i < 25; i++) {
		for (int j = 0; j < 79; j++) {
			std::cout << displayGrid[i][j];
		}
		std::cout << std::endl;
	}
	std::cout << "Race: " << floor->player->getRace() << 
	"                                                          Floor "
	<< floor->getLevel() << std::endl;
	std::cout << "Gold: " << floor->player->getGold() << std::endl;
	std::cout << "HP: " << floor->player->getHP() << std::endl;
	std::cout << "Atk: " << floor->player->getAtk() << std::endl;
	std::cout << "Def: " << floor->player->getDef() << std::endl;
	std::cout << "Action: " << log << std::endl;
	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, -0x30(%rbp)
movq %rsi, %r14
movq %rdi, %r15
movq 0x12126(%rip), %r12     # 0x16fd0
leaq 0xb153(%rip), %rsi      # 0x10004
movq %r12, %rdi
callq 0x4180
xorl %r13d, %r13d
cmpq $0x19, %r13
je 0x4eed
xorl %ebx, %ebx
cmpq $0x4f, %rbx
je 0x4edc
movsbl (%r15,%rbx), %esi
movq %r12, %rdi
callq 0x41c0
incq %rbx
jmp 0x4ec4
movq %r12, %rdi
callq 0x40f0
incq %r13
addq $0x4f, %r15
jmp 0x4ebc
movq 0x120dc(%rip), %rdi     # 0x16fd0
leaq 0xb325(%rip), %rsi      # 0x10220
callq 0x4180
movq %rax, %r15
movq 0xfe0(%r14), %rsi
movq (%rsi), %rax
leaq -0x50(%rbp), %r12
movq %r12, %rdi
callq *0x28(%rax)
movq %r15, %rdi
movq %r12, %rsi
callq 0x4150
leaq 0xb2fe(%rip), %rsi      # 0x10227
movq %rax, %rdi
callq 0x4180
movq %rax, %r15
movq %r14, %rdi
callq 0x824c
movq %r15, %rdi
movl %eax, %esi
callq 0x4270
movq %rax, %rdi
callq 0x40f0
leaq -0x50(%rbp), %rdi
callq 0x40e0
movq 0x12072(%rip), %r15     # 0x16fd0
leaq 0xbbdc(%rip), %rsi      # 0x10b41
movq %r15, %rdi
callq 0x4180
movq %rax, %r12
movq 0xfe0(%r14), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq %r12, %rdi
movl %eax, %esi
callq 0x4270
movq %rax, %rdi
callq 0x40f0
leaq 0xbcce(%rip), %rsi      # 0x10c64
movq %r15, %rdi
callq 0x4180
movq %rax, %r12
movq 0xfe0(%r14), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movq %r12, %rdi
movl %eax, %esi
callq 0x4270
movq %rax, %rdi
callq 0x40f0
leaq 0xba98(%rip), %rsi      # 0x10a5f
movq %r15, %rdi
callq 0x4180
movq %rax, %r12
movq 0xfe0(%r14), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq %r12, %rdi
movl %eax, %esi
callq 0x4270
movq %rax, %rdi
callq 0x40f0
leaq 0xbacf(%rip), %rsi      # 0x10ac7
movq %r15, %rdi
callq 0x4180
movq %rax, %r12
movq 0xfe0(%r14), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq %r12, %rdi
movl %eax, %esi
callq 0x4270
movq %rax, %rdi
callq 0x40f0
leaq 0xb23f(%rip), %rsi      # 0x10268
movq %r15, %rdi
callq 0x4180
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x4150
movq %rax, %rdi
callq 0x40f0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x40e0
movq %rbx, %rdi
callq 0x4280
// File: /workspace/github_cpp_makefile_star2_O2/malcolmyeh[P]CC3K/floor.cc
// Function: Floor::Floor(int, bool, bool)
Floor::Floor(int level, bool hostile, bool spawned) {
	this->level = level;
	this->merchantHostile = hostile;
	this->barrierSpawned = spawned;
	this->player = NULL;
	this->stair = NULL;
	this->suit = NULL;
	for (int i = 0; i < 6; ++i){
		this->knownPotion[i] = false;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0x810(%rdi)
movups %xmm0, 0x800(%rdi)
movups %xmm0, 0x7f0(%rdi)
movups %xmm0, 0x7e0(%rdi)
movups %xmm0, 0x7d0(%rdi)
movups %xmm0, 0x7c0(%rdi)
movl %esi, (%rdi)
movb %dl, 0x4(%rdi)
movb %cl, 0x5(%rdi)
movups %xmm0, 0xfd8(%rdi)
andq $0x0, 0xfe8(%rdi)
movabsq $-0x6, %rax
testq %rax, %rax
je 0x5118
movb $0x0, 0xff6(%rdi,%rax)
incq %rax
jmp 0x5106
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/malcolmyeh[P]CC3K/floor.cc
// Function: Floor::~Floor()
Floor::~Floor() {
	for (int i = 0; i < enemies.size(); ++i) {
		//delete enemies.at(i);
		Enemy * temp = enemies.at(i);
		enemies.erase(enemies.begin() + i);
		delete temp;
		--i;
	}
	for (int i = 0; i < golds.size(); ++i) { 
		//delete golds.at(i); 
		Gold * temp = golds.at(i);
		golds.erase(golds.begin() + i);
		delete temp;
		--i;
	}
	for (int i = 0; i < potions.size(); ++i) {
		//delete potions.at(i);
		Potion * temp = potions.at(i);
		potions.erase(potions.begin() + i);
		delete temp;
		--i;
	}
	for (int i = 0; i < chambers.size(); ++i) {
		//delete chambers.at(i);
		Chamber * temp = chambers.at(i);
		chambers.erase(chambers.begin() + i);
		delete temp;
		--i;
	}
	delete this->player;
	delete this->stair;
	delete this->suit;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x7c0(%rdi), %rbx
movq 0x7c8(%r14), %rax
cmpq 0x7c0(%r14), %rax
je 0x516a
movq %rbx, %rdi
xorl %esi, %esi
callq 0x825e
movq (%rax), %r15
movq (%rbx), %rsi
movq %rbx, %rdi
callq 0x828e
testq %r15, %r15
je 0x5132
movq (%r15), %rax
movq %r15, %rdi
callq *0x60(%rax)
jmp 0x5132
movq %rbx, -0x30(%rbp)
leaq 0x7d8(%r14), %r15
pushq $0x38
popq %r12
movq 0x7e0(%r14), %rax
cmpq 0x7d8(%r14), %rax
je 0x51bc
movq %r15, %rdi
xorl %esi, %esi
callq 0x82c8
movq (%rax), %r13
movq (%r15), %rsi
movq %r15, %rdi
callq 0x82ea
testq %r13, %r13
je 0x51af
leaq 0x18(%r13), %rdi
callq 0x40e0
movq %r13, %rdi
movq %r12, %rsi
callq 0x41a0
jmp 0x5179
leaq 0x7f0(%r14), %r12
pushq $0x30
popq %rbx
movq 0x7f8(%r14), %rax
cmpq 0x7f0(%r14), %rax
je 0x520a
movq %r12, %rdi
xorl %esi, %esi
callq 0x8324
movq (%rax), %r13
movq (%r12), %rsi
movq %r12, %rdi
callq 0x8346
testq %r13, %r13
je 0x51fd
leaq 0x10(%r13), %rdi
callq 0x40e0
movq %r13, %rdi
movq %rbx, %rsi
callq 0x41a0
jmp 0x51c6
leaq 0x808(%r14), %r13
movq 0x810(%r14), %rax
cmpq 0x808(%r14), %rax
je 0x5247
movq %r13, %rdi
xorl %esi, %esi
callq 0x8380
movq (%rax), %rbx
movq (%r13), %rsi
movq %r13, %rdi
callq 0x83a2
movq %rbx, %rdi
pushq $0x14
popq %rsi
callq 0x41a0
jmp 0x5211
movq 0xfe0(%r14), %rdi
testq %rdi, %rdi
je 0x5259
movq (%rdi), %rax
callq *0x60(%rax)
movq 0xfd8(%r14), %rdi
pushq $0xc
popq %rsi
callq 0x41a0
movq 0xfe8(%r14), %rdi
pushq $0x10
popq %rsi
callq 0x41a0
movq %r13, %rdi
callq 0x86e0
movq %r12, %rdi
callq 0x86a2
movq %r15, %rdi
callq 0x8664
movq -0x30(%rbp), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8626
jmp 0x52ac
jmp 0x52ac
jmp 0x52ac
movq %rax, %rdi
callq 0x827f