#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 /*<<< orphan*/ background(int, int);
int /*<<< orphan*/ rectbox(int, int);
int /*<<< orphan*/ rectboxtarget(int, int);
int /*<<< orphan*/ rectwall(int, int);
int /*<<< orphan*/ target(int, int);
int /*<<< orphan*/ worker(int, int);
void DrawElement(int x, int y, int type) {
  switch (type) {
  case 0x00:
    background(x, y);
    break;
  case 0x10:
    rectwall(x, y);
    break;
  case 0x08:
    rectbox(x, y);
    break;
  case 0x04:
    target(x, y);
    break;
  case 0x20:
    worker(x, y);
    break;
  default:
    if (type & 0x04 && type & 0x08)
      rectboxtarget(x, y);
    break;
  }
}


x86 assembly (clang, -O0):
<DrawElement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x20,%rax
ja     11e6 <DrawElement+0x86>
mov    -0x18(%rbp),%rax
lea    0xe73(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <background@plt>
jmp    1214 <DrawElement+0xb4>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1080 <rectwall@plt>
jmp    1214 <DrawElement+0xb4>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <rectbox@plt>
jmp    1214 <DrawElement+0xb4>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <target@plt>
jmp    1214 <DrawElement+0xb4>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <worker@plt>
jmp    1214 <DrawElement+0xb4>
mov    -0xc(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     120f <DrawElement+0xaf>
mov    -0xc(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     120f <DrawElement+0xaf>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <rectboxtarget@plt>
jmp    1214 <DrawElement+0xb4>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DrawElement>:
mov    %edx,%eax
rol    $0x1e,%eax
cmp    $0x8,%eax
ja     117f <DrawElement+0x1f>
lea    0xe8f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1060 <background@plt>
not    %edx
test   $0xc,%dl
jne    119f <DrawElement+0x3f>
jmp    1030 <rectboxtarget@plt>
jmp    1050 <target@plt>
jmp    1070 <rectbox@plt>
jmp    1080 <rectwall@plt>
jmp    1040 <worker@plt>
ret

LLVM IR (-O0):
define void @DrawElement(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
switch i32 %7, label %28 [
i32 0, label %8
i32 16, label %12
i32 8, label %16
i32 4, label %20
i32 32, label %24
]
8: ; preds = %3
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = call i32 @background(i32 %9, i32 %10)
br label %41
12: ; preds = %3
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = call i32 @rectwall(i32 %13, i32 %14)
br label %41
16: ; preds = %3
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = call i32 @rectbox(i32 %17, i32 %18)
br label %41
20: ; preds = %3
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = call i32 @target(i32 %21, i32 %22)
br label %41
24: ; preds = %3
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = call i32 @worker(i32 %25, i32 %26)
br label %41
28: ; preds = %3
%29 = load i32, i32* %6
%30 = and i32 %29, 4
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %40
32: ; preds = %28
%33 = load i32, i32* %6
%34 = and i32 %33, 8
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %32
%37 = load i32, i32* %4
%38 = load i32, i32* %5
%39 = call i32 @rectboxtarget(i32 %37, i32 %38)
br label %40
40: ; preds = %36, %32, %28
br label %41
41: ; preds = %40, %24, %20, %16, %12, %8
ret void
}

LLVM IR (-O2):
define void @DrawElement(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @llvm.fshl.i32(i32 %2, i32 %2, i32 30)
switch i32 %4, label %15 [
i32 0, label %5
i32 4, label %7
i32 2, label %9
i32 1, label %11
i32 8, label %13
]
5: ; preds = %3
%6 = tail call i32 @background(i32 %0, i32 %1)
br label %20
7: ; preds = %3
%8 = tail call i32 @rectwall(i32 %0, i32 %1)
br label %20
9: ; preds = %3
%10 = tail call i32 @rectbox(i32 %0, i32 %1)
br label %20
11: ; preds = %3
%12 = tail call i32 @target(i32 %0, i32 %1)
br label %20
13: ; preds = %3
%14 = tail call i32 @worker(i32 %0, i32 %1)
br label %20
15: ; preds = %3
%16 = and i32 %2, 12
%17 = icmp eq i32 %16, 12
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call i32 @rectboxtarget(i32 %0, i32 %1)
br label %20
20: ; preds = %15, %18, %13, %11, %9, %7, %5
ret void
}