#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*/ O_RDONLY;
int /*<<< orphan*/ STDERR_FILENO;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ dprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ print_log(unsigned char *, unsigned char *, unsigned int);
int /*<<< orphan*/ read(int, unsigned char *, int);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  char *infile = NULL;
  if (argc != 2) {
    usage(argv[0]);
    exit(1);
  }
  infile = argv[1];
  int infd = open(infile, O_RDONLY);
  if (infd < 0) {
    dprintf(STDERR_FILENO, "Error (%d) opening file. %s\n", errno,
            strerror(errno));
    exit(2);
  }
  unsigned char buf[32768];
  read(infd, buf, 32768);
  for (unsigned char x = 0; x < 100; x++) {
    unsigned char *l = buf + x * 90;
    if (x == ((l + 20)[0] + ((l + 20)[1] << 8))) {
      unsigned int start = ((l)[0] + ((l)[1] << 8) + ((l)[2] << 16));
      unsigned int end = 0;
      if (x == 99)
        end = ((buf)[0] + ((buf)[1] << 8) + ((buf)[2] << 16));
      else
        end = ((l + 90)[0] + ((l + 90)[1] << 8) + ((l + 90)[2] << 16));
      print_log(l, buf + start, end - start);
    }
  }
  close(infd);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8040,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11c1 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <usage@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2e10(%rip),%rax
mov    (%rax),%esi
call   1080 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    123c <main+0xbc>
mov    0x2ddd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8040(%rbp)
mov    0x2dd6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x803c(%rbp)
mov    0x2dc7(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    -0x8040(%rbp),%edi
mov    -0x803c(%rbp),%edx
mov    %eax,%ecx
lea    0xdd3(%rip),%rsi
call   1050 <dprintf@plt>
mov    $0x2,%edi
call   1090 <exit@plt>
mov    -0x1c(%rbp),%edi
lea    -0x8020(%rbp),%rsi
mov    $0x8000,%edx
call   1060 <read@plt>
movb   $0x0,-0x8021(%rbp)
movzbl -0x8021(%rbp),%eax
cmp    $0x64,%eax
jge    1394 <main+0x214>
lea    -0x8020(%rbp),%rax
movzbl -0x8021(%rbp),%ecx
imul   $0x5a,%ecx,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8030(%rbp)
movzbl -0x8021(%rbp),%eax
mov    -0x8030(%rbp),%rcx
movzbl 0x14(%rcx),%ecx
mov    -0x8030(%rbp),%rdx
movzbl 0x15(%rdx),%edx
shl    $0x8,%edx
add    %edx,%ecx
cmp    %ecx,%eax
jne    137c <main+0x1fc>
mov    -0x8030(%rbp),%rax
movzbl (%rax),%eax
mov    -0x8030(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x8030(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
mov    %eax,-0x8034(%rbp)
movl   $0x0,-0x8038(%rbp)
movzbl -0x8021(%rbp),%eax
cmp    $0x63,%eax
jne    1323 <main+0x1a3>
movzbl -0x8020(%rbp),%eax
movzbl -0x801f(%rbp),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
movzbl -0x801e(%rbp),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
mov    %eax,-0x8038(%rbp)
jmp    1354 <main+0x1d4>
mov    -0x8030(%rbp),%rax
movzbl 0x5a(%rax),%eax
mov    -0x8030(%rbp),%rcx
movzbl 0x5b(%rcx),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x8030(%rbp),%rcx
movzbl 0x5c(%rcx),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
mov    %eax,-0x8038(%rbp)
mov    -0x8030(%rbp),%rdi
lea    -0x8020(%rbp),%rsi
mov    -0x8034(%rbp),%eax
add    %rax,%rsi
mov    -0x8038(%rbp),%edx
sub    -0x8034(%rbp),%edx
call   1030 <print_log@plt>
jmp    1381 <main+0x201>
mov    -0x8021(%rbp),%al
add    $0x1,%al
mov    %al,-0x8021(%rbp)
jmp    1257 <main+0xd7>
mov    -0x1c(%rbp),%edi
call   1040 <close@plt>
xor    %edi,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x8008,%rsp
cmp    $0x2,%edi
jne    11dd <main+0x5d>
mov    0x8(%rsi),%rdi
mov    0x2e4b(%rip),%rax
mov    (%rax),%esi
call   1080 <open@plt>
test   %eax,%eax
jns    11ef <main+0x6f>
mov    0x2e21(%rip),%rax
mov    (%rax),%ebx
mov    0x2e20(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   10a0 <strerror@plt>
lea    0xe38(%rip),%rsi
mov    %ebx,%edi
mov    %ebp,%edx
mov    %eax,%ecx
call   1050 <dprintf@plt>
mov    $0x2,%edi
call   1090 <exit@plt>
mov    (%rsi),%rdi
call   1070 <usage@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    %eax,%r14d
mov    %rsp,%rbx
mov    %eax,%edi
mov    %rbx,%rsi
mov    $0x8000,%edx
call   1060 <read@plt>
lea    0x2(%rsp),%r15
xor    %ebp,%ebp
jmp    123c <main+0xbc>
nopl   (%rax)
movzwl 0x5a(%rbx),%ecx
lea    0x5c(%rbx),%rdx
movzbl (%rdx),%edx
shl    $0x10,%edx
or     %ecx,%edx
lea    (%rsp,%rax,1),%rsi
sub    %eax,%edx
mov    %rbx,%rdi
call   1030 <print_log@plt>
add    $0x1,%rbp
add    $0x5a,%rbx
cmp    $0x64,%rbp
je     1261 <main+0xe1>
movzwl 0x14(%rbx),%eax
cmp    %rax,%rbp
jne    122e <main+0xae>
movzwl (%rbx),%ecx
movzbl 0x2(%rbx),%eax
shl    $0x10,%rax
or     %rcx,%rax
cmp    $0x63,%ebp
jne    1210 <main+0x90>
movzwl (%rsp),%ecx
mov    %r15,%rdx
jmp    1218 <main+0x98>
mov    %r14d,%edi
call   1040 <close@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@O_RDONLY = global i32 0
@STDERR_FILENO = global i32 0
@.str = [29 x i8] c"Error (%d) opening file. %s\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [32768 x i8]
%9 = alloca i8
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 2
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 @usage(i8* %18)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
store i8* %24, i8** %6
%25 = load i8*, i8** %6
%26 = load i32, i32* @O_RDONLY
%27 = call i32 @open(i8* %25, i32 %26)
store i32 %27, i32* %7
%28 = load i32, i32* %7
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %37
30: ; preds = %21
%31 = load i32, i32* @STDERR_FILENO
%32 = load i32, i32* @errno
%33 = load i32, i32* @errno
%34 = call i32 @strerror(i32 %33)
%35 = call i32 @dprintf(i32 %31, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %32, i32 %34)
%36 = call i32 @exit(i32 2)
unreachable
37: ; preds = %21
%38 = load i32, i32* %7
%39 = getelementptr inbounds [32768 x i8], [32768 x i8]* %8, i64 0, i64 0
%40 = call i32 @read(i32 %38, i8* %39, i32 32768)
store i8 0, i8* %9
br label %41
41: ; preds = %132, %37
%42 = load i8, i8* %9
%43 = zext i8 %42 to i32
%44 = icmp slt i32 %43, 100
br i1 %44, label %45, label %135
45: ; preds = %41
%46 = getelementptr inbounds [32768 x i8], [32768 x i8]* %8, i64 0, i64 0
%47 = load i8, i8* %9
%48 = zext i8 %47 to i32
%49 = mul nsw i32 %48, 90
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %46, i64 %50
store i8* %51, i8** %10
%52 = load i8, i8* %9
%53 = zext i8 %52 to i32
%54 = load i8*, i8** %10
%55 = getelementptr inbounds i8, i8* %54, i64 20
%56 = getelementptr inbounds i8, i8* %55, i64 0
%57 = load i8, i8* %56
%58 = zext i8 %57 to i32
%59 = load i8*, i8** %10
%60 = getelementptr inbounds i8, i8* %59, i64 20
%61 = getelementptr inbounds i8, i8* %60, i64 1
%62 = load i8, i8* %61
%63 = zext i8 %62 to i32
%64 = shl i32 %63, 8
%65 = add nsw i32 %58, %64
%66 = icmp eq i32 %53, %65
br i1 %66, label %67, label %131
67: ; preds = %45
%68 = load i8*, i8** %10
%69 = getelementptr inbounds i8, i8* %68, i64 0
%70 = load i8, i8* %69
%71 = zext i8 %70 to i32
%72 = load i8*, i8** %10
%73 = getelementptr inbounds i8, i8* %72, i64 1
%74 = load i8, i8* %73
%75 = zext i8 %74 to i32
%76 = shl i32 %75, 8
%77 = add nsw i32 %71, %76
%78 = load i8*, i8** %10
%79 = getelementptr inbounds i8, i8* %78, i64 2
%80 = load i8, i8* %79
%81 = zext i8 %80 to i32
%82 = shl i32 %81, 16
%83 = add nsw i32 %77, %82
store i32 %83, i32* %11
store i32 0, i32* %12
%84 = load i8, i8* %9
%85 = zext i8 %84 to i32
%86 = icmp eq i32 %85, 99
br i1 %86, label %87, label %101
87: ; preds = %67
%88 = getelementptr inbounds [32768 x i8], [32768 x i8]* %8, i64 0, i64 0
%89 = load i8, i8* %88
%90 = zext i8 %89 to i32
%91 = getelementptr inbounds [32768 x i8], [32768 x i8]* %8, i64 0, i64 1
%92 = load i8, i8* %91
%93 = zext i8 %92 to i32
%94 = shl i32 %93, 8
%95 = add nsw i32 %90, %94
%96 = getelementptr inbounds [32768 x i8], [32768 x i8]* %8, i64 0, i64 2
%97 = load i8, i8* %96
%98 = zext i8 %97 to i32
%99 = shl i32 %98, 16
%100 = add nsw i32 %95, %99
store i32 %100, i32* %12
br label %121
101: ; preds = %67
%102 = load i8*, i8** %10
%103 = getelementptr inbounds i8, i8* %102, i64 90
%104 = getelementptr inbounds i8, i8* %103, i64 0
%105 = load i8, i8* %104
%106 = zext i8 %105 to i32
%107 = load i8*, i8** %10
%108 = getelementptr inbounds i8, i8* %107, i64 90
%109 = getelementptr inbounds i8, i8* %108, i64 1
%110 = load i8, i8* %109
%111 = zext i8 %110 to i32
%112 = shl i32 %111, 8
%113 = add nsw i32 %106, %112
%114 = load i8*, i8** %10
%115 = getelementptr inbounds i8, i8* %114, i64 90
%116 = getelementptr inbounds i8, i8* %115, i64 2
%117 = load i8, i8* %116
%118 = zext i8 %117 to i32
%119 = shl i32 %118, 16
%120 = add nsw i32 %113, %119
store i32 %120, i32* %12
br label %121
121: ; preds = %101, %87
%122 = load i8*, i8** %10
%123 = getelementptr inbounds [32768 x i8], [32768 x i8]* %8, i64 0, i64 0
%124 = load i32, i32* %11
%125 = zext i32 %124 to i64
%126 = getelementptr inbounds i8, i8* %123, i64 %125
%127 = load i32, i32* %12
%128 = load i32, i32* %11
%129 = sub i32 %127, %128
%130 = call i32 @print_log(i8* %122, i8* %126, i32 %129)
br label %131
131: ; preds = %121, %45
br label %132
132: ; preds = %131
%133 = load i8, i8* %9
%134 = add i8 %133, 1
store i8 %134, i8* %9
br label %41
135: ; preds = %41
%136 = load i32, i32* %7
%137 = call i32 @close(i32 %136)
%138 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@STDERR_FILENO = global i32 0
@.str = [29 x i8] c"Error (%d) opening file. %s\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [32768 x i8]
%4 = icmp eq i32 %0, 2
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 @usage(i8* %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = load i32, i32* @O_RDONLY
%13 = tail call i32 @open(i8* %11, i32 %12)
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %9
%16 = load i32, i32* @STDERR_FILENO
%17 = load i32, i32* @errno
%18 = tail call i32 @strerror(i32 %17)
%19 = tail call i32 @dprintf(i32 %16, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18)
%20 = tail call i32 @exit(i32 2)
unreachable
21: ; preds = %9
%22 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 0
%23 = call i32 @read(i32 %13, i8* %22, i32 32768)
%24 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 1
%25 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 2
br label %29
26: ; preds = %85
%27 = call i32 @close(i32 %13)
%28 = call i32 @exit(i32 0)
unreachable
29: ; preds = %21, %85
%30 = phi i32 [ 0, %21 ], [ %86, %85 ]
%31 = phi i64 [ 0, %21 ], [ %87, %85 ]
%32 = mul nuw nsw i64 %31, 90
%33 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 %32
%34 = getelementptr inbounds i8, i8* %33, i64 20
%35 = load i8, i8* %34
%36 = zext i8 %35 to i64
%37 = getelementptr inbounds i8, i8* %33, i64 21
%38 = load i8, i8* %37
%39 = zext i8 %38 to i64
%40 = shl nuw nsw i64 %39, 8
%41 = or i64 %40, %36
%42 = icmp eq i64 %41, %31
br i1 %42, label %43, label %85
43: ; preds = %29
%44 = load i8, i8* %33
%45 = zext i8 %44 to i32
%46 = getelementptr inbounds i8, i8* %33, i64 1
%47 = load i8, i8* %46
%48 = zext i8 %47 to i32
%49 = shl nuw nsw i32 %48, 8
%50 = or i32 %49, %45
%51 = getelementptr inbounds i8, i8* %33, i64 2
%52 = load i8, i8* %51
%53 = zext i8 %52 to i32
%54 = shl nuw nsw i32 %53, 16
%55 = or i32 %50, %54
%56 = icmp eq i32 %30, 99
br i1 %56, label %57, label %64
57: ; preds = %43
%58 = load i8, i8* %22
%59 = zext i8 %58 to i32
%60 = load i8, i8* %24
%61 = zext i8 %60 to i32
%62 = shl nuw nsw i32 %61, 8
%63 = or i32 %62, %59
br label %74
64: ; preds = %43
%65 = getelementptr inbounds i8, i8* %33, i64 90
%66 = load i8, i8* %65
%67 = zext i8 %66 to i32
%68 = getelementptr inbounds i8, i8* %33, i64 91
%69 = load i8, i8* %68
%70 = zext i8 %69 to i32
%71 = shl nuw nsw i32 %70, 8
%72 = or i32 %71, %67
%73 = getelementptr inbounds i8, i8* %33, i64 92
br label %74
74: ; preds = %64, %57
%75 = phi i8* [ %73, %64 ], [ %25, %57 ]
%76 = phi i32 [ %72, %64 ], [ %63, %57 ]
%77 = load i8, i8* %75
%78 = zext i8 %77 to i32
%79 = shl nuw nsw i32 %78, 16
%80 = or i32 %76, %79
%81 = zext i32 %55 to i64
%82 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 %81
%83 = sub nsw i32 %80, %55
%84 = call i32 @print_log(i8* %33, i8* %82, i32 %83)
br label %85
85: ; preds = %74, %29
%86 = add nuw nsw i32 %30, 1
%87 = add nuw nsw i64 %31, 1
%88 = icmp eq i64 %87, 100
br i1 %88, label %26, label %29
}