#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int i, r;
  unsigned char *pp;
  int pics;
  FILE *fp;
  static unsigned char a_buf[1000000];
  if (argc != 2) {
    fprintf(stderr, "Syntax: vlog <logfile>\n");
    exit(1);
  }
  fp = fopen(argv[1], "r");
  if (!fp) {
    fprintf(stderr, "Cannot open %s\n", argv[1]);
    exit(1);
  }
  while (1) {
    r = fread(a_buf, 1, 1000000, fp);
    pp = a_buf;
    for (i = 0; i < r - 4; i++) {
      if (pp[0] == 0) {
        if (pp[1] == 0) {
          if (pp[2] == 1) {
            if (pp[3] < 0x30 && pp[3] != 0) {
              printf("I");
            } else {
              printf("%02X ", pp[3]);
            }
            if (pp[3] == 0) {
              pics++;
            }
            if (pp[3] == 0xb3) {
              printf("\n");
              pics = 0;
            }
            if (pp[3] == 0x00) {
              printf("\n");
            }
          }
        }
      }
      pp++;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1191 <main+0x41>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe78(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11dd <main+0x8d>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe4e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
jmp    11e2 <main+0x92>
mov    -0x30(%rbp),%rcx
lea    0x2e73(%rip),%rdi
mov    $0x1,%esi
mov    $0xf4240,%edx
call   1030 <fread@plt>
mov    %eax,-0x18(%rbp)
lea    0x2e5a(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x4,%ecx
cmp    %ecx,%eax
jge    1329 <main+0x1d9>
mov    -0x20(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
jne    130f <main+0x1bf>
mov    -0x20(%rbp),%rax
movzbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    130a <main+0x1ba>
mov    -0x20(%rbp),%rax
movzbl 0x2(%rax),%eax
cmp    $0x1,%eax
jne    1305 <main+0x1b5>
mov    -0x20(%rbp),%rax
movzbl 0x3(%rax),%eax
cmp    $0x30,%eax
jge    1289 <main+0x139>
mov    -0x20(%rbp),%rax
movzbl 0x3(%rax),%eax
cmp    $0x0,%eax
je     1289 <main+0x139>
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    129f <main+0x14f>
mov    -0x20(%rbp),%rax
movzbl 0x3(%rax),%esi
lea    0xd94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rax
movzbl 0x3(%rax),%eax
cmp    $0x0,%eax
jne    12b9 <main+0x169>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
movzbl 0x3(%rax),%eax
cmp    $0xb3,%eax
jne    12e1 <main+0x191>
lea    0xd43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%rax
movzbl 0x3(%rax),%eax
cmp    $0x0,%eax
jne    1300 <main+0x1b0>
lea    0xd1d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1305 <main+0x1b5>
jmp    130a <main+0x1ba>
jmp    130f <main+0x1bf>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1211 <main+0xc1>
jmp    11e2 <main+0x92>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
cmp    $0x2,%edi
jne    123b <main+0xdb>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe98(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     125c <main+0xfc>
mov    %rax,%r14
lea    0x2ec8(%rip),%r12
lea    0xe8b(%rip),%r15
nop
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0xf4240,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x5,%eax
jl     11a0 <main+0x40>
mov    %eax,%r13d
add    $0xfffffffb,%r13d
add    $0x1,%r13
xor    %ebx,%ebx
jmp    11d9 <main+0x79>
test   %al,%al
je     122f <main+0xcf>
nopl   (%rax)
add    $0x1,%rbx
cmp    %rbx,%r13
je     11a0 <main+0x40>
cmpb   $0x0,(%rbx,%r12,1)
jne    11d0 <main+0x70>
cmpb   $0x0,0x1(%rbx,%r12,1)
jne    11d0 <main+0x70>
cmpb   $0x1,0x2(%rbx,%r12,1)
jne    11d0 <main+0x70>
movzbl 0x3(%rbx,%r12,1),%esi
lea    -0x30(%rsi),%eax
cmp    $0xd1,%al
jae    1209 <main+0xa9>
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1213 <main+0xb3>
mov    $0x49,%edi
call   1030 <putchar@plt>
movzbl 0x3(%rbx,%r12,1),%eax
cmp    $0xb3,%al
jne    11c9 <main+0x69>
mov    $0xa,%edi
call   1030 <putchar@plt>
movzbl 0x3(%rbx,%r12,1),%eax
jmp    11c9 <main+0x69>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11d0 <main+0x70>
mov    0x2d9e(%rip),%rax
mov    (%rax),%edi
lea    0xdb5(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    0x2d7d(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xdaa(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@main.a_buf = internal global [1000000 x i8] zeroinitializer
@stderr = global i32 0
@.str = [24 x i8] c"Syntax: vlog <logfile>\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [16 x i8] c"Cannot open %s\0A\00"
@.str.3 = [2 x i8] c"I\00"
@.str.4 = [6 x i8] c"%02X \00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %21, i32** %10
%22 = load i32*, i32** %10
%23 = icmp ne i32* %22, null
br i1 %23, label %31, label %24
24: ; preds = %17
%25 = load i32, i32* @stderr
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %28)
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %17
br label %32
32: ; preds = %31, %112
%33 = load i32*, i32** %10
%34 = call i32 @fread(i8* getelementptr inbounds ([1000000 x i8], [1000000 x i8]* @main.a_buf, i64 0, i64 0), i32 1, i32 1000000, i32* %33)
store i32 %34, i32* %7
store i8* getelementptr inbounds ([1000000 x i8], [1000000 x i8]* @main.a_buf, i64 0, i64 0), i8** %8
store i32 0, i32* %6
br label %35
35: ; preds = %109, %32
%36 = load i32, i32* %6
%37 = load i32, i32* %7
%38 = sub nsw i32 %37, 4
%39 = icmp slt i32 %36, %38
br i1 %39, label %40, label %112
40: ; preds = %35
%41 = load i8*, i8** %8
%42 = getelementptr inbounds i8, i8* %41, i64 0
%43 = load i8, i8* %42
%44 = zext i8 %43 to i32
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %106
46: ; preds = %40
%47 = load i8*, i8** %8
%48 = getelementptr inbounds i8, i8* %47, i64 1
%49 = load i8, i8* %48
%50 = zext i8 %49 to i32
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %105
52: ; preds = %46
%53 = load i8*, i8** %8
%54 = getelementptr inbounds i8, i8* %53, i64 2
%55 = load i8, i8* %54
%56 = zext i8 %55 to i32
%57 = icmp eq i32 %56, 1
br i1 %57, label %58, label %104
58: ; preds = %52
%59 = load i8*, i8** %8
%60 = getelementptr inbounds i8, i8* %59, i64 3
%61 = load i8, i8* %60
%62 = zext i8 %61 to i32
%63 = icmp slt i32 %62, 48
br i1 %63, label %64, label %72
64: ; preds = %58
%65 = load i8*, i8** %8
%66 = getelementptr inbounds i8, i8* %65, i64 3
%67 = load i8, i8* %66
%68 = zext i8 %67 to i32
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %72
70: ; preds = %64
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %78
72: ; preds = %64, %58
%73 = load i8*, i8** %8
%74 = getelementptr inbounds i8, i8* %73, i64 3
%75 = load i8, i8* %74
%76 = zext i8 %75 to i32
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %76)
br label %78
78: ; preds = %72, %70
%79 = load i8*, i8** %8
%80 = getelementptr inbounds i8, i8* %79, i64 3
%81 = load i8, i8* %80
%82 = zext i8 %81 to i32
%83 = icmp eq i32 %82, 0
br i1 %83, label %84, label %87
84: ; preds = %78
%85 = load i32, i32* %9
%86 = add nsw i32 %85, 1
store i32 %86, i32* %9
br label %87
87: ; preds = %84, %78
%88 = load i8*, i8** %8
%89 = getelementptr inbounds i8, i8* %88, i64 3
%90 = load i8, i8* %89
%91 = zext i8 %90 to i32
%92 = icmp eq i32 %91, 179
br i1 %92, label %93, label %95
93: ; preds = %87
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %9
br label %95
95: ; preds = %93, %87
%96 = load i8*, i8** %8
%97 = getelementptr inbounds i8, i8* %96, i64 3
%98 = load i8, i8* %97
%99 = zext i8 %98 to i32
%100 = icmp eq i32 %99, 0
br i1 %100, label %101, label %103
101: ; preds = %95
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %103
103: ; preds = %101, %95
br label %104
104: ; preds = %103, %52
br label %105
105: ; preds = %104, %46
br label %106
106: ; preds = %105, %40
%107 = load i8*, i8** %8
%108 = getelementptr inbounds i8, i8* %107, i32 1
store i8* %108, i8** %8
br label %109
109: ; preds = %106
%110 = load i32, i32* %6
%111 = add nsw i32 %110, 1
store i32 %111, i32* %6
br label %35
112: ; preds = %35
br label %32
}

LLVM IR (-O2):
@main.a_buf = internal global [1000000 x i8] zeroinitializer
@stderr = global i32 0
@.str = [24 x i8] c"Syntax: vlog <logfile>\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [16 x i8] c"Cannot open %s\0A\00"
@.str.4 = [6 x i8] c"%02X \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %18
13: ; preds = %8
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %9
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %15)
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %8, %21
%19 = tail call i32 @fread(i8* getelementptr inbounds ([1000000 x i8], [1000000 x i8]* @main.a_buf, i64 0, i64 0), i32 1, i32 1000000, i32* %11)
%20 = icmp sgt i32 %19, 4
br i1 %20, label %22, label %21
21: ; preds = %59, %18
br label %18
22: ; preds = %18
%23 = add nsw i32 %19, -5
%24 = zext i32 %23 to i64
%25 = getelementptr [1000000 x i8], [1000000 x i8]* @main.a_buf, i64 0, i64 %24
br label %26
26: ; preds = %22, %59
%27 = phi i8* [ %60, %59 ], [ getelementptr inbounds ([1000000 x i8], [1000000 x i8]* @main.a_buf, i64 0, i64 0), %22 ]
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 0
br i1 %29, label %30, label %59
30: ; preds = %26
%31 = getelementptr inbounds i8, i8* %27, i64 1
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 0
br i1 %33, label %34, label %59
34: ; preds = %30
%35 = getelementptr inbounds i8, i8* %27, i64 2
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 1
br i1 %37, label %38, label %59
38: ; preds = %34
%39 = getelementptr inbounds i8, i8* %27, i64 3
%40 = load i8, i8* %39
%41 = add i8 %40, -48
%42 = icmp ult i8 %41, -47
br i1 %42, label %45, label %43
43: ; preds = %38
%44 = tail call i32 @putchar(i32 73)
br label %48
45: ; preds = %38
%46 = zext i8 %40 to i32
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %46)
br label %48
48: ; preds = %45, %43
%49 = load i8, i8* %39
%50 = icmp eq i8 %49, -77
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = tail call i32 @putchar(i32 10)
%53 = load i8, i8* %39
br label %54
54: ; preds = %51, %48
%55 = phi i8 [ %53, %51 ], [ %49, %48 ]
%56 = icmp eq i8 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %54
%58 = tail call i32 @putchar(i32 10)
br label %59
59: ; preds = %30, %54, %57, %34, %26
%60 = getelementptr inbounds i8, i8* %27, i64 1
%61 = icmp eq i8* %27, %25
br i1 %61, label %21, label %26
}