#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 */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ vt_write_str(char *);
void vt_attr_set(uint8_t attrs) {
  vt_write_str("\x1B"
               "["
               "0");
  if (attrs & ((uint8_t)(1 << 0))) {
    vt_write_str(";1");
  }
  if (attrs & ((uint8_t)(1 << 1))) {
    vt_write_str(";2");
  }
  if (attrs & ((uint8_t)(1 << 2))) {
    vt_write_str(";4");
  }
  if (attrs & ((uint8_t)(1 << 3))) {
    vt_write_str(";5");
  }
  if (attrs & ((uint8_t)(1 << 4))) {
    vt_write_str(";7");
  }
  if (attrs & ((uint8_t)(1 << 5))) {
    vt_write_str(";8");
  }
  vt_write_str("m");
}


x86 assembly (clang, -O0):
<vt_attr_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <vt_write_str@plt>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1142 <vt_attr_set+0x32>
lea    0xec7(%rip),%rdi
call   1030 <vt_write_str@plt>
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     115d <vt_attr_set+0x4d>
lea    0xeaf(%rip),%rdi
call   1030 <vt_write_str@plt>
mov    -0x4(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1178 <vt_attr_set+0x68>
lea    0xe97(%rip),%rdi
call   1030 <vt_write_str@plt>
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1193 <vt_attr_set+0x83>
lea    0xe7f(%rip),%rdi
call   1030 <vt_write_str@plt>
mov    -0x4(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11ae <vt_attr_set+0x9e>
lea    0xe67(%rip),%rdi
call   1030 <vt_write_str@plt>
mov    -0x4(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     11c9 <vt_attr_set+0xb9>
lea    0xe4f(%rip),%rdi
call   1030 <vt_write_str@plt>
lea    0xe46(%rip),%rdi
call   1030 <vt_write_str@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vt_attr_set>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rdi
call   1030 <vt_write_str@plt>
test   $0x1,%bl
jne    1156 <vt_attr_set+0x46>
test   $0x2,%bl
jne    1167 <vt_attr_set+0x57>
test   $0x4,%bl
jne    1178 <vt_attr_set+0x68>
test   $0x8,%bl
jne    1189 <vt_attr_set+0x79>
test   $0x10,%bl
jne    119a <vt_attr_set+0x8a>
test   $0x20,%bl
je     1149 <vt_attr_set+0x39>
lea    0xecf(%rip),%rdi
call   1030 <vt_write_str@plt>
lea    0xec6(%rip),%rdi
pop    %rbx
jmp    1030 <vt_write_str@plt>
lea    0xea7(%rip),%rdi
call   1030 <vt_write_str@plt>
test   $0x2,%bl
je     1129 <vt_attr_set+0x19>
lea    0xe99(%rip),%rdi
call   1030 <vt_write_str@plt>
test   $0x4,%bl
je     112e <vt_attr_set+0x1e>
lea    0xe8b(%rip),%rdi
call   1030 <vt_write_str@plt>
test   $0x8,%bl
je     1133 <vt_attr_set+0x23>
lea    0xe7d(%rip),%rdi
call   1030 <vt_write_str@plt>
test   $0x10,%bl
je     1138 <vt_attr_set+0x28>
lea    0xe6f(%rip),%rdi
call   1030 <vt_write_str@plt>
test   $0x20,%bl
jne    113d <vt_attr_set+0x2d>
jmp    1149 <vt_attr_set+0x39>

LLVM IR (-O0):
@.str = [4 x i8] c"\1B[0\00"
@.str.1 = [3 x i8] c";1\00"
@.str.2 = [3 x i8] c";2\00"
@.str.3 = [3 x i8] c";4\00"
@.str.4 = [3 x i8] c";5\00"
@.str.5 = [3 x i8] c";7\00"
@.str.6 = [3 x i8] c";8\00"
@.str.7 = [2 x i8] c"m\00"
define void @vt_attr_set(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @vt_write_str(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = and i32 %4, 1
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @vt_write_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i32, i32* %2
%11 = and i32 %10, 2
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @vt_write_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %9
%16 = load i32, i32* %2
%17 = and i32 %16, 4
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @vt_write_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %21
21: ; preds = %19, %15
%22 = load i32, i32* %2
%23 = and i32 %22, 8
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 @vt_write_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %27
27: ; preds = %25, %21
%28 = load i32, i32* %2
%29 = and i32 %28, 16
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @vt_write_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %33
33: ; preds = %31, %27
%34 = load i32, i32* %2
%35 = and i32 %34, 32
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = call i32 @vt_write_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %39
39: ; preds = %37, %33
%40 = call i32 @vt_write_str(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"\1B[0\00"
@.str.1 = [3 x i8] c";1\00"
@.str.2 = [3 x i8] c";2\00"
@.str.3 = [3 x i8] c";4\00"
@.str.4 = [3 x i8] c";5\00"
@.str.5 = [3 x i8] c";7\00"
@.str.6 = [3 x i8] c";8\00"
@.str.7 = [2 x i8] c"m\00"
define void @vt_attr_set(i32 %0) {
%2 = tail call i32 @vt_write_str(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = and i32 %0, 1
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @vt_write_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = and i32 %0, 2
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 @vt_write_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
%13 = and i32 %0, 4
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = tail call i32 @vt_write_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
%18 = and i32 %0, 8
%19 = icmp eq i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = tail call i32 @vt_write_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
%23 = and i32 %0, 16
%24 = icmp eq i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = tail call i32 @vt_write_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %27
27: ; preds = %25, %22
%28 = and i32 %0, 32
%29 = icmp eq i32 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %27
%31 = tail call i32 @vt_write_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %32
32: ; preds = %30, %27
%33 = tail call i32 @vt_write_str(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
ret void
}