#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 *);
void print_piece_css(unsigned int piece, char *text) {
  if (0) {
  } else if ((piece & 7) == 1)
    sprintf(text, "pawn");
  else if ((piece & 7) == 2)
    sprintf(text, "tower");
  else if ((piece & 7) == 3)
    sprintf(text, "horse");
  else if ((piece & 7) == 4)
    sprintf(text, "bishop");
  else if ((piece & 7) == 5)
    sprintf(text, "queen");
  else if ((piece & 7) == 6)
    sprintf(text, "king");
}


x86 assembly (clang, -O0):
<print_piece_css>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7,%eax
cmp    $0x1,%eax
jne    1143 <print_piece_css+0x33>
mov    -0x10(%rbp),%rdi
lea    0xec7(%rip),%rsi
call   1030 <sprintf@plt>
jmp    120b <print_piece_css+0xfb>
mov    -0x4(%rbp),%eax
and    $0x7,%eax
cmp    $0x2,%eax
jne    1167 <print_piece_css+0x57>
mov    -0x10(%rbp),%rdi
lea    0xea8(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1206 <print_piece_css+0xf6>
mov    -0x4(%rbp),%eax
and    $0x7,%eax
cmp    $0x3,%eax
jne    118b <print_piece_css+0x7b>
mov    -0x10(%rbp),%rdi
lea    0xe8a(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1201 <print_piece_css+0xf1>
mov    -0x4(%rbp),%eax
and    $0x7,%eax
cmp    $0x4,%eax
jne    11af <print_piece_css+0x9f>
mov    -0x10(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1030 <sprintf@plt>
jmp    11fc <print_piece_css+0xec>
mov    -0x4(%rbp),%eax
and    $0x7,%eax
cmp    $0x5,%eax
jne    11d3 <print_piece_css+0xc3>
mov    -0x10(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1030 <sprintf@plt>
jmp    11f7 <print_piece_css+0xe7>
mov    -0x4(%rbp),%eax
and    $0x7,%eax
cmp    $0x6,%eax
jne    11f2 <print_piece_css+0xe2>
mov    -0x10(%rbp),%rdi
lea    0xe31(%rip),%rsi
call   1030 <sprintf@plt>
jmp    11f7 <print_piece_css+0xe7>
jmp    11fc <print_piece_css+0xec>
jmp    1201 <print_piece_css+0xf1>
jmp    1206 <print_piece_css+0xf6>
jmp    120b <print_piece_css+0xfb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_piece_css>:
and    $0x7,%edi
add    $0xffffffff,%edi
cmp    $0x5,%edi
ja     1165 <print_piece_css+0x65>
lea    0xeee(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
movb   $0x0,0x4(%rsi)
movl   $0x6e776170,(%rsi)
ret
movw   $0x72,0x4(%rsi)
movl   $0x65776f74,(%rsi)
ret
movw   $0x65,0x4(%rsi)
movl   $0x73726f68,(%rsi)
ret
movl   $0x706f68,0x3(%rsi)
movl   $0x68736962,(%rsi)
ret
movw   $0x6e,0x4(%rsi)
movl   $0x65657571,(%rsi)
ret
movb   $0x0,0x4(%rsi)
movl   $0x676e696b,(%rsi)
ret

LLVM IR (-O0):
@.str = [5 x i8] c"pawn\00"
@.str.1 = [6 x i8] c"tower\00"
@.str.2 = [6 x i8] c"horse\00"
@.str.3 = [7 x i8] c"bishop\00"
@.str.4 = [6 x i8] c"queen\00"
@.str.5 = [5 x i8] c"king\00"
define void @print_piece_css(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = and i32 %5, 7
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %51
11: ; preds = %2
%12 = load i32, i32* %3
%13 = and i32 %12, 7
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i8*, i8** %4
%17 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %50
18: ; preds = %11
%19 = load i32, i32* %3
%20 = and i32 %19, 7
%21 = icmp eq i32 %20, 3
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load i8*, i8** %4
%24 = call i32 @sprintf(i8* %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %49
25: ; preds = %18
%26 = load i32, i32* %3
%27 = and i32 %26, 7
%28 = icmp eq i32 %27, 4
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = load i8*, i8** %4
%31 = call i32 @sprintf(i8* %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %48
32: ; preds = %25
%33 = load i32, i32* %3
%34 = and i32 %33, 7
%35 = icmp eq i32 %34, 5
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = load i8*, i8** %4
%38 = call i32 @sprintf(i8* %37, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %47
39: ; preds = %32
%40 = load i32, i32* %3
%41 = and i32 %40, 7
%42 = icmp eq i32 %41, 6
br i1 %42, label %43, label %46
43: ; preds = %39
%44 = load i8*, i8** %4
%45 = call i32 @sprintf(i8* %44, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %46
46: ; preds = %43, %39
br label %47
47: ; preds = %46, %36
br label %48
48: ; preds = %47, %29
br label %49
49: ; preds = %48, %22
br label %50
50: ; preds = %49, %15
br label %51
51: ; preds = %50, %8
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"pawn\00"
@.str.1 = [6 x i8] c"tower\00"
@.str.2 = [6 x i8] c"horse\00"
@.str.3 = [7 x i8] c"bishop\00"
@.str.4 = [6 x i8] c"queen\00"
@.str.5 = [5 x i8] c"king\00"
define void @print_piece_css(i32 %0, i8* nocapture writeonly %1) {
%3 = and i32 %0, 7
switch i32 %3, label %10 [
i32 1, label %4
i32 2, label %5
i32 3, label %6
i32 4, label %7
i32 5, label %8
i32 6, label %9
]
4: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %1, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 5, i1 false)
br label %10
5: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(6) %1, 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 %10
6: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(6) %1, 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 %10
7: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(7) %1, i8* align 1 dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i64 7, i1 false)
br label %10
8: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(6) %1, i8* align 1 dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i64 6, i1 false)
br label %10
9: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %1, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i64 5, i1 false)
br label %10
10: ; preds = %2, %5, %7, %9, %8, %6, %4
ret void
}