#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*/ printf(char *, int);
void uxmi_color_bg(int uxmi_color) {
  int sel_color = 40;
  switch (uxmi_color) {
  case 0:
    sel_color = 40;
    break;
  case 1:
    sel_color = 44;
    break;
  case 2:
    sel_color = 42;
    break;
  case 3:
    sel_color = 46;
    break;
  case 4:
    sel_color = 41;
    break;
  case 5:
    sel_color = 45;
    break;
  case 6:
    sel_color = 43;
    break;
  default:
    sel_color = 47;
    break;
  }
  printf("\033[%dm", sel_color);
  return;
}


x86 assembly (clang, -O0):
<uxmi_color_bg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x28,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x6,%rax
ja     119b <uxmi_color_bg+0x8b>
mov    -0x10(%rbp),%rax
lea    0xec2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x28,-0x8(%rbp)
jmp    11a2 <uxmi_color_bg+0x92>
movl   $0x2c,-0x8(%rbp)
jmp    11a2 <uxmi_color_bg+0x92>
movl   $0x2a,-0x8(%rbp)
jmp    11a2 <uxmi_color_bg+0x92>
movl   $0x2e,-0x8(%rbp)
jmp    11a2 <uxmi_color_bg+0x92>
movl   $0x29,-0x8(%rbp)
jmp    11a2 <uxmi_color_bg+0x92>
movl   $0x2d,-0x8(%rbp)
jmp    11a2 <uxmi_color_bg+0x92>
movl   $0x2b,-0x8(%rbp)
jmp    11a2 <uxmi_color_bg+0x92>
movl   $0x2f,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uxmi_color_bg>:
mov    $0x2f,%esi
cmp    $0x6,%edi
ja     1127 <uxmi_color_bg+0x17>
movslq %edi,%rax
lea    0xee4(%rip),%rcx
mov    (%rcx,%rax,4),%esi
lea    0xed2(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"\1B[%dm\00"
define void @uxmi_color_bg(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 40, i32* %3
%4 = load i32, i32* %2
switch i32 %4, label %12 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 3, label %8
i32 4, label %9
i32 5, label %10
i32 6, label %11
]
5: ; preds = %1
store i32 40, i32* %3
br label %13
6: ; preds = %1
store i32 44, i32* %3
br label %13
7: ; preds = %1
store i32 42, i32* %3
br label %13
8: ; preds = %1
store i32 46, i32* %3
br label %13
9: ; preds = %1
store i32 41, i32* %3
br label %13
10: ; preds = %1
store i32 45, i32* %3
br label %13
11: ; preds = %1
store i32 43, i32* %3
br label %13
12: ; preds = %1
store i32 47, i32* %3
br label %13
13: ; preds = %12, %11, %10, %9, %8, %7, %6, %5
%14 = load i32, i32* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %14)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[%dm\00"
@switch.table.uxmi_color_bg = [7 x i32] [i32 40, i32 44, i32 42, i32 46, i32 41, i32 45, i32 43]
define void @uxmi_color_bg(i32 %0) {
%2 = icmp ult i32 %0, 7
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [7 x i32], [7 x i32]* @switch.table.uxmi_color_bg, i64 0, i64 %4
%6 = load i32, i32* %5
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 47, %1 ]
%9 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %8)
ret void
}