#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 bitmap_decompress1(char *, int, int, char *, int);
int bitmap_decompress2(char *, int, int, char *, int);
int bitmap_decompress3(char *, int, int, char *, int);
int rdp_bitmap_decompress(char *output, int width, int height, char *input,
                          int size, int Bpp) {
  int rv;
  switch (Bpp) {
  case 1:
    rv = bitmap_decompress1(output, width, height, input, size);
    break;
  case 2:
    rv = bitmap_decompress2(output, width, height, input, size);
    break;
  case 3:
    rv = bitmap_decompress3(output, width, height, input, size);
    break;
  default:
    rv = 0;
    break;
  }
  return rv;
}


x86 assembly (clang, -O0):
<rdp_bitmap_decompress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x1,%eax
je     1184 <rdp_bitmap_decompress+0x54>
jmp    1162 <rdp_bitmap_decompress+0x32>
mov    -0x28(%rbp),%eax
sub    $0x2,%eax
je     11a3 <rdp_bitmap_decompress+0x73>
jmp    1173 <rdp_bitmap_decompress+0x43>
mov    -0x28(%rbp),%eax
sub    $0x3,%eax
je     11c2 <rdp_bitmap_decompress+0x92>
jmp    11e1 <rdp_bitmap_decompress+0xb1>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1050 <bitmap_decompress1@plt>
mov    %eax,-0x24(%rbp)
jmp    11e8 <rdp_bitmap_decompress+0xb8>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1030 <bitmap_decompress2@plt>
mov    %eax,-0x24(%rbp)
jmp    11e8 <rdp_bitmap_decompress+0xb8>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1040 <bitmap_decompress3@plt>
mov    %eax,-0x24(%rbp)
jmp    11e8 <rdp_bitmap_decompress+0xb8>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdp_bitmap_decompress>:
cmp    $0x3,%r9d
je     1147 <rdp_bitmap_decompress+0x17>
cmp    $0x2,%r9d
je     114c <rdp_bitmap_decompress+0x1c>
cmp    $0x1,%r9d
jne    1151 <rdp_bitmap_decompress+0x21>
jmp    1050 <bitmap_decompress1@plt>
jmp    1040 <bitmap_decompress3@plt>
jmp    1030 <bitmap_decompress2@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @rdp_bitmap_decompress(i8* %0, i32 %1, i32 %2, i8* %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i8* %3, i8** %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%14 = load i32, i32* %12
switch i32 %14, label %36 [
i32 1, label %15
i32 2, label %22
i32 3, label %29
]
15: ; preds = %6
%16 = load i8*, i8** %7
%17 = load i32, i32* %8
%18 = load i32, i32* %9
%19 = load i8*, i8** %10
%20 = load i32, i32* %11
%21 = call i32 @bitmap_decompress1(i8* %16, i32 %17, i32 %18, i8* %19, i32 %20)
store i32 %21, i32* %13
br label %37
22: ; preds = %6
%23 = load i8*, i8** %7
%24 = load i32, i32* %8
%25 = load i32, i32* %9
%26 = load i8*, i8** %10
%27 = load i32, i32* %11
%28 = call i32 @bitmap_decompress2(i8* %23, i32 %24, i32 %25, i8* %26, i32 %27)
store i32 %28, i32* %13
br label %37
29: ; preds = %6
%30 = load i8*, i8** %7
%31 = load i32, i32* %8
%32 = load i32, i32* %9
%33 = load i8*, i8** %10
%34 = load i32, i32* %11
%35 = call i32 @bitmap_decompress3(i8* %30, i32 %31, i32 %32, i8* %33, i32 %34)
store i32 %35, i32* %13
br label %37
36: ; preds = %6
store i32 0, i32* %13
br label %37
37: ; preds = %36, %29, %22, %15
%38 = load i32, i32* %13
ret i32 %38
}

LLVM IR (-O2):
define i32 @rdp_bitmap_decompress(i8* %0, i32 %1, i32 %2, i8* %3, i32 %4, i32 %5) {
switch i32 %5, label %13 [
i32 1, label %7
i32 2, label %9
i32 3, label %11
]
7: ; preds = %6
%8 = tail call i32 @bitmap_decompress1(i8* %0, i32 %1, i32 %2, i8* %3, i32 %4)
br label %13
9: ; preds = %6
%10 = tail call i32 @bitmap_decompress2(i8* %0, i32 %1, i32 %2, i8* %3, i32 %4)
br label %13
11: ; preds = %6
%12 = tail call i32 @bitmap_decompress3(i8* %0, i32 %1, i32 %2, i8* %3, i32 %4)
br label %13
13: ; preds = %6, %11, %9, %7
%14 = phi i32 [ %12, %11 ], [ %10, %9 ], [ %8, %7 ], [ 0, %6 ]
ret i32 %14
}