// File: /workspace/github_c_makefile_star2_O0/Aethlas[P]fflz4/./lib/lz4/lz4.c
// Function: LZ4_loadDict
int LZ4_loadDict (LZ4_stream_t* LZ4_dict, const char* dictionary, int dictSize)
{
    LZ4_stream_t_internal* dict = &LZ4_dict->internal_donotuse;
    const tableType_t tableType = byU32;
    const BYTE* p = (const BYTE*)dictionary;
    const BYTE* const dictEnd = p + dictSize;
    const BYTE* base;

    DEBUGLOG(4, "LZ4_loadDict (%i bytes from %p into %p)", dictSize, dictionary, LZ4_dict);

    /* It's necessary to reset the context,
     * and not just continue it with prepareTable()
     * to avoid any risk of generating overflowing matchIndex
     * when compressing using this dictionary */
    LZ4_resetStream(LZ4_dict);

    /* We always increment the offset by 64 KB, since, if the dict is longer,
     * we truncate it to the last 64k, and if it's shorter, we still want to
     * advance by a whole window length so we can provide the guarantee that
     * there are only valid offsets in the window, which allows an optimization
     * in LZ4_compress_fast_continue() where it uses noDictIssue even when the
     * dictionary isn't a full 64k. */
    dict->currentOffset += 64 KB;

    if (dictSize < (int)HASH_UNIT) {
        return 0;
    }

    if ((dictEnd - p) > 64 KB) p = dictEnd - 64 KB;
    base = dictEnd - dict->currentOffset;
    dict->dictionary = p;
    dict->dictSize = (U32)(dictEnd - p);
    dict->tableType = tableType;

    while (p <= dictEnd-HASH_UNIT) {
        LZ4_putPosition(p, dict->hashTable, tableType, base);
        p+=3;
    }

    return (int)dict->dictSize;
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movl %edx, 0x34(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x28(%rsp)
movl $0x2, 0x24(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movslq 0x34(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x40(%rsp), %rdi
callq 0x23340
movq 0x28(%rsp), %rax
movl 0x4000(%rax), %ecx
addl $0x10000, %ecx          # imm = 0x10000
movl %ecx, 0x4000(%rax)
cmpl $0x8, 0x34(%rsp)
jge 0x23568
movl $0x0, 0x48(%rsp)
jmp 0x236bf
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rcx, %rax
cmpq $0x10000, %rax          # imm = 0x10000
jle 0x2358d
movq 0x10(%rsp), %rax
addq $-0x10000, %rax         # imm = 0xFFFF0000
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rax
movq 0x28(%rsp), %rcx
movl 0x4000(%rcx), %ecx
movl %ecx, %edx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x4008(%rax)
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rcx, %rax
movl %eax, %ecx
movq 0x28(%rsp), %rax
movl %ecx, 0x4018(%rax)
movq 0x28(%rsp), %rax
movw $0x2, 0x4006(%rax)
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
addq $-0x8, %rcx
cmpq %rcx, %rax
ja 0x236b0
movq 0x18(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rdx, 0x68(%rsp)
movq %rcx, 0x60(%rsp)
movl $0x2, 0x5c(%rsp)
movq %rax, 0x50(%rsp)
movq 0x68(%rsp), %rcx
movl 0x5c(%rsp), %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
cmpl $0x3, 0x74(%rsp)
je 0x2365a
movq 0x78(%rsp), %rdi
callq 0x47010
movq %rax, %rdi
movl 0x74(%rsp), %esi
callq 0x46f60
movl %eax, 0x84(%rsp)
jmp 0x23676
movq 0x78(%rsp), %rdi
callq 0x46ce0
movl %eax, %edi
movl 0x74(%rsp), %esi
callq 0x47020
movl %eax, 0x84(%rsp)
movl 0x84(%rsp), %eax
movl %eax, 0x4c(%rsp)
movq 0x68(%rsp), %rdi
movl 0x4c(%rsp), %esi
movq 0x60(%rsp), %rdx
movl 0x5c(%rsp), %ecx
movq 0x50(%rsp), %r8
callq 0x46c30
movq 0x18(%rsp), %rax
addq $0x3, %rax
movq %rax, 0x18(%rsp)
jmp 0x235e5
movq 0x28(%rsp), %rax
movl 0x4018(%rax), %eax
movl %eax, 0x48(%rsp)
movl 0x48(%rsp), %eax
addq $0x88, %rsp
retq
nopl (%rax,%rax)