// File: /workspace/github_c_makefile_star2_O2/bluecmd[P]fst-example/gtkwave/lz4.c
// Function: LZ4_decompress_safe_continue
int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxOutputSize)
{
    LZ4_streamDecode_t_internal* lz4sd = (LZ4_streamDecode_t_internal*) LZ4_streamDecode;
    int result;

    if (lz4sd->prefixEnd == (BYTE*)dest)
    {
        result = LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
                                        endOnInputSize, full, 0,
                                        usingExtDict, lz4sd->prefixEnd - lz4sd->prefixSize, lz4sd->externalDict, lz4sd->extDictSize);
        if (result <= 0) return result;
        lz4sd->prefixSize += result;
        lz4sd->prefixEnd  += result;
    }
    else
    {
        lz4sd->extDictSize = lz4sd->prefixSize;
        lz4sd->externalDict = lz4sd->prefixEnd - lz4sd->extDictSize;
        result = LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
                                        endOnInputSize, full, 0,
                                        usingExtDict, (BYTE*)dest, lz4sd->externalDict, lz4sd->extDictSize);
        if (result <= 0) return result;
        lz4sd->prefixSize = result;
        lz4sd->prefixEnd  = (BYTE*)dest + result;
    }

    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdx, %r15
movq 0x10(%rdi), %r10
movq 0x18(%rdi), %r11
movslq %ecx, %r9
addq %rsi, %r9
movslq %r8d, %rdx
addq %r15, %rdx
cmpq %r15, %r10
movq %rdi, -0xa0(%rbp)
movq %r15, -0x68(%rbp)
movq %rsi, -0x98(%rbp)
movq %rdx, -0x88(%rbp)
movq %r9, -0x90(%rbp)
je 0xec7e
movq %r11, 0x8(%rdi)
movq %r10, %rax
subq %r11, %rax
movq %rax, (%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, -0xd0(%rbp)
movaps %xmm0, -0xc0(%rbp)
movaps %xmm0, -0xe0(%rbp)
orq $-0x1, -0xc8(%rbp)
movq $0x1, -0xb8(%rbp)
movq $0x2, -0xb0(%rbp)
movq $0x3, -0xa8(%rbp)
testl %r8d, %r8d
je 0xf01b
pushq $0xf
popq %r8
movq %r15, %rdi
subq %r11, %rdi
leaq -0xc(%rdx), %rax
leaq -0xf(%r9), %r13
leaq -0x8(%r9), %rcx
movq %rcx, -0x78(%rbp)
leaq -0x8(%rdx), %rcx
movq %rcx, -0x38(%rbp)
leaq -0x5(%r9), %rcx
movq %rcx, -0x70(%rbp)
movq %rax, %r9
leaq -0x5(%rdx), %rax
movq %rax, -0x60(%rbp)
movq %r15, %r14
movq %rsi, %r12
movq %rdi, -0x30(%rbp)
movq %r10, -0x50(%rbp)
movq %r11, -0x48(%rbp)
movq %r9, -0x58(%rbp)
movzbl (%r12), %edx
incq %r12
movl %edx, %eax
shrl $0x4, %eax
cmpl $0xf, %eax
jne 0xea6a
movq %r8, %rax
movzbl (%r12), %ecx
incq %r12
addq %rcx, %rax
cmpq %r13, %r12
jae 0xea61
cmpb $-0x1, %cl
je 0xea4c
testq %rax, %rax
js 0xefbc
leaq (%r14,%rax), %rbx
leaq (%r12,%rax), %rsi
cmpq %r9, %rbx
ja 0xef69
cmpq -0x78(%rbp), %rsi
ja 0xef69
movq (%r12), %rax
movq %rax, (%r14)
addq $0x8, %r14
addq $0x8, %r12
cmpq %rbx, %r14
jb 0xea85
movzwl (%rsi), %eax
movq %rbx, %rcx
subq %rax, %rcx
addq $0x2, %rsi
cmpq $0xffff, %r11           # imm = 0xFFFF
ja 0xeab8
cmpq %rdi, %rcx
jb 0xefb9
andl $0xf, %edx
cmpq $0xf, %rdx
jne 0xeaf1
movq %r8, %rdx
movq %rsi, %r12
movq -0x70(%rbp), %rsi
cmpq %rsi, %r12
ja 0xefbc
movzbl (%r12), %eax
incq %r12
addq %rax, %rdx
cmpq $0xff, %rax
je 0xeacb
testq %rdx, %rdx
jns 0xeaf4
jmp 0xefbc
movq %rsi, %r12
leaq (%rbx,%rdx), %r14
addq $0x4, %r14
cmpq %r15, %rcx
jae 0xeb72
cmpq -0x60(%rbp), %r14
ja 0xefbc
addq $0x4, %rdx
subq %rcx, %r15
subq %r15, %r10
movq %rdx, %rax
subq %r15, %rax
jbe 0xebb0
movq %rbx, %rdi
movq %r10, %rsi
movq %r15, %rdx
movq %rax, -0x40(%rbp)
callq 0x2240
addq %r15, %rbx
movq %rbx, %rax
movq -0x68(%rbp), %r15
subq %r15, %rax
cmpq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdx
jbe 0xebc1
movq %r15, %rax
movq -0x50(%rbp), %r10
movq -0x48(%rbp), %r11
pushq $0xf
popq %r8
movq -0x30(%rbp), %rdi
movq -0x58(%rbp), %r9
cmpq %r14, %rbx
jae 0xebe5
movb (%rax), %cl
incq %rax
movb %cl, (%rbx)
incq %rbx
jmp 0xeb61
movq %rbx, %rdx
subq %rcx, %rdx
cmpq $0x7, %rdx
jle 0xebed
movq (%rcx), %rax
movq %rax, (%rbx)
addq $0x8, %rcx
movq %rcx, %rax
addq $0x8, %rbx
cmpq %r9, %r14
ja 0xec2b
movq (%rax), %rcx
movq %rcx, (%rbx)
addq $0x8, %rbx
addq $0x8, %rax
cmpq %r14, %rbx
jb 0xeb98
jmp 0xea37
movq %rbx, %rdi
movq %r10, %rsi
callq 0x22f0
movq -0x68(%rbp), %r15
jmp 0xebcc
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2240
movq -0x50(%rbp), %r10
movq -0x48(%rbp), %r11
pushq $0xf
popq %r8
movq -0x30(%rbp), %rdi
movq -0x58(%rbp), %r9
jmp 0xea37
movq %rbx, %r14
jmp 0xea37
movb (%rcx), %sil
leaq 0x3ec9(%rip), %rax      # 0x12ac0
movq (%rax,%rdx,8), %rdi
leaq (%rcx,%rdi), %rax
subq -0xe0(%rbp,%rdx,8), %rax
movb %sil, (%rbx)
movb 0x1(%rcx), %dl
movb %dl, 0x1(%rbx)
movb 0x2(%rcx), %dl
movb %dl, 0x2(%rbx)
movb 0x3(%rcx), %dl
movb %dl, 0x3(%rbx)
movl (%rcx,%rdi), %ecx
movq -0x30(%rbp), %rdi
movl %ecx, 0x4(%rbx)
jmp 0xeb8b
cmpq -0x60(%rbp), %r14
ja 0xefbc
movq -0x38(%rbp), %rcx
cmpq %rcx, %rbx
jae 0xec74
movq %rax, %rcx
movq %rbx, %rdx
movq (%rcx), %rsi
movq %rsi, (%rdx)
addq $0x8, %rdx
addq $0x8, %rcx
cmpq -0x38(%rbp), %rdx
jb 0xec44
movq -0x38(%rbp), %rdx
movq %rdx, %rcx
subq %rbx, %rcx
addq %rcx, %rax
movq %rdx, %rbx
jmp 0xec74
movb (%rax), %cl
incq %rax
movb %cl, (%rbx)
incq %rbx
cmpq %r14, %rbx
jb 0xec6a
jmp 0xea37
movq 0x8(%rdi), %rax
movq (%rdi), %rbx
addq %rax, %rbx
movq %rbx, -0x58(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0xd0(%rbp)
movaps %xmm0, -0xc0(%rbp)
movaps %xmm0, -0xe0(%rbp)
orq $-0x1, -0xc8(%rbp)
movq $0x1, -0xb8(%rbp)
movq $0x2, -0xb0(%rbp)
movq $0x3, -0xa8(%rbp)
testl %r8d, %r8d
je 0xf01b
movq %rax, %rdi
subq %r11, %r10
movq %r10, %r8
subq %rax, %r8
leaq -0xc(%rdx), %r11
leaq -0xf(%r9), %r13
leaq -0x8(%r9), %rax
movq %rax, -0x78(%rbp)
leaq -0x8(%rdx), %rax
movq %rax, -0x48(%rbp)
leaq -0x5(%r9), %rax
movq %rax, -0x70(%rbp)
leaq -0x5(%rdx), %rax
movq %rax, -0x60(%rbp)
movq %r15, %r14
movq %rsi, %r12
movq %rdi, -0x30(%rbp)
movq %r8, -0x40(%rbp)
movq %r11, -0x38(%rbp)
movq %r10, -0x50(%rbp)
movzbl (%r12), %edx
incq %r12
movl %edx, %eax
shrl $0x4, %eax
cmpl $0xf, %eax
jne 0xed53
pushq $0xf
popq %rax
movzbl (%r12), %ecx
incq %r12
addq %rcx, %rax
cmpq %r13, %r12
jae 0xed4a
cmpb $-0x1, %cl
je 0xed35
testq %rax, %rax
js 0xefe1
leaq (%r14,%rax), %rbx
leaq (%r12,%rax), %rsi
cmpq %r11, %rbx
ja 0xef91
cmpq -0x78(%rbp), %rsi
ja 0xef91
movq (%r12), %rax
movq %rax, (%r14)
addq $0x8, %r14
addq $0x8, %r12
cmpq %rbx, %r14
jb 0xed6e
movzwl (%rsi), %eax
movq %rbx, %rcx
subq %rax, %rcx
addq $0x2, %rsi
cmpq $0xffff, %rdi           # imm = 0xFFFF
ja 0xeda1
cmpq %r8, %rcx
jb 0xefde
andl $0xf, %edx
cmpq $0xf, %rdx
jne 0xedda
pushq $0xf
popq %rdx
movq %rsi, %r12
movq -0x70(%rbp), %rsi
cmpq %rsi, %r12
ja 0xefe1
movzbl (%r12), %eax
incq %r12
addq %rax, %rdx
cmpq $0xff, %rax
je 0xedb4
testq %rdx, %rdx
jns 0xeddd
jmp 0xefe1
movq %rsi, %r12
leaq (%rbx,%rdx), %r14
addq $0x4, %r14
cmpq %r10, %rcx
jae 0xee5f
cmpq -0x60(%rbp), %r14
ja 0xefe1
addq $0x4, %rdx
movq %r10, %r15
subq %rcx, %r15
movq -0x58(%rbp), %rsi
subq %r15, %rsi
movq %rdx, %rax
subq %r15, %rax
jbe 0xeea1
movq %rbx, %rdi
movq %r15, %rdx
movq %rax, -0x80(%rbp)
callq 0x2240
addq %r15, %rbx
movq %rbx, %rax
movq -0x50(%rbp), %r10
subq %r10, %rax
cmpq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdx
jbe 0xeeb3
movq %r10, %rax
movq -0x68(%rbp), %r15
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %r8
movq -0x38(%rbp), %r11
cmpq %r14, %rbx
jae 0xeed9
movb (%rax), %cl
incq %rax
movb %cl, (%rbx)
incq %rbx
jmp 0xee4a
movq %rbx, %rdx
subq %rcx, %rdx
cmpq $0x7, %rdx
jle 0xeee1
movq (%rcx), %rax
movq %rax, (%rbx)
addq $0x8, %rcx
movq %rcx, %rax
movq -0x48(%rbp), %r9
addq $0x8, %rbx
cmpq %r11, %r14
ja 0xef1f
movq (%rax), %rcx
movq %rcx, (%rbx)
addq $0x8, %rbx
addq $0x8, %rax
cmpq %r14, %rbx
jb 0xee89
jmp 0xed20
movq %rbx, %rdi
callq 0x22f0
movq -0x68(%rbp), %r15
movq -0x50(%rbp), %r10
jmp 0xeec8
movq %rbx, %rdi
movq %r10, %rsi
movq %r10, %rbx
callq 0x2240
movq %rbx, %r10
movq -0x68(%rbp), %r15
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %r8
movq -0x38(%rbp), %r11
jmp 0xed20
movq %rbx, %r14
jmp 0xed20
movb (%rcx), %sil
leaq 0x3bd5(%rip), %rax      # 0x12ac0
movq (%rax,%rdx,8), %rdi
leaq (%rcx,%rdi), %rax
subq -0xe0(%rbp,%rdx,8), %rax
movb %sil, (%rbx)
movb 0x1(%rcx), %dl
movb %dl, 0x1(%rbx)
movb 0x2(%rcx), %dl
movb %dl, 0x2(%rbx)
movb 0x3(%rcx), %dl
movb %dl, 0x3(%rbx)
movl (%rcx,%rdi), %ecx
movq -0x30(%rbp), %rdi
movl %ecx, 0x4(%rbx)
jmp 0xee78
cmpq -0x60(%rbp), %r14
ja 0xefe1
cmpq %r9, %rbx
jae 0xef5f
movq %rax, %rcx
movq %rbx, %rdx
movq (%rcx), %rsi
movq %rsi, (%rdx)
addq $0x8, %rdx
addq $0x8, %rcx
cmpq %r9, %rdx
jb 0xef34
movq %r9, %rcx
subq %rbx, %rcx
addq %rcx, %rax
movq %r9, %rbx
jmp 0xef5f
movb (%rax), %cl
incq %rax
movb %cl, (%rbx)
incq %rbx
cmpq %r14, %rbx
jb 0xef55
jmp 0xed20
cmpq -0x90(%rbp), %rsi
jne 0xefbc
cmpq -0x88(%rbp), %rbx
ja 0xefbc
movq %r14, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2240
subl %r15d, %ebx
movl %ebx, %r12d
jmp 0xefc6
cmpq -0x90(%rbp), %rsi
jne 0xefe1
cmpq -0x88(%rbp), %rbx
ja 0xefe1
movq %r14, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2240
subl %r15d, %ebx
movl %ebx, %r12d
jmp 0xefeb
movq %rsi, %r12
notl %r12d
addl -0x98(%rbp), %r12d
testl %r12d, %r12d
movq -0xa0(%rbp), %rcx
jle 0xf006
movl %r12d, %eax
movq %rax, 0x18(%rcx)
addq %rax, %r15
jmp 0xf002
movq %rsi, %r12
notl %r12d
addl -0x98(%rbp), %r12d
testl %r12d, %r12d
movq -0xa0(%rbp), %rcx
jle 0xf006
movl %r12d, %r15d
addq %r15, 0x18(%rcx)
addq 0x10(%rcx), %r15
movq %r15, 0x10(%rcx)
movl %r12d, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x1, %ecx
jne 0xf02b
xorl %r12d, %r12d
cmpb (%rsi), %r12b
sbbl %r12d, %r12d
jmp 0xf006
pushq $-0x1
popq %r12
jmp 0xf006