#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*/ sprintf(char *, char *, ...);
char *color2text(int c) {
  static char buf[64];
  if (c == -1)
    sprintf(buf, "* ");
  else if (c == -2)
    sprintf(buf, "Team ");
  else if (c == -3)
    sprintf(buf, "Rank ");
  else if (c < 255)
    sprintf(buf, "%i ", c);
  else
    sprintf(buf, "%i,%i ", (c >> 4) & 15, c & 15);
  return (buf);
}


x86 assembly (clang, -O0):
<color2text>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    113f <color2text+0x2f>
lea    0x2f14(%rip),%rdi
lea    0xecd(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    11e4 <color2text+0xd4>
cmpl   $0xfffffffe,-0x4(%rbp)
jne    1163 <color2text+0x53>
lea    0x2ef0(%rip),%rdi
lea    0xeac(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    11df <color2text+0xcf>
cmpl   $0xfffffffd,-0x4(%rbp)
jne    1187 <color2text+0x77>
lea    0x2ecc(%rip),%rdi
lea    0xe8e(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    11da <color2text+0xca>
cmpl   $0xff,-0x4(%rbp)
jge    11b1 <color2text+0xa1>
mov    -0x4(%rbp),%edx
lea    0x2ea2(%rip),%rdi
lea    0xe6d(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    11d5 <color2text+0xc5>
mov    -0x4(%rbp),%edx
sar    $0x4,%edx
and    $0xf,%edx
mov    -0x4(%rbp),%ecx
and    $0xf,%ecx
lea    0x2e79(%rip),%rdi
lea    0xe41(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    11da <color2text+0xca>
jmp    11df <color2text+0xcf>
jmp    11e4 <color2text+0xd4>
lea    0x2e55(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<color2text>:
push   %rax
cmp    $0xfffffffd,%edi
je     1134 <color2text+0x24>
mov    %edi,%ecx
cmp    $0xfffffffe,%edi
je     1149 <color2text+0x39>
cmp    $0xffffffff,%ecx
jne    115e <color2text+0x4e>
movb   $0x0,0x2f19(%rip)
movw   $0x202a,0x2f0e(%rip)
2a 20
jmp    119f <color2text+0x8f>
movw   $0x20,0x2f07(%rip)
movl   $0x6b6e6152,0x2ef9(%rip)
61 6e 6b
jmp    119f <color2text+0x8f>
movw   $0x20,0x2ef2(%rip)
movl   $0x6d616554,0x2ee4(%rip)
65 61 6d
jmp    119f <color2text+0x8f>
cmp    $0xfe,%ecx
jg     117f <color2text+0x6f>
lea    0x2ed3(%rip),%rdi
lea    0xe9e(%rip),%rsi
mov    %ecx,%edx
xor    %eax,%eax
call   1030 <sprintf@plt>
jmp    119f <color2text+0x8f>
mov    %ecx,%edx
shr    $0x4,%edx
and    $0xf,%edx
and    $0xf,%ecx
lea    0x2eaf(%rip),%rdi
lea    0xe77(%rip),%rsi
xor    %eax,%eax
call   1030 <sprintf@plt>
lea    0x2e9a(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@color2text.buf = internal global [64 x i8] zeroinitializer
@.str = [3 x i8] c"* \00"
@.str.1 = [6 x i8] c"Team \00"
@.str.2 = [6 x i8] c"Rank \00"
@.str.3 = [4 x i8] c"%i \00"
@.str.4 = [7 x i8] c"%i,%i \00"
define i8* @color2text(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @color2text.buf, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %33
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, -2
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @color2text.buf, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %32
12: ; preds = %7
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, -3
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @color2text.buf, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %31
17: ; preds = %12
%18 = load i32, i32* %2
%19 = icmp slt i32 %18, 255
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i32, i32* %2
%22 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @color2text.buf, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %21)
br label %30
23: ; preds = %17
%24 = load i32, i32* %2
%25 = ashr i32 %24, 4
%26 = and i32 %25, 15
%27 = load i32, i32* %2
%28 = and i32 %27, 15
%29 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @color2text.buf, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %26, i32 %28)
br label %30
30: ; preds = %23, %20
br label %31
31: ; preds = %30, %15
br label %32
32: ; preds = %31, %10
br label %33
33: ; preds = %32, %5
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @color2text.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@color2text.buf = internal global [64 x i8] zeroinitializer
@.str = [3 x i8] c"* \00"
@.str.1 = [6 x i8] c"Team \00"
@.str.2 = [6 x i8] c"Rank \00"
@.str.3 = [4 x i8] c"%i \00"
@.str.4 = [7 x i8] c"%i,%i \00"
define i8* @color2text(i32 %0) {
switch i32 %0, label %5 [
i32 -1, label %2
i32 -2, label %3
i32 -3, label %4
]
2: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 dereferenceable(3) getelementptr inbounds ([64 x i8], [64 x i8]* @color2text.buf, i64 0, i64 0), i8* align 1 dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 3, i1 false)
br label %14
3: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 dereferenceable(6) getelementptr inbounds ([64 x i8], [64 x i8]* @color2text.buf, i64 0, i64 0), i8* align 1 dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 6, i1 false)
br label %14
4: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 dereferenceable(6) getelementptr inbounds ([64 x i8], [64 x i8]* @color2text.buf, i64 0, i64 0), i8* align 1 dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 6, i1 false)
br label %14
5: ; preds = %1
%6 = icmp slt i32 %0, 255
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @color2text.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %0)
br label %14
9: ; preds = %5
%10 = lshr i32 %0, 4
%11 = and i32 %10, 15
%12 = and i32 %0, 15
%13 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @color2text.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %11, i32 %12)
br label %14
14: ; preds = %3, %7, %9, %4, %2
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @color2text.buf, i64 0, i64 0)
}