LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_treemap.cpp
// Function: ccTreeMap::findValue(char const*)
int ccTreeMap::findValue(const char *key) {
	if (!key || strlen(key) <= 0) { return -1; }
    std::string cppkey(key);
    if (this->storage.count(cppkey) <= 0) { return -1; }
    return this->storage[cppkey];
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rsi, %rsi
je 0x1073f
movq %rsi, %r14
cmpb $0x0, (%rsi)
je 0x1073f
movq %rdi, %rbx
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
movq %r14, %rdi
callq 0x31a0
leaq (%rax,%r14), %rdx
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x10276
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1098c
leaq 0x8(%rbx), %rcx
cmpq %rcx, %rax
je 0x10724
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x1081c
movl (%rax), %ebp
jmp 0x10729
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x1073f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3320
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x10767
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3320
movq %rbx, %rdi
callq 0x3560
nop
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_internallist.cpp
// Function: ccInternalList::peeknext()
long ccInternalList::peeknext() {
    int tpos = pos;
	// this should work even if 3 bytes aren't remaining
	while (isPosValid(tpos) && (script[tpos] == SCODE_META)) {
        tpos+=3;
	}

	if (isPosValid(tpos)) {
		return script[tpos];
	} else {
        return SCODE_INVALID;
	}
}

// Assembly:
movl (%rdi), %ecx
movl 0x10(%rdi), %esi
testl %esi, %esi
setns %al
cmpl %esi, %ecx
setg %dl
andb %al, %dl
movq $-0x1, %rax
cmpb $0x1, %dl
jne 0x10f87
movl %esi, %esi
movq 0x8(%rdi), %r8
cmpq $-0x2, (%r8,%rsi,8)
jne 0x10f75
movq %rsi, %r9
cmpl $-0x3, %esi
setge %r10b
leal 0x3(%r9), %edx
cmpl %edx, %ecx
setg %dl
andb %r10b, %dl
je 0x10f87
leaq 0x3(%r9), %r10
cmpq $-0x2, 0x18(%r8,%r9,8)
movq %r10, %r9
je 0x10f4f
jmp 0x10f78
movq %rsi, %r10
testb %dl, %dl
je 0x10f87
movq 0x8(%rdi), %rax
movl %r10d, %ecx
movq (%rax,%rcx,8), %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_internallist.cpp
// Function: ccInternalList::write(int)
void ccInternalList::write(int value) {
    if ((length+1) * sizeof(long) >= (unsigned long)allocated) {

		if (allocated < 1000) {
            allocated += 1000;
		} else {
            allocated *= 2;
		}

        script = (long*)realloc(script, allocated);
		// TODO: this doesn't check realloc result
    }
    script[length] = value;
    length ++;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movslq (%rdi), %rax
leaq 0x8(,%rax,8), %rcx
movslq 0x4(%rdi), %rax
cmpq %rax, %rcx
jb 0x11085
leal (%rax,%rax), %ecx
movl $0x3e8, %edx            # imm = 0x3E8
leal (%rax,%rdx), %esi
cmpl %edx, %eax
cmovgel %ecx, %esi
movl %esi, 0x4(%rbx)
movq 0x8(%rbx), %rdi
movslq %esi, %rsi
callq 0x3520
movq %rax, 0x8(%rbx)
movslq %ebp, %rax
movq 0x8(%rbx), %rcx
movslq (%rbx), %rdx
movq %rax, (%rcx,%rdx,8)
leal 0x1(%rdx), %eax
movl %eax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_symboltable.cpp
// Function: symbolTable::get_type(int)
int symbolTable::get_type(int ii) {
    // just return the real type, regardless of pointerness/constness
    ii &= STYPE_MASK;
	if ((ii < 0) || ((size_t)ii >= entries.size())) { return -1; }
    return entries[ii].stype;
}

// Assembly:
andl $0xfffffff, %esi        # imm = 0xFFFFFFF
movq 0x28(%rdi), %rcx
movq 0x30(%rdi), %rax
subq %rcx, %rax
sarq $0x4, %rax
movabsq $0x2e8ba2e8ba2e8ba3, %rdx # imm = 0x2E8BA2E8BA2E8BA3
imulq %rax, %rdx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rsi, %rdx
jbe 0x111e3
imulq $0xb0, %rsi, %rax
movswl 0x20(%rcx,%rax), %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_symboltable.cpp
// Function: symbolTable::add_operator(char const*, int, int)
int symbolTable::add_operator(const char *nta, int priority, int vcpucmd) {
    int nss = add_ex(nta, SYM_OPERATOR, priority);
	if (nss >= 0) {
        entries[nss].vartype = vcpucmd;
	}
    return nss;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdi, %r14
movsbl %dl, %ecx
movl $0x3, %edx
callq 0x11be6
testl %eax, %eax
js 0x11f88
movl %eax, %ecx
movq 0x28(%r14), %rdx
imulq $0xb0, %rcx, %rcx
movw %bx, 0x30(%rdx,%rcx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_symboltable.cpp
// Function: symbolTable::get_name(int)
const char *symbolTable::get_name(int idx) {
	if (nameGenCache.count(idx) > 0) {
		return nameGenCache[idx];
	}

	int actualIdx = idx & STYPE_MASK;
	if (actualIdx < 0 || (size_t)actualIdx >= entries.size()) { return NULL; }

	std::string resultString = get_name_string(idx);
	char *result = (char *)malloc(resultString.length() + 1);
	strcpy(result, resultString.c_str());
	nameGenCache[idx] = result;
	return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movl %esi, %edx
movq %rdi, %rsi
movl %edx, 0xc(%rsp)
movq 0x50(%rdi), %rdi
leaq 0x48(%rsi), %rax
movq %rax, %rcx
testq %rdi, %rdi
je 0x1267b
movq %rax, %rcx
xorl %r8d, %r8d
cmpl %edx, 0x20(%rdi)
setl %r8b
cmovgeq %rdi, %rcx
movq 0x10(%rdi,%r8,8), %rdi
testq %rdi, %rdi
jne 0x12663
movq %rax, %rdi
cmpq %rax, %rcx
je 0x1268d
cmpl %edx, 0x20(%rcx)
cmovgq %rax, %rcx
movq %rcx, %rdi
leaq 0x40(%rsi), %r14
cmpq %rax, %rdi
je 0x126a8
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x12762
movq (%rax), %rbx
jmp 0x12724
movl %edx, %eax
andl $0xfffffff, %eax        # imm = 0xFFFFFFF
movq 0x30(%rsi), %rcx
subq 0x28(%rsi), %rcx
sarq $0x4, %rcx
movabsq $0x2e8ba2e8ba2e8ba3, %rdi # imm = 0x2E8BA2E8BA2E8BA3
imulq %rcx, %rdi
cmpq %rax, %rdi
jbe 0x12722
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x122be
movq 0x8(%r15), %rdi
incq %rdi
callq 0x3440
movq %rax, %rbx
movq (%r15), %rsi
movq %rax, %rdi
callq 0x32d0
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x12762
movq %rbx, (%rax)
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x12724
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3320
jmp 0x12724
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1274f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3320
movq %rbx, %rdi
callq 0x3560
nop
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/fmem.cpp
// Function: fmem_create()
FMEM*fmem_create() {
  tempy=(FMEM*)malloc(sizeof(FMEM));
  tempy->size=100;
  tempy->len=0;
  tempy->data=(char*)malloc(tempy->size+10);
  tempy->data[0]=0;
  tempy->magic=FMEM_MAGIC;
  tempy->pos=0;
  return tempy;
  }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0x28, %edi
callq 0x3440
movq %rax, %rbx
movq %rax, 0x12490(%rip)     # 0x25798
movq $0x64, 0x10(%rax)
xorl %r14d, %r14d
movq %r14, 0x8(%rax)
movl $0x6e, %edi
callq 0x3440
movq %rax, (%rbx)
movb $0x0, (%rax)
movl $0xcddebeef, %eax       # imm = 0xCDDEBEEF
movq %rax, 0x18(%rbx)
movq %r14, 0x20(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/fmem.cpp
// Function: fmem_open(char const*)
FMEM*fmem_open(const char*sourc) {
  tempy=(FMEM*)malloc(sizeof(FMEM));
  tempy->size=strlen(sourc)+10;
  tempy->len=strlen(sourc);
  tempy->data=(char*)malloc(tempy->size+10);
  strcpy(tempy->data,sourc);
  tempy->magic=FMEM_MAGIC;
  tempy->pos=0;
  return tempy;
  }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x28, %edi
callq 0x3440
movq %rax, %r14
movq %rax, 0x1243e(%rip)     # 0x25798
movq %rbx, %rdi
callq 0x31a0
leaq 0xa(%rax), %rcx
movq %rcx, 0x10(%r14)
movq %rax, 0x8(%r14)
leaq 0x14(%rax), %rdi
callq 0x3440
movq %rax, (%r14)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x32d0
movl $0xcddebeef, %eax       # imm = 0xCDDEBEEF
movq %rax, 0x18(%r14)
movq $0x0, 0x20(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/fmem.cpp
// Function: fmem_close(FMEM*)
void fmem_close(FMEM*cloo) {
  if (cloo==NULL) return;
  if (cloo->magic != FMEM_MAGIC) return;   // uninitialized
  free(cloo->data);
  free(cloo);
  }

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x133c6
movq %rdi, %rbx
movl $0xcddebeef, %eax       # imm = 0xCDDEBEEF
cmpq %rax, 0x18(%rdi)
jne 0x133c6
movq (%rbx), %rdi
callq 0x33c0
movq %rbx, %rdi
popq %rbx
jmp 0x33c0
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/fmem.cpp
// Function: fmem_write(char*, long, FMEM*)
void fmem_write(char* towr,long mei,FMEM*fill) {
  long curdatlen=fill->len;
  if (curdatlen + mei >= fill->size) {
    char*datwas=fill->data;
    fill->size=fill->size + mei + BUFFER_INCREMENT_SIZE;
    fill->data=(char*)malloc(fill->size+10);
    strcpy(fill->data,datwas);
    free(datwas);
    }

  memcpy(&fill->data[curdatlen],towr,mei);
  fill->data[curdatlen+mei]=0;
  fill->len+=mei;
  fill->pos+=mei;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rdx), %r12
movq 0x10(%rdx), %rax
leaq (%r12,%rsi), %rbp
cmpq %rax, %rbp
jl 0x13425
movq (%rbx), %r13
leaq (%rax,%r14), %rcx
addq $0x7d0, %rcx            # imm = 0x7D0
movq %rcx, 0x10(%rbx)
leaq (%rax,%r14), %rdi
addq $0x7da, %rdi            # imm = 0x7DA
callq 0x3440
movq %rax, (%rbx)
movq %rax, %rdi
movq %r13, %rsi
callq 0x32d0
movq %r13, %rdi
callq 0x33c0
addq (%rbx), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x3290
movq (%rbx), %rax
movb $0x0, (%rax,%rbp)
addq %r14, 0x8(%rbx)
addq %r14, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/fmem.cpp
// Function: fmem_putc(char, FMEM*)
void fmem_putc(char toput,FMEM*fill) {
  char templ[2];
  templ[0]=toput;
  templ[1]=0;
  fmem_write(&templ[0],1,fill);
  }

// Assembly:
pushq %rax
movq %rsi, %rdx
leaq 0x6(%rsp), %rax
movb %dil, (%rax)
movb $0x0, 0x1(%rax)
movl $0x1, %esi
movq %rax, %rdi
callq 0x133c8
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/fmem.cpp
// Function: fmem_puts(char const*, FMEM*)
void fmem_puts(const char*strin,FMEM*ooo) {
  char buf[1024], *p;
  size_t l = strlen(strin);
  if(l+3 < sizeof buf)
    p = buf;
  else
    p = (char*)malloc(l+3);
  sprintf(p, "%s\r\n",strin);
  fmem_write(p,l+2,ooo);
  if(p != buf) free(p);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
movq %rsi, %rbx
movq %rdi, %r12
callq 0x31a0
movq %rax, %r14
leaq 0x3(%rax), %rdi
movq %rsp, %r13
movq %r13, %r15
cmpq $0x400, %rdi            # imm = 0x400
jb 0x134ac
callq 0x3440
movq %rax, %r15
leaq 0x966d(%rip), %rsi      # 0x1cb20
movq %r15, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x30d0
addq $0x2, %r14
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x133c8
cmpq %r13, %r15
je 0x134df
movq %r15, %rdi
callq 0x33c0
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_compiledscript.cpp
// Function: ccCompiledScript::write_code(int)
void ccCompiledScript::write_code(int32_t byy) {
    flush_line_numbers();
    if (codesize >= codeallocated - 2) {
        codeallocated += 500;
        code = (int32_t*)realloc(code,codeallocated*sizeof(int32_t));
    }
    code[codesize] = byy;
    codesize++;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
callq 0x13d98
movslq 0x20(%rbx), %rcx
movq 0x90(%rbx), %rax
leaq -0x2(%rax), %rdx
cmpq %rcx, %rdx
jg 0x135e6
leaq 0x1f4(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq 0x18(%rbx), %rdi
leaq 0x7d0(,%rax,4), %rsi
callq 0x3520
movq %rax, 0x18(%rbx)
movq 0x18(%rbx), %rax
movslq 0x20(%rbx), %rcx
movl %ebp, (%rax,%rcx,4)
incl 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_compiledscript.cpp
// Function: ccCompiledScript::write_cmd3(int, int, int, int)
void ccCompiledScript::write_cmd3(int cmdd,int param,int param2,int param3) {
    write_code(cmdd);
    write_code(param);
    write_code(param2);
    write_code(param3);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %r8d, %ebx
movl %ecx, %ebp
movl %edx, %r14d
movq %rdi, %r15
callq 0x135a2
movq %r15, %rdi
movl %r14d, %esi
callq 0x135a2
movq %r15, %rdi
movl %ebp, %esi
callq 0x135a2
movq %r15, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x135a2
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_compiledscript.cpp
// Function: ccCompiledScript::add_global(int, char const*)
int ccCompiledScript::add_global(int siz,const char*vall) {
    //  printf("Add global size %d at %d\n",siz,globaldatasize);
    //  if (remove_any_import (vall)) return -2;
    globaldata = (char*)realloc(globaldata, globaldatasize + siz);
    if (vall != NULL)
        memcpy(&globaldata[globaldatasize],vall,siz);
    else memset(&globaldata[globaldatasize],0,siz);
    int toret = globaldatasize;
    globaldatasize += siz;
    return toret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movl %esi, %ebx
movq %rdi, %r14
movq 0x8(%rdi), %rdi
movslq 0x10(%r14), %rsi
movslq %ebx, %r15
addq %r15, %rsi
callq 0x3520
movq %rax, 0x8(%r14)
movslq 0x10(%r14), %rdi
addq %rax, %rdi
testq %r12, %r12
je 0x13856
movq %r12, %rsi
movq %r15, %rdx
callq 0x3290
jmp 0x13860
xorl %esi, %esi
movq %r15, %rdx
callq 0x3210
movl 0x10(%r14), %eax
addl %eax, %ebx
movl %ebx, 0x10(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_compiledscript.cpp
// Function: ccCompiledScript::add_string(char const*)
int ccCompiledScript::add_string(const char*strr) {
    size_t len = strlen(strr);
    strings = (char*)realloc(strings, stringssize + len + 1);
    char *write_ptr = strings + stringssize;
    for (size_t src = 0; src <= len; ++src) {
        char ch = strr[src];
        if (ch=='\\') {
            src++;
            ch = strr[src];
            if (ch == 'n') {ch = '\n';}
            else if (ch == 'r') {ch = '\r';}
            else if (ch == '[') { // pass through as \[
                *write_ptr = '\\';
                write_ptr++;
            }
        }
        *write_ptr = ch;
        write_ptr++;
    }
    int toret = stringssize;
    stringssize += write_ptr - (strings + stringssize);
    return toret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x31a0
movq %rax, %r15
movq 0x28(%rbx), %rdi
movslq 0x30(%rbx), %rax
leaq (%r15,%rax), %rsi
incq %rsi
callq 0x3520
movq %rax, 0x28(%rbx)
movslq 0x30(%rbx), %rcx
addq %rax, %rcx
xorl %eax, %eax
movb (%r14,%rax), %dl
cmpb $0x5c, %dl
jne 0x138dc
movzbl 0x1(%r14,%rax), %edx
incq %rax
cmpl $0x5b, %edx
je 0x138d6
cmpl $0x6e, %edx
je 0x138d2
cmpl $0x72, %edx
jne 0x138dc
movb $0xd, %dl
jmp 0x138dc
movb $0xa, %dl
jmp 0x138dc
movb $0x5c, (%rcx)
incq %rcx
movb %dl, (%rcx)
incq %rcx
incq %rax
cmpq %r15, %rax
jbe 0x138ad
movl 0x30(%rbx), %eax
subl 0x28(%rbx), %ecx
movl %ecx, 0x30(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_compiledscript.cpp
// Function: ccCompiledScript::add_fixup(int, char)
void ccCompiledScript::add_fixup(int32_t locc, char ftype) {
    fixuptypes = (char*)realloc(fixuptypes, numfixups + 5);
    fixups = (int32_t*)realloc(fixups, (numfixups * sizeof(int32_t)) + 10);
    fixuptypes[numfixups] = ftype;
    fixups[numfixups] = locc;
    numfixups++;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movq 0x38(%rdi), %rdi
movslq 0x48(%r14), %rsi
addq $0x5, %rsi
callq 0x3520
movq %rax, 0x38(%r14)
movq 0x40(%r14), %rdi
movslq 0x48(%r14), %rax
leaq 0xa(,%rax,4), %rsi
callq 0x3520
movq %rax, 0x40(%r14)
movq 0x38(%r14), %rax
movslq 0x48(%r14), %rcx
movb %bl, (%rax,%rcx)
movq 0x40(%r14), %rax
movslq 0x48(%r14), %rcx
movl %ebp, (%rax,%rcx,4)
incl 0x48(%r14)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_compiledscript.cpp
// Function: ccCompiledScript::add_new_function(char const*, int*)
int ccCompiledScript::add_new_function(const char*namm, int *idx) {
    if (numfunctions >= MAX_FUNCTIONS) return -1;
    //  if (remove_any_import (namm)) return -2;
    functions[numfunctions] = (char*)malloc(strlen(namm)+20);
    strcpy(functions[numfunctions],namm);
    funccodeoffs[numfunctions] = codesize;
    funcnumparams[numfunctions] = 0;
    //  code = (long*)realloc(code, codesize + 5000);
    if (idx)
        *idx = numfunctions;
    numfunctions++;
    return codesize;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq 0x8d38(%rdi), %r12
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq $0x7cf, %r12            # imm = 0x7CF
jg 0x139d8
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x31a0
leaq 0x14(%rax), %rdi
callq 0x3440
movq %rax, 0x98(%rbx,%r12,8)
movq %rax, %rdi
movq %r15, %rsi
callq 0x32d0
movslq 0x20(%rbx), %rax
movq %rax, 0x3f18(%rbx,%r12,8)
movq 0x8d38(%rbx), %rax
movw $0x0, 0x7d98(%rbx,%rax,2)
testq %r14, %r14
je 0x139cb
movl %eax, (%r14)
incq %rax
movq %rax, 0x8d38(%rbx)
movl 0x20(%rbx), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_compiledscript.cpp
// Function: ccCompiledScript::add_new_import(char const*)
int ccCompiledScript::add_new_import(const char*namm)
{
    if (numimports >= importsCapacity)
    {
        importsCapacity += 1000;
        imports = (char**)realloc(imports, sizeof(char*) * importsCapacity);
    }
    imports[numimports] = (char*)malloc(strlen(namm)+12);
    strcpy(imports[numimports],namm);
    numimports++;
    return numimports-1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movslq 0x4c(%rdi), %rax
cmpl %eax, 0x58(%rdi)
jl 0x13a16
leaq 0x3e8(%rax), %rcx
movl %ecx, 0x4c(%rbx)
movq 0x50(%rbx), %rdi
leaq 0x1f40(,%rax,8), %rsi
callq 0x3520
movq %rax, 0x50(%rbx)
movq %r14, %rdi
callq 0x31a0
leaq 0xc(%rax), %rdi
callq 0x3440
movq 0x50(%rbx), %rcx
movslq 0x58(%rbx), %rdx
movq %rax, (%rcx,%rdx,8)
movq 0x50(%rbx), %rax
movq (%rax,%rdx,8), %rdi
movq %r14, %rsi
callq 0x32d0
movl 0x58(%rbx), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x58(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_compiledscript.cpp
// Function: ccCompiledScript::add_new_export(char const*, int, long, int)
int ccCompiledScript::add_new_export(const char*namm,int etype,long eoffs, int numArgs)
{
    if (numexports >= exportsCapacity)
    {
        exportsCapacity += 1000;
        exports = (char**)realloc(exports, sizeof(char*) * exportsCapacity);
        export_addr = (int32_t*)realloc(export_addr, sizeof(int32_t) * exportsCapacity);
    }
    if (eoffs >= 0x00ffffff) {
        cc_error("export offset too high; script data size too large?");
        return -1;
    }
    char *newName = (char*)malloc(strlen(namm)+20);
    strcpy(newName, namm);
    // mangle the name for functions to record parameters
    if (etype == EXPORT_FUNCTION) {
        char tempAddition[20];
        sprintf(tempAddition, "$%d", numArgs);
        strcat(newName, tempAddition);
    }
    // Check if it's already exported
    for (int aa = 0; aa < numexports; aa++) {
        if (strcmp(exports[aa], newName) == 0) {
            free(newName);
            return aa;
        }
    }
    exports[numexports] = newName;

    export_addr[numexports] = eoffs | ((long)etype << 24L);
    numexports++;
    return numexports-1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %r15d
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %r13
movq %rdi, %rbx
movslq 0x5c(%rdi), %rax
cmpl %eax, 0x70(%rdi)
jl 0x13cbf
leaq 0x3e8(%rax), %rcx
movl %ecx, 0x5c(%rbx)
movq 0x60(%rbx), %rdi
leaq 0x1f40(,%rax,8), %rsi
callq 0x3520
movq %rax, 0x60(%rbx)
movq 0x68(%rbx), %rdi
movslq 0x5c(%rbx), %rsi
shlq $0x2, %rsi
callq 0x3520
movq %rax, 0x68(%rbx)
cmpq $0xffffff, %r14         # imm = 0xFFFFFF
jl 0x13ce1
leaq 0x8ec2(%rip), %rdi      # 0x1cb91
xorl %eax, %eax
callq 0x10418
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0x13d85
movq %r13, %rdi
callq 0x31a0
leaq 0x14(%rax), %rdi
callq 0x3440
movq %rax, %r12
movq %rax, %rdi
movq %r13, %rsi
callq 0x32d0
movl %ebp, 0xc(%rsp)
cmpl $0x1, %ebp
jne 0x13d2d
leaq 0x8eb5(%rip), %rsi      # 0x1cbc5
leaq 0x10(%rsp), %r13
movq %r13, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x30d0
movq %r12, %rdi
movq %r13, %rsi
callq 0x3570
movslq 0x70(%rbx), %r13
testq %r13, %r13
jle 0x13d56
movq 0x60(%rbx), %rbp
xorl %r15d, %r15d
movq (%rbp,%r15,8), %rdi
movq %r12, %rsi
callq 0x3450
testl %eax, %eax
je 0x13d7d
incq %r15
cmpq %r15, %r13
jne 0x13d3d
movq 0x60(%rbx), %rax
movq %r12, (%rax,%r13,8)
movl 0xc(%rsp), %eax
shll $0x18, %eax
orl %eax, %r14d
movq 0x68(%rbx), %rax
movl %r14d, (%rax,%r13,4)
movl 0x70(%rbx), %r15d
leal 0x1(%r15), %eax
movl %eax, 0x70(%rbx)
jmp 0x13d85
movq %r12, %rdi
callq 0x33c0
movl %r15d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_compiledscript.cpp
// Function: ccCompiledScript::flush_line_numbers()
void ccCompiledScript::flush_line_numbers() {
    if (next_line) {
        int linum = next_line;
        next_line = 0;
        if(ccGetOption(SCOPT_LINENUMBERS)) {
            write_code(SCMD_LINENUM);
            write_code(linum);
        }
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl 0x8d48(%rdi), %ebx
testl %ebx, %ebx
je 0x13ddf
movq %rdi, %r14
movl $0x0, 0x8d48(%rdi)
movl $0x4, %edi
callq 0x140a4
testl %eax, %eax
je 0x13ddf
movq %r14, %rdi
movl $0x24, %esi
callq 0x135a2
movq %r14, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x135a2
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_compiledscript.cpp
// Function: ccCompiledScript::start_new_section(char const*)
const char* ccCompiledScript::start_new_section(const char *name) {

    if ((numSections == 0) ||
        (codesize != sectionOffsets[numSections - 1]))
    {
        if (numSections >= capacitySections)
        {
            capacitySections += 100;
            sectionNames = (char**)realloc(sectionNames, sizeof(char*) * capacitySections);
            sectionOffsets = (int32_t*)realloc(sectionOffsets, sizeof(int32_t) * capacitySections);
        }
        sectionNames[numSections] = (char*)malloc(strlen(name) + 1);
        strcpy(sectionNames[numSections], name);
        sectionOffsets[numSections] = codesize;

        numSections++;
    }
    else
    {
        // nothing was in the last section, so overwrite it with this new one
        free(sectionNames[numSections - 1]);
        sectionNames[numSections - 1] = (char*)malloc(strlen(name) + 1);
        strcpy(sectionNames[numSections - 1], name);
    }

    return sectionNames[numSections - 1];
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movslq 0x88(%rdi), %rax
testq %rax, %rax
je 0x13e53
movl 0x20(%rbx), %ecx
movq 0x80(%rbx), %rdx
cmpl -0x4(%rdx,%rax,4), %ecx
jne 0x13e53
movq 0x78(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %rdi
callq 0x33c0
movq %r14, %rdi
callq 0x31a0
leaq 0x1(%rax), %rdi
callq 0x3440
movq 0x78(%rbx), %rcx
movslq 0x88(%rbx), %rdx
movq %rax, -0x8(%rcx,%rdx,8)
movq 0x78(%rbx), %rax
movq -0x8(%rax,%rdx,8), %rdi
movq %r14, %rsi
callq 0x32d0
jmp 0x13ee5
movslq 0x8c(%rbx), %rcx
cmpl %ecx, %eax
jl 0x13e9b
leaq 0x64(%rcx), %rax
movl %eax, 0x8c(%rbx)
movq 0x78(%rbx), %rdi
leaq 0x320(,%rcx,8), %rsi
callq 0x3520
movq %rax, 0x78(%rbx)
movq 0x80(%rbx), %rdi
movslq 0x8c(%rbx), %rsi
shlq $0x2, %rsi
callq 0x3520
movq %rax, 0x80(%rbx)
movq %r14, %rdi
callq 0x31a0
leaq 0x1(%rax), %rdi
callq 0x3440
movq 0x78(%rbx), %rcx
movslq 0x88(%rbx), %rdx
movq %rax, (%rcx,%rdx,8)
movq 0x78(%rbx), %rax
movq (%rax,%rdx,8), %rdi
movq %r14, %rsi
callq 0x32d0
movl 0x20(%rbx), %eax
movq 0x80(%rbx), %rcx
movslq 0x88(%rbx), %rdx
movl %eax, (%rcx,%rdx,4)
incl 0x88(%rbx)
movq 0x78(%rbx), %rax
movslq 0x88(%rbx), %rcx
movq -0x8(%rax,%rcx,8), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_compiledscript.cpp
// Function: ccCompiledScript::free_extra()
void ccCompiledScript::free_extra() {
    int aa;
	for (aa=0;aa<numfunctions;aa++) {
        free(functions[aa]);
	}
    numfunctions=0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, 0x8d38(%rdi)
jle 0x13f2b
xorl %r14d, %r14d
movq 0x98(%rbx,%r14,8), %rdi
callq 0x33c0
incq %r14
cmpq %r14, 0x8d38(%rbx)
jg 0x13f12
movq $0x0, 0x8d38(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_script.cpp
// Function: freadstring(char**, AGS::Common::Stream*)
void freadstring(char **strptr, Stream *in)
{
    static char ibuffer[300];
    int idxx = 0;

    while ((ibuffer[idxx] = in->ReadInt8()) != 0)
        idxx++;

    if (ibuffer[0] == 0) {
        strptr[0] = nullptr;
        return;
    }

    strptr[0] = (char *)malloc(strlen(ibuffer) + 1);
    strcpy(strptr[0], ibuffer);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x11622(%rip), %r15     # 0x257b0
movq (%r14), %rax
movq %r14, %rdi
callq *0x70(%rax)
movb %al, (%r15)
incq %r15
testb %al, %al
jne 0x1418e
cmpb $0x0, 0x11608(%rip)     # 0x257b0
je 0x141d5
leaq 0x115ff(%rip), %r14     # 0x257b0
movq %r14, %rdi
callq 0x31a0
leaq 0x1(%rax), %rdi
callq 0x3440
movq %rax, (%rbx)
movq %rax, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x32d0
movq $0x0, (%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_script.cpp
// Function: ccScript::CreateFromStream(AGS::Common::Stream*)
ccScript *ccScript::CreateFromStream(Stream *in)
{
    ccScript *scri = new ccScript();
    if (!scri->Read(in))
    {
        delete scri;
        return nullptr;
    }
    return scri;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x90, %edi
callq 0x3310
movq %rax, %rbx
leaq 0x10adb(%rip), %rax     # 0x24cd8
movq %rax, (%rbx)
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movl %eax, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movl %eax, 0x20(%rbx)
movq %rax, 0x28(%rbx)
movl %eax, 0x30(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbx)
movups %xmm0, 0x48(%rbx)
movups %xmm0, 0x58(%rbx)
movups %xmm0, 0x68(%rbx)
movups %xmm0, 0x78(%rbx)
movq %rax, 0x88(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1425a
testb %al, %al
jne 0x1424f
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_script.cpp
// Function: ccScript::Free()
void ccScript::Free()
{
    if (globaldata != nullptr)
        free(globaldata);

    if (code != nullptr)
        free(code);

    if (strings != nullptr)
        free(strings);

    if (fixups != nullptr && numfixups > 0)
        free(fixups);

    if (fixuptypes != nullptr && numfixups > 0)
        free(fixuptypes);

    globaldata = nullptr;
    code = nullptr;
    strings = nullptr;
    fixups = nullptr;
    fixuptypes = nullptr;

    int aa;
    for (aa = 0; aa < numimports; aa++) {
        if (imports[aa] != nullptr)
            free(imports[aa]);
    }

    for (aa = 0; aa < numexports; aa++)
        free(exports[aa]);

    for (aa = 0; aa < numSections; aa++)
        free(sectionNames[aa]);

    if (sectionNames != nullptr)
    {
        free(sectionNames);
        free(sectionOffsets);
        sectionNames = nullptr;
        sectionOffsets = nullptr;
    }

    if (imports != nullptr)
    {
        free(imports);
        free(exports);
        free(export_addr);
        imports = nullptr;
        exports = nullptr;
        export_addr = nullptr;
    }
    numimports = 0;
    numexports = 0;
    numSections = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x14871
callq 0x33c0
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x1487f
callq 0x33c0
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x1488d
callq 0x33c0
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x148a1
cmpl $0x0, 0x48(%rbx)
jle 0x148a1
callq 0x33c0
leaq 0x38(%rbx), %r14
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x148b9
cmpl $0x0, 0x48(%rbx)
jle 0x148b9
callq 0x33c0
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq %rax, 0x18(%rbx)
movq %rax, 0x28(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
cmpl $0x0, 0x58(%rbx)
jle 0x148f5
xorl %r14d, %r14d
movq 0x50(%rbx), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x148e9
callq 0x33c0
incq %r14
movslq 0x58(%rbx), %rax
cmpq %rax, %r14
jl 0x148d7
cmpl $0x0, 0x70(%rbx)
jle 0x14917
xorl %r14d, %r14d
movq 0x60(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x33c0
incq %r14
movslq 0x70(%rbx), %rax
cmpq %rax, %r14
jl 0x148fe
cmpl $0x0, 0x88(%rbx)
jle 0x1493f
xorl %r14d, %r14d
movq 0x78(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x33c0
incq %r14
movslq 0x88(%rbx), %rax
cmpq %rax, %r14
jl 0x14923
movq 0x78(%rbx), %rdi
testq %rdi, %rdi
je 0x14964
leaq 0x78(%rbx), %r14
callq 0x33c0
movq 0x80(%rbx), %rdi
callq 0x33c0
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x14993
callq 0x33c0
movq 0x60(%rbx), %rdi
callq 0x33c0
movq 0x68(%rbx), %rdi
callq 0x33c0
movq $0x0, 0x50(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%rbx)
xorl %eax, %eax
movl %eax, 0x58(%rbx)
movl %eax, 0x70(%rbx)
movl %eax, 0x88(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/cc_script.cpp
// Function: ccScript::GetSectionName(int)
const char* ccScript::GetSectionName(int32_t offs) {

    int i;
    for (i = 0; i < numSections; i++) {
        if (sectionOffsets[i] < offs)
            continue;
        break;
    }

    // if no sections in script, return unknown
    if (i == 0)
        return "(unknown section)";

    return sectionNames[i - 1];
}

// Assembly:
movl 0x88(%rdi), %ecx
testl %ecx, %ecx
jle 0x14cc8
movq 0x80(%rdi), %rdx
xorl %eax, %eax
cmpl %esi, (%rdx,%rax,4)
jge 0x14cca
incq %rax
cmpq %rax, %rcx
jne 0x14cb7
movl %ecx, %eax
jmp 0x14cca
xorl %eax, %eax
testl %eax, %eax
je 0x14cda
movq 0x78(%rdi), %rcx
movl %eax, %eax
movq -0x8(%rcx,%rax,8), %rax
retq
leaq 0x8308(%rip), %rax      # 0x1cfe9
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/util_string_compat.c
// Function: ags_strlwr
char *ags_strlwr(char *s)
{
    char *p = s;
    for (; *p; p++)
        *p = tolower(*p);
    return s;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb (%rdi), %bpl
testb %bpl, %bpl
je 0x14d13
callq 0x30c0
leaq 0x1(%rbx), %rcx
movq (%rax), %rdx
movsbq %bpl, %rsi
movb (%rdx,%rsi,4), %dl
movb %dl, -0x1(%rcx)
movb (%rcx), %bpl
incq %rcx
testb %bpl, %bpl
jne 0x14cfb
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/util_string_compat.c
// Function: ags_strupr
char *ags_strupr(char *s)
{
    char *p = s;
    for (; *p; p++)
        *p = toupper(*p);
    return s;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb (%rdi), %bpl
testb %bpl, %bpl
je 0x14d4c
callq 0x30a0
leaq 0x1(%rbx), %rcx
movq (%rax), %rdx
movsbq %bpl, %rsi
movb (%rdx,%rsi,4), %dl
movb %dl, -0x1(%rcx)
movb (%rcx), %bpl
incq %rcx
testb %bpl, %bpl
jne 0x14d34
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::operator=(AGS::Common::String const&)
String &String::operator=(const String& str)
{
    if (_data != str._data)
    {
        Free();
        if (str._data && str._meta->Length > 0)
        {
            _data = str._data;
            if (_meta)
            {
                _meta->RefCount++;
            }
        }
    }
    return *this;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rax
cmpq (%rsi), %rax
je 0x14dcf
movq %rsi, %r14
movq %rbx, %rdi
callq 0x14ef4
movq (%r14), %rax
testq %rax, %rax
je 0x14dcf
cmpq $0x0, 0x10(%rax)
je 0x14dcf
movq %rax, (%rbx)
incq (%rax)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::SetString(char const*, unsigned long)
void String::SetString(const char *cstr, size_t length)
{
    if (cstr)
    {
        length = Math::Min(length, strlen(cstr));
        if (length > 0)
        {
            ReserveAndShift(false, Math::Surplus(length, GetLength()));
            memcpy(_meta->CStr, cstr, length);
            _meta->Length = length;
            _meta->CStr[length] = 0;
        }
        else
        {
            Empty();
        }
    }
    else
    {
        Empty();
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0x14e45
movq %rdx, %rbx
movq %rsi, %r15
movq %rsi, %rdi
callq 0x31a0
cmpq %rbx, %rax
cmovbq %rax, %rbx
testq %rbx, %rbx
je 0x14e45
movq (%r14), %rax
testq %rax, %rax
je 0x14e52
movq 0x10(%rax), %rax
jmp 0x14e54
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x14ffa
xorl %eax, %eax
xorl %edx, %edx
movq %rbx, %rcx
subq %rax, %rcx
cmovaeq %rcx, %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x150f6
movq (%r14), %rax
movq 0x18(%rax), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x3290
movq (%r14), %rax
movq %rbx, 0x10(%rax)
movq (%r14), %rax
movq 0x18(%rax), %rax
movb $0x0, (%rax,%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::FillString(char, unsigned long)
void String::FillString(char c, size_t count)
{
    Empty();
    if (count > 0)
    {
        ReserveAndShift(false, count);
        memset(_meta->CStr, c, count);
        _meta->Length = count;
        _meta->CStr[count] = 0;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
callq 0x14ffa
testq %rbx, %rbx
je 0x14ee8
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x150f6
movq (%r14), %rax
movq 0x18(%rax), %rdi
movzbl %bpl, %esi
movq %rbx, %rdx
callq 0x3210
movq (%r14), %rax
movq %rbx, 0x10(%rax)
movq (%r14), %rax
movq 0x18(%rax), %rax
movb $0x0, (%rax,%rbx)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::Free()
void String::Free()
{
    if (_meta)
    {
        assert(_meta->RefCount > 0);
        _meta->RefCount--;
        if (!_meta->RefCount)
        {
            delete [] _data;
        }
    }
    _data = nullptr;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
testq %rax, %rax
je 0x14f1c
movq (%rax), %rcx
testq %rcx, %rcx
je 0x14f25
decq %rcx
movq %rcx, (%rax)
movq (%rbx), %rdi
cmpq $0x0, (%rdi)
jne 0x14f1c
callq 0x3430
movq $0x0, (%rbx)
popq %rbx
retq
leaq 0x8158(%rip), %rdi      # 0x1d084
leaq 0x80df(%rip), %rsi      # 0x1d012
leaq 0x815e(%rip), %rcx      # 0x1d098
movl $0x271, %edx            # imm = 0x271
callq 0x3240
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::Read(AGS::Common::Stream*, unsigned long, bool)
void String::Read(Stream *in, size_t max_chars, bool stop_at_limit)
{
    Empty();
    if (!in)
    {
        return;
    }
    if (max_chars == 0 && stop_at_limit)
    {
        return;
    }

    char buffer[1024];
    char *read_ptr = buffer;
    size_t read_size = 0;
    int ichar;
    do
    {
        ichar = in->ReadByte();
        read_size++;
        if (read_size > max_chars)
        {
            continue;
        }
        *read_ptr = (char)(ichar >= 0 ? ichar : 0);
        if (!*read_ptr || ((read_ptr - buffer) == (sizeof(buffer) - 1 - 1)))
        {
            buffer[sizeof(buffer) - 1] = 0;
            Append(buffer);
            read_ptr = buffer;
        }
        else
        {
            read_ptr++;
        }
    }
    while(ichar > 0 && !(stop_at_limit && read_size == max_chars));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, 0x8(%rsp)
callq 0x14ffa
testq %r15, %r15
sete %al
testq %r14, %r14
sete %cl
andb %bl, %cl
orb %al, %cl
jne 0x14fe7
leaq 0x10(%rsp), %r13
movl $0x1, %r12d
movq (%r15), %rax
movq %r15, %rdi
callq *0x58(%rax)
movl %eax, %ebp
cmpq %r14, %r12
ja 0x14fd6
movl %ebp, %eax
testl %ebp, %ebp
jg 0x14f9c
xorl %eax, %eax
movb %al, (%r13)
testb %al, %al
je 0x14fbc
movq %r13, %rax
leaq 0x10(%rsp), %rcx
subq %rcx, %rax
cmpq $0x3fe, %rax            # imm = 0x3FE
je 0x14fbc
incq %r13
jmp 0x14fd6
movb $0x0, 0x40f(%rsp)
movq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %r13
movq %r13, %rsi
callq 0x15032
cmpq %r12, %r14
sete %al
testb %bl, %al
jne 0x14fe7
incq %r12
testl %ebp, %ebp
jg 0x14f84
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::Empty()
void String::Empty()
{
    if (_meta)
    {
        BecomeUnique();
        _meta->Length = 0;
        _meta->CStr[0] = 0;
    }
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x15030
pushq %rbx
movq %rdi, %rbx
cmpq $0x2, (%rax)
jb 0x1501a
movq 0x10(%rax), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x15e46
movq (%rbx), %rax
movq $0x0, 0x10(%rax)
movq (%rbx), %rax
movq 0x18(%rax), %rax
movb $0x0, (%rax)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::Append(char const*)
void String::Append(const char *cstr)
{
    if (cstr)
    {
        size_t length = strlen(cstr);
        if (length > 0)
        {
            ReserveAndShift(false, length);
            memcpy(_meta->CStr + _meta->Length, cstr, length);
            _meta->Length += length;
            _meta->CStr[_meta->Length] = 0;
        }
    }
}

// Assembly:
testq %rsi, %rsi
je 0x15090
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x31a0
testq %rax, %rax
je 0x1508b
movq %rax, %r15
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x150f6
movq (%rbx), %rax
movq 0x18(%rax), %rdi
addq 0x10(%rax), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3290
movq (%rbx), %rax
addq %r15, 0x10(%rax)
movq (%rbx), %rax
movq 0x10(%rax), %rcx
movq 0x18(%rax), %rax
movb $0x0, (%rax,%rcx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::ReadCount(AGS::Common::Stream*, unsigned long)
void String::ReadCount(Stream *in, size_t count)
{
    Empty();
    if (in && count > 0)
    {
        ReserveAndShift(false, count);
        count = in->Read(_meta->CStr, count);
        _meta->CStr[count] = 0;
        _meta->Length = strlen(_meta->CStr);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
callq 0x14ffa
testq %r15, %r15
sete %al
testq %r14, %r14
sete %cl
orb %al, %cl
jne 0x150f0
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x150f6
movq (%rbx), %rax
movq 0x18(%rax), %rsi
movq (%r15), %rax
movq %r15, %rdi
movq %r14, %rdx
callq *0x50(%rax)
movq (%rbx), %rcx
movq 0x18(%rcx), %rcx
movb $0x0, (%rcx,%rax)
movq (%rbx), %rbx
movq 0x18(%rbx), %rdi
callq 0x31a0
movq %rax, 0x10(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::ReserveAndShift(bool, unsigned long)
void String::ReserveAndShift(bool left, size_t more_length)
{
    if (_meta)
    {
        size_t total_length = _meta->Length + more_length;
        if (_meta->Capacity < total_length)
        {
            // grow by 50% or at least to total_size
            size_t grow_length = _meta->Capacity + (_meta->Capacity >> 1);
            Copy(Math::Max(total_length, grow_length), left ? more_length : 0u);
        }
        else if (_meta->RefCount > 1)
        {
            Copy(total_length, left ? more_length : 0u);
        }
        else
        {
            // make sure we make use of all of our space
            const char *cstr_head = _data + sizeof(String::Header);
            size_t free_space = left ?
                _meta->CStr - cstr_head :
                (cstr_head + _meta->Capacity) - (_meta->CStr + _meta->Length);
            if (free_space < more_length)
            {
                Align((left ?
                    _meta->CStr + (more_length - free_space) :
                    _meta->CStr - (more_length - free_space)) - cstr_head);
            }
        }
    }
    else
    {
        Create(more_length);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rdi, %rbx
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x1513b
movq 0x8(%rcx), %rdi
movq 0x10(%rcx), %rdx
leaq (%rdx,%r14), %rax
cmpq %rax, %rdi
jae 0x1516c
movq %rdi, %rcx
shrq %rcx
addq %rdi, %rcx
cmpq %rcx, %rax
cmovaq %rax, %rcx
xorl %edx, %edx
testb %sil, %sil
cmovneq %r14, %rdx
movq %rbx, %rdi
movq %rcx, %rsi
jmp 0x15181
leaq 0x21(%r14), %rdi
callq 0x3040
movq %rax, (%rbx)
movq $0x1, (%rax)
movq %r14, 0x8(%rax)
movq $0x0, 0x10(%rax)
leaq 0x20(%rax), %rcx
movq %rcx, 0x18(%rax)
movb $0x0, 0x20(%rax)
popq %rbx
popq %r14
popq %r15
retq
cmpq $0x2, (%rcx)
jb 0x1518b
xorl %edx, %edx
testb %sil, %sil
cmovneq %r14, %rdx
movq %rbx, %rdi
movq %rax, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x15e46
leaq 0x20(%rcx), %rax
testb %sil, %sil
je 0x1519a
movq 0x18(%rcx), %rdi
jmp 0x151a7
addq %rdi, %rax
movq %rax, %rdi
movq 0x18(%rcx), %rax
addq %rdx, %rax
subq %rax, %rdi
movq %rdi, %r15
subq %r14, %r15
jae 0x15166
movq 0x18(%rcx), %rax
subq %rdi, %r14
testb %sil, %sil
cmovneq %r14, %r15
addq %rax, %r15
incq %rdx
movq %r15, %rdi
movq %rax, %rsi
callq 0x3500
movq (%rbx), %rax
movq %r15, 0x18(%rax)
jmp 0x15166
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::WriteCount(AGS::Common::Stream*, unsigned long) const
void String::WriteCount(Stream *out, size_t count) const
{
    if (out)
    {
        size_t str_out_len = Math::Min(count - 1, GetLength());
        if (str_out_len > 0)
            out->Write(GetCStr(), str_out_len);
        size_t null_out_len = count - str_out_len;
        if (null_out_len > 0)
            out->WriteByteCount(0, null_out_len);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rsi, %rsi
je 0x1526c
movq %rdx, %rbx
movq %rsi, %r14
leaq -0x1(%rdx), %rcx
movq (%rdi), %rax
testq %rax, %rax
je 0x1523a
movq 0x10(%rax), %r15
jmp 0x1523d
xorl %r15d, %r15d
cmpq %r15, %rcx
cmovbq %rcx, %r15
testq %r15, %r15
je 0x15267
testq %rax, %rax
je 0x15254
movq 0x18(%rax), %rsi
jmp 0x1525b
leaq 0x7f8d(%rip), %rsi      # 0x1d1e8
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rdx
callq *0x60(%rax)
subq %r15, %rbx
jne 0x15272
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x16a54
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::CompareRight(char const*, unsigned long) const
int String::CompareRight(const char *cstr, size_t count) const
{
    cstr = cstr ? cstr : "";
    count = count != -1 ? count : strlen(cstr);
    size_t off = Math::Min(GetLength(), count);
    return strncmp(GetCStr() + GetLength() - off, cstr, count);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
testq %rsi, %rsi
leaq 0x7d69(%rip), %r14      # 0x1d1e8
cmoveq %r14, %rbx
cmpq $-0x1, %rdx
jne 0x15494
movq %rbx, %rdi
callq 0x31a0
movq %rax, %rdx
movq (%r15), %rcx
testq %rcx, %rcx
je 0x154a2
movq 0x10(%rcx), %rax
jmp 0x154a4
xorl %eax, %eax
testq %rcx, %rcx
je 0x154ad
movq 0x18(%rcx), %r14
testq %rcx, %rcx
je 0x154b8
movq 0x10(%rcx), %rcx
jmp 0x154ba
xorl %ecx, %ecx
cmpq %rdx, %rax
cmovaeq %rdx, %rax
addq %rcx, %r14
subq %rax, %r14
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x31d0
nop
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::CompareRightNoCase(char const*, unsigned long) const
int String::CompareRightNoCase(const char *cstr, size_t count) const
{
    cstr = cstr ? cstr : "";
    count = count != -1 ? count : strlen(cstr);
    size_t off = Math::Min(GetLength(), count);
    return ags_strnicmp(GetCStr() + GetLength() - off, cstr, count);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
testq %rsi, %rsi
leaq 0x7cfb(%rip), %r14      # 0x1d1e8
cmoveq %r14, %rbx
cmpq $-0x1, %rdx
jne 0x15502
movq %rbx, %rdi
callq 0x31a0
movq %rax, %rdx
movq (%r15), %rcx
testq %rcx, %rcx
je 0x15510
movq 0x10(%rcx), %rax
jmp 0x15512
xorl %eax, %eax
testq %rcx, %rcx
je 0x1551b
movq 0x18(%rcx), %r14
testq %rcx, %rcx
je 0x15526
movq 0x10(%rcx), %rcx
jmp 0x15528
xorl %ecx, %ecx
cmpq %rdx, %rax
cmovaeq %rdx, %rax
addq %rcx, %r14
subq %rax, %r14
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x14d5b
nop
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::FindChar(char, unsigned long) const
size_t String::FindChar(char c, size_t from) const
{
    if (_meta && c && from < _meta->Length)
    {
        const char * found_cstr = strchr(_meta->CStr + from, c);
        return found_cstr ? found_cstr - _meta->CStr : -1;
    }
    return -1;
}

// Assembly:
movq (%rdi), %rcx
testq %rcx, %rcx
sete %dil
testb %sil, %sil
sete %r8b
movq $-0x1, %rax
orb %dil, %r8b
jne 0x15593
cmpq %rdx, 0x10(%rcx)
jbe 0x15593
pushq %rbx
movq 0x18(%rcx), %rbx
addq %rbx, %rdx
movsbl %sil, %esi
movq %rdx, %rdi
callq 0x3180
movq %rax, %rcx
movq %rax, %rdx
subq %rbx, %rdx
xorl %eax, %eax
cmpq $0x1, %rcx
sbbq %rax, %rax
orq %rdx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::FindCharReverse(char, unsigned long) const
size_t String::FindCharReverse(char c, size_t from) const
{
    if (!_meta || !c)
    {
        return -1;
    }

    from = Math::Min(from, _meta->Length - 1);
    const char *seek_ptr = _meta->CStr + from;
    while (seek_ptr >= _meta->CStr)
    {
        if (*seek_ptr == c)
        {
            return seek_ptr - _meta->CStr;
        }
        seek_ptr--;
    }
    return -1;
}

// Assembly:
movq (%rdi), %rdi
testq %rdi, %rdi
sete %cl
testb %sil, %sil
sete %r8b
movq $-0x1, %rax
orb %cl, %r8b
jne 0x155dc
movq 0x10(%rdi), %rcx
decq %rcx
cmpq %rdx, %rcx
cmovaeq %rdx, %rcx
testq %rcx, %rcx
js 0x155dc
movq 0x18(%rdi), %rdx
cmpb %sil, (%rdx,%rcx)
je 0x155dd
leaq (%rdx,%rcx), %rdi
decq %rdi
decq %rcx
cmpq %rdx, %rdi
jae 0x155c7
retq
movq %rcx, %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::FindString(char const*, unsigned long) const
size_t String::FindString(const char *cstr, size_t from) const
{
    if (_meta && cstr && from < _meta->Length)
    {
        const char * found_cstr = strstr(_meta->CStr + from, cstr);
        return found_cstr ? found_cstr - _meta->CStr : -1;
    }
    return -1;
}

// Assembly:
movq (%rdi), %rcx
testq %rcx, %rcx
sete %dil
testq %rsi, %rsi
sete %r8b
movq $-0x1, %rax
orb %dil, %r8b
jne 0x1562b
cmpq %rdx, 0x10(%rcx)
jbe 0x1562b
pushq %rbx
movq 0x18(%rcx), %rbx
addq %rbx, %rdx
movq %rdx, %rdi
callq 0x30e0
movq %rax, %rcx
movq %rax, %rdx
subq %rbx, %rdx
xorl %eax, %eax
cmpq $0x1, %rcx
sbbq %rax, %rax
orq %rdx, %rax
popq %rbx
retq