#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_flagsstr(int t) {
  int i;
  static char buf[64];
  buf[0] = '\0';
  if (t & ~((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3)))
    snprintf(buf, sizeof buf, "0x%x ", t);
  strcat(buf, "<");
  i = 0;
  if (t & ((1 << 0))) {
    if (i++ > 0)
      strcat(buf, "|");
    strcat(buf, "TRUE");
  };
  if (t & ((1 << 1))) {
    if (i++ > 0)
      strcat(buf, "|");
    strcat(buf, "PARSED");
  };
  if (t & ((1 << 2))) {
    if (i++ > 0)
      strcat(buf, "|");
    strcat(buf, "DATEFAB");
  };
  if (t & ((1 << 3))) {
    if (i++ > 0)
      strcat(buf, "|");
    strcat(buf, "TRIMMED");
  };
  strcat(buf, ">");
  return buf;
}


x86 assembly (clang, -O0):
<c_flagsstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x0,0x2f0e(%rip)
mov    -0x4(%rbp),%eax
and    $0xfffffff0,%eax
cmp    $0x0,%eax
je     115c <c_flagsstr+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_flagsstr+0x9f>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    11ac <c_flagsstr+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_flagsstr+0xe8>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    11f5 <c_flagsstr+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>
mov    -0x4(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1251 <c_flagsstr+0x131>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    123e <c_flagsstr+0x11e>
lea    0x2e0e(%rip),%rdi
lea    0xdcf(%rip),%rsi
call   1040 <strcat@plt>
lea    0x2dfb(%rip),%rdi
lea    0xdca(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     129a <c_flagsstr+0x17a>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    1287 <c_flagsstr+0x167>
lea    0x2dc5(%rip),%rdi
lea    0xd86(%rip),%rsi
call   1040 <strcat@plt>
lea    0x2db2(%rip),%rdi
lea    0xd89(%rip),%rsi
call   1040 <strcat@plt>
lea    0x2d9f(%rip),%rdi
lea    0xd7e(%rip),%rsi
call   1040 <strcat@plt>
lea    0x2d8c(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_flagsstr>:
push   %rbx
mov    %edi,%ebx
movb   $0x0,0x2f16(%rip)
cmp    $0x10,%edi
jb     1149 <c_flagsstr+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    1179 <c_flagsstr+0x59>
test   $0x2,%bl
jne    11b0 <c_flagsstr+0x90>
test   $0x4,%bl
jne    11db <c_flagsstr+0xbb>
test   $0x8,%bl
jne    1206 <c_flagsstr+0xe6>
jmp    1219 <c_flagsstr+0xf9>
lea    0x2ec0(%rip),%rdi
lea    0xe83(%rip),%rsi
call   1040 <strcat@plt>
test   $0x2,%bl
jne    119d <c_flagsstr+0x7d>
test   $0x4,%bl
jne    11c8 <c_flagsstr+0xa8>
test   $0x8,%bl
jne    11f3 <c_flagsstr+0xd3>
jmp    1219 <c_flagsstr+0xf9>
lea    0x2e9c(%rip),%rdi
lea    0xe5d(%rip),%rsi
call   1040 <strcat@plt>
lea    0x2e89(%rip),%rdi
lea    0xe51(%rip),%rsi
call   1040 <strcat@plt>
test   $0x4,%bl
je     1196 <c_flagsstr+0x76>
lea    0x2e71(%rip),%rdi
lea    0xe32(%rip),%rsi
call   1040 <strcat@plt>
lea    0x2e5e(%rip),%rdi
lea    0xe2d(%rip),%rsi
call   1040 <strcat@plt>
test   $0x8,%bl
je     1219 <c_flagsstr+0xf9>
lea    0x2e46(%rip),%rdi
lea    0xe07(%rip),%rsi
call   1040 <strcat@plt>
lea    0x2e33(%rip),%rdi
lea    0xe0a(%rip),%rsi
call   1040 <strcat@plt>
lea    0x2e20(%rip),%rbx
lea    0xdff(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@c_flagsstr.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"TRUE\00"
@.str.4 = [7 x i8] c"PARSED\00"
@.str.5 = [8 x i8] c"DATEFAB\00"
@.str.6 = [8 x i8] c"TRIMMED\00"
@.str.7 = [2 x i8] c">\00"
define i8* @c_flagsstr(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_flagsstr.buf, i64 0, i64 0)
%4 = load i32, i32* %2
%5 = and i32 %4, -16
%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_flagsstr.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_flagsstr.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_flagsstr.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_flagsstr.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_flagsstr.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_flagsstr.buf, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %35
35: ; preds = %33, %23
%36 = load i32, i32* %2
%37 = and i32 %36, 4
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %47
39: ; preds = %35
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
store i32 %41, i32* %3
%42 = icmp sgt i32 %40, 0
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_flagsstr.buf, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %45
45: ; preds = %43, %39
%46 = call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_flagsstr.buf, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %47
47: ; preds = %45, %35
%48 = load i32, i32* %2
%49 = and i32 %48, 8
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %59
51: ; preds = %47
%52 = load i32, i32* %3
%53 = add nsw i32 %52, 1
store i32 %53, i32* %3
%54 = icmp sgt i32 %52, 0
br i1 %54, label %55, label %57
55: ; preds = %51
%56 = call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_flagsstr.buf, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %57
57: ; preds = %55, %51
%58 = call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_flagsstr.buf, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %59
59: ; preds = %57, %47
%60 = call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_flagsstr.buf, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_flagsstr.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@c_flagsstr.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"TRUE\00"
@.str.4 = [7 x i8] c"PARSED\00"
@.str.5 = [8 x i8] c"DATEFAB\00"
@.str.6 = [8 x i8] c"TRIMMED\00"
@.str.7 = [2 x i8] c">\00"
define i8* @c_flagsstr(i32 %0) {
store i8 0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_flagsstr.buf, i64 0, i64 0)
%2 = icmp ult i32 %0, 16
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_flagsstr.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_flagsstr.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 %23, label %18
12: ; preds = %5
%13 = tail call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_flagsstr.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_flagsstr.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_flagsstr.buf, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %20
20: ; preds = %12, %18
%21 = and i32 %0, 4
%22 = icmp eq i32 %21, 0
br i1 %22, label %30, label %26
23: ; preds = %9
%24 = and i32 %0, 4
%25 = icmp eq i32 %24, 0
br i1 %25, label %33, label %28
26: ; preds = %20
%27 = tail call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_flagsstr.buf, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %23, %26
%29 = tail call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_flagsstr.buf, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %30
30: ; preds = %28, %20
%31 = and i32 %0, 8
%32 = icmp eq i32 %31, 0
br i1 %32, label %40, label %36
33: ; preds = %23
%34 = and i32 %0, 8
%35 = icmp eq i32 %34, 0
br i1 %35, label %40, label %38
36: ; preds = %30
%37 = tail call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_flagsstr.buf, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %38
38: ; preds = %33, %36
%39 = tail call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_flagsstr.buf, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %40
40: ; preds = %33, %38, %30
%41 = tail call i32 @strcat(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_flagsstr.buf, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @c_flagsstr.buf, i64 0, i64 0)
}