#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, int);
char *tag_string(int tag, int type) {
  static char str[16];
  char t;
  if (type & (1 << 7))
    t = 'X';
  else if (type & (1 << 4))
    t = 'C';
  else if (type & (1 << 3))
    t = 'A';
  else if (type & (1 << 5))
    t = 'B';
  else if (type & (1 << 13))
    t = 'P';
  else
    t = 'D';
  sprintf(str, "_%c%03d", t, tag);
  return str;
}


x86 assembly (clang, -O0):
<tag_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1138 <tag_string+0x28>
movb   $0x58,-0x9(%rbp)
jmp    11b2 <tag_string+0xa2>
mov    -0x8(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     1150 <tag_string+0x40>
movb   $0x43,-0x9(%rbp)
jmp    11ad <tag_string+0x9d>
mov    -0x8(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1168 <tag_string+0x58>
movb   $0x41,-0x9(%rbp)
jmp    11a8 <tag_string+0x98>
mov    -0x8(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     1180 <tag_string+0x70>
movb   $0x42,-0x9(%rbp)
jmp    11a3 <tag_string+0x93>
mov    -0x8(%rbp),%eax
and    $0x2000,%eax
cmp    $0x0,%eax
je     119a <tag_string+0x8a>
movb   $0x50,-0x9(%rbp)
jmp    119e <tag_string+0x8e>
movb   $0x44,-0x9(%rbp)
jmp    11a3 <tag_string+0x93>
jmp    11a8 <tag_string+0x98>
jmp    11ad <tag_string+0x9d>
jmp    11b2 <tag_string+0xa2>
mov    -0x9(%rbp),%al
mov    -0x4(%rbp),%ecx
lea    0x2e81(%rip),%rdi
lea    0xe3a(%rip),%rsi
movsbl %al,%edx
call   1030 <sprintf@plt>
lea    0x2e6b(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tag_string>:
mov    %edi,%ecx
mov    $0x58,%al
test   $0x80,%sil
jne    1145 <tag_string+0x35>
mov    $0x43,%al
test   $0x10,%sil
jne    1145 <tag_string+0x35>
mov    $0x41,%al
test   $0x8,%sil
jne    1145 <tag_string+0x35>
mov    $0x42,%al
test   $0x20,%sil
jne    1145 <tag_string+0x35>
test   $0x2000,%esi
mov    $0x44,%edx
mov    $0x50,%eax
cmove  %edx,%eax
push   %rbx
movzbl %al,%edx
lea    0x2ef0(%rip),%rbx
lea    0xea9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@tag_string.str = internal global [16 x i8] zeroinitializer
@.str = [8 x i8] c"_%c%03d\00"
define i8* @tag_string(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = and i32 %6, 128
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store i8 88, i8* %5
br label %35
10: ; preds = %2
%11 = load i32, i32* %4
%12 = and i32 %11, 16
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
store i8 67, i8* %5
br label %34
15: ; preds = %10
%16 = load i32, i32* %4
%17 = and i32 %16, 8
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15
store i8 65, i8* %5
br label %33
20: ; preds = %15
%21 = load i32, i32* %4
%22 = and i32 %21, 32
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %20
store i8 66, i8* %5
br label %32
25: ; preds = %20
%26 = load i32, i32* %4
%27 = and i32 %26, 8192
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %25
store i8 80, i8* %5
br label %31
30: ; preds = %25
store i8 68, i8* %5
br label %31
31: ; preds = %30, %29
br label %32
32: ; preds = %31, %24
br label %33
33: ; preds = %32, %19
br label %34
34: ; preds = %33, %14
br label %35
35: ; preds = %34, %9
%36 = load i8, i8* %5
%37 = load i32, i32* %3
%38 = call i32 @sprintf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @tag_string.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 signext %36, i32 %37)
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @tag_string.str, i64 0, i64 0)
}

LLVM IR (-O2):
@tag_string.str = internal global [16 x i8] zeroinitializer
@.str = [8 x i8] c"_%c%03d\00"
define i8* @tag_string(i32 %0, i32 %1) {
%3 = and i32 %1, 128
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %18
5: ; preds = %2
%6 = and i32 %1, 16
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = and i32 %1, 8
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = and i32 %1, 32
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = and i32 %1, 8192
%16 = icmp eq i32 %15, 0
%17 = select i1 %16, i8 68, i8 80
br label %18
18: ; preds = %14, %11, %8, %5, %2
%19 = phi i8 [ 88, %2 ], [ 67, %5 ], [ 65, %8 ], [ 66, %11 ], [ %17, %14 ]
%20 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @tag_string.str, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 signext %19, i32 %0)
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @tag_string.str, i64 0, i64 0)
}