#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 getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int main(int argc, char **argv) {
  int i, c[24], last[8], diff;
  while (1) {
    while (1) {
      for (i = 0; i < 24; i++)
        c[i] = getchar();
      putchar('\n');
      for (i = 0; i < 8; i++)
        if (c[8 + i] != last[i]) {
          diff = 1;
          last[i] = c[8 + i];
        }
      if (diff) {
        printf("---- EVENT ----\n");
        diff = 0;
      }
      for (i = 0; i < 24; i++)
        printf("%2x", c[i]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
jmp    114e <main+0x1e>
movl   $0x0,-0x14(%rbp)
cmpl   $0x18,-0x14(%rbp)
jge    117e <main+0x4e>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,%ecx
movslq -0x14(%rbp),%rax
mov    %ecx,-0x80(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1155 <main+0x25>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    11ea <main+0xba>
mov    -0x14(%rbp),%eax
add    $0x8,%eax
cltq
mov    -0x80(%rbp,%rax,4),%eax
movslq -0x14(%rbp),%rcx
cmp    -0xa0(%rbp,%rcx,4),%eax
je     11d7 <main+0xa7>
movl   $0x1,-0xa4(%rbp)
mov    -0x14(%rbp),%eax
add    $0x8,%eax
cltq
mov    -0x80(%rbp,%rax,4),%ecx
movslq -0x14(%rbp),%rax
mov    %ecx,-0xa0(%rbp,%rax,4)
jmp    11dc <main+0xac>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118f <main+0x5f>
cmpl   $0x0,-0xa4(%rbp)
je     120f <main+0xdf>
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xa4(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x18,-0x14(%rbp)
jge    1244 <main+0x114>
movslq -0x14(%rbp),%rax
mov    -0x80(%rbp,%rax,4),%esi
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1216 <main+0xe6>
jmp    114e <main+0x1e>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0xeab(%rip),%rbx
jmp    12f3 <main+0x1b3>
nopw   0x0(%rax,%rax,1)
lea    0xe9d(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    0x34(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x38(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x3c(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x40(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x44(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x48(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x4c(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x50(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r14d,0x2c(%rsp)
mov    0x4(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x8(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0xc(%rsp),%ebp
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x74(%rsp),%r14d
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x54(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x58(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x5c(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x60(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x64(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x68(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x6c(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x70(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14d,0x30(%rsp)
mov    %ebp,0x28(%rsp)
mov    %r13d,0x24(%rsp)
mov    %r12d,0x20(%rsp)
mov    %r15d,0x1c(%rsp)
mov    0x2c(%rsp),%eax
mov    %eax,0x18(%rsp)
mov    0x8(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    0x4(%rsp),%eax
mov    %eax,0x10(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x34(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x38(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x3c(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x40(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x44(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x48(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x4c(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x50(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x4(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x8(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%r12d
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%r13d
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0xc(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x54(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x58(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x5c(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x60(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x64(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x68(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x6c(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x70(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebp,0x74(%rsp)
cmp    0x30(%rsp),%ebp
jne    1160 <main+0x20>
mov    0x28(%rsp),%eax
cmp    %eax,0xc(%rsp)
jne    1160 <main+0x20>
cmp    0x24(%rsp),%r13d
jne    1160 <main+0x20>
cmp    0x20(%rsp),%r12d
jne    1160 <main+0x20>
cmp    0x1c(%rsp),%r15d
jne    1160 <main+0x20>
cmp    0x18(%rsp),%r14d
jne    1160 <main+0x20>
mov    0x14(%rsp),%eax
cmp    %eax,0x8(%rsp)
jne    1160 <main+0x20>
mov    0x10(%rsp),%eax
cmp    %eax,0x4(%rsp)
je     116c <main+0x2c>
jmp    1160 <main+0x20>

LLVM IR (-O0):
@.str = [17 x i8] c"---- EVENT ----\0A\00"
@.str.1 = [4 x i8] c"%2x\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [24 x i32]
%8 = alloca [8 x i32]
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %10
10: ; preds = %2
br label %11
11: ; preds = %10, %70
store i32 0, i32* %6
br label %12
12: ; preds = %20, %11
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 24
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = call i32 (...) @getchar()
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [24 x i32], [24 x i32]* %7, i64 0, i64 %18
store i32 %16, i32* %19
br label %20
20: ; preds = %15
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
br label %12
23: ; preds = %12
%24 = call i32 @putchar(i8 signext 10)
store i32 0, i32* %6
br label %25
25: ; preds = %49, %23
%26 = load i32, i32* %6
%27 = icmp slt i32 %26, 8
br i1 %27, label %28, label %52
28: ; preds = %25
%29 = load i32, i32* %6
%30 = add nsw i32 8, %29
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [24 x i32], [24 x i32]* %7, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = icmp ne i32 %33, %37
br i1 %38, label %39, label %48
39: ; preds = %28
store i32 1, i32* %9
%40 = load i32, i32* %6
%41 = add nsw i32 8, %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [24 x i32], [24 x i32]* %7, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = load i32, i32* %6
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 %46
store i32 %44, i32* %47
br label %48
48: ; preds = %39, %28
br label %49
49: ; preds = %48
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %25
52: ; preds = %25
%53 = load i32, i32* %9
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %9
br label %57
57: ; preds = %55, %52
store i32 0, i32* %6
br label %58
58: ; preds = %67, %57
%59 = load i32, i32* %6
%60 = icmp slt i32 %59, 24
br i1 %60, label %61, label %70
61: ; preds = %58
%62 = load i32, i32* %6
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [24 x i32], [24 x i32]* %7, i64 0, i64 %63
%65 = load i32, i32* %64
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %65)
br label %67
67: ; preds = %61
%68 = load i32, i32* %6
%69 = add nsw i32 %68, 1
store i32 %69, i32* %6
br label %58
70: ; preds = %58
br label %11
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%2x\00"
@str = [16 x i8] c"---- EVENT ----\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %54, %2
%4 = phi i32 [ undef, %2 ], [ %27, %54 ]
%5 = phi i32 [ undef, %2 ], [ %26, %54 ]
%6 = phi i32 [ undef, %2 ], [ %25, %54 ]
%7 = phi i32 [ undef, %2 ], [ %24, %54 ]
%8 = phi i32 [ undef, %2 ], [ %23, %54 ]
%9 = phi i32 [ undef, %2 ], [ %22, %54 ]
%10 = phi i32 [ undef, %2 ], [ %21, %54 ]
%11 = phi i32 [ undef, %2 ], [ %20, %54 ]
%12 = tail call i32 (...) @getchar()
%13 = tail call i32 (...) @getchar()
%14 = tail call i32 (...) @getchar()
%15 = tail call i32 (...) @getchar()
%16 = tail call i32 (...) @getchar()
%17 = tail call i32 (...) @getchar()
%18 = tail call i32 (...) @getchar()
%19 = tail call i32 (...) @getchar()
%20 = tail call i32 (...) @getchar()
%21 = tail call i32 (...) @getchar()
%22 = tail call i32 (...) @getchar()
%23 = tail call i32 (...) @getchar()
%24 = tail call i32 (...) @getchar()
%25 = tail call i32 (...) @getchar()
%26 = tail call i32 (...) @getchar()
%27 = tail call i32 (...) @getchar()
%28 = tail call i32 (...) @getchar()
%29 = tail call i32 (...) @getchar()
%30 = tail call i32 (...) @getchar()
%31 = tail call i32 (...) @getchar()
%32 = tail call i32 (...) @getchar()
%33 = tail call i32 (...) @getchar()
%34 = tail call i32 (...) @getchar()
%35 = tail call i32 (...) @getchar()
%36 = tail call i32 @putchar(i8 signext 10)
%37 = icmp eq i32 %20, %11
%38 = icmp eq i32 %21, %10
%39 = icmp eq i32 %22, %9
%40 = icmp eq i32 %23, %8
%41 = icmp eq i32 %24, %7
%42 = icmp eq i32 %25, %6
%43 = icmp eq i32 %26, %5
%44 = icmp eq i32 %27, %4
%45 = select i1 %44, i1 %43, i1 false
%46 = select i1 %45, i1 %42, i1 false
%47 = select i1 %46, i1 %41, i1 false
%48 = select i1 %47, i1 %40, i1 false
%49 = select i1 %48, i1 %39, i1 false
%50 = select i1 %49, i1 %38, i1 false
%51 = select i1 %50, i1 %37, i1 false
br i1 %51, label %54, label %52
52: ; preds = %3
%53 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %54
54: ; preds = %52, %3
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%60 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%65 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%72 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%76 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %33)
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %35)
br label %3
}