#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*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
char *c_typestr(int t) {
  int i;
  static char buf[64];
  buf[0] = '\0';
  if (t & ~((1 << 0) | (1 << 1)))
    snprintf(buf, sizeof buf, "0x%x ", t);
  strcat(buf, "<");
  i = 0;
  if (t & ((1 << 0))) {
    if (i++ > 0)
      strcat(buf, "|");
    strcat(buf, "ADDR");
  };
  if (t & ((1 << 1))) {
    if (i++ > 0)
      strcat(buf, "|");
    strcat(buf, "DATE");
  };
  strcat(buf, ">");
  return buf;
}


x86 assembly (clang, -O0):
<c_typestr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x0,0x2f0e(%rip)
mov    -0x4(%rbp),%eax
and    $0xfffffffc,%eax
cmp    $0x0,%eax
je     115c <c_typestr+0x3c>
mov    -0x4(%rbp),%ecx
lea    0x2ef5(%rip),%rdi
mov    $0x40,%esi
lea    0xea9(%rip),%rdx
call   1030 <snprintf@plt>
lea    0x2edd(%rip),%rdi
lea    0xe9c(%rip),%rsi
call   1040 <strcat@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11bf <c_typestr+0x9f>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    11ac <c_typestr+0x8c>
lea    0x2ea0(%rip),%rdi
lea    0xe61(%rip),%rsi
call   1040 <strcat@plt>
lea    0x2e8d(%rip),%rdi
lea    0xe50(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1208 <c_typestr+0xe8>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    11f5 <c_typestr+0xd5>
lea    0x2e57(%rip),%rdi
lea    0xe18(%rip),%rsi
call   1040 <strcat@plt>
lea    0x2e44(%rip),%rdi
lea    0xe0c(%rip),%rsi
call   1040 <strcat@plt>
lea    0x2e31(%rip),%rdi
lea    0xdfe(%rip),%rsi
call   1040 <strcat@plt>
lea    0x2e1e(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_typestr>:
push   %rbx
mov    %edi,%ebx
movb   $0x0,0x2f16(%rip)
cmp    $0x4,%edi
jb     1149 <c_typestr+0x29>
lea    0x2f0a(%rip),%rdi
lea    0xec3(%rip),%rdx
mov    $0x40,%esi
mov    %ebx,%ecx
call   1030 <snprintf@plt>
lea    0x2ef0(%rip),%rdi
lea    0xeaf(%rip),%rsi
call   1040 <strcat@plt>
test   $0x1,%bl
jne    1168 <c_typestr+0x48>
test   $0x2,%bl
jne    1193 <c_typestr+0x73>
jmp    11a6 <c_typestr+0x86>
lea    0x2ed1(%rip),%rdi
lea    0xe94(%rip),%rsi
call   1040 <strcat@plt>
test   $0x2,%bl
je     11a6 <c_typestr+0x86>
lea    0x2eb9(%rip),%rdi
lea    0xe7a(%rip),%rsi
call   1040 <strcat@plt>
lea    0x2ea6(%rip),%rdi
lea    0xe6e(%rip),%rsi
call   1040 <strcat@plt>
lea    0x2e93(%rip),%rbx
lea    0xe60(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@c_typestr.buf = internal global [64 x i8] zeroinitializer
@.str = [6 x i8] c"0x%x \00"
@.str.1 = [2 x i8] c"<\00"
@.str.2 = [2 x i8] c"|\00"
@.str.3 = [5 x i8] c"ADDR\00"
@.str.4 = [5 x i8] c"DATE\00"
@.str.5 = [2 x i8] c">\00"
define i8* @c_typestr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i8 0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_typestr.buf, i64 0, i64 0)
%4 = load i32, i32* %2
%5 = and i32 %4, -4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = call i32 @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_typestr.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %7, %1
%11 = call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_typestr.buf, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
%12 = load i32, i32* %2
%13 = and i32 %12, 1
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %23
15: ; preds = %10
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
%18 = icmp sgt i32 %16, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_typestr.buf, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %15
%22 = call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_typestr.buf, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %23
23: ; preds = %21, %10
%24 = load i32, i32* %2
%25 = and i32 %24, 2
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %35
27: ; preds = %23
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
%30 = icmp sgt i32 %28, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_typestr.buf, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %31, %27
%34 = call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_typestr.buf, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %35
35: ; preds = %33, %23
%36 = call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_typestr.buf, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_typestr.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@c_typestr.buf = internal global [64 x i8] zeroinitializer
@.str = [6 x i8] c"0x%x \00"
@.str.1 = [2 x i8] c"<\00"
@.str.2 = [2 x i8] c"|\00"
@.str.3 = [5 x i8] c"ADDR\00"
@.str.4 = [5 x i8] c"DATE\00"
@.str.5 = [2 x i8] c">\00"
define i8* @c_typestr(i32 %0) {
store i8 0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_typestr.buf, i64 0, i64 0)
%2 = icmp ult i32 %0, 4
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_typestr.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %5
5: ; preds = %3, %1
%6 = tail call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_typestr.buf, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = and i32 %0, 1
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = and i32 %0, 2
%11 = icmp eq i32 %10, 0
br i1 %11, label %20, label %18
12: ; preds = %5
%13 = tail call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_typestr.buf, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%14 = and i32 %0, 2
%15 = icmp eq i32 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = tail call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_typestr.buf, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %9, %16
%19 = tail call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_typestr.buf, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %20
20: ; preds = %12, %18, %9
%21 = tail call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_typestr.buf, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_typestr.buf, i64 0, i64 0)
}