#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*/ FILE;

/* Variables and functions */
unsigned char *getGray(int /*<<< orphan*/ *, int);
unsigned char *getRGB(int /*<<< orphan*/ *, int);
unsigned char *getRGBA(int /*<<< orphan*/ *, int);
unsigned char *getData(FILE *s, int sz, int iBits) {
  if (iBits == 32)
    return getRGBA(s, sz);
  else if (iBits == 24)
    return getRGB(s, sz);
  else if (iBits == 8)
    return getGray(s, sz);
}


x86 assembly (clang, -O0):
<getData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpl   $0x20,-0x18(%rbp)
jne    1161 <getData+0x31>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <getRGBA@plt>
mov    %rax,-0x8(%rbp)
jmp    11a9 <getData+0x79>
cmpl   $0x18,-0x18(%rbp)
jne    1180 <getData+0x50>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <getRGB@plt>
mov    %rax,-0x8(%rbp)
jmp    11a9 <getData+0x79>
cmpl   $0x8,-0x18(%rbp)
jne    119f <getData+0x6f>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <getGray@plt>
mov    %rax,-0x8(%rbp)
jmp    11a9 <getData+0x79>
jmp    11a4 <getData+0x74>
jmp    11a9 <getData+0x79>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getData>:
cmp    $0x8,%edx
je     1144 <getData+0x14>
cmp    $0x18,%edx
je     1149 <getData+0x19>
cmp    $0x20,%edx
jne    114e <getData+0x1e>
jmp    1030 <getRGBA@plt>
jmp    1040 <getGray@plt>
jmp    1050 <getRGB@plt>
ret

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

LLVM IR (-O2):
define i8* @getData(i32* %0, i32 %1, i32 %2) {
switch i32 %2, label %10 [
i32 32, label %4
i32 24, label %6
i32 8, label %8
]
4: ; preds = %3
%5 = tail call i8* @getRGBA(i32* %0, i32 %1)
br label %10
6: ; preds = %3
%7 = tail call i8* @getRGB(i32* %0, i32 %1)
br label %10
8: ; preds = %3
%9 = tail call i8* @getGray(i32* %0, i32 %1)
br label %10
10: ; preds = %3, %4, %6, %8
%11 = phi i8* [ %5, %4 ], [ %7, %6 ], [ %9, %8 ], [ undef, %3 ]
ret i8* %11
}