#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 */
scalar_t__ getGray(int /*<<< orphan*/ *, int);
scalar_t__ getRGB(int /*<<< orphan*/ *, int);
scalar_t__ getRGBA(int /*<<< orphan*/ *, int);
char *getData(FILE *s, int sz, int iBits) {
  if (iBits == 32)
    return (char *)getRGBA(s, sz);
  else if (iBits == 24)
    return (char *)getRGB(s, sz);
  else if (iBits == 8)
    return (char *)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>:
push   %rax
cmp    $0x8,%edx
je     1147 <getData+0x17>
cmp    $0x18,%edx
je     114e <getData+0x1e>
cmp    $0x20,%edx
jne    114c <getData+0x1c>
call   1030 <getRGBA@plt>
pop    %rcx
ret
call   1040 <getGray@plt>
pop    %rcx
ret
call   1050 <getRGB@plt>
pop    %rcx
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 %15
10: ; preds = %3
%11 = load i32*, i32** %5
%12 = load i32, i32* %6
%13 = call i64 @getRGBA(i32* %11, i32 %12)
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %4
br label %33
15: ; preds = %3
%16 = load i32, i32* %7
%17 = icmp eq i32 %16, 24
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = load i32*, i32** %5
%20 = load i32, i32* %6
%21 = call i64 @getRGB(i32* %19, i32 %20)
%22 = inttoptr i64 %21 to i8*
store i8* %22, i8** %4
br label %33
23: ; preds = %15
%24 = load i32, i32* %7
%25 = icmp eq i32 %24, 8
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = load i32*, i32** %5
%28 = load i32, i32* %6
%29 = call i64 @getGray(i32* %27, i32 %28)
%30 = inttoptr i64 %29 to i8*
store i8* %30, i8** %4
br label %33
31: ; preds = %23
br label %32
32: ; preds = %31
br label %33
33: ; preds = %10, %18, %26, %32
%34 = load i8*, i8** %4
ret i8* %34
}

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