#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
void _set_bkgnd_color(int color) {
  if (color >= 0 && color <= 7)
    fprintf(stdout, "\x1B[4%dm", color);
  else if (color == -1)
    fprintf(stdout, "\x1B[49m");
  else if (color >= 8 && color <= 15)
    fprintf(stdout, "\x1B[10%dm", color - 8);
}


x86 assembly (clang, -O0):
<_set_bkgnd_color>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     114e <_set_bkgnd_color+0x3e>
cmpl   $0x7,-0x4(%rbp)
jg     114e <_set_bkgnd_color+0x3e>
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xebe(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11af <_set_bkgnd_color+0x9f>
cmpl   $0xffffffff,-0x4(%rbp)
jne    1174 <_set_bkgnd_color+0x64>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11aa <_set_bkgnd_color+0x9a>
cmpl   $0x8,-0x4(%rbp)
jl     11a5 <_set_bkgnd_color+0x95>
cmpl   $0xf,-0x4(%rbp)
jg     11a5 <_set_bkgnd_color+0x95>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
sub    $0x8,%edx
lea    0xe6f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11aa <_set_bkgnd_color+0x9a>
jmp    11af <_set_bkgnd_color+0x9f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_set_bkgnd_color>:
mov    %edi,%edx
cmp    $0x7,%edi
ja     112e <_set_bkgnd_color+0x1e>
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
lea    0xed9(%rip),%rsi
xor    %eax,%eax
jmp    1030 <fprintf@plt>
cmp    $0xffffffff,%edx
je     1157 <_set_bkgnd_color+0x47>
mov    %edx,%eax
and    $0xfffffff8,%eax
cmp    $0x8,%eax
jne    116e <_set_bkgnd_color+0x5e>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
add    $0xfffffff8,%edx
lea    0xebd(%rip),%rsi
xor    %eax,%eax
jmp    1030 <fprintf@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
xor    %eax,%eax
jmp    1030 <fprintf@plt>
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [7 x i8] c"\1B[4%dm\00"
@.str.1 = [6 x i8] c"\1B[49m\00"
@.str.2 = [8 x i8] c"\1B[10%dm\00"
define void @_set_bkgnd_color(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 7
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = load i32, i32* @stdout
%10 = load i32, i32* %2
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %31
12: ; preds = %5, %1
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* @stdout
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %30
18: ; preds = %12
%19 = load i32, i32* %2
%20 = icmp sge i32 %19, 8
br i1 %20, label %21, label %29
21: ; preds = %18
%22 = load i32, i32* %2
%23 = icmp sle i32 %22, 15
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = load i32, i32* @stdout
%26 = load i32, i32* %2
%27 = sub nsw i32 %26, 8
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %24, %21, %18
br label %30
30: ; preds = %29, %15
br label %31
31: ; preds = %30, %8
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [7 x i8] c"\1B[4%dm\00"
@.str.1 = [6 x i8] c"\1B[49m\00"
@.str.2 = [8 x i8] c"\1B[10%dm\00"
define void @_set_bkgnd_color(i32 %0) {
%2 = icmp ult i32 %0, 8
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = load i32, i32* @stdout
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %18
6: ; preds = %1
%7 = icmp eq i32 %0, -1
br i1 %7, label %8, label %11
8: ; preds = %6
%9 = load i32, i32* @stdout
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %18
11: ; preds = %6
%12 = and i32 %0, -8
%13 = icmp eq i32 %12, 8
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i32, i32* @stdout
%16 = add nsw i32 %0, -8
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %8, %14, %11, %3
ret void
}