#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, char *, char *,
                           char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
void dumpcss(FILE *fp, char *attribs_used) {
  char *colormap[] = {"#000000", "#0000AA", "#00AA00", "#00AAAA",
                      "#AA0000", "#AA00AA", "#AA5500", "#AAAAAA",
                      "#555555", "#5555AA", "#55FF55", "#55FFFF",
                      "#FF5555", "#FF55FF", "#FFFF00", "#FFFFFF"};
  int i;
  if (!attribs_used)
    fputs("/* Virtual console attributes automatically generated by "
          "vcsadump"
          " */\n\n",
          fp);
  for (i = 0; i < 256; i++) {
    if (!attribs_used || attribs_used[i])
      fprintf(fp, "span.a%02x { color: %s; background-color: %s; %s}\n", i,
              colormap[i & 0x0F], colormap[(i >> 4) & 0x07],
              (i & 0x80) ? "text-decoration: underline; " : "");
  }
}


x86 assembly (clang, -O0):
<dumpcss>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
lea    0x2c4f(%rip),%rsi
mov    $0x80,%edx
call   1050 <memcpy@plt>
cmpq   $0x0,-0x10(%rbp)
jne    1176 <dumpcss+0x46>
mov    -0x8(%rbp),%rsi
lea    0xf0f(%rip),%rdi
call   1030 <fputs@plt>
movl   $0x0,-0x94(%rbp)
cmpl   $0x100,-0x94(%rbp)
jge    122c <dumpcss+0xfc>
cmpq   $0x0,-0x10(%rbp)
je     11b3 <dumpcss+0x83>
mov    -0x10(%rbp),%rax
movslq -0x94(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1213 <dumpcss+0xe3>
mov    -0x8(%rbp),%rdi
mov    -0x94(%rbp),%edx
mov    -0x94(%rbp),%eax
and    $0xf,%eax
cltq
mov    -0x90(%rbp,%rax,8),%rcx
ff
mov    -0x94(%rbp),%eax
sar    $0x4,%eax
and    $0x7,%eax
cltq
mov    -0x90(%rbp,%rax,8),%r8
ff
mov    -0x94(%rbp),%esi
and    $0x80,%esi
lea    0xecd(%rip),%r9
lea    0xefa(%rip),%rax
cmp    $0x0,%esi
cmovne %rax,%r9
lea    0xeb9(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1218 <dumpcss+0xe8>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1180 <dumpcss+0x50>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumpcss>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
test   %rsi,%rsi
jne    114f <dumpcss+0x2f>
lea    0xf43(%rip),%rdi
mov    $0x46,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1040 <fwrite@plt>
xor    %ebx,%ebx
lea    0x2c48(%rip),%r13
lea    0xf9b(%rip),%rbp
lea    0xf61(%rip),%r12
jmp    11b2 <dumpcss+0x92>
nopl   0x0(%rax,%rax,1)
mov    %ebx,%eax
and    $0xf,%eax
mov    0x0(%r13,%rax,8),%rcx
mov    %rbx,%rax
shr    %rax
and    $0x38,%eax
mov    (%rax,%r13,1),%r8
test   $0x80,%bl
mov    %rbp,%r9
lea    0xf32(%rip),%rax
cmove  %rax,%r9
mov    %r14,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1030 <fprintf@plt>
add    $0x1,%rbx
cmp    $0x100,%rbx
je     11c0 <dumpcss+0xa0>
test   %r15,%r15
je     1170 <dumpcss+0x50>
cmpb   $0x0,(%r15,%rbx,1)
jne    1170 <dumpcss+0x50>
jmp    11a5 <dumpcss+0x85>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"\00"
@.str.1 = [8 x i8] c"AA\00"
@.str.2 = [8 x i8] c"AA00\00"
@.str.3 = [8 x i8] c"AAAA\00"
@.str.4 = [8 x i8] c"#AA0000\00"
@.str.5 = [8 x i8] c"#AA00AA\00"
@.str.6 = [8 x i8] c"#AA5500\00"
@.str.7 = [8 x i8] c"#AAAAAA\00"
@.str.8 = [8 x i8] c"\00"
@.str.9 = [8 x i8] c"AA\00"
@.str.10 = [8 x i8] c"FF55\00"
@.str.11 = [8 x i8] c"FFFF\00"
@.str.12 = [8 x i8] c"#FF5555\00"
@.str.13 = [8 x i8] c"#FF55FF\00"
@.str.14 = [8 x i8] c"#FFFF00\00"
@.str.15 = [8 x i8] c"#FFFFFF\00"
@__const.dumpcss.colormap = [16 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i32 0, i32 0)]
@.str.16 = [71 x i8] c"/* Virtual console attributes automatically generated by vcsadump */\0A\0A\00"
@.str.17 = [51 x i8] c"span.a%02x { color: %s; background-color: %s; %s}\0A\00"
@.str.18 = [29 x i8] c"text-decoration: underline; \00"
@.str.19 = [1 x i8] zeroinitializer
define void @dumpcss(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca [16 x i8*]
%6 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
%7 = bitcast [16 x i8*]* %5 to i8*
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = load i32*, i32** %3
%12 = call i32 @fputs(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.16, i64 0, i64 0), i32* %11)
br label %13
13: ; preds = %10, %2
store i32 0, i32* %6
br label %14
14: ; preds = %49, %13
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 256
br i1 %16, label %17, label %52
17: ; preds = %14
%18 = load i8*, i8** %4
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %28
20: ; preds = %17
%21 = load i8*, i8** %4
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %48
28: ; preds = %20, %17
%29 = load i32*, i32** %3
%30 = load i32, i32* %6
%31 = load i32, i32* %6
%32 = and i32 %31, 15
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [16 x i8*], [16 x i8*]* %5, i64 0, i64 %33
%35 = load i8*, i8** %34
%36 = load i32, i32* %6
%37 = ashr i32 %36, 4
%38 = and i32 %37, 7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [16 x i8*], [16 x i8*]* %5, i64 0, i64 %39
%41 = load i8*, i8** %40
%42 = load i32, i32* %6
%43 = and i32 %42, 128
%44 = icmp ne i32 %43, 0
%45 = zext i1 %44 to i64
%46 = select i1 %44, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.19, i64 0, i64 0)
%47 = call i32 @fprintf(i32* %29, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.17, i64 0, i64 0), i32 %30, i8* %35, i8* %41, i8* %46)
br label %48
48: ; preds = %28, %20
br label %49
49: ; preds = %48
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %14
52: ; preds = %14
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"\00"
@.str.1 = [8 x i8] c"AA\00"
@.str.2 = [8 x i8] c"AA00\00"
@.str.3 = [8 x i8] c"AAAA\00"
@.str.4 = [8 x i8] c"#AA0000\00"
@.str.5 = [8 x i8] c"#AA00AA\00"
@.str.6 = [8 x i8] c"#AA5500\00"
@.str.7 = [8 x i8] c"#AAAAAA\00"
@.str.8 = [8 x i8] c"\00"
@.str.9 = [8 x i8] c"AA\00"
@.str.10 = [8 x i8] c"FF55\00"
@.str.11 = [8 x i8] c"FFFF\00"
@.str.12 = [8 x i8] c"#FF5555\00"
@.str.13 = [8 x i8] c"#FF55FF\00"
@.str.14 = [8 x i8] c"#FFFF00\00"
@.str.15 = [8 x i8] c"#FFFFFF\00"
@__const.dumpcss.colormap = [16 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i32 0, i32 0)]
@.str.16 = [71 x i8] c"/* Virtual console attributes automatically generated by vcsadump */\0A\0A\00"
@.str.17 = [51 x i8] c"span.a%02x { color: %s; background-color: %s; %s}\0A\00"
@.str.18 = [29 x i8] c"text-decoration: underline; \00"
@.str.19 = [1 x i8] zeroinitializer
define void @dumpcss(i32* nocapture %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.16, i64 0, i64 0), i64 70, i64 1, i32* %0)
br label %6
6: ; preds = %4, %2
br label %7
7: ; preds = %6, %26
%8 = phi i64 [ %27, %26 ], [ 0, %6 ]
br i1 %3, label %13, label %9
9: ; preds = %7
%10 = getelementptr inbounds i8, i8* %1, i64 %8
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %26, label %13
13: ; preds = %9, %7
%14 = trunc i64 %8 to i32
%15 = and i64 %8, 15
%16 = getelementptr inbounds [16 x i8*], [16 x i8*]* @__const.dumpcss.colormap, i64 0, i64 %15
%17 = load i8*, i8** %16
%18 = lshr i64 %8, 4
%19 = and i64 %18, 7
%20 = getelementptr inbounds [16 x i8*], [16 x i8*]* @__const.dumpcss.colormap, i64 0, i64 %19
%21 = load i8*, i8** %20
%22 = and i32 %14, 128
%23 = icmp eq i32 %22, 0
%24 = select i1 %23, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.18, i64 0, i64 0)
%25 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.17, i64 0, i64 0), i32 %14, i8* %17, i8* %21, i8* %24)
br label %26
26: ; preds = %9, %13
%27 = add nuw nsw i64 %8, 1
%28 = icmp eq i64 %27, 256
br i1 %28, label %29, label %7
29: ; preds = %26
ret void
}