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

/* Variables and functions */
int /*<<< orphan*/ ppuSetNameTblHorizontal();
int /*<<< orphan*/ ppuSetNameTblSingleLower();
int /*<<< orphan*/ ppuSetNameTblSingleUpper();
int /*<<< orphan*/ ppuSetNameTblVertical();
void s3setParamsE800(uint16_t addr, uint8_t val) {
  (void)addr;
  switch (val & 3) {
  case 0:
    ppuSetNameTblVertical();
    break;
  case 1:
    ppuSetNameTblHorizontal();
    break;
  case 2:
    ppuSetNameTblSingleLower();
    break;
  case 3:
    ppuSetNameTblSingleUpper();
    break;
  }
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x3,%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%eax
ja     11a0 <s3setParamsE800+0x60>
mov    -0x10(%rbp),%rax
lea    0xe94(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1060 <ppuSetNameTblVertical@plt>
jmp    11a0 <s3setParamsE800+0x60>
mov    $0x0,%al
call   1050 <ppuSetNameTblHorizontal@plt>
jmp    11a0 <s3setParamsE800+0x60>
mov    $0x0,%al
call   1040 <ppuSetNameTblSingleLower@plt>
jmp    11a0 <s3setParamsE800+0x60>
mov    $0x0,%al
call   1030 <ppuSetNameTblSingleUpper@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
and    $0x3,%esi
lea    0xeb6(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
xor    %eax,%eax
jmp    1060 <ppuSetNameTblVertical@plt>
xor    %eax,%eax
jmp    1040 <ppuSetNameTblSingleLower@plt>
xor    %eax,%eax
jmp    1030 <ppuSetNameTblSingleUpper@plt>
xor    %eax,%eax
jmp    1050 <ppuSetNameTblHorizontal@plt>

LLVM IR (-O0):
define void @s3setParamsE800(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = and i32 %6, 3
switch i32 %7, label %16 [
i32 0, label %8
i32 1, label %10
i32 2, label %12
i32 3, label %14
]
8: ; preds = %2
%9 = call i32 (...) @ppuSetNameTblVertical()
br label %16
10: ; preds = %2
%11 = call i32 (...) @ppuSetNameTblHorizontal()
br label %16
12: ; preds = %2
%13 = call i32 (...) @ppuSetNameTblSingleLower()
br label %16
14: ; preds = %2
%15 = call i32 (...) @ppuSetNameTblSingleUpper()
br label %16
16: ; preds = %2, %14, %12, %10, %8
ret void
}

LLVM IR (-O2):
define void @s3setParamsE800(i32 %0, i32 %1) {
%3 = and i32 %1, 3
switch i32 %3, label %12 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
]
4: ; preds = %2
%5 = tail call i32 (...) @ppuSetNameTblVertical()
br label %13
6: ; preds = %2
%7 = tail call i32 (...) @ppuSetNameTblHorizontal()
br label %13
8: ; preds = %2
%9 = tail call i32 (...) @ppuSetNameTblSingleLower()
br label %13
10: ; preds = %2
%11 = tail call i32 (...) @ppuSetNameTblSingleUpper()
br label %13
12: ; preds = %2
unreachable
13: ; preds = %10, %8, %6, %4
ret void
}