void kmain(void) {
  char *str = "\x1b\x2d\x37\x62\x15\x0b\x0c\x63\x62\x0b\x36\x62\x35\x23\x31\x62"
              "\x23\x62\x29\x27\x30\x2c\x27\x2e\x62\x23\x2e\x2e\x62\x23\x2e\x2d"
              "\x2c\x25\x6c\x62\x16\x2a\x27\x62\x24\x2e\x23\x25\x62\x2b\x31\x78"
              "\x62\x09\x27\x30\x2c\x27\x2e\x1d\x12\x30\x2d\x25\x30\x23\x2f\x2b"
              "\x2c\x25\x1d\x0b\x31\x1d\x07\x23\x31\x3b\x42";
  char *vidptr = (char *)0xb8000;
  char key = '\x42';
  unsigned int i = 0;
  unsigned int j = 0;
  char *falseflag = "This isn't the flag you are looking for";
  while (j < 80 * 25 * 2) {
    vidptr[j] = ' ';
    vidptr[j + 1] = 0x07;
    j = j + 2;
  }
  j = 0;
  while (str[j] != '\0') {
    vidptr[i] = str[j] ^ key;
    vidptr[i + 1] = 0x02;
    ++j;
    i = i + 2;
  }
  return;
}


x86 assembly (clang, -O0):
<kmain>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    $0xb8000,%eax
mov    %rax,-0x10(%rbp)
movb   $0x42,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xf1b(%rip),%rax
mov    %rax,-0x28(%rbp)
cmpl   $0xfa0,-0x1c(%rbp)
jae    116b <kmain+0x6b>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movb   $0x20,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
movb   $0x7,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
jmp    1135 <kmain+0x35>
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11ca <kmain+0xca>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
movsbl -0x11(%rbp),%ecx
xor    %ecx,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
movb   $0x2,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
jmp    1172 <kmain+0x72>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kmain>:
mov    $0xb8070,%eax
xor    %ecx,%ecx
movaps 0xef2(%rip),%xmm0
xchg   %ax,%ax
movaps %xmm0,-0x70(%rax,%rcx,2)
movaps %xmm0,-0x60(%rax,%rcx,2)
cmp    $0x7c0,%rcx
je     1146 <kmain+0x46>
movaps %xmm0,-0x50(%rax,%rcx,2)
movaps %xmm0,-0x40(%rax,%rcx,2)
movaps %xmm0,-0x30(%rax,%rcx,2)
movaps %xmm0,-0x20(%rax,%rcx,2)
movaps %xmm0,-0x10(%rax,%rcx,2)
movaps %xmm0,(%rax,%rcx,2)
add    $0x40,%rcx
jmp    1110 <kmain+0x10>
lea    0xf53(%rip),%r8
cmp    $0xb8096,%r8
setb   %dl
lea    0xf8d(%rip),%rsi
cmp    $0xb8001,%rsi
setae  %cl
test   %dl,%cl
je     1175 <kmain+0x75>
xor    %esi,%esi
xor    %edx,%edx
jmp    1206 <kmain+0x106>
movaps 0xe94(%rip),%xmm0
movaps %xmm0,0xb8000
movaps 0xe95(%rip),%xmm0
movaps %xmm0,0xb8010
movaps 0xe96(%rip),%xmm0
movaps %xmm0,0xb8020
movaps 0xe97(%rip),%xmm0
movaps %xmm0,0xb8030
movaps 0xe98(%rip),%xmm0
movaps %xmm0,0xb8040
movaps 0xe99(%rip),%xmm0
movaps %xmm0,0xb8050
movaps 0xe9a(%rip),%xmm0
movaps %xmm0,0xb8060
movaps 0xe9b(%rip),%xmm0
movaps %xmm0,0xb8070
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,0xb8080
mov    $0x90,%edx
mov    $0x48,%esi
mov    (%rsi,%r8,1),%cl
xor    $0x42,%cl
mov    %cl,-0x70(%rax,%rdx,1)
mov    %rdx,%rcx
or     $0x1,%rcx
movb   $0x2,-0x70(%rax,%rcx,1)
mov    $0x4a,%r9d
sub    %rsi,%r9
lea    (%rsi,%r8,1),%rdi
add    $0x2,%rdi
add    %rdx,%rax
add    $0xffffffffffffff95,%rax
xor    %esi,%esi
nopw   0x0(%rax,%rax,1)
movzbl -0x1(%rdi,%rsi,1),%edx
movzbl (%rdi,%rsi,1),%ecx
xor    $0x42,%dl
mov    %dl,-0x3(%rax,%rsi,2)
movb   $0x2,-0x2(%rax,%rsi,2)
xor    $0x42,%cl
mov    %cl,-0x1(%rax,%rsi,2)
movb   $0x2,(%rax,%rsi,2)
add    $0x2,%rsi
cmp    %rsi,%r9
jne    1240 <kmain+0x140>
ret

LLVM IR (-O0):
@.str = [76 x i8] c"\1B-7b\15\0B\0Ccb\0B6b5b#b)'0,'.b#..b#.-,%lb\16*'b$.#%b+1xb\09'0,'.\1D\120-%0#/+,%\1D\0B1\1D\07;B\00"
@.str.1 = [40 x i8] c"This isn't the flag you are looking for\00"
define void @kmain() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* inttoptr (i64 753664 to i8*), i8** %2
store i8 66, i8* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8** %6
br label %7
7: ; preds = %10, %0
%8 = load i32, i32* %5
%9 = icmp ult i32 %8, 4000
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = load i8*, i8** %2
%12 = load i32, i32* %5
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
store i8 32, i8* %14
%15 = load i8*, i8** %2
%16 = load i32, i32* %5
%17 = add i32 %16, 1
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %15, i64 %18
store i8 7, i8* %19
%20 = load i32, i32* %5
%21 = add i32 %20, 2
store i32 %21, i32* %5
br label %7
22: ; preds = %7
store i32 0, i32* %5
br label %23
23: ; preds = %31, %22
%24 = load i8*, i8** %1
%25 = load i32, i32* %5
%26 = zext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %55
31: ; preds = %23
%32 = load i8*, i8** %1
%33 = load i32, i32* %5
%34 = zext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = load i8, i8* %3
%39 = sext i8 %38 to i32
%40 = xor i32 %37, %39
%41 = trunc i32 %40 to i8
%42 = load i8*, i8** %2
%43 = load i32, i32* %4
%44 = zext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
store i8 %41, i8* %45
%46 = load i8*, i8** %2
%47 = load i32, i32* %4
%48 = add i32 %47, 1
%49 = zext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %46, i64 %49
store i8 2, i8* %50
%51 = load i32, i32* %5
%52 = add i32 %51, 1
store i32 %52, i32* %5
%53 = load i32, i32* %4
%54 = add i32 %53, 2
store i32 %54, i32* %4
br label %23
55: ; preds = %23
ret void
}

LLVM IR (-O2):
@.str = [76 x i8] c"\1B-7b\15\0B\0Ccb\0B6b5b#b)'0,'.b#..b#.-,%lb\16*'b$.#%b+1xb\09'0,'.\1D\120-%0#/+,%\1D\0B1\1D\07;B\00"
define void @kmain() {
br label %1
1: ; preds = %12, %0
%2 = phi i64 [ 0, %0 ], [ %34, %12 ]
%3 = shl nuw i64 %2, 1
%4 = or i64 %3, 1
%5 = or i64 %3, 17
%6 = getelementptr inbounds i8, i8* inttoptr (i64 753663 to i8*), i64 %4
%7 = bitcast i8* %6 to <16 x i8>*
%8 = getelementptr inbounds i8, i8* inttoptr (i64 753663 to i8*), i64 %5
%9 = bitcast i8* %8 to <16 x i8>*
store <16 x i8> <i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7>, <16 x i8>* %7
store <16 x i8> <i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7>, <16 x i8>* %9
%10 = or i64 %2, 16
%11 = icmp eq i64 %10, 2000
br i1 %11, label %35, label %12
12: ; preds = %1
%13 = shl nuw i64 %10, 1
%14 = or i64 %13, 1
%15 = or i64 %13, 17
%16 = getelementptr inbounds i8, i8* inttoptr (i64 753663 to i8*), i64 %14
%17 = bitcast i8* %16 to <16 x i8>*
%18 = getelementptr inbounds i8, i8* inttoptr (i64 753663 to i8*), i64 %15
%19 = bitcast i8* %18 to <16 x i8>*
store <16 x i8> <i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7>, <16 x i8>* %17
store <16 x i8> <i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7>, <16 x i8>* %19
%20 = shl nuw i64 %2, 1
%21 = or i64 %20, 65
%22 = or i64 %20, 81
%23 = getelementptr inbounds i8, i8* inttoptr (i64 753663 to i8*), i64 %21
%24 = bitcast i8* %23 to <16 x i8>*
%25 = getelementptr inbounds i8, i8* inttoptr (i64 753663 to i8*), i64 %22
%26 = bitcast i8* %25 to <16 x i8>*
store <16 x i8> <i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7>, <16 x i8>* %24
store <16 x i8> <i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7>, <16 x i8>* %26
%27 = shl nuw i64 %2, 1
%28 = or i64 %27, 97
%29 = or i64 %27, 113
%30 = getelementptr inbounds i8, i8* inttoptr (i64 753663 to i8*), i64 %28
%31 = bitcast i8* %30 to <16 x i8>*
%32 = getelementptr inbounds i8, i8* inttoptr (i64 753663 to i8*), i64 %29
%33 = bitcast i8* %32 to <16 x i8>*
store <16 x i8> <i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7>, <16 x i8>* %31
store <16 x i8> <i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7>, <16 x i8>* %33
%34 = add nuw nsw i64 %2, 64
br label %1
35: ; preds = %1
br i1 and (i1 icmp ult (i8* inttoptr (i64 753664 to i8*), i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 75)), i1 icmp ult (i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i8* inttoptr (i64 753814 to i8*))), label %37, label %36
36: ; preds = %35
store <16 x i8> <i8 89, i8 2, i8 111, i8 2, i8 117, i8 2, i8 32, i8 2, i8 87, i8 2, i8 73, i8 2, i8 78, i8 2, i8 33, i8 2>, <16 x i8>* inttoptr (i64 753664 to <16 x i8>*)
store <16 x i8> <i8 32, i8 2, i8 73, i8 2, i8 116, i8 2, i8 32, i8 2, i8 119, i8 2, i8 97, i8 2, i8 115, i8 2, i8 32, i8 2>, <16 x i8>* inttoptr (i64 753680 to <16 x i8>*)
store <16 x i8> <i8 97, i8 2, i8 32, i8 2, i8 107, i8 2, i8 101, i8 2, i8 114, i8 2, i8 110, i8 2, i8 101, i8 2, i8 108, i8 2>, <16 x i8>* inttoptr (i64 753696 to <16 x i8>*)
store <16 x i8> <i8 32, i8 2, i8 97, i8 2, i8 108, i8 2, i8 108, i8 2, i8 32, i8 2, i8 97, i8 2, i8 108, i8 2, i8 111, i8 2>, <16 x i8>* inttoptr (i64 753712 to <16 x i8>*)
store <16 x i8> <i8 110, i8 2, i8 103, i8 2, i8 46, i8 2, i8 32, i8 2, i8 84, i8 2, i8 104, i8 2, i8 101, i8 2, i8 32, i8 2>, <16 x i8>* inttoptr (i64 753728 to <16 x i8>*)
store <16 x i8> <i8 102, i8 2, i8 108, i8 2, i8 97, i8 2, i8 103, i8 2, i8 32, i8 2, i8 105, i8 2, i8 115, i8 2, i8 58, i8 2>, <16 x i8>* inttoptr (i64 753744 to <16 x i8>*)
store <16 x i8> <i8 32, i8 2, i8 75, i8 2, i8 101, i8 2, i8 114, i8 2, i8 110, i8 2, i8 101, i8 2, i8 108, i8 2, i8 95, i8 2>, <16 x i8>* inttoptr (i64 753760 to <16 x i8>*)
store <16 x i8> <i8 80, i8 2, i8 114, i8 2, i8 111, i8 2, i8 103, i8 2, i8 114, i8 2, i8 97, i8 2, i8 109, i8 2, i8 105, i8 2>, <16 x i8>* inttoptr (i64 753776 to <16 x i8>*)
store <16 x i8> <i8 110, i8 2, i8 103, i8 2, i8 95, i8 2, i8 73, i8 2, i8 115, i8 2, i8 95, i8 2, i8 69, i8 2, i8 97, i8 2>, <16 x i8>* inttoptr (i64 753792 to <16 x i8>*)
br label %37
37: ; preds = %36, %35
%38 = phi i64 [ 0, %35 ], [ 72, %36 ]
%39 = phi i64 [ 0, %35 ], [ 144, %36 ]
%40 = getelementptr inbounds [76 x i8], [76 x i8]* @.str, i64 0, i64 %38
%41 = load i8, i8* %40
%42 = xor i8 %41, 66
%43 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %39
store i8 %42, i8* %43
%44 = or i64 %39, 1
%45 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %44
store i8 2, i8* %45
%46 = or i64 %38, 1
%47 = or i64 %39, 2
br label %48
48: ; preds = %48, %37
%49 = phi i64 [ %46, %37 ], [ %65, %48 ]
%50 = phi i64 [ %47, %37 ], [ %66, %48 ]
%51 = getelementptr inbounds [76 x i8], [76 x i8]* @.str, i64 0, i64 %49
%52 = load i8, i8* %51
%53 = xor i8 %52, 66
%54 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %50
store i8 %53, i8* %54
%55 = or i64 %50, 1
%56 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %55
store i8 2, i8* %56
%57 = add nuw nsw i64 %49, 1
%58 = add nuw nsw i64 %50, 2
%59 = getelementptr inbounds [76 x i8], [76 x i8]* @.str, i64 0, i64 %57
%60 = load i8, i8* %59
%61 = xor i8 %60, 66
%62 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %58
store i8 %61, i8* %62
%63 = or i64 %58, 1
%64 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %63
store i8 2, i8* %64
%65 = add nuw nsw i64 %49, 2
%66 = add nuw nsw i64 %50, 4
%67 = icmp eq i64 %65, 75
br i1 %67, label %68, label %48
68: ; preds = %48
ret void
}