#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*/ setMessageToDisplay(char *);
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ writeCG(int, char *);
void demoMode(void) {
  char man1[5] = {0x02, 0x64, 0x1D, 0x64, 0x02};
  char man2[5] = {0x04, 0x64, 0x1D, 0x64, 0x04};
  char u[5] = {0x00, 0x1C, 0x20, 0x20, 0x3E};
  char f[5] = {0x00, 0x3E, 0x0A, 0x0A, 0x00};
  char s[5] = {0x20, 0x20, 0x2C, 0x12, 0x02};
  char neun[5] = {0x20, 0x20, 0x2E, 0x2A, 0x3E};
  char eins[5] = {0x00, 0x00, 0x3E, 0x00, 0x00};
  char nul[5] = {0x1C, 0x22, 0x22, 0x1C, 0x00};
  char *writechars[7] = {man1, u, f, s, neun, eins, nul};
  char *writechars_ani[7] = {man2, u, f, s, neun, eins, nul};
  int i;
  for (i = 0; i < 7; i++) {
    writeCG(i, *(writechars + i));
  }
  char test[9] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00};
  setMessageToDisplay(test);
  while (1) {
    usleep(750000);
    writeCG(0, *(writechars_ani + 0));
    setMessageToDisplay(test);
    usleep(750000);
    writeCG(0, *(writechars + 0));
    setMessageToDisplay(test);
  }
}


x86 assembly (clang, -O0):
<demoMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    0xebf(%rip),%eax
mov    %eax,-0x5(%rbp)
mov    0xeba(%rip),%al
mov    %al,-0x1(%rbp)
mov    0xeb2(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xead(%rip),%al
mov    %al,-0x6(%rbp)
mov    0xea5(%rip),%eax
mov    %eax,-0xf(%rbp)
mov    0xea0(%rip),%al
mov    %al,-0xb(%rbp)
mov    0xe98(%rip),%eax
mov    %eax,-0x14(%rbp)
mov    0xe93(%rip),%al
mov    %al,-0x10(%rbp)
mov    0xe8b(%rip),%eax
mov    %eax,-0x19(%rbp)
mov    0xe86(%rip),%al
mov    %al,-0x15(%rbp)
mov    0xe7e(%rip),%eax
mov    %eax,-0x1e(%rbp)
mov    0xe79(%rip),%al
mov    %al,-0x1a(%rbp)
mov    0xe71(%rip),%eax
mov    %eax,-0x23(%rbp)
mov    0xe6c(%rip),%al
mov    %al,-0x1f(%rbp)
mov    0xe64(%rip),%eax
mov    %eax,-0x28(%rbp)
mov    0xe5f(%rip),%al
mov    %al,-0x24(%rbp)
lea    -0x5(%rbp),%rax
mov    %rax,-0x60(%rbp)
lea    -0xf(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    -0x19(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x1e(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x23(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0xa(%rbp),%rax
mov    %rax,-0xa0(%rbp)
lea    -0xf(%rbp),%rax
mov    %rax,-0x98(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x90(%rbp)
lea    -0x19(%rbp),%rax
mov    %rax,-0x88(%rbp)
lea    -0x1e(%rbp),%rax
mov    %rax,-0x80(%rbp)
lea    -0x23(%rbp),%rax
mov    %rax,-0x78(%rbp)
lea    -0x28(%rbp),%rax
mov    %rax,-0x70(%rbp)
movl   $0x0,-0xa4(%rbp)
cmpl   $0x7,-0xa4(%rbp)
jge    1289 <demoMode+0x159>
mov    -0xa4(%rbp),%edi
movslq -0xa4(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rsi
call   1040 <writeCG@plt>
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    1251 <demoMode+0x121>
mov    0xd98(%rip),%rax
mov    %rax,-0xad(%rbp)
mov    0xd93(%rip),%al
mov    %al,-0xa5(%rbp)
lea    -0xad(%rbp),%rdi
call   1030 <setMessageToDisplay@plt>
mov    $0xb71b0,%edi
call   1050 <usleep@plt>
mov    -0xa0(%rbp),%rsi
xor    %edi,%edi
call   1040 <writeCG@plt>
lea    -0xad(%rbp),%rdi
call   1030 <setMessageToDisplay@plt>
mov    $0xb71b0,%edi
call   1050 <usleep@plt>
mov    -0x60(%rbp),%rsi
xor    %edi,%edi
call   1040 <writeCG@plt>
lea    -0xad(%rbp),%rdi
call   1030 <setMessageToDisplay@plt>
jmp    12af <demoMode+0x17f>

x86 assembly (clang, -O2):
<demoMode>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
movb   $0x2,0x3c(%rsp)
movl   $0x641d6402,0x38(%rsp)
64
movb   $0x4,0x34(%rsp)
movl   $0x641d6404,0x30(%rsp)
64
movb   $0x3e,0x2c(%rsp)
movl   $0x20201c00,0x28(%rsp)
20
movb   $0x0,0x24(%rsp)
movl   $0xa0a3e00,0x20(%rsp)
0a
movb   $0x2,0x1c(%rsp)
movl   $0x122c2020,0x18(%rsp)
12
movb   $0x3e,0x14(%rsp)
movl   $0x2a2e2020,0x10(%rsp)
2a
movb   $0x0,0xc(%rsp)
movl   $0x3e0000,0x8(%rsp)
movb   $0x0,0x4(%rsp)
movl   $0x1c22221c,(%rsp)
lea    0x38(%rsp),%r14
xor    %edi,%edi
mov    %r14,%rsi
call   1040 <writeCG@plt>
lea    0x28(%rsp),%rsi
mov    $0x1,%edi
call   1040 <writeCG@plt>
lea    0x20(%rsp),%rsi
mov    $0x2,%edi
call   1040 <writeCG@plt>
lea    0x18(%rsp),%rsi
mov    $0x3,%edi
call   1040 <writeCG@plt>
lea    0x10(%rsp),%rsi
mov    $0x4,%edi
call   1040 <writeCG@plt>
lea    0x8(%rsp),%rsi
mov    $0x5,%edi
call   1040 <writeCG@plt>
mov    %rsp,%rsi
mov    $0x6,%edi
call   1040 <writeCG@plt>
movabs $0x807060504030201,%rax
06 07 08
mov    %rax,0x40(%rsp)
movb   $0x0,0x48(%rsp)
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <setMessageToDisplay@plt>
lea    0x30(%rsp),%r15
nopl   (%rax)
mov    $0xb71b0,%edi
call   1050 <usleep@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   1040 <writeCG@plt>
mov    %rbx,%rdi
call   1030 <setMessageToDisplay@plt>
mov    $0xb71b0,%edi
call   1050 <usleep@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1040 <writeCG@plt>
mov    %rbx,%rdi
call   1030 <setMessageToDisplay@plt>
jmp    1230 <demoMode+0x100>

LLVM IR (-O0):
@__const.demoMode.man1 = [5 x i8] c"\02d\1Dd\02"
@__const.demoMode.man2 = [5 x i8] c"\04d\1Dd\04"
@__const.demoMode.u = [5 x i8] c"\00\1C >"
@__const.demoMode.f = [5 x i8] c"\00>\0A\0A\00"
@__const.demoMode.s = [5 x i8] c" ,\12\02"
@__const.demoMode.neun = [5 x i8] c" .*>"
@__const.demoMode.eins = [5 x i8] c"\00\00>\00\00"
@__const.demoMode.nul = [5 x i8] c"\1C\22\22\1C\00"
@__const.demoMode.test = [9 x i8] c"\01\02\03\04\05\06\07\08\00"
define void @demoMode() {
%1 = alloca [5 x i8]
%2 = alloca [5 x i8]
%3 = alloca [5 x i8]
%4 = alloca [5 x i8]
%5 = alloca [5 x i8]
%6 = alloca [5 x i8]
%7 = alloca [5 x i8]
%8 = alloca [5 x i8]
%9 = alloca [7 x i8*]
%10 = alloca [7 x i8*]
%11 = alloca i32
%12 = alloca [9 x i8]
%13 = bitcast [5 x i8]* %1 to i8*
%14 = bitcast [5 x i8]* %2 to i8*
%15 = bitcast [5 x i8]* %3 to i8*
%16 = bitcast [5 x i8]* %4 to i8*
%17 = bitcast [5 x i8]* %5 to i8*
%18 = bitcast [5 x i8]* %6 to i8*
%19 = bitcast [5 x i8]* %7 to i8*
%20 = bitcast [5 x i8]* %8 to i8*
%21 = getelementptr inbounds [7 x i8*], [7 x i8*]* %9, i64 0, i64 0
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
store i8* %22, i8** %21
%23 = getelementptr inbounds i8*, i8** %21, i64 1
%24 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
store i8* %24, i8** %23
%25 = getelementptr inbounds i8*, i8** %23, i64 1
%26 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
store i8* %26, i8** %25
%27 = getelementptr inbounds i8*, i8** %25, i64 1
%28 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
store i8* %28, i8** %27
%29 = getelementptr inbounds i8*, i8** %27, i64 1
%30 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
store i8* %30, i8** %29
%31 = getelementptr inbounds i8*, i8** %29, i64 1
%32 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
store i8* %32, i8** %31
%33 = getelementptr inbounds i8*, i8** %31, i64 1
%34 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
store i8* %34, i8** %33
%35 = getelementptr inbounds [7 x i8*], [7 x i8*]* %10, i64 0, i64 0
%36 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
store i8* %36, i8** %35
%37 = getelementptr inbounds i8*, i8** %35, i64 1
%38 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
store i8* %38, i8** %37
%39 = getelementptr inbounds i8*, i8** %37, i64 1
%40 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
store i8* %40, i8** %39
%41 = getelementptr inbounds i8*, i8** %39, i64 1
%42 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
store i8* %42, i8** %41
%43 = getelementptr inbounds i8*, i8** %41, i64 1
%44 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
store i8* %44, i8** %43
%45 = getelementptr inbounds i8*, i8** %43, i64 1
%46 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
store i8* %46, i8** %45
%47 = getelementptr inbounds i8*, i8** %45, i64 1
%48 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
store i8* %48, i8** %47
store i32 0, i32* %11
br label %49
49: ; preds = %60, %0
%50 = load i32, i32* %11
%51 = icmp slt i32 %50, 7
br i1 %51, label %52, label %63
52: ; preds = %49
%53 = load i32, i32* %11
%54 = getelementptr inbounds [7 x i8*], [7 x i8*]* %9, i64 0, i64 0
%55 = load i32, i32* %11
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8*, i8** %54, i64 %56
%58 = load i8*, i8** %57
%59 = call i32 @writeCG(i32 %53, i8* %58)
br label %60
60: ; preds = %52
%61 = load i32, i32* %11
%62 = add nsw i32 %61, 1
store i32 %62, i32* %11
br label %49
63: ; preds = %49
%64 = bitcast [9 x i8]* %12 to i8*
%65 = getelementptr inbounds [9 x i8], [9 x i8]* %12, i64 0, i64 0
%66 = call i32 @setMessageToDisplay(i8* %65)
br label %67
67: ; preds = %63, %67
%68 = call i32 @usleep(i32 750000)
%69 = getelementptr inbounds [7 x i8*], [7 x i8*]* %10, i64 0, i64 0
%70 = getelementptr inbounds i8*, i8** %69, i64 0
%71 = load i8*, i8** %70
%72 = call i32 @writeCG(i32 0, i8* %71)
%73 = getelementptr inbounds [9 x i8], [9 x i8]* %12, i64 0, i64 0
%74 = call i32 @setMessageToDisplay(i8* %73)
%75 = call i32 @usleep(i32 750000)
%76 = getelementptr inbounds [7 x i8*], [7 x i8*]* %9, i64 0, i64 0
%77 = getelementptr inbounds i8*, i8** %76, i64 0
%78 = load i8*, i8** %77
%79 = call i32 @writeCG(i32 0, i8* %78)
%80 = getelementptr inbounds [9 x i8], [9 x i8]* %12, i64 0, i64 0
%81 = call i32 @setMessageToDisplay(i8* %80)
br label %67
}

LLVM IR (-O2):
@__const.demoMode.man1 = [5 x i8] c"\02d\1Dd\02"
@__const.demoMode.man2 = [5 x i8] c"\04d\1Dd\04"
@__const.demoMode.u = [5 x i8] c"\00\1C >"
@__const.demoMode.f = [5 x i8] c"\00>\0A\0A\00"
@__const.demoMode.s = [5 x i8] c" ,\12\02"
@__const.demoMode.neun = [5 x i8] c" .*>"
@__const.demoMode.eins = [5 x i8] c"\00\00>\00\00"
@__const.demoMode.nul = [5 x i8] c"\1C\22\22\1C\00"
@__const.demoMode.test = [9 x i8] c"\01\02\03\04\05\06\07\08\00"
define void @demoMode() {
%1 = alloca [5 x i8]
%2 = alloca [5 x i8]
%3 = alloca [5 x i8]
%4 = alloca [5 x i8]
%5 = alloca [5 x i8]
%6 = alloca [5 x i8]
%7 = alloca [5 x i8]
%8 = alloca [5 x i8]
%9 = alloca [9 x i8]
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%13 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%15 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%16 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
%18 = call i32 @writeCG(i32 0, i8* %10)
%19 = call i32 @writeCG(i32 1, i8* %12)
%20 = call i32 @writeCG(i32 2, i8* %13)
%21 = call i32 @writeCG(i32 3, i8* %14)
%22 = call i32 @writeCG(i32 4, i8* %15)
%23 = call i32 @writeCG(i32 5, i8* %16)
%24 = call i32 @writeCG(i32 6, i8* %17)
%25 = getelementptr inbounds [9 x i8], [9 x i8]* %9, i64 0, i64 0
%26 = call i32 @setMessageToDisplay(i8* %25)
br label %27
27: ; preds = %27, %0
%28 = call i32 @usleep(i32 750000)
%29 = call i32 @writeCG(i32 0, i8* %11)
%30 = call i32 @setMessageToDisplay(i8* %25)
%31 = call i32 @usleep(i32 750000)
%32 = call i32 @writeCG(i32 0, i8* %10)
%33 = call i32 @setMessageToDisplay(i8* %25)
br label %27
}