#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*/ print(int, char *, int);
int websafe(int tty, int fg, int bg) {
  if (fg > -1 && fg < 224)
    print(tty, "\033[38;5;%dm", fg + 16);
  if (bg > -1 && bg < 224)
    print(tty, "\033[48;5;%dm", bg + 16);
  return 0;
}


x86 assembly (clang, -O0):
<websafe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jle    114d <websafe+0x3d>
cmpl   $0xe0,-0x8(%rbp)
jge    114d <websafe+0x3d>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
add    $0x10,%edx
lea    0xeb8(%rip),%rsi
call   1030 <print@plt>
cmpl   $0xffffffff,-0xc(%rbp)
jle    1179 <websafe+0x69>
cmpl   $0xe0,-0xc(%rbp)
jge    1179 <websafe+0x69>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%edx
add    $0x10,%edx
lea    0xe97(%rip),%rsi
call   1030 <print@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<websafe>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %edi,%ebp
cmp    $0xdf,%esi
ja     1132 <websafe+0x22>
mov    %esi,%edx
add    $0x10,%edx
lea    0xed5(%rip),%rsi
mov    %ebp,%edi
call   1030 <print@plt>
cmp    $0xdf,%ebx
ja     114d <websafe+0x3d>
add    $0x10,%ebx
lea    0xec7(%rip),%rsi
mov    %ebp,%edi
mov    %ebx,%edx
call   1030 <print@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"\1B[38;5;%dm\00"
@.str.1 = [11 x i8] c"\1B[48;5;%dm\00"
define i32 @websafe(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* %5
%8 = icmp sgt i32 %7, -1
br i1 %8, label %9, label %17
9: ; preds = %3
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 224
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 16
%16 = call i32 @print(i32 %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %12, %9, %3
%18 = load i32, i32* %6
%19 = icmp sgt i32 %18, -1
br i1 %19, label %20, label %28
20: ; preds = %17
%21 = load i32, i32* %6
%22 = icmp slt i32 %21, 224
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i32, i32* %4
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 16
%27 = call i32 @print(i32 %24, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %23, %20, %17
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"\1B[38;5;%dm\00"
@.str.1 = [11 x i8] c"\1B[48;5;%dm\00"
define i32 @websafe(i32 %0, i32 %1, i32 %2) {
%4 = icmp ult i32 %1, 224
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = add nuw nsw i32 %1, 16
%7 = tail call i32 @print(i32 %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %5, %3
%9 = icmp ult i32 %2, 224
br i1 %9, label %10, label %13
10: ; preds = %8
%11 = add nuw nsw i32 %2, 16
%12 = tail call i32 @print(i32 %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %10, %8
ret i32 0
}