// File: m0Mh42[P]mash/./src/mash.cpp
// Function: Mash::chunkdata(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*)
string* Mash::chunkdata(string* input){
    string* data;
    data = new string;
    if (data == nullptr){
        cout << memerr;
        exit(MEMERR);
    }
    *data = *input;

    if (data->length() % 32 > 0){
        int len  = 32 - (data->length() % 32);
        for (int l = 0; l < len; l++){
            data->push_back((unsigned char) '0' + len);
        }
    } // Divisible to 32.

    cspace = data->length() / 32; // Each byte space
    chunk_count = cspace; // Chunk count
    string* chunks;

    if (cspace % 2 != 0)
        chunk_count++; // Extra chunk

    chunks = new string[chunk_count];
    prv_chunks = new string[chunk_count];
    if (chunks == nullptr){
        cout << memerr;
        exit(MEMERR);
    }

    for (int a = 0; a < cspace; a++){ // Chunk all data
        for (int r = 0; r < 32; r++){
            (chunks + a)->push_back((*data)[r * cspace + a]);
        }
    }

    if (cspace != chunk_count){ // Last empty chunk
        for (int i = 0; i < 32; i++){
            rand_c_generator();
            (chunks + cspace)->push_back(rand_c);
        }
    }

    delete data;
    return chunks;
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x60(%rsp)
movl $0x20, %edi
callq 0x2200
movq %rax, %rdi
movq %rdi, 0x68(%rsp)
callq 0x2300
movq 0x68(%rsp), %rax
movq %rax, 0x90(%rsp)
cmpq $0x0, 0x90(%rsp)
jne 0x3b40
movq 0x34a6(%rip), %rdi      # 0x6fd0
leaq 0x1620(%rip), %rsi      # 0x5151
callq 0x21f0
movl $0x1, %edi
callq 0x2290
movq 0x98(%rsp), %rsi
movq 0x90(%rsp), %rdi
callq 0x2040
movq 0x90(%rsp), %rdi
callq 0x2340
andq $0x1f, %rax
cmpq $0x0, %rax
jbe 0x3bd9
movq 0x90(%rsp), %rdi
callq 0x2340
movq %rax, %rcx
andq $0x1f, %rcx
movl $0x20, %eax
subq %rcx, %rax
movl %eax, 0x8c(%rsp)
movl $0x0, 0x88(%rsp)
movl 0x88(%rsp), %eax
cmpl 0x8c(%rsp), %eax
jge 0x3bd7
movq 0x90(%rsp), %rdi
movl 0x8c(%rsp), %eax
addl $0x30, %eax
movsbl %al, %esi
callq 0x2180
movl 0x88(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x88(%rsp)
jmp 0x3b9a
jmp 0x3bd9
movq 0x90(%rsp), %rdi
callq 0x2340
movq %rax, %rcx
movq 0x60(%rsp), %rax
shrq $0x5, %rcx
movl %ecx, 0x4(%rax)
movl 0x4(%rax), %ecx
movl %ecx, 0x8(%rax)
movl 0x4(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
je 0x3c19
movq 0x60(%rsp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
movq 0x60(%rsp), %rax
movslq 0x8(%rax), %rax
movq %rax, 0x50(%rsp)
movl $0x20, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
addq $0x8, %rdi
setb %al
orb %al, %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2030
movq %rax, %rcx
movq 0x50(%rsp), %rax
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, 0x58(%rsp)
cmpq $0x0, %rax
je 0x3cb0
movq 0x58(%rsp), %rax
movq 0x50(%rsp), %rdx
shlq $0x5, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, 0x40(%rsp)
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x2300
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, 0x48(%rsp)
jne 0x3c89
movq 0x60(%rsp), %rax
movq 0x58(%rsp), %rcx
movq %rcx, 0x80(%rsp)
movslq 0x8(%rax), %rax
movq %rax, 0x28(%rsp)
movl $0x20, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
addq $0x8, %rdi
setb %al
orb %al, %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2030
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, 0x30(%rsp)
cmpq $0x0, %rax
je 0x3d54
movq 0x30(%rsp), %rax
movq 0x28(%rsp), %rdx
shlq $0x5, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x2300
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, 0x20(%rsp)
jne 0x3d2d
movq 0x60(%rsp), %rax
movq 0x30(%rsp), %rcx
movq %rcx, 0x10(%rax)
cmpq $0x0, 0x80(%rsp)
jne 0x3d8a
movq 0x325c(%rip), %rdi      # 0x6fd0
leaq 0x13d6(%rip), %rsi      # 0x5151
callq 0x21f0
movl $0x1, %edi
callq 0x2290
movl $0x0, 0x7c(%rsp)
movq 0x60(%rsp), %rcx
movl 0x7c(%rsp), %eax
cmpl 0x4(%rcx), %eax
jge 0x3e12
movl $0x0, 0x78(%rsp)
cmpl $0x20, 0x78(%rsp)
jge 0x3e03
movq 0x60(%rsp), %rcx
movq 0x80(%rsp), %rax
movslq 0x7c(%rsp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rax, 0x8(%rsp)
movq 0x90(%rsp), %rdi
movl 0x78(%rsp), %eax
imull 0x4(%rcx), %eax
addl 0x7c(%rsp), %eax
movslq %eax, %rsi
callq 0x2440
movq 0x8(%rsp), %rdi
movsbl (%rax), %esi
callq 0x2180
movl 0x78(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x78(%rsp)
jmp 0x3da8
jmp 0x3e05
movl 0x7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0x3d92
movq 0x60(%rsp), %rcx
movl 0x4(%rcx), %eax
cmpl 0x8(%rcx), %eax
je 0x3e67
movl $0x0, 0x74(%rsp)
cmpl $0x20, 0x74(%rsp)
jge 0x3e65
movq 0x60(%rsp), %rdi
callq 0x3ea0
movq 0x60(%rsp), %rax
movq 0x80(%rsp), %rdi
movslq 0x4(%rax), %rcx
shlq $0x5, %rcx
addq %rcx, %rdi
movsbl (%rax), %esi
callq 0x2180
movl 0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x74(%rsp)
jmp 0x3e27
jmp 0x3e67
movq 0x90(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x3e90
movq (%rsp), %rdi
callq 0x2130
movq (%rsp), %rdi
movl $0x20, %esi
callq 0x2210
movq 0x80(%rsp), %rax
addq $0xa8, %rsp
retq