// File: 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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, 0x8(%rax)
je 0x27218
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4460
movq -0x18(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x27230
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x4460
movq -0x18(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x27248
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x4460
movq -0x18(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x2726a
movq -0x18(%rbp), %rax
cmpl $0x0, 0x48(%rax)
jle 0x2726a
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x4460
movq -0x18(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x2728c
movq -0x18(%rbp), %rax
cmpl $0x0, 0x48(%rax)
jle 0x2728c
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x4460
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq $0x0, 0x18(%rax)
movq $0x0, 0x28(%rax)
movq $0x0, 0x40(%rax)
movq $0x0, 0x38(%rax)
movl $0x0, -0xc(%rbp)
movq -0x18(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0x58(%rcx), %eax
jge 0x27300
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x272f3
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4460
jmp 0x272f5
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x272bf
movl $0x0, -0xc(%rbp)
movq -0x18(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0x70(%rcx), %eax
jge 0x27333
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4460
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x27307
movl $0x0, -0xc(%rbp)
movq -0x18(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0x88(%rcx), %eax
jge 0x27369
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4460
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2733a
movq -0x18(%rbp), %rax
cmpq $0x0, 0x78(%rax)
je 0x273a8
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rdi
callq 0x4460
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rdi
callq 0x4460
movq -0x18(%rbp), %rax
movq $0x0, 0x78(%rax)
movq $0x0, 0x80(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x273f6
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x4460
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x4460
movq -0x18(%rbp), %rax
movq 0x68(%rax), %rdi
callq 0x4460
movq -0x18(%rbp), %rax
movq $0x0, 0x50(%rax)
movq $0x0, 0x60(%rax)
movq $0x0, 0x68(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x58(%rax)
movl $0x0, 0x70(%rax)
movl $0x0, 0x88(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)