#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 */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int fastlz1_compress(int /*<<< orphan*/ const *, int, int /*<<< orphan*/ *);
int fastlz2_compress(int /*<<< orphan*/ const *, int, int /*<<< orphan*/ *);
int fastlz_compress_level(int level, const uint8_t *input, int length,
                          uint8_t *output) {
  if (level == 1)
    return fastlz1_compress(input, length, output);
  if (level == 2)
    return fastlz2_compress(input, length, output);
  return 0;
}


x86 assembly (clang, -O0):
<fastlz_compress_level>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1158 <fastlz_compress_level+0x38>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1030 <fastlz1_compress@plt>
mov    %eax,-0x4(%rbp)
jmp    1181 <fastlz_compress_level+0x61>
cmpl   $0x2,-0x8(%rbp)
jne    117a <fastlz_compress_level+0x5a>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1040 <fastlz2_compress@plt>
mov    %eax,-0x4(%rbp)
jmp    1181 <fastlz_compress_level+0x61>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastlz_compress_level>:
cmp    $0x2,%edi
je     1137 <fastlz_compress_level+0x17>
cmp    $0x1,%edi
jne    1144 <fastlz_compress_level+0x24>
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rcx,%rdx
jmp    1030 <fastlz1_compress@plt>
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rcx,%rdx
jmp    1040 <fastlz2_compress@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @fastlz_compress_level(i32 %0, i32* %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32*
store i32 %0, i32* %6
store i32* %1, i32** %7
store i32 %2, i32* %8
store i32* %3, i32** %9
%10 = load i32, i32* %6
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %17
12: ; preds = %4
%13 = load i32*, i32** %7
%14 = load i32, i32* %8
%15 = load i32*, i32** %9
%16 = call i32 @fastlz1_compress(i32* %13, i32 %14, i32* %15)
store i32 %16, i32* %5
br label %26
17: ; preds = %4
%18 = load i32, i32* %6
%19 = icmp eq i32 %18, 2
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i32*, i32** %7
%22 = load i32, i32* %8
%23 = load i32*, i32** %9
%24 = call i32 @fastlz2_compress(i32* %21, i32 %22, i32* %23)
store i32 %24, i32* %5
br label %26
25: ; preds = %17
store i32 0, i32* %5
br label %26
26: ; preds = %25, %20, %12
%27 = load i32, i32* %5
ret i32 %27
}

LLVM IR (-O2):
define i32 @fastlz_compress_level(i32 %0, i32* %1, i32 %2, i32* %3) {
switch i32 %0, label %9 [
i32 1, label %5
i32 2, label %7
]
5: ; preds = %4
%6 = tail call i32 @fastlz1_compress(i32* %1, i32 %2, i32* %3)
br label %9
7: ; preds = %4
%8 = tail call i32 @fastlz2_compress(i32* %1, i32 %2, i32* %3)
br label %9
9: ; preds = %4, %7, %5
%10 = phi i32 [ %6, %5 ], [ %8, %7 ], [ 0, %4 ]
ret i32 %10
}