#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 *);
int strlen(char *);
int html_colour(char type, char *string) {
  char code[25];
  char *p = '\0';
  switch (type) {
  default:
  case '\0':
    code[0] = '\0';
    break;
  case ' ':
    sprintf(code, " ");
    break;
  case 'x':
    sprintf(code, "<font color="
                  "#006400"
                  ">");
    break;
  case 'b':
    sprintf(code, "<font color="
                  "#00008B"
                  ">");
    break;
  case 'c':
    sprintf(code, "<font color="
                  "#008B8B"
                  ">");
    break;
  case 'g':
    sprintf(code, "<font color="
                  "#006400"
                  ">");
    break;
  case 'm':
    sprintf(code, "<font color="
                  "#8B008B"
                  ">");
    break;
  case 'r':
    sprintf(code, "<font color="
                  "#8B0000"
                  ">");
    break;
  case 'w':
    sprintf(code, "<font color="
                  "#808080"
                  ">");
    break;
  case 'y':
    sprintf(code, "<font color="
                  "#808000"
                  ">");
    break;
  case 'B':
    sprintf(code, "<font color="
                  "#0000FF"
                  ">");
    break;
  case 'C':
    sprintf(code, "<font color="
                  "#OOFFFF"
                  ">");
    break;
  case 'G':
    sprintf(code, "<font color="
                  "#00FF00"
                  ">");
    break;
  case 'M':
    sprintf(code, "<font color="
                  "#FF00FF"
                  ">");
    break;
  case 'R':
    sprintf(code, "<font color="
                  "#FF0000"
                  ">");
    break;
  case 'W':
    sprintf(code, "<font color="
                  "#FFFFFF"
                  ">");
    break;
  case 'Y':
    sprintf(code, "<font color="
                  "#FFFF00"
                  ">");
    break;
  case 'D':
    sprintf(code, "<font color="
                  "#636363"
                  ">");
    break;
  case '{':
    sprintf(code, "{");
    break;
  }
  p = code;
  while (*p != '\0') {
    *string = *p++;
    *++string = '\0';
  }
  return (strlen(code));
}


x86 assembly (clang, -O0):
<html_colour>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x38(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0x7b,%eax
ja     1161 <html_colour+0x41>
mov    -0x40(%rbp),%rax
lea    0xea8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1166 <html_colour+0x46>
movb   $0x0,-0x30(%rbp)
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x1076(%rip),%rsi
call   1040 <sprintf@plt>
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x1063(%rip),%rsi
call   1040 <sprintf@plt>
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x1063(%rip),%rsi
call   1040 <sprintf@plt>
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x1063(%rip),%rsi
call   1040 <sprintf@plt>
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x1024(%rip),%rsi
call   1040 <sprintf@plt>
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x104e(%rip),%rsi
call   1040 <sprintf@plt>
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x104e(%rip),%rsi
call   1040 <sprintf@plt>
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x104e(%rip),%rsi
call   1040 <sprintf@plt>
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x104e(%rip),%rsi
call   1040 <sprintf@plt>
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x104e(%rip),%rsi
call   1040 <sprintf@plt>
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x104e(%rip),%rsi
call   1040 <sprintf@plt>
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x104e(%rip),%rsi
call   1040 <sprintf@plt>
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x104e(%rip),%rsi
call   1040 <sprintf@plt>
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x104e(%rip),%rsi
call   1040 <sprintf@plt>
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x104e(%rip),%rsi
call   1040 <sprintf@plt>
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x104e(%rip),%rsi
call   1040 <sprintf@plt>
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x104e(%rip),%rsi
call   1040 <sprintf@plt>
jmp    12e4 <html_colour+0x1c4>
lea    -0x30(%rbp),%rdi
lea    0x104e(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     132b <html_colour+0x20b>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,0x1(%rax)
jmp    12ec <html_colour+0x1cc>
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<html_colour>:
sub    $0x28,%rsp
add    $0xffffffe0,%edi
cmp    $0x5b,%edi
ja     1153 <html_colour+0x43>
lea    0xedd(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
movups 0x103d(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x3e303034363030,%rax
jmp    12b4 <html_colour+0x1a4>
movw   $0x20,(%rsp)
mov    $0x20,%al
jmp    12bb <html_colour+0x1ab>
movb   $0x0,(%rsp)
jmp    12d4 <html_colour+0x1c4>
movups 0x10a0(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x3e464630303030,%rax
jmp    12b4 <html_colour+0x1a4>
movups 0x109b(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x3e464646464f4f,%rax
jmp    12b4 <html_colour+0x1a4>
movups 0x10ff(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x3e333633363336,%rax
jmp    12b4 <html_colour+0x1a4>
movups 0x107c(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x3e303046463030,%rax
jmp    12b4 <html_colour+0x1a4>
movups 0x1077(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x3e464630304646,%rax
jmp    12b4 <html_colour+0x1a4>
movups 0x1072(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x3e303030304646,%rax
jmp    12b4 <html_colour+0x1a4>
movups 0x106d(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x3e464646464646,%rax
jmp    12b4 <html_colour+0x1a4>
movups 0x1068(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x3e303046464646,%rax
jmp    12b4 <html_colour+0x1a4>
movups 0xf52(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x3e423830303030,%rax
jmp    12b4 <html_colour+0x1a4>
movups 0xf50(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x3e423842383030,%rax
jmp    12b4 <html_colour+0x1a4>
movups 0xf4e(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x3e423830304238,%rax
jmp    12b4 <html_colour+0x1a4>
movups 0xf4c(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x3e303030304238,%rax
jmp    12b4 <html_colour+0x1a4>
movups 0xf4a(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x3e303830383038,%rax
jmp    12b4 <html_colour+0x1a4>
movups 0xf48(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x3e303030383038,%rax
mov    %rax,0xd(%rsp)
mov    $0x3c,%al
mov    $0x1,%ecx
mov    %al,-0x1(%rsi,%rcx,1)
movb   $0x0,(%rsi,%rcx,1)
movzbl (%rsp,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    12c0 <html_colour+0x1b0>
mov    %rsp,%rdi
call   1030 <strlen@plt>
add    $0x28,%rsp
ret
movw   $0x7b,(%rsp)
mov    $0x7b,%al
jmp    12bb <html_colour+0x1ab>

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [21 x i8] c"<font color=>\00"
@.str.2 = [21 x i8] c"<font color=B>\00"
@.str.3 = [21 x i8] c"<font color=B8B>\00"
@.str.4 = [21 x i8] c"<font color=B008B>\00"
@.str.5 = [21 x i8] c"<font color=B0000>\00"
@.str.6 = [21 x i8] c"<font color=>\00"
@.str.7 = [21 x i8] c"<font color=>\00"
@.str.8 = [21 x i8] c"<font color=FF>\00"
@.str.9 = [21 x i8] c"<font color=#OOFFFF>\00"
@.str.10 = [21 x i8] c"<font color=FF00>\00"
@.str.11 = [21 x i8] c"<font color=#FF00FF>\00"
@.str.12 = [21 x i8] c"<font color=#FF0000>\00"
@.str.13 = [21 x i8] c"<font color=#FFFFFF>\00"
@.str.14 = [21 x i8] c"<font color=#FFFF00>\00"
@.str.15 = [21 x i8] c"<font color=>\00"
@.str.16 = [2 x i8] c"{\00"
define i32 @html_colour(i8 signext %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca [25 x i8]
%6 = alloca i8*
store i8 %0, i8* %3
store i8* %1, i8** %4
store i8* null, i8** %6
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
switch i32 %8, label %9 [
i32 0, label %10
i32 32, label %12
i32 120, label %15
i32 98, label %18
i32 99, label %21
i32 103, label %24
i32 109, label %27
i32 114, label %30
i32 119, label %33
i32 121, label %36
i32 66, label %39
i32 67, label %42
i32 71, label %45
i32 77, label %48
i32 82, label %51
i32 87, label %54
i32 89, label %57
i32 68, label %60
i32 123, label %63
]
9: ; preds = %2
br label %10
10: ; preds = %2, %9
%11 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
store i8 0, i8* %11
br label %66
12: ; preds = %2
%13 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%14 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %66
15: ; preds = %2
%16 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%17 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %66
18: ; preds = %2
%19 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%20 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %66
21: ; preds = %2
%22 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%23 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
br label %66
24: ; preds = %2
%25 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%26 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %66
27: ; preds = %2
%28 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%29 = call i32 @sprintf(i8* %28, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %66
30: ; preds = %2
%31 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%32 = call i32 @sprintf(i8* %31, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
br label %66
33: ; preds = %2
%34 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%35 = call i32 @sprintf(i8* %34, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
br label %66
36: ; preds = %2
%37 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%38 = call i32 @sprintf(i8* %37, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
br label %66
39: ; preds = %2
%40 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%41 = call i32 @sprintf(i8* %40, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
br label %66
42: ; preds = %2
%43 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%44 = call i32 @sprintf(i8* %43, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
br label %66
45: ; preds = %2
%46 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%47 = call i32 @sprintf(i8* %46, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0))
br label %66
48: ; preds = %2
%49 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%50 = call i32 @sprintf(i8* %49, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0))
br label %66
51: ; preds = %2
%52 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%53 = call i32 @sprintf(i8* %52, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0))
br label %66
54: ; preds = %2
%55 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%56 = call i32 @sprintf(i8* %55, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0))
br label %66
57: ; preds = %2
%58 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%59 = call i32 @sprintf(i8* %58, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0))
br label %66
60: ; preds = %2
%61 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%62 = call i32 @sprintf(i8* %61, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0))
br label %66
63: ; preds = %2
%64 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%65 = call i32 @sprintf(i8* %64, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
br label %66
66: ; preds = %63, %60, %57, %54, %51, %48, %45, %42, %39, %36, %33, %30, %27, %24, %21, %18, %15, %12, %10
%67 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
store i8* %67, i8** %6
br label %68
68: ; preds = %73, %66
%69 = load i8*, i8** %6
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = icmp ne i32 %71, 0
br i1 %72, label %73, label %80
73: ; preds = %68
%74 = load i8*, i8** %6
%75 = getelementptr inbounds i8, i8* %74, i32 1
store i8* %75, i8** %6
%76 = load i8, i8* %74
%77 = load i8*, i8** %4
store i8 %76, i8* %77
%78 = load i8*, i8** %4
%79 = getelementptr inbounds i8, i8* %78, i32 1
store i8* %79, i8** %4
store i8 0, i8* %79
br label %68
80: ; preds = %68
%81 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%82 = call i32 @strlen(i8* %81)
ret i32 %82
}

LLVM IR (-O2):
@.str.1 = [21 x i8] c"<font color=>\00"
@.str.2 = [21 x i8] c"<font color=B>\00"
@.str.3 = [21 x i8] c"<font color=B8B>\00"
@.str.4 = [21 x i8] c"<font color=B008B>\00"
@.str.5 = [21 x i8] c"<font color=B0000>\00"
@.str.6 = [21 x i8] c"<font color=>\00"
@.str.7 = [21 x i8] c"<font color=>\00"
@.str.8 = [21 x i8] c"<font color=FF>\00"
@.str.9 = [21 x i8] c"<font color=#OOFFFF>\00"
@.str.10 = [21 x i8] c"<font color=FF00>\00"
@.str.11 = [21 x i8] c"<font color=#FF00FF>\00"
@.str.12 = [21 x i8] c"<font color=#FF0000>\00"
@.str.13 = [21 x i8] c"<font color=#FFFFFF>\00"
@.str.14 = [21 x i8] c"<font color=#FFFF00>\00"
@.str.15 = [21 x i8] c"<font color=>\00"
define i32 @html_colour(i8 signext %0, i8* nocapture writeonly %1) {
%3 = alloca [25 x i8]
%4 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 0
%5 = sext i8 %0 to i32
switch i32 %5, label %28 [
i32 123, label %26
i32 32, label %6
i32 120, label %10
i32 98, label %11
i32 99, label %12
i32 103, label %13
i32 109, label %14
i32 114, label %15
i32 119, label %16
i32 121, label %17
i32 66, label %18
i32 67, label %19
i32 71, label %20
i32 77, label %21
i32 82, label %22
i32 87, label %23
i32 89, label %24
i32 68, label %25
]
6: ; preds = %2
%7 = bitcast [25 x i8]* %3 to i16*
store i16 32, i16* %7
br label %8
8: ; preds = %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %6
%9 = phi i8 [ 123, %26 ], [ 60, %25 ], [ 60, %24 ], [ 60, %23 ], [ 60, %22 ], [ 60, %21 ], [ 60, %20 ], [ 60, %19 ], [ 60, %18 ], [ 60, %17 ], [ 60, %16 ], [ 60, %15 ], [ 60, %14 ], [ 60, %13 ], [ 60, %12 ], [ 60, %11 ], [ 60, %10 ], [ 32, %6 ]
br label %29
10: ; preds = %2
br label %8
11: ; preds = %2
br label %8
12: ; preds = %2
br label %8
13: ; preds = %2
br label %8
14: ; preds = %2
br label %8
15: ; preds = %2
br label %8
16: ; preds = %2
br label %8
17: ; preds = %2
br label %8
18: ; preds = %2
br label %8
19: ; preds = %2
br label %8
20: ; preds = %2
br label %8
21: ; preds = %2
br label %8
22: ; preds = %2
br label %8
23: ; preds = %2
br label %8
24: ; preds = %2
br label %8
25: ; preds = %2
br label %8
26: ; preds = %2
%27 = bitcast [25 x i8]* %3 to i16*
store i16 123, i16* %27
br label %8
28: ; preds = %2
store i8 0, i8* %4
br label %37
29: ; preds = %8, %29
%30 = phi i8 [ %35, %29 ], [ %9, %8 ]
%31 = phi i8* [ %33, %29 ], [ %4, %8 ]
%32 = phi i8* [ %34, %29 ], [ %1, %8 ]
%33 = getelementptr inbounds i8, i8* %31, i64 1
store i8 %30, i8* %32
%34 = getelementptr inbounds i8, i8* %32, i64 1
store i8 0, i8* %34
%35 = load i8, i8* %33
%36 = icmp eq i8 %35, 0
br i1 %36, label %37, label %29
37: ; preds = %29, %28
%38 = call i32 @strlen(i8* %4)
ret i32 %38
}