#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*/ WRITETEST(char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
void TestSGR() {
  char EscStr[20], WriteStr[200], AttStr[30], DispStr[30], BackStr[30];
  int i, j, k, Attribute, DispColor, BackColor, Count = 0;
  for (i = 0; i < 8; i++) {
    switch (i) {
    case 0:
      Attribute = 1;
      strcpy(AttStr, "BOLD ");
      break;
    case 1:
      Attribute = 2;
      strcpy(AttStr, "UNDERSCORE ");
      break;
    case 2:
      Attribute = 5;
      strcpy(AttStr, "SLOWBLINK ");
      break;
    case 3:
      Attribute = 7;
      strcpy(AttStr, "REVERSE ");
      break;
    case 4:
      Attribute = 22;
      strcpy(AttStr, "NORMAL ");
      break;
    case 5:
      Attribute = 24;
      strcpy(AttStr, "NOT_UNDERLINE ");
      break;
    case 6:
      Attribute = 25;
      strcpy(AttStr, "NOT_BLINKING ");
      break;
    case 7:
      Attribute = 27;
      strcpy(AttStr, "POSITIVE_IMAGE ");
      break;
    }
    for (j = 0; j < 8; j++) {
      switch (j) {
      case 0:
        DispColor = 30;
        strcpy(DispStr, "DISP_BLACK ");
        break;
      case 1:
        DispColor = 31;
        strcpy(DispStr, "DISP_RED ");
        break;
      case 2:
        DispColor = 32;
        strcpy(DispStr, "DISP_GREEN ");
        break;
      case 3:
        DispColor = 33;
        strcpy(DispStr, "DISP_YELLOW ");
        break;
      case 4:
        DispColor = 34;
        strcpy(DispStr, "DISP_BLUE ");
        break;
      case 5:
        DispColor = 35;
        strcpy(DispStr, "DISP_MAGENTA ");
        break;
      case 6:
        DispColor = 36;
        strcpy(DispStr, "DISP_CYAN ");
        break;
      case 7:
        DispColor = 37;
        strcpy(DispStr, "DISP_WHITE ");
        break;
      }
      for (k = 0; k < 8; k++) {
        switch (k) {
        case 0:
          BackColor = 40;
          strcpy(BackStr, "BACK_BLACK ");
          break;
        case 1:
          BackColor = 41;
          strcpy(BackStr, "BACK_RED ");
          break;
        case 2:
          BackColor = 42;
          strcpy(BackStr, "BACK_GREEN ");
          break;
        case 3:
          BackColor = 43;
          strcpy(BackStr, "BACK_YELLOW ");
          break;
        case 4:
          BackColor = 44;
          strcpy(BackStr, "BACK_BLUE ");
          break;
        case 5:
          BackColor = 45;
          strcpy(BackStr, "BACK_MAGENTA ");
          break;
        case 6:
          BackColor = 46;
          strcpy(BackStr, "BACK_CYAN ");
          break;
        case 7:
          BackColor = 47;
          strcpy(BackStr, "BACK_WHITE ");
          break;
        }
        sprintf(EscStr, "%s%d;%d;%dm", "\033[", Attribute, DispColor,
                BackColor);
        WRITETEST(EscStr);
        sprintf(WriteStr, "%2d;%2d;%2d ", Attribute, DispColor, BackColor);
        WRITETEST(WriteStr);
        sprintf(EscStr, "%s0m", "\033[");
        WRITETEST(EscStr);
      }
    }
  }
}


x86 assembly (clang, -O0):
<TestSGR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
movl   $0x0,-0x16c(%rbp)
movl   $0x0,-0x154(%rbp)
cmpl   $0x8,-0x154(%rbp)
jge    1607 <TestSGR+0x4d7>
mov    -0x154(%rbp),%eax
mov    %rax,-0x178(%rbp)
sub    $0x7,%rax
ja     1295 <TestSGR+0x165>
mov    -0x178(%rbp),%rax
lea    0xe7f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x160(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xebe(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1295 <TestSGR+0x165>
movl   $0x2,-0x160(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1295 <TestSGR+0x165>
movl   $0x5,-0x160(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xe8c(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1295 <TestSGR+0x165>
movl   $0x7,-0x160(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1295 <TestSGR+0x165>
movl   $0x16,-0x160(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xe5c(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1295 <TestSGR+0x165>
movl   $0x18,-0x160(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xe42(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1295 <TestSGR+0x165>
movl   $0x19,-0x160(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xe2f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1295 <TestSGR+0x165>
movl   $0x1b,-0x160(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xe1b(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x158(%rbp)
cmpl   $0x8,-0x158(%rbp)
jge    15ee <TestSGR+0x4be>
mov    -0x158(%rbp),%eax
mov    %rax,-0x180(%rbp)
sub    $0x7,%rax
ja     13e5 <TestSGR+0x2b5>
mov    -0x180(%rbp),%rax
lea    0xd4f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1e,-0x164(%rbp)
lea    -0x130(%rbp),%rdi
lea    0xdc9(%rip),%rsi
call   1030 <strcpy@plt>
jmp    13e5 <TestSGR+0x2b5>
movl   $0x1f,-0x164(%rbp)
lea    -0x130(%rbp),%rdi
lea    0xdb3(%rip),%rsi
call   1030 <strcpy@plt>
jmp    13e5 <TestSGR+0x2b5>
movl   $0x20,-0x164(%rbp)
lea    -0x130(%rbp),%rdi
lea    0xd9b(%rip),%rsi
call   1030 <strcpy@plt>
jmp    13e5 <TestSGR+0x2b5>
movl   $0x21,-0x164(%rbp)
lea    -0x130(%rbp),%rdi
lea    0xd85(%rip),%rsi
call   1030 <strcpy@plt>
jmp    13e5 <TestSGR+0x2b5>
movl   $0x22,-0x164(%rbp)
lea    -0x130(%rbp),%rdi
lea    0xd70(%rip),%rsi
call   1030 <strcpy@plt>
jmp    13e5 <TestSGR+0x2b5>
movl   $0x23,-0x164(%rbp)
lea    -0x130(%rbp),%rdi
lea    0xd59(%rip),%rsi
call   1030 <strcpy@plt>
jmp    13e5 <TestSGR+0x2b5>
movl   $0x24,-0x164(%rbp)
lea    -0x130(%rbp),%rdi
lea    0xd45(%rip),%rsi
call   1030 <strcpy@plt>
jmp    13e5 <TestSGR+0x2b5>
movl   $0x25,-0x164(%rbp)
lea    -0x130(%rbp),%rdi
lea    0xd2e(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x15c(%rbp)
cmpl   $0x8,-0x15c(%rbp)
jge    15d5 <TestSGR+0x4a5>
mov    -0x15c(%rbp),%eax
mov    %rax,-0x188(%rbp)
sub    $0x7,%rax
ja     1535 <TestSGR+0x405>
mov    -0x188(%rbp),%rax
lea    0xc1f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x28,-0x168(%rbp)
lea    -0x150(%rbp),%rdi
lea    0xcd8(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1535 <TestSGR+0x405>
movl   $0x29,-0x168(%rbp)
lea    -0x150(%rbp),%rdi
lea    0xcc2(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1535 <TestSGR+0x405>
movl   $0x2a,-0x168(%rbp)
lea    -0x150(%rbp),%rdi
lea    0xcaa(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1535 <TestSGR+0x405>
movl   $0x2b,-0x168(%rbp)
lea    -0x150(%rbp),%rdi
lea    0xc94(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1535 <TestSGR+0x405>
movl   $0x2c,-0x168(%rbp)
lea    -0x150(%rbp),%rdi
lea    0xc7f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1535 <TestSGR+0x405>
movl   $0x2d,-0x168(%rbp)
lea    -0x150(%rbp),%rdi
lea    0xc68(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1535 <TestSGR+0x405>
movl   $0x2e,-0x168(%rbp)
lea    -0x150(%rbp),%rdi
lea    0xc54(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1535 <TestSGR+0x405>
movl   $0x2f,-0x168(%rbp)
lea    -0x150(%rbp),%rdi
lea    0xc3d(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rdi
mov    -0x160(%rbp),%ecx
mov    -0x164(%rbp),%r8d
mov    -0x168(%rbp),%r9d
lea    0xc25(%rip),%rsi
lea    0xc2a(%rip),%rdx
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <WRITETEST@plt>
lea    -0xf0(%rbp),%rdi
mov    -0x160(%rbp),%edx
mov    -0x164(%rbp),%ecx
mov    -0x168(%rbp),%r8d
lea    0xbfc(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    -0xf0(%rbp),%rdi
call   1040 <WRITETEST@plt>
lea    -0x20(%rbp),%rdi
lea    0xbeb(%rip),%rsi
lea    0xbd4(%rip),%rdx
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <WRITETEST@plt>
mov    -0x15c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x15c(%rbp)
jmp    13ef <TestSGR+0x2bf>
jmp    15da <TestSGR+0x4aa>
mov    -0x158(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x158(%rbp)
jmp    129f <TestSGR+0x16f>
jmp    15f3 <TestSGR+0x4c3>
mov    -0x154(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x154(%rbp)
jmp    114f <TestSGR+0x1f>
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestSGR>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x168,%rsp
xor    %ebx,%ebx
jmp    1160 <TestSGR+0x30>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x8(%rsp),%ebx
add    $0x1,%ebx
cmp    $0x8,%ebx
je     12b7 <TestSGR+0x187>
cmp    $0x7,%ebx
ja     1190 <TestSGR+0x60>
mov    %ebx,%eax
lea    0xfce(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
lea    0x1020(%rip),%rcx
mov    (%rcx,%rax,4),%eax
mov    %eax,0xc(%rsp)
lea    0x80(%rsp),%rdi
call   1030 <strcpy@plt>
mov    %ebx,0x8(%rsp)
xor    %ebx,%ebx
jmp    11ad <TestSGR+0x7d>
nopl   0x0(%rax,%rax,1)
mov    0x18(%rsp),%rbx
add    $0x1,%ebx
cmp    $0x8,%ebx
je     1150 <TestSGR+0x20>
cmp    $0x7,%ebx
ja     11d3 <TestSGR+0xa3>
mov    %ebx,%eax
lea    0xfa1(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
lea    0x1e(%rbx),%eax
mov    %eax,0x10(%rsp)
lea    0x60(%rsp),%rdi
call   1030 <strcpy@plt>
mov    %rbx,0x18(%rsp)
xor    %ebx,%ebx
lea    0xf9b(%rip),%r15
jmp    128b <TestSGR+0x15b>
cs nopw 0x0(%rax,%rax,1)
lea    0x20(%rsp),%r12
mov    %r12,%rdi
lea    0xf1a(%rip),%rsi
lea    0xf1f(%rip),%rdx
mov    0xc(%rsp),%r13d
mov    %r13d,%ecx
mov    0x10(%rsp),%r14d
mov    %r14d,%r8d
mov    0x14(%rsp),%ebp
mov    %ebp,%r9d
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %r12,%rdi
call   1040 <WRITETEST@plt>
lea    0xa0(%rsp),%r12
mov    %r12,%rdi
lea    0xeea(%rip),%rsi
mov    %r13d,%edx
mov    %r14d,%ecx
mov    %ebp,%r8d
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %r12,%rdi
call   1040 <WRITETEST@plt>
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
lea    0xed0(%rip),%rsi
lea    0xeb9(%rip),%rdx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbp,%rdi
call   1040 <WRITETEST@plt>
add    $0x1,%ebx
add    $0x4,%r15
cmp    $0x8,%ebx
je     11a0 <TestSGR+0x70>
cmp    $0x7,%ebx
ja     11f0 <TestSGR+0xc0>
movslq (%r15),%rsi
lea    0xede(%rip),%rax
add    %rax,%rsi
lea    0x28(%rbx),%eax
mov    %eax,0x14(%rsp)
lea    0x40(%rsp),%rdi
call   1030 <strcpy@plt>
jmp    11f0 <TestSGR+0xc0>
add    $0x168,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"BOLD \00"
@.str.1 = [12 x i8] c"UNDERSCORE \00"
@.str.2 = [11 x i8] c"SLOWBLINK \00"
@.str.3 = [9 x i8] c"REVERSE \00"
@.str.4 = [8 x i8] c"NORMAL \00"
@.str.5 = [15 x i8] c"NOT_UNDERLINE \00"
@.str.6 = [14 x i8] c"NOT_BLINKING \00"
@.str.7 = [16 x i8] c"POSITIVE_IMAGE \00"
@.str.8 = [12 x i8] c"DISP_BLACK \00"
@.str.9 = [10 x i8] c"DISP_RED \00"
@.str.10 = [12 x i8] c"DISP_GREEN \00"
@.str.11 = [13 x i8] c"DISP_YELLOW \00"
@.str.12 = [11 x i8] c"DISP_BLUE \00"
@.str.13 = [14 x i8] c"DISP_MAGENTA \00"
@.str.14 = [11 x i8] c"DISP_CYAN \00"
@.str.15 = [12 x i8] c"DISP_WHITE \00"
@.str.16 = [12 x i8] c"BACK_BLACK \00"
@.str.17 = [10 x i8] c"BACK_RED \00"
@.str.18 = [12 x i8] c"BACK_GREEN \00"
@.str.19 = [13 x i8] c"BACK_YELLOW \00"
@.str.20 = [11 x i8] c"BACK_BLUE \00"
@.str.21 = [14 x i8] c"BACK_MAGENTA \00"
@.str.22 = [11 x i8] c"BACK_CYAN \00"
@.str.23 = [12 x i8] c"BACK_WHITE \00"
@.str.24 = [12 x i8] c"%s%d;%d;%dm\00"
@.str.25 = [3 x i8] c"\1B[\00"
@.str.26 = [13 x i8] c"%2d;%2d;%2d \00"
@.str.27 = [5 x i8] c"%s0m\00"
define void @TestSGR() {
%1 = alloca [20 x i8]
%2 = alloca [200 x i8]
%3 = alloca [30 x i8]
%4 = alloca [30 x i8]
%5 = alloca [30 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %12
store i32 0, i32* %6
br label %13
13: ; preds = %129, %0
%14 = load i32, i32* %6
%15 = icmp slt i32 %14, 8
br i1 %15, label %16, label %132
16: ; preds = %13
%17 = load i32, i32* %6
switch i32 %17, label %42 [
i32 0, label %18
i32 1, label %21
i32 2, label %24
i32 3, label %27
i32 4, label %30
i32 5, label %33
i32 6, label %36
i32 7, label %39
]
18: ; preds = %16
store i32 1, i32* %9
%19 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%20 = call i32 @strcpy(i8* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %42
21: ; preds = %16
store i32 2, i32* %9
%22 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%23 = call i32 @strcpy(i8* %22, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %42
24: ; preds = %16
store i32 5, i32* %9
%25 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%26 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %42
27: ; preds = %16
store i32 7, i32* %9
%28 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%29 = call i32 @strcpy(i8* %28, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %42
30: ; preds = %16
store i32 22, i32* %9
%31 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%32 = call i32 @strcpy(i8* %31, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %42
33: ; preds = %16
store i32 24, i32* %9
%34 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%35 = call i32 @strcpy(i8* %34, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %42
36: ; preds = %16
store i32 25, i32* %9
%37 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%38 = call i32 @strcpy(i8* %37, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
br label %42
39: ; preds = %16
store i32 27, i32* %9
%40 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%41 = call i32 @strcpy(i8* %40, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
br label %42
42: ; preds = %16, %39, %36, %33, %30, %27, %24, %21, %18
store i32 0, i32* %7
br label %43
43: ; preds = %125, %42
%44 = load i32, i32* %7
%45 = icmp slt i32 %44, 8
br i1 %45, label %46, label %128
46: ; preds = %43
%47 = load i32, i32* %7
switch i32 %47, label %72 [
i32 0, label %48
i32 1, label %51
i32 2, label %54
i32 3, label %57
i32 4, label %60
i32 5, label %63
i32 6, label %66
i32 7, label %69
]
48: ; preds = %46
store i32 30, i32* %10
%49 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%50 = call i32 @strcpy(i8* %49, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
br label %72
51: ; preds = %46
store i32 31, i32* %10
%52 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%53 = call i32 @strcpy(i8* %52, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
br label %72
54: ; preds = %46
store i32 32, i32* %10
%55 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%56 = call i32 @strcpy(i8* %55, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
br label %72
57: ; preds = %46
store i32 33, i32* %10
%58 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%59 = call i32 @strcpy(i8* %58, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
br label %72
60: ; preds = %46
store i32 34, i32* %10
%61 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%62 = call i32 @strcpy(i8* %61, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
br label %72
63: ; preds = %46
store i32 35, i32* %10
%64 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%65 = call i32 @strcpy(i8* %64, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0))
br label %72
66: ; preds = %46
store i32 36, i32* %10
%67 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%68 = call i32 @strcpy(i8* %67, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0))
br label %72
69: ; preds = %46
store i32 37, i32* %10
%70 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%71 = call i32 @strcpy(i8* %70, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
br label %72
72: ; preds = %46, %69, %66, %63, %60, %57, %54, %51, %48
store i32 0, i32* %8
br label %73
73: ; preds = %121, %72
%74 = load i32, i32* %8
%75 = icmp slt i32 %74, 8
br i1 %75, label %76, label %124
76: ; preds = %73
%77 = load i32, i32* %8
switch i32 %77, label %102 [
i32 0, label %78
i32 1, label %81
i32 2, label %84
i32 3, label %87
i32 4, label %90
i32 5, label %93
i32 6, label %96
i32 7, label %99
]
78: ; preds = %76
store i32 40, i32* %11
%79 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%80 = call i32 @strcpy(i8* %79, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0))
br label %102
81: ; preds = %76
store i32 41, i32* %11
%82 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%83 = call i32 @strcpy(i8* %82, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.17, i64 0, i64 0))
br label %102
84: ; preds = %76
store i32 42, i32* %11
%85 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%86 = call i32 @strcpy(i8* %85, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
br label %102
87: ; preds = %76
store i32 43, i32* %11
%88 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%89 = call i32 @strcpy(i8* %88, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.19, i64 0, i64 0))
br label %102
90: ; preds = %76
store i32 44, i32* %11
%91 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%92 = call i32 @strcpy(i8* %91, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.20, i64 0, i64 0))
br label %102
93: ; preds = %76
store i32 45, i32* %11
%94 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%95 = call i32 @strcpy(i8* %94, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.21, i64 0, i64 0))
br label %102
96: ; preds = %76
store i32 46, i32* %11
%97 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%98 = call i32 @strcpy(i8* %97, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.22, i64 0, i64 0))
br label %102
99: ; preds = %76
store i32 47, i32* %11
%100 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%101 = call i32 @strcpy(i8* %100, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.23, i64 0, i64 0))
br label %102
102: ; preds = %76, %99, %96, %93, %90, %87, %84, %81, %78
%103 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%104 = load i32, i32* %9
%105 = load i32, i32* %10
%106 = load i32, i32* %11
%107 = call i32 (i8*, i8*, ...) @sprintf(i8* %103, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.24, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i64 0, i64 0), i32 %104, i32 %105, i32 %106)
%108 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%109 = call i32 @WRITETEST(i8* %108)
%110 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%111 = load i32, i32* %9
%112 = load i32, i32* %10
%113 = load i32, i32* %11
%114 = call i32 (i8*, i8*, ...) @sprintf(i8* %110, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.26, i64 0, i64 0), i32 %111, i32 %112, i32 %113)
%115 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%116 = call i32 @WRITETEST(i8* %115)
%117 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%118 = call i32 (i8*, i8*, ...) @sprintf(i8* %117, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.27, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i64 0, i64 0))
%119 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%120 = call i32 @WRITETEST(i8* %119)
br label %121
121: ; preds = %102
%122 = load i32, i32* %8
%123 = add nsw i32 %122, 1
store i32 %123, i32* %8
br label %73
124: ; preds = %73
br label %125
125: ; preds = %124
%126 = load i32, i32* %7
%127 = add nsw i32 %126, 1
store i32 %127, i32* %7
br label %43
128: ; preds = %43
br label %129
129: ; preds = %128
%130 = load i32, i32* %6
%131 = add nsw i32 %130, 1
store i32 %131, i32* %6
br label %13
132: ; preds = %13
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"BOLD \00"
@.str.1 = [12 x i8] c"UNDERSCORE \00"
@.str.2 = [11 x i8] c"SLOWBLINK \00"
@.str.3 = [9 x i8] c"REVERSE \00"
@.str.4 = [8 x i8] c"NORMAL \00"
@.str.5 = [15 x i8] c"NOT_UNDERLINE \00"
@.str.6 = [14 x i8] c"NOT_BLINKING \00"
@.str.7 = [16 x i8] c"POSITIVE_IMAGE \00"
@.str.8 = [12 x i8] c"DISP_BLACK \00"
@.str.9 = [10 x i8] c"DISP_RED \00"
@.str.10 = [12 x i8] c"DISP_GREEN \00"
@.str.11 = [13 x i8] c"DISP_YELLOW \00"
@.str.12 = [11 x i8] c"DISP_BLUE \00"
@.str.13 = [14 x i8] c"DISP_MAGENTA \00"
@.str.14 = [11 x i8] c"DISP_CYAN \00"
@.str.15 = [12 x i8] c"DISP_WHITE \00"
@.str.16 = [12 x i8] c"BACK_BLACK \00"
@.str.17 = [10 x i8] c"BACK_RED \00"
@.str.18 = [12 x i8] c"BACK_GREEN \00"
@.str.19 = [13 x i8] c"BACK_YELLOW \00"
@.str.20 = [11 x i8] c"BACK_BLUE \00"
@.str.21 = [14 x i8] c"BACK_MAGENTA \00"
@.str.22 = [11 x i8] c"BACK_CYAN \00"
@.str.23 = [12 x i8] c"BACK_WHITE \00"
@.str.24 = [12 x i8] c"%s%d;%d;%dm\00"
@.str.25 = [3 x i8] c"\1B[\00"
@.str.26 = [13 x i8] c"%2d;%2d;%2d \00"
@.str.27 = [5 x i8] c"%s0m\00"
@reltable.TestSGR = [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.1 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.2 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.3 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.4 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.5 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.6 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.7 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR to i64)) to i32)]
@switch.table.TestSGR.28 = [8 x i32] [i32 1, i32 2, i32 5, i32 7, i32 22, i32 24, i32 25, i32 27]
@reltable.TestSGR.31 = [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.8 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR.31 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.9 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR.31 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.10 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR.31 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.11 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR.31 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.12 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR.31 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.13 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR.31 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.14 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR.31 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.15 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR.31 to i64)) to i32)]
@reltable.TestSGR.32 = [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.16 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR.32 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.17 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR.32 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.18 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR.32 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.19 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR.32 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.20 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR.32 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.21 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR.32 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.22 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR.32 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.23 to i64), i64 ptrtoint ([8 x i32]* @reltable.TestSGR.32 to i64)) to i32)]
define void @TestSGR() {
%1 = alloca [20 x i8]
%2 = alloca [200 x i8]
%3 = alloca [30 x i8]
%4 = alloca [30 x i8]
%5 = alloca [30 x i8]
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
br label %11
11: ; preds = %0, %63
%12 = phi i32 [ 0, %0 ], [ %64, %63 ]
%13 = phi i32 [ undef, %0 ], [ %51, %63 ]
%14 = phi i32 [ undef, %0 ], [ %39, %63 ]
%15 = phi i32 [ undef, %0 ], [ %26, %63 ]
%16 = icmp ult i32 %12, 8
br i1 %16, label %17, label %25
17: ; preds = %11
%18 = zext i32 %12 to i64
%19 = shl i64 %18, 2
%20 = call i8* @llvm.load.relative.i64(i8* bitcast ([8 x i32]* @reltable.TestSGR to i8*), i64 %19)
%21 = zext i32 %12 to i64
%22 = getelementptr inbounds [8 x i32], [8 x i32]* @switch.table.TestSGR.28, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = call i32 @strcpy(i8* %8, i8* %20)
br label %25
25: ; preds = %11, %17
%26 = phi i32 [ %15, %11 ], [ %23, %17 ]
br label %27
27: ; preds = %25, %60
%28 = phi i32 [ %13, %25 ], [ %51, %60 ]
%29 = phi i32 [ %14, %25 ], [ %39, %60 ]
%30 = phi i32 [ 0, %25 ], [ %61, %60 ]
%31 = icmp ult i32 %30, 8
br i1 %31, label %32, label %38
32: ; preds = %27
%33 = zext i32 %30 to i64
%34 = shl i64 %33, 2
%35 = call i8* @llvm.load.relative.i64(i8* bitcast ([8 x i32]* @reltable.TestSGR.31 to i8*), i64 %34)
%36 = add nuw i32 %30, 30
%37 = call i32 @strcpy(i8* %9, i8* %35)
br label %38
38: ; preds = %27, %32
%39 = phi i32 [ %29, %27 ], [ %36, %32 ]
br label %40
40: ; preds = %38, %50
%41 = phi i32 [ %28, %38 ], [ %51, %50 ]
%42 = phi i32 [ 0, %38 ], [ %58, %50 ]
%43 = icmp ult i32 %42, 8
br i1 %43, label %44, label %50
44: ; preds = %40
%45 = zext i32 %42 to i64
%46 = shl i64 %45, 2
%47 = call i8* @llvm.load.relative.i64(i8* bitcast ([8 x i32]* @reltable.TestSGR.32 to i8*), i64 %46)
%48 = add nuw i32 %42, 40
%49 = call i32 @strcpy(i8* %10, i8* %47)
br label %50
50: ; preds = %40, %44
%51 = phi i32 [ %41, %40 ], [ %48, %44 ]
%52 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.24, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i64 0, i64 0), i32 %26, i32 %39, i32 %51)
%53 = call i32 @WRITETEST(i8* %6)
%54 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.26, i64 0, i64 0), i32 %26, i32 %39, i32 %51)
%55 = call i32 @WRITETEST(i8* %7)
%56 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.27, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i64 0, i64 0))
%57 = call i32 @WRITETEST(i8* %6)
%58 = add nuw nsw i32 %42, 1
%59 = icmp eq i32 %58, 8
br i1 %59, label %60, label %40
60: ; preds = %50
%61 = add nuw nsw i32 %30, 1
%62 = icmp eq i32 %61, 8
br i1 %62, label %63, label %27
63: ; preds = %60
%64 = add nuw nsw i32 %12, 1
%65 = icmp eq i32 %64, 8
br i1 %65, label %66, label %11
66: ; preds = %63
ret void
}