// File: /workspace/github_c_makefile_star2_O3/bluecmd[P]fst-example/gtkwave/fastlz.c
// Function: fastlz_decompress
int fastlz_decompress(const void* input, int length, void* output, int maxout)
{
  /* magic identifier for compression level */
  int level = ((*(const flzuint8*)input) >> 5) + 1;

  if(level == 1)
    return fastlz1_decompress(input, length, output, maxout);
  if(level == 2)
    return fastlz2_decompress(input, length, output, maxout);

  /* unknown level, trigger error */
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, -0x38(%rbp)
movzbl (%rdi), %r12d
movslq %esi, %r10
movslq %ecx, %r11
cmpl $0x1f, %r12d
ja 0x25cd
addq %rdi, %r10
movq -0x38(%rbp), %rcx
addq %rcx, %r11
incq %rdi
pushq $0x1
popq %r13
movl %r13d, %r14d
movq %r10, -0x40(%rbp)
cmpl $0x20, %r12d
jb 0x24ab
movl %r12d, %r8d
shrl $0x5, %r8d
decl %r8d
cmpl $0x6, %r8d
jne 0x2426
movzbl (%rdi), %r8d
incq %rdi
addl $0x6, %r8d
movl %r8d, %edx
leaq (%rcx,%rdx), %r15
addq $0x3, %r15
xorl %eax, %eax
cmpq %r11, %r15
ja 0x2821
movl %r12d, %r9d
andl $0x1f, %r9d
shll $0x8, %r9d
movq %rcx, %rsi
subq %r9, %rsi
movzbl (%rdi), %r9d
subq %r9, %rsi
leaq -0x1(%rsi), %r9
cmpq -0x38(%rbp), %r9
jb 0x2821
leaq 0x1(%rdi), %rbx
cmpq %r10, %rbx
jae 0x25c5
movzbl 0x1(%rdi), %r12d
addq $0x2, %rdi
movq %rdi, %rbx
movb -0x1(%rsi), %al
movb %al, (%rcx)
cmpq %rcx, %rsi
je 0x2511
movb (%rsi), %al
movb %al, 0x1(%rcx)
movb 0x1(%rsi), %al
movb %al, 0x2(%rcx)
testb $0x1, %r8b
jne 0x253f
addq $0x2, %rsi
addq $0x3, %rcx
jmp 0x2553
movl %r12d, %edx
leaq (%rcx,%rdx), %rsi
incq %rsi
xorl %eax, %eax
cmpq %r11, %rsi
ja 0x2821
addq %rdi, %rdx
incq %rdx
cmpq %r10, %rdx
ja 0x2821
movb (%rdi), %al
movb %al, (%rcx)
incq %rcx
leaq 0x1(%rdi), %rax
testl %r12d, %r12d
je 0x24f2
movb (%rax), %dl
movb %dl, (%rcx)
incq %rcx
incq %rax
decl %r12d
jne 0x24df
leaq -0x1(%rax), %rdi
cmpq %r10, %rax
jae 0x2810
addq $0x2, %rdi
movzbl (%rax), %r12d
movq %rcx, %r15
movl %r13d, %r14d
movq %rdi, %rbx
jmp 0x25b1
movb %al, 0x1(%rcx)
movb %al, 0x2(%rcx)
addq $0x3, %rcx
testl %r8d, %r8d
je 0x25ae
movzbl %al, %esi
movq %rcx, %rdi
movq %r11, %r13
callq 0x2190
movq %r13, %r11
movq -0x40(%rbp), %r10
pushq $0x1
popq %r13
jmp 0x25b1
movb 0x2(%rsi), %al
addq $0x3, %rsi
movb %al, 0x3(%rcx)
addq $0x4, %rcx
decl %r8d
movq %r8, %rdx
movq %rcx, %r15
movl %r8d, %ecx
shrl %ecx
movq %r15, %rax
cmpl $0xa, %r8d
jb 0x2592
movzwl (%rsi), %edi
movw %di, (%rax)
movzwl 0x2(%rsi), %edi
movw %di, 0x2(%rax)
movzwl 0x4(%rsi), %edi
movw %di, 0x4(%rax)
movzwl 0x6(%rsi), %edi
addq $0x8, %rsi
movw %di, 0x6(%rax)
addq $0x8, %rax
addl $-0x4, %ecx
cmpl $0x4, %ecx
ja 0x2564
addq %rdx, %r15
testl %ecx, %ecx
je 0x25b1
movl %ecx, %ecx
xorl %edx, %edx
movzwl (%rsi,%rdx,2), %edi
movw %di, (%rax,%rdx,2)
incq %rdx
cmpl %edx, %ecx
jne 0x259d
jmp 0x25b1
movq %rcx, %r15
movq %r15, %rcx
movq %rbx, %rdi
testl %r14d, %r14d
jne 0x2401
jmp 0x2813
xorl %r14d, %r14d
jmp 0x247b
movl %r12d, %ecx
andb $-0x20, %cl
xorl %eax, %eax
cmpb $0x20, %cl
jne 0x2821
pushq $0x1
popq %r8
addq %rdi, %r10
movq -0x38(%rbp), %rbx
addq %rbx, %r11
incq %rdi
andl $0x1f, %r12d
pushq $0x6
popq %r9
movl %r8d, %eax
movq %r10, -0x40(%rbp)
cmpl $0x20, %r12d
jb 0x26ba
movl %r12d, %r13d
shrl $0x5, %r13d
decl %r13d
cmpl $0x6, %r13d
movl %eax, -0x2c(%rbp)
jne 0x262e
movl %r9d, %r13d
movzbl (%rdi), %eax
incq %rdi
addl %eax, %r13d
cmpl $0xff, %eax
je 0x261e
movl %r12d, %eax
andl $0x1f, %eax
shll $0x8, %eax
movl %eax, %edx
movq %rbx, %rcx
subq %rdx, %rcx
leaq 0x1(%rdi), %r15
movzbl (%rdi), %edx
subq %rdx, %rcx
cmpq $0xff, %rdx
je 0x27d5
movl %r13d, %edx
leaq (%rbx,%rdx), %rsi
addq $0x3, %rsi
xorl %eax, %eax
cmpq %r11, %rsi
ja 0x2821
leaq -0x1(%rcx), %rsi
cmpq -0x38(%rbp), %rsi
jb 0x2821
cmpq %r10, %r15
jae 0x2804
movzbl (%r15), %r12d
incq %r15
movb -0x1(%rcx), %al
movb %al, (%rbx)
cmpq %rbx, %rcx
je 0x271d
movb (%rcx), %al
movb %al, 0x1(%rbx)
movb 0x1(%rcx), %al
movb %al, 0x2(%rbx)
testb $0x1, %r13b
jne 0x2756
addq $0x2, %rcx
addq $0x3, %rbx
jmp 0x276a
movl %r12d, %ecx
leaq (%rbx,%rcx), %rdx
incq %rdx
xorl %eax, %eax
cmpq %r11, %rdx
ja 0x2821
addq %rdi, %rcx
incq %rcx
cmpq %r10, %rcx
ja 0x2821
movb (%rdi), %al
movb %al, (%rbx)
incq %rbx
leaq 0x1(%rdi), %rax
testl %r12d, %r12d
je 0x2701
movb (%rax), %cl
movb %cl, (%rbx)
incq %rbx
incq %rax
decl %r12d
jne 0x26ee
leaq -0x1(%rax), %rdi
cmpq %r10, %rax
jae 0x281c
addq $0x2, %rdi
movzbl (%rax), %r12d
movq %rdi, %r15
movl %r8d, %eax
jmp 0x27c8
movb %al, 0x1(%rbx)
leaq 0x3(%rbx), %rdi
movb %al, 0x2(%rbx)
testl %r13d, %r13d
je 0x27c2
movzbl %al, %esi
movq %r11, %r14
callq 0x2190
pushq $0x6
popq %r9
pushq $0x1
popq %r8
movq %r14, %r11
movq -0x40(%rbp), %r10
decl %r13d
addq %r13, %rbx
addq $0x4, %rbx
jmp 0x27c5
movb 0x2(%rcx), %al
addq $0x3, %rcx
movb %al, 0x3(%rbx)
addq $0x4, %rbx
decl %r13d
movq %r13, %rdx
movl %r13d, %esi
shrl %esi
movq %rbx, %rax
cmpl $0xa, %r13d
jb 0x27a6
movzwl (%rcx), %edi
movw %di, (%rax)
movzwl 0x2(%rcx), %edi
movw %di, 0x2(%rax)
movzwl 0x4(%rcx), %edi
movw %di, 0x4(%rax)
movzwl 0x6(%rcx), %edi
addq $0x8, %rcx
movw %di, 0x6(%rax)
addq $0x8, %rax
addl $-0x4, %esi
cmpl $0x4, %esi
ja 0x2778
addq %rdx, %rbx
testl %esi, %esi
je 0x27c5
movl %esi, %edx
xorl %esi, %esi
movzwl (%rcx,%rsi,2), %edi
movw %di, (%rax,%rsi,2)
incq %rsi
cmpl %esi, %edx
jne 0x27b1
jmp 0x27c5
movq %rdi, %rbx
movl -0x2c(%rbp), %eax
movq %r15, %rdi
testl %eax, %eax
jne 0x25fe
jmp 0x281c
cmpl $0x1f00, %eax           # imm = 0x1F00
jne 0x2656
movzwl 0x1(%rdi), %eax
addq $0x3, %rdi
rolw $0x8, %ax
movzwl %ax, %eax
movq %rbx, %rcx
subq %rax, %rcx
addq $-0x1fff, %rcx          # imm = 0xE001
movq %rdi, %r15
jmp 0x2656
movl $0x0, -0x2c(%rbp)
jmp 0x268a
movq %rcx, %r15
subl -0x38(%rbp), %r15d
movl %r15d, %eax
jmp 0x2821
subl -0x38(%rbp), %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq