#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int LZ4_decompress_safe(char const *, char *, int, int);
int LZ4_decompress_safe_forceExtDict(char const *, char *, int, int,
                                     char const *, size_t);
int LZ4_decompress_safe_withPrefix64k(char const *, char *, int, int);
int LZ4_decompress_safe_withSmallPrefix(char const *, char *, int, int, size_t);
int LZ4_decompress_safe_usingDict(const char *source, char *dest,
                                  int compressedSize, int maxOutputSize,
                                  const char *dictStart, int dictSize) {
  if (dictSize == 0)
    return LZ4_decompress_safe(source, dest, compressedSize, maxOutputSize);
  if (dictStart + dictSize == dest) {
    if (dictSize >= 64 * (1 << 10) - 1) {
      return LZ4_decompress_safe_withPrefix64k(source, dest, compressedSize,
                                               maxOutputSize);
    }
    ((void)0);
    return LZ4_decompress_safe_withSmallPrefix(source, dest, compressedSize,
                                               maxOutputSize, (size_t)dictSize);
  }
  ((void)0);
  return LZ4_decompress_safe_forceExtDict(
      source, dest, compressedSize, maxOutputSize, dictStart, (size_t)dictSize);
}


x86 assembly (clang, -O0):
<LZ4_decompress_safe_usingDict>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    1183 <LZ4_decompress_safe_usingDict+0x43>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1060 <LZ4_decompress_safe@plt>
mov    %eax,-0x4(%rbp)
jmp    11fd <LZ4_decompress_safe_usingDict+0xbd>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
add    %rcx,%rax
cmp    -0x18(%rbp),%rax
jne    11df <LZ4_decompress_safe_usingDict+0x9f>
cmpl   $0xffff,-0x2c(%rbp)
jl     11c0 <LZ4_decompress_safe_usingDict+0x80>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1040 <LZ4_decompress_safe_withPrefix64k@plt>
mov    %eax,-0x4(%rbp)
jmp    11fd <LZ4_decompress_safe_usingDict+0xbd>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
movslq -0x2c(%rbp),%r8
call   1030 <LZ4_decompress_safe_withSmallPrefix@plt>
mov    %eax,-0x4(%rbp)
jmp    11fd <LZ4_decompress_safe_usingDict+0xbd>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x28(%rbp),%r8
movslq -0x2c(%rbp),%r9
call   1050 <LZ4_decompress_safe_forceExtDict@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LZ4_decompress_safe_usingDict>:
test   %r9d,%r9d
je     1159 <LZ4_decompress_safe_usingDict+0x19>
mov    %r9d,%r10d
movslq %r9d,%r9
lea    (%r8,%r9,1),%rax
cmp    %rsi,%rax
je     115e <LZ4_decompress_safe_usingDict+0x1e>
jmp    1050 <LZ4_decompress_safe_forceExtDict@plt>
jmp    1060 <LZ4_decompress_safe@plt>
cmp    $0xffff,%r10d
jl     116c <LZ4_decompress_safe_usingDict+0x2c>
jmp    1040 <LZ4_decompress_safe_withPrefix64k@plt>
mov    %r9,%r8
jmp    1030 <LZ4_decompress_safe_withSmallPrefix@plt>

LLVM IR (-O0):
define i32 @LZ4_decompress_safe_usingDict(i8* %0, i8* %1, i32 %2, i32 %3, i8* %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
store i8* %0, i8** %8
store i8* %1, i8** %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i32 %5, i32* %13
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %22
16: ; preds = %6
%17 = load i8*, i8** %8
%18 = load i8*, i8** %9
%19 = load i32, i32* %10
%20 = load i32, i32* %11
%21 = call i32 @LZ4_decompress_safe(i8* %17, i8* %18, i32 %19, i32 %20)
store i32 %21, i32* %7
br label %55
22: ; preds = %6
%23 = load i8*, i8** %12
%24 = load i32, i32* %13
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i8*, i8** %9
%28 = icmp eq i8* %26, %27
br i1 %28, label %29, label %46
29: ; preds = %22
%30 = load i32, i32* %13
%31 = icmp sge i32 %30, 65535
br i1 %31, label %32, label %38
32: ; preds = %29
%33 = load i8*, i8** %8
%34 = load i8*, i8** %9
%35 = load i32, i32* %10
%36 = load i32, i32* %11
%37 = call i32 @LZ4_decompress_safe_withPrefix64k(i8* %33, i8* %34, i32 %35, i32 %36)
store i32 %37, i32* %7
br label %55
38: ; preds = %29
%39 = load i8*, i8** %8
%40 = load i8*, i8** %9
%41 = load i32, i32* %10
%42 = load i32, i32* %11
%43 = load i32, i32* %13
%44 = sext i32 %43 to i64
%45 = call i32 @LZ4_decompress_safe_withSmallPrefix(i8* %39, i8* %40, i32 %41, i32 %42, i64 %44)
store i32 %45, i32* %7
br label %55
46: ; preds = %22
%47 = load i8*, i8** %8
%48 = load i8*, i8** %9
%49 = load i32, i32* %10
%50 = load i32, i32* %11
%51 = load i8*, i8** %12
%52 = load i32, i32* %13
%53 = sext i32 %52 to i64
%54 = call i32 @LZ4_decompress_safe_forceExtDict(i8* %47, i8* %48, i32 %49, i32 %50, i8* %51, i64 %53)
store i32 %54, i32* %7
br label %55
55: ; preds = %46, %38, %32, %16
%56 = load i32, i32* %7
ret i32 %56
}

LLVM IR (-O2):
define i32 @LZ4_decompress_safe_usingDict(i8* %0, i8* %1, i32 %2, i32 %3, i8* %4, i32 %5) {
%7 = icmp eq i32 %5, 0
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = tail call i32 @LZ4_decompress_safe(i8* %0, i8* %1, i32 %2, i32 %3)
br label %22
10: ; preds = %6
%11 = sext i32 %5 to i64
%12 = getelementptr inbounds i8, i8* %4, i64 %11
%13 = icmp eq i8* %12, %1
br i1 %13, label %14, label %20
14: ; preds = %10
%15 = icmp sgt i32 %5, 65534
br i1 %15, label %16, label %18
16: ; preds = %14
%17 = tail call i32 @LZ4_decompress_safe_withPrefix64k(i8* %0, i8* %1, i32 %2, i32 %3)
br label %22
18: ; preds = %14
%19 = tail call i32 @LZ4_decompress_safe_withSmallPrefix(i8* %0, i8* %1, i32 %2, i32 %3, i64 %11)
br label %22
20: ; preds = %10
%21 = tail call i32 @LZ4_decompress_safe_forceExtDict(i8* %0, i8* %1, i32 %2, i32 %3, i8* %4, i64 %11)
br label %22
22: ; preds = %20, %18, %16, %8
%23 = phi i32 [ %9, %8 ], [ %17, %16 ], [ %19, %18 ], [ %21, %20 ]
ret i32 %23
}