LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/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 0x12ef6(%rip), %r15     # 0x257c0
movq (%r14), %rax
movq %r14, %rdi
callq *0x70(%rax)
movb %al, (%r15)
incq %r15
testb %al, %al
jne 0x128ca
cmpb $0x0, 0x12edc(%rip)     # 0x257c0
je 0x12911
leaq 0x12ed3(%rip), %r14     # 0x257c0
movq %r14, %rdi
callq 0x3190
leaq 0x1(%rax), %rdi
callq 0x3430
movq %rax, (%rbx)
movq %rax, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x32c0
andq $0x0, (%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x33a0
movq 0x18(%rbx), %rdi
callq 0x33a0
movq 0x28(%rbx), %rdi
callq 0x33a0
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
setne %cl
movl 0x48(%rbx), %eax
testl %eax, %eax
setg %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x12f7f
callq 0x33a0
movl 0x48(%rbx), %eax
leaq 0x38(%rbx), %r14
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x12f95
testl %eax, %eax
jle 0x12f95
callq 0x33a0
andq $0x0, 0x8(%rbx)
andq $0x0, 0x18(%rbx)
andq $0x0, 0x28(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
xorl %r14d, %r14d
movslq 0x58(%rbx), %rax
cmpq %rax, %r14
jge 0x12fc9
movq 0x50(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x33a0
incq %r14
jmp 0x12fae
leaq 0x60(%rbx), %r14
xorl %r15d, %r15d
movslq 0x70(%rbx), %rax
cmpq %rax, %r15
jge 0x12fea
movq (%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x33a0
incq %r15
jmp 0x12fd0
leaq 0x78(%rbx), %r15
xorl %r12d, %r12d
movslq 0x88(%rbx), %rax
movq 0x78(%rbx), %rdi
cmpq %rax, %r12
jge 0x1300f
movq (%rdi,%r12,8), %rdi
callq 0x33a0
incq %r12
jmp 0x12ff1
testq %rdi, %rdi
je 0x1302c
callq 0x33a0
movq 0x80(%rbx), %rdi
callq 0x33a0
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x13058
callq 0x33a0
movq 0x60(%rbx), %rdi
callq 0x33a0
movq 0x68(%rbx), %rdi
callq 0x33a0
andq $0x0, 0x50(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
andl $0x0, 0x58(%rbx)
andl $0x0, 0x70(%rbx)
andl $0x0, 0x88(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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), %eax
movq 0x80(%rdi), %rdx
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
cmpq %rcx, %rax
je 0x13265
cmpl %esi, (%rdx,%rcx,4)
jge 0x13263
incq %rcx
jmp 0x13254
movl %ecx, %eax
testl %eax, %eax
je 0x13275
movq 0x78(%rdi), %rcx
movl %eax, %eax
movq -0x8(%rcx,%rax,8), %rax
retq
leaq 0x7d7e(%rip), %rax      # 0x1affa
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq %rdi, %r14
movsbq (%r14), %r15
testq %r15, %r15
je 0x132f4
callq 0x30b0
movq (%rax), %rax
movb (%rax,%r15,4), %al
movb %al, (%r14)
incq %r14
jmp 0x132d7
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq %rdi, %r14
movsbq (%r14), %r15
testq %r15, %r15
je 0x13325
callq 0x3090
movq (%rax), %rax
movb (%rax,%r15,4), %al
movb %al, (%r14)
incq %r14
jmp 0x13308
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x133a3
movq %rsi, %r14
movq %rbx, %rdi
callq 0x134b6
movq (%r14), %rax
testq %rax, %rax
je 0x133a3
cmpq $0x0, 0x10(%rax)
je 0x133a3
movq %rax, (%rbx)
incq (%rax)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x13409
movq %rdx, %rbx
movq %rsi, %r15
movq %rsi, %rdi
callq 0x3190
cmpq %rbx, %rax
cmovbq %rax, %rbx
testq %rbx, %rbx
je 0x13409
movq (%r14), %rax
testq %rax, %rax
je 0x13416
movq 0x10(%rax), %rax
jmp 0x13418
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x135b8
xorl %eax, %eax
xorl %edx, %edx
movq %rbx, %rcx
subq %rax, %rcx
cmovaeq %rcx, %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x136a0
movq (%r14), %rax
movq 0x18(%rax), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x3280
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_O2/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 0x135b8
testq %rbx, %rbx
je 0x134aa
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x136a0
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_O2/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 0x134de
movq (%rax), %rcx
testq %rcx, %rcx
je 0x134e4
decq %rcx
movq %rcx, (%rax)
movq (%rbx), %rdi
cmpq $0x0, (%rdi)
jne 0x134de
callq 0x3410
andq $0x0, (%rbx)
popq %rbx
retq
leaq 0x7baa(%rip), %rdi      # 0x1b095
leaq 0x7b31(%rip), %rsi      # 0x1b023
leaq 0x7bb0(%rip), %rcx      # 0x1b0a9
movl $0x271, %edx            # imm = 0x271
callq 0x3240
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x135b8
testq %r15, %r15
sete %al
testq %r14, %r14
sete %cl
andb %bl, %cl
orb %al, %cl
jne 0x135a5
leaq 0x10(%rsp), %r13
pushq $0x1
popq %r12
movq (%r15), %rax
movq %r15, %rdi
callq *0x58(%rax)
movl %eax, %ebp
cmpq %r14, %r12
ja 0x13594
movl %ebp, %eax
testl %ebp, %ebp
jg 0x1355a
xorl %eax, %eax
movb %al, (%r13)
testb %al, %al
je 0x1357a
movq %r13, %rax
leaq 0x10(%rsp), %rcx
subq %rcx, %rax
cmpq $0x3fe, %rax            # imm = 0x3FE
je 0x1357a
incq %r13
jmp 0x13594
movb $0x0, 0x40f(%rsp)
movq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %r13
movq %r13, %rsi
callq 0x135dc
cmpq %r12, %r14
sete %al
testb %bl, %al
jne 0x135a5
incq %r12
testl %ebp, %ebp
jg 0x13542
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_O2/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:
cmpq $0x0, (%rdi)
je 0x135da
pushq %rbx
movq %rdi, %rbx
callq 0x143a4
movq (%rbx), %rax
andq $0x0, 0x10(%rax)
movq (%rbx), %rax
movq 0x18(%rax), %rax
movb $0x0, (%rax)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x1363a
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x3190
testq %rax, %rax
je 0x13635
movq %rax, %r15
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x136a0
movq (%rbx), %rax
movq 0x18(%rax), %rdi
addq 0x10(%rax), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3280
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_O2/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 0x135b8
testq %r15, %r15
sete %al
testq %r14, %r14
sete %cl
orb %al, %cl
jne 0x1369a
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x136a0
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 0x3190
movq %rax, 0x10(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x136e4
movq 0x8(%rcx), %rdi
movq 0x10(%rcx), %rdx
leaq (%rdx,%r14), %rax
cmpq %rax, %rdi
jae 0x136f6
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 0x1370b
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x142a8
cmpq $0x2, (%rcx)
jb 0x13717
xorl %edx, %edx
testb %sil, %sil
cmovneq %r14, %rdx
movq %rbx, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1421c
leaq 0x20(%rcx), %rax
testb %sil, %sil
je 0x13734
movq 0x18(%rcx), %rsi
movq %rsi, %rcx
subq %rax, %rcx
subq %rcx, %r14
jbe 0x13764
addq %rsi, %r14
jmp 0x1374c
addq %rax, %rdi
movq 0x18(%rcx), %rsi
subq %rsi, %rdi
subq %rdx, %rdi
subq %r14, %rdi
jae 0x13764
addq %rsi, %rdi
movq %rdi, %r14
subq %rax, %r14
addq %rax, %r14
incq %rdx
movq %r14, %rdi
callq 0x3510
movq (%rbx), %rax
movq %r14, 0x18(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x137e6
movq %rdx, %rbx
movq %rsi, %r14
movq (%rdi), %rax
testq %rax, %rax
je 0x137de
leaq -0x1(%rbx), %rcx
movq 0x10(%rax), %r15
cmpq %r15, %rcx
cmovbq %rcx, %r15
testq %r15, %r15
je 0x137de
movq 0x18(%rax), %rsi
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rdx
callq *0x60(%rax)
jmp 0x137e1
xorl %r15d, %r15d
subq %r15, %rbx
jne 0x137ec
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x14db4
// File: /workspace/github_cpp_makefile_star2_O2/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 0x781b(%rip), %r14      # 0x1b1f8
cmoveq %r14, %rbx
cmpq $-0x1, %rdx
jne 0x139f2
movq %rbx, %rdi
callq 0x3190
movq %rax, %rdx
movq (%r15), %rax
testq %rax, %rax
je 0x13a0e
movq 0x10(%rax), %rcx
movq 0x18(%rax), %r14
cmpq %rdx, %rcx
movq %rdx, %rax
cmovbq %rcx, %rax
jmp 0x13a12
xorl %eax, %eax
xorl %ecx, %ecx
addq %rcx, %r14
subq %rax, %r14
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x31d0
// File: /workspace/github_cpp_makefile_star2_O2/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 0x77bb(%rip), %r14      # 0x1b1f8
cmoveq %r14, %rbx
cmpq $-0x1, %rdx
jne 0x13a52
movq %rbx, %rdi
callq 0x3190
movq %rax, %rdx
movq (%r15), %rax
testq %rax, %rax
je 0x13a6e
movq 0x10(%rax), %rcx
movq 0x18(%rax), %r14
cmpq %rdx, %rcx
movq %rdx, %rax
cmovbq %rcx, %rax
jmp 0x13a72
xorl %eax, %eax
xorl %ecx, %ecx
addq %rcx, %r14
subq %rax, %r14
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x13333
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $-0x1
popq %rax
orb %dil, %r8b
jne 0x13ad1
cmpq %rdx, 0x10(%rcx)
jbe 0x13ad1
pushq %rbx
movq 0x18(%rcx), %rbx
addq %rbx, %rdx
movsbl %sil, %esi
movq %rdx, %rdi
callq 0x3170
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_O2/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
pushq $-0x1
popq %rax
orb %cl, %r8b
jne 0x13b12
movq 0x10(%rdi), %rcx
movq 0x18(%rdi), %rdi
decq %rcx
cmpq %rdx, %rcx
cmovaeq %rdx, %rcx
leaq (%rdi,%rcx), %rdx
cmpq %rdi, %rdx
jb 0x13b12
cmpb %sil, (%rdx)
je 0x13b0f
decq %rcx
jmp 0x13afc
movq %rcx, %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $-0x1
popq %rax
orb %dil, %r8b
jne 0x13b59
cmpq %rdx, 0x10(%rcx)
jbe 0x13b59
pushq %rbx
movq 0x18(%rcx), %rbx
addq %rbx, %rdx
movq %rdx, %rdi
callq 0x30d0
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_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::FromFormat(char const*, ...)
String String::FromFormat(const char *fcstr, ...)
{
    fcstr = fcstr ? fcstr : "";
    String str;
    va_list argptr;
    va_start(argptr, fcstr);
    str.FormatV(fcstr, argptr);
    va_end(argptr);
    return str;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xd8, %rsp
leaq 0x20(%rsp), %r10
movq %rdx, 0x10(%r10)
movq %rcx, 0x18(%r10)
movq %r8, 0x20(%r10)
movq %r9, 0x28(%r10)
testb %al, %al
je 0x13cfe
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
testq %rsi, %rsi
leaq 0x74f0(%rip), %rax      # 0x1b1f8
cmoveq %rax, %rsi
movq %rdi, %rbx
andq $0x0, (%rdi)
movq %rsp, %rdx
movq %r10, 0x10(%rdx)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
callq 0x13d5a
movq %rbx, %rax
addq $0xd8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x134b6
movq %r14, %rdi
callq 0x3560
nop
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::FormatV(char const*, __va_list_tag*)
void String::FormatV(const char *fcstr, va_list argptr)
{
    fcstr = fcstr ? fcstr : "";
    va_list argptr_cpy;
    va_copy(argptr_cpy, argptr);
    size_t length = vsnprintf(nullptr, 0u, fcstr, argptr);
    ReserveAndShift(false, Math::Surplus(length, GetLength()));
    vsprintf(_meta->CStr, fcstr, argptr_cpy);
    va_end(argptr_cpy);
    _meta->Length = length;
    _meta->CStr[_meta->Length] = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rcx
movq %rdi, %rbx
testq %rsi, %rsi
leaq 0x7483(%rip), %r14      # 0x1b1f8
cmovneq %rsi, %r14
movq 0x10(%rdx), %rax
movq %rax, 0x10(%rsp)
movups (%rdx), %xmm0
movaps %xmm0, (%rsp)
xorl %r15d, %r15d
xorl %edi, %edi
xorl %esi, %esi
movq %r14, %rdx
callq 0x3230
movq (%rbx), %rcx
testq %rcx, %rcx
je 0x13da4
movq 0x10(%rcx), %r15
movslq %eax, %r12
xorl %edx, %edx
movq %r12, %rax
subq %r15, %rax
cmovaeq %rax, %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x136a0
movq (%rbx), %rax
movq 0x18(%rax), %rdi
movq %rsp, %rdx
movq %r14, %rsi
callq 0x31b0
movq (%rbx), %rax
movq %r12, 0x10(%rax)
movq (%rbx), %rax
movq 0x10(%rax), %rcx
movq 0x18(%rax), %rax
movb $0x0, (%rax,%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::LeftSection(char, bool) const
String String::LeftSection(char separator, bool exclude_separator) const
{
    if (_meta && separator)
    {
        size_t slice_at = FindChar(separator);
        if (slice_at != -1)
        {
            slice_at = exclude_separator ? slice_at : slice_at + 1;
            return Left(slice_at);
        }
    }
    return *this;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
testb %dl, %dl
je 0x14016
cmpq $0x0, (%r14)
je 0x14016
movl %ecx, %ebp
movsbl %dl, %esi
movq %r14, %rdi
xorl %edx, %edx
callq 0x13a88
cmpq $-0x1, %rax
je 0x14016
xorb $0x1, %bpl
movzbl %bpl, %ecx
addq %rcx, %rax
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x13f1c
jmp 0x14021
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1336a
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::RightSection(char, bool) const
String String::RightSection(char separator, bool exclude_separator) const
{
    if (_meta && separator)
    {
        size_t slice_at = FindCharReverse(separator);
        if (slice_at != -1)
        {
            size_t count = exclude_separator ? _meta->Length - slice_at - 1 : _meta->Length - slice_at;
            return Right(count);
        }
    }
    return *this;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %r15
testq %r15, %r15
sete %al
testb %dl, %dl
sete %cl
orb %al, %cl
jne 0x14083
movsbl %dl, %esi
pushq $-0x1
popq %rdx
movq %r14, %rdi
callq 0x13ad2
cmpq $-0x1, %rax
je 0x14083
movq %rax, %rcx
notq %rcx
negq %rax
testb %bpl, %bpl
cmovneq %rcx, %rax
addq 0x10(%r15), %rax
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x13f9c
jmp 0x1408e
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1336a
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::Section(char, unsigned long, unsigned long, bool, bool) const
String String::Section(char separator, size_t first, size_t last,
                          bool exclude_first_sep, bool exclude_last_sep) const
{
    if (!_meta || !separator)
    {
        return String();
    }

    size_t slice_from;
    size_t slice_to;
    if (FindSection(separator, first, last, exclude_first_sep, exclude_last_sep,
        slice_from, slice_to))
    {
        return Mid(slice_from, slice_to - slice_from);
    }
    return String();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
testb %dl, %dl
je 0x14102
movq %rsi, %r14
cmpq $0x0, (%rsi)
je 0x14102
movb 0x30(%rsp), %dil
leaq 0x8(%rsp), %r10
leaq 0x10(%rsp), %r11
movsbl %dl, %esi
movzbl %r9b, %eax
movzbl %dil, %r9d
movq %r14, %rdi
movq %rcx, %rdx
movq %r8, %rcx
movl %eax, %r8d
pushq %r10
pushq %r11
callq 0x13b5a
popq %rcx
popq %rdx
testb %al, %al
je 0x14102
movq 0x10(%rsp), %rdx
movq 0x8(%rsp), %rcx
subq %rdx, %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x13f4a
jmp 0x14106
andq $0x0, (%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::Split(char) const
std::vector<String> String::Split(char separator) const
{
    std::vector<String> result;
    if (!_meta || !separator)
        return result;
    const char *ptr = _meta->CStr;
    while (*ptr)
    {
        const char *found_cstr = strchr(ptr, separator);
        if (!found_cstr) break;
        result.push_back(String(ptr, found_cstr - ptr));
        ptr = found_cstr + 1;
    }
    if (*ptr)
        result.push_back(String(ptr));
    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
andq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq (%rsi), %rax
testq %rax, %rax
sete %cl
testb %dl, %dl
sete %sil
orb %cl, %sil
jne 0x141b5
movq 0x18(%rax), %r12
movsbl %dl, %ebp
leaq 0x8(%rsp), %r14
cmpb $0x0, (%r12)
je 0x141b5
movq %r12, %rdi
movl %ebp, %esi
callq 0x3170
testq %rax, %rax
je 0x14191
movq %rax, %r15
movq %rax, %rdx
subq %r12, %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x133ca
movq %rbx, %rdi
movq %r14, %rsi
callq 0x14ba2
movq %r14, %rdi
callq 0x134b6
incq %r15
movq %r15, %r12
jmp 0x1414c
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x133ae
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x14ba2
leaq 0x8(%rsp), %rdi
callq 0x134b6
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x141ce
jmp 0x141c9
movq %rax, %r14
jmp 0x141db
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x134b6
movq %rbx, %rdi
callq 0x14b26
movq %r14, %rdi
callq 0x3560
nop
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::Reserve(unsigned long)
void String::Reserve(size_t max_length)
{
    if (_meta)
    {
        if (max_length > _meta->Capacity)
        {
            // grow by 50%
            size_t grow_length = _meta->Capacity + (_meta->Capacity / 2);
            Copy(Math::Max(max_length, grow_length));
        }
    }
    else
    {
        Create(max_length);
    }
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x142a8
movq 0x8(%rax), %rcx
cmpq %rsi, %rcx
jae 0x1421b
movq %rcx, %rax
shrq %rax
addq %rcx, %rax
cmpq %rsi, %rax
cmovbeq %rsi, %rax
movq %rax, %rsi
xorl %edx, %edx
jmp 0x1421c
retq
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::Copy(unsigned long, unsigned long)
void String::Copy(size_t max_length, size_t offset)
{
    if (!_meta)
    {
        return;
    }

    char *new_data = new char[sizeof(String::Header) + max_length + 1];
    // remember, that _meta->CStr may point to any address in buffer
    char *cstr_head = new_data + sizeof(String::Header) + offset;
    memcpy(new_data, _data, sizeof(String::Header));
    size_t copy_length = Math::Min(_meta->Length, max_length);
    memcpy(cstr_head, _meta->CStr, copy_length);
    Free();
    _data = new_data;
    _meta->RefCount = 1;
    _meta->Capacity = max_length;
    _meta->Length = copy_length;
    _meta->CStr = cstr_head;
    _meta->CStr[_meta->Length] = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq (%rdi), %rbp
testq %rbp, %rbp
je 0x14298
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x21(%rsi), %rdi
callq 0x3040
movq %rax, %r12
addq %r15, %rax
movq %rax, (%rsp)
addq %r12, %r15
addq $0x20, %r15
movq 0x10(%rbp), %r13
movq 0x18(%rbp), %rsi
cmpq %rbx, %r13
cmovaeq %rbx, %r13
movq %r15, %rdi
movq %r13, %rdx
callq 0x3280
movq %r14, %rdi
callq 0x134b6
movq %r12, (%r14)
movq $0x1, (%r12)
movq %rbx, 0x8(%r12)
movq %r13, 0x10(%r12)
movq %r15, 0x18(%r12)
movq (%rsp), %rax
movb $0x0, 0x20(%r13,%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::Create(unsigned long)
void String::Create(size_t max_length)
{
    _data = new char[sizeof(String::Header) + max_length + 1];
    _meta->RefCount = 1;
    _meta->Capacity = max_length;
    _meta->Length = 0;
    _meta->CStr = _data + sizeof(String::Header);
    _meta->CStr[_meta->Length] = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x21(%rsi), %rdi
callq 0x3040
movq %rax, (%r14)
movq $0x1, (%rax)
movq %rbx, 0x8(%rax)
andq $0x0, 0x10(%rax)
leaq 0x20(%rax), %rcx
movq %rcx, 0x18(%rax)
movb $0x0, 0x20(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::AppendChar(char)
void String::AppendChar(char c)
{
    if (c)
    {
        ReserveAndShift(false, 1);
        _meta->CStr[_meta->Length++] = c;
        _meta->CStr[_meta->Length] = 0;
    }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
testb %bpl, %bpl
je 0x14355
movq %rdi, %rbx
pushq $0x1
popq %rdx
xorl %esi, %esi
callq 0x136a0
movq (%rbx), %rax
movq 0x10(%rax), %rcx
movq 0x18(%rax), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, 0x10(%rax)
movb %bpl, (%rdx,%rcx)
movq (%rbx), %rax
movq 0x10(%rax), %rcx
movq 0x18(%rax), %rax
movb $0x0, (%rax,%rcx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::ClipLeft(unsigned long)
void String::ClipLeft(size_t count)
{
    if (_meta && _meta->Length > 0 && count > 0)
    {
        count = Math::Min(count, _meta->Length);
        BecomeUnique();
        _meta->Length -= count;
        _meta->CStr += count;
    }
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x143a3
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq 0x10(%rax), %rax
testq %rax, %rax
sete %cl
testq %rsi, %rsi
sete %dl
orb %cl, %dl
jne 0x1439c
movq %rdi, %r14
cmpq %rbx, %rax
cmovbq %rax, %rbx
callq 0x143a4
movq (%r14), %rax
subq %rbx, 0x10(%rax)
movq (%r14), %rax
addq %rbx, 0x18(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::ClipMid(unsigned long, unsigned long)
void String::ClipMid(size_t from, size_t count)
{
    if (_meta && from < _meta->Length)
    {
        count = Math::Min(count, _meta->Length - from);
        if (count > 0)
        {
            BecomeUnique();
            if (!from)
            {
                _meta->Length -= count;
                _meta->CStr += count;
            }
            else if (from + count == _meta->Length)
            {
                _meta->Length -= count;
                _meta->CStr[_meta->Length] = 0;
            }
            else
            {
                char *cstr_mid = _meta->CStr + from;
                memmove(cstr_mid, _meta->CStr + from + count, _meta->Length - from - count + 1);
                _meta->Length -= count;
            }
        }
    }
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x1444b
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq 0x10(%rax), %rax
subq %rsi, %rax
jbe 0x14446
movq %rdx, %rbx
cmpq %rdx, %rax
cmovbq %rax, %rbx
testq %rbx, %rbx
je 0x14446
movq %rdi, %r14
callq 0x143a4
testq %r15, %r15
je 0x1441c
leaq (%rbx,%r15), %rcx
movq (%r14), %rax
movq 0x10(%rax), %rdx
subq %rcx, %rdx
jne 0x1442c
movq %r15, 0x10(%rax)
movq (%r14), %rax
movq 0x10(%rax), %rcx
movq 0x18(%rax), %rax
movb $0x0, (%rax,%rcx)
jmp 0x14446
movq (%r14), %rax
subq %rbx, 0x10(%rax)
movq (%r14), %rax
addq %rbx, 0x18(%rax)
jmp 0x14446
addq 0x18(%rax), %r15
leaq (%r15,%rbx), %rsi
incq %rdx
movq %r15, %rdi
callq 0x3510
movq (%r14), %rax
subq %rbx, 0x10(%rax)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::ClipRight(unsigned long)
void String::ClipRight(size_t count)
{
    if (_meta && count > 0)
    {
        count = Math::Min(count, GetLength());
        BecomeUnique();
        _meta->Length -= count;
        _meta->CStr[_meta->Length] = 0;
    }
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
sete %cl
testq %rsi, %rsi
sete %dl
orb %cl, %dl
jne 0x14496
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x10(%rax), %rax
cmpq %rsi, %rax
cmovbq %rax, %r14
callq 0x143a4
movq (%rbx), %rax
subq %r14, 0x10(%rax)
movq (%rbx), %rax
movq 0x10(%rax), %rcx
movq 0x18(%rax), %rax
movb $0x0, (%rax,%rcx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::ClipLeftSection(char, bool)
void String::ClipLeftSection(char separator, bool include_separator)
{
    if (_meta && separator)
    {
        size_t slice_at = FindChar(separator);
        if (slice_at != -1)
        {
            ClipLeft(include_separator ? slice_at + 1 : slice_at);
        }
        else
            Empty();
    }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
testb %sil, %sil
je 0x144d7
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0x144d7
movl %edx, %ebp
movsbl %sil, %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x13a88
cmpq $-0x1, %rax
je 0x144de
movzbl %bpl, %ecx
addq %rcx, %rax
movq %rbx, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1435c
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x135b8
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::ClipRightSection(char, bool)
void String::ClipRightSection(char separator, bool include_separator)
{
    if (_meta && separator)
    {
        size_t slice_at = FindCharReverse(separator);
        if (slice_at != -1)
        {
            ClipRight(include_separator ? _meta->Length - slice_at : _meta->Length - slice_at - 1);
        }
        else
            Empty();
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq (%rdi), %r14
testq %r14, %r14
sete %al
testb %sil, %sil
sete %cl
orb %al, %cl
jne 0x1453d
movl %edx, %ebp
movq %rdi, %rbx
movsbl %sil, %esi
pushq $-0x1
popq %rdx
callq 0x13ad2
cmpq $-0x1, %rax
je 0x14542
movq %rax, %rcx
notq %rcx
negq %rax
testb %bpl, %bpl
cmoveq %rcx, %rax
addq 0x10(%r14), %rax
movq %rbx, %rdi
movq %rax, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x1444c
popq %rbx
popq %r14
popq %rbp
retq
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x135b8
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::ClipSection(char, unsigned long, unsigned long, bool, bool)
void String::ClipSection(char separator, size_t first, size_t last,
                              bool include_first_sep, bool include_last_sep)
{
    if (!_meta || !separator)
    {
        return;
    }

    size_t slice_from;
    size_t slice_to;
    if (FindSection(separator, first, last, !include_first_sep, !include_last_sep,
        slice_from, slice_to))
    {
        ClipMid(slice_from, slice_to - slice_from);
    }
}

// Assembly:
testb %sil, %sil
je 0x145a7
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0x145a2
xorb $0x1, %r8b
xorb $0x1, %r9b
movq %rsp, %rax
leaq 0x8(%rsp), %r10
movsbl %sil, %esi
movzbl %r8b, %r8d
movzbl %r9b, %r9d
movq %rbx, %rdi
pushq %rax
pushq %r10
callq 0x13b5a
popq %rcx
popq %rdx
testb %al, %al
je 0x145a2
movq 0x8(%rsp), %rsi
movq (%rsp), %rdx
subq %rsi, %rdx
movq %rbx, %rdi
callq 0x143be
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::Prepend(char const*)
void String::Prepend(const char *cstr)
{
    if (cstr)
    {
        size_t length = strlen(cstr);
        if (length > 0)
        {
            ReserveAndShift(true, length);
            memcpy(_meta->CStr - length, cstr, length);
            _meta->Length += length;
            _meta->CStr -= length;
        }
    }
}

// Assembly:
testq %rsi, %rsi
je 0x14682
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x3190
testq %rax, %rax
je 0x1467d
movq %rax, %r15
pushq $0x1
popq %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0x136a0
movq (%rbx), %rax
movq 0x18(%rax), %rdi
subq %r15, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3280
movq (%rbx), %rax
addq %r15, 0x10(%rax)
movq (%rbx), %rax
subq %r15, 0x18(%rax)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::PrependChar(char)
void String::PrependChar(char c)
{
    if (c)
    {
        ReserveAndShift(true, 1);
        _meta->Length++;
        _meta->CStr--;
        _meta->CStr[0] = c;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
testb %bl, %bl
je 0x146b3
movq %rdi, %r14
pushq $0x1
popq %rsi
pushq $0x1
popq %rdx
callq 0x136a0
movq (%r14), %rax
incq 0x10(%rax)
movq (%r14), %rax
decq 0x18(%rax)
movq (%r14), %rax
movq 0x18(%rax), %rax
movb %bl, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::Replace(char, char)
void String::Replace(char what, char with)
{
    if (_meta && what && with && what != with)
    {
        BecomeUnique();
        char *rep_ptr = _meta->CStr;
        while (*rep_ptr)
        {
            if (*rep_ptr == what)
            {
                *rep_ptr = with;
            }
            rep_ptr++;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
movl %esi, %ebp
cmpb %bl, %bpl
je 0x146fc
testb %bl, %bl
je 0x146fc
testb %bpl, %bpl
je 0x146fc
movq %rdi, %r14
cmpq $0x0, (%rdi)
je 0x146fc
movq %r14, %rdi
callq 0x143a4
movq (%r14), %rax
movq 0x18(%rax), %rax
movb (%rax), %cl
testb %cl, %cl
je 0x146fc
cmpb %bpl, %cl
jne 0x146f7
movb %bl, (%rax)
incq %rax
jmp 0x146ea
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::ReplaceMid(unsigned long, unsigned long, char const*)
void String::ReplaceMid(size_t from, size_t count, const char *cstr)
{
    if (!cstr)
        cstr = "";
    size_t length = strlen(cstr);
    Math::ClampLength(from, count, (size_t)0, GetLength());
    ReserveAndShift(false, Math::Surplus(length, count));
    memmove(_meta->CStr + from + length, _meta->CStr + from + count, GetLength() - (from + count) + 1);
    memcpy(_meta->CStr + from, cstr, length);
    _meta->Length += length - count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %rbx
testq %rcx, %rcx
leaq 0x6ad8(%rip), %r14      # 0x1b1f8
cmovneq %rcx, %r14
movq %r14, %rdi
callq 0x3190
movq %rax, %r12
movq (%rbx), %rax
testq %rax, %rax
je 0x1474a
movq 0x10(%rax), %rbp
xorl %eax, %eax
cmpq %r15, %rbp
cmovaq %r13, %rax
cmovbq %rbp, %r15
jmp 0x14751
xorl %ebp, %ebp
xorl %eax, %eax
xorl %r15d, %r15d
subq %r15, %rbp
cmpq %rbp, %rax
cmovbq %rax, %rbp
xorl %edx, %edx
movq %r12, %r13
subq %rbp, %r13
cmovaeq %r13, %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x136a0
movq (%rbx), %rax
movq 0x18(%rax), %rsi
addq %r15, %rsi
movq %r12, %rdi
addq %rsi, %rdi
addq %rbp, %rsi
movq 0x10(%rax), %rax
addq %r15, %rbp
negq %rbp
leaq (%rax,%rbp), %rdx
incq %rdx
callq 0x3510
movq (%rbx), %rax
addq 0x18(%rax), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x3280
movq (%rbx), %rax
addq %r13, 0x10(%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::TrimLeft(char)
void String::TrimLeft(char c)
{
    if (!_meta || !_meta->Length)
    {
        return;
    }

    const char *trim_ptr = _meta->CStr;
    for (;;)
    {
        auto t = *trim_ptr;
        if (t == 0) { break; }
        if (c && t != c) { break; }
        if (!c && !isspace(t)) { break; }
        trim_ptr++;
    }
    size_t trimmed = trim_ptr - _meta->CStr;
    if (trimmed > 0)
    {
        BecomeUnique();
        _meta->Length -= trimmed;
        _meta->CStr += trimmed;
    }
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x14890
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x0, 0x10(%rax)
je 0x14886
movl %esi, %ebp
movq %rdi, %rbx
movq 0x18(%rax), %r15
xorl %r14d, %r14d
testb %bpl, %bpl
sete %al
movsbl (%r15,%r14), %edi
cmpb %bpl, %dil
sete %cl
testb %dil, %dil
je 0x1486b
orb %cl, %al
je 0x1486b
testb %bpl, %bpl
jne 0x14866
callq 0x3080
testl %eax, %eax
je 0x1486b
incq %r14
jmp 0x1483e
testq %r14, %r14
je 0x14886
movq %rbx, %rdi
callq 0x143a4
movq (%rbx), %rax
subq %r14, 0x10(%rax)
movq (%rbx), %rax
addq %r14, 0x18(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::TrimRight(char)
void String::TrimRight(char c)
{
    if (!_meta || !_meta->Length)
    {
        return;
    }

    const char *trim_ptr = _meta->CStr + _meta->Length - 1;
    for (;;) 
    {
        if (trim_ptr < _meta->CStr) { break; }
        auto t = *trim_ptr;
        if (c && t != c) { break; }
        if (!c && !isspace(t)) { break; }
        trim_ptr--;
    }
    size_t trimmed = (_meta->CStr + _meta->Length - 1) - trim_ptr;
    if (trimmed > 0)
    {
        BecomeUnique();
        _meta->Length -= trimmed;
        _meta->CStr[_meta->Length] = 0;
    }
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x14915
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0x1490d
movl %esi, %ebp
movq %rdi, %rbx
movq 0x18(%rax), %r15
leaq (%rcx,%r15), %r12
decq %r12
xorl %r14d, %r14d
cmpq %r15, %r12
jb 0x148ea
movb (%r12), %al
testb %bpl, %bpl
je 0x148d1
cmpb %bpl, %al
jne 0x148ea
testb %bpl, %bpl
jne 0x148e2
movsbl %al, %edi
callq 0x3080
testl %eax, %eax
je 0x148ea
incq %r14
decq %r12
jmp 0x148be
testq %r14, %r14
je 0x1490d
movq %rbx, %rdi
callq 0x143a4
movq (%rbx), %rax
subq %r14, 0x10(%rax)
movq (%rbx), %rax
movq 0x10(%rax), %rcx
movq 0x18(%rax), %rax
movb $0x0, (%rax,%rcx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::TruncateToLeft(unsigned long)
void String::TruncateToLeft(size_t count)
{
    if (_meta)
    {
        count = Math::Min(count, _meta->Length);
        if (count < _meta->Length)
        {
            BecomeUnique();
            _meta->Length = count;
            _meta->CStr[_meta->Length] = 0;
        }
    }
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x14950
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
cmpq %rsi, 0x10(%rax)
jbe 0x14949
movq %rdi, %rbx
callq 0x143a4
movq (%rbx), %rax
movq %r14, 0x10(%rax)
movq (%rbx), %rax
movq 0x10(%rax), %rcx
movq 0x18(%rax), %rax
movb $0x0, (%rax,%rcx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::TruncateToMid(unsigned long, unsigned long)
void String::TruncateToMid(size_t from, size_t count)
{
    if (_meta)
    {
        Math::ClampLength(from, count, (size_t)0, _meta->Length);
        if (from > 0 || count < _meta->Length)
        {
            BecomeUnique();
            _meta->Length = count;
            _meta->CStr += from;
            _meta->CStr[_meta->Length] = 0;
        }
    }
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x149ba
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq 0x10(%rax), %rax
xorl %ecx, %ecx
cmpq %rsi, %rax
cmovaq %rdx, %rcx
cmovbq %rax, %rbx
movq %rax, %r15
subq %rbx, %r15
cmpq %r15, %rcx
cmovbq %rcx, %r15
testq %rbx, %rbx
sete %cl
cmpq %rax, %r15
setae %al
testb %al, %cl
jne 0x149b5
movq %rdi, %r14
callq 0x143a4
movq (%r14), %rax
movq %r15, 0x10(%rax)
movq (%r14), %rax
addq %rbx, 0x18(%rax)
movq (%r14), %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_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::TruncateToRight(unsigned long)
void String::TruncateToRight(size_t count)
{
    if (_meta)
    {
        count = Math::Min(count, GetLength());
        if (count < _meta->Length)
        {
            BecomeUnique();
            _meta->CStr += _meta->Length - count;
            _meta->Length = count;
        }
    }
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x149f5
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
cmpq %rsi, 0x10(%rax)
jbe 0x149ee
movq %rdi, %r14
callq 0x143a4
movq (%r14), %rax
movq 0x10(%rax), %rcx
subq %rbx, %rcx
addq %rcx, 0x18(%rax)
movq (%r14), %rax
movq %rbx, 0x10(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/rofl0r[P]ascc/util_string.cpp
// Function: AGS::Common::String::TruncateToLeftSection(char, bool)
void String::TruncateToLeftSection(char separator, bool exclude_separator)
{
    if (_meta && separator)
    {
        size_t slice_at = FindChar(separator);
        if (slice_at != -1)
        {
            TruncateToLeft(exclude_separator ? slice_at : slice_at + 1);
        }
    }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
testb %sil, %sil
je 0x14a39
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0x14a39
movl %edx, %ebp
movsbl %sil, %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x13a88
cmpq $-0x1, %rax
je 0x14a39
xorb $0x1, %bpl
movzbl %bpl, %ecx
addq %rcx, %rax
movq %rbx, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x14916
addq $0x8, %rsp
popq %rbx
popq %rbp
retq