#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 scalar_t__ ssize_t;
typedef size_t off_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ err(int /*<<< orphan*/, char *);
int /*<<< orphan*/ errx(int /*<<< orphan*/, char *);
unsigned char *memchr(unsigned char *, float, size_t);
int /*<<< orphan*/ memmove(unsigned char *, unsigned char *, size_t);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ read(int, unsigned char *, int);
int /*<<< orphan*/ warnx(char *, unsigned char, unsigned char, unsigned char,
                         ...);
int main(int argc, char *argv[]) {
  int fd, j;
  off_t bufoff;
  size_t buflen = 0, framelen;
  ssize_t ret;
  unsigned char buf[8192];
  unsigned char *bufptr;
  if (argc < 2) {
    errx(EXIT_FAILURE, "<isoch data file>");
  }
  fd = open(argv[1], O_RDONLY);
  if (fd < 0) {
    err(EXIT_FAILURE, "open");
  }
  while ((ret = read(fd, buf + buflen, sizeof(buf) - buflen)) > 0) {
    buflen += (size_t)ret;
    bufoff = 0;
    do {
      bufptr = memchr(buf + bufoff, '\xff', buflen - bufoff);
      if (!bufptr) {
        break;
      }
      framelen = bufptr - (buf + bufoff);
      if (framelen + 3 + 3 > buflen - bufoff) {
        break;
      }
      if (bufptr[1] != 0x00 || bufptr[2] != 0x00 ||
          (bufptr[3] & 0x10) != 0x10) {
        warnx("bad EAV: %02x %02x %02x %02x", bufptr[0], bufptr[1], bufptr[2],
              bufptr[3]);
        break;
      }
      if (bufptr[4] != 0x00 || bufptr[5] != 0xff || bufptr[6] != 0xff) {
        warnx("bad ANC: %02x %02x %02x", bufptr[4], bufptr[5], bufptr[6]);
        break;
      }
      printf("%4zi: ", framelen);
      for (j = 0; j < 32; j++) {
        printf("%02x ", *(bufptr + j));
      }
      printf("\n");
      bufoff += framelen + 32;
    } while (1);
    buflen -= bufoff;
    memmove(buf, buf + bufoff, buflen);
  }
  if (ret < 0) {
    errx(EXIT_FAILURE, "read");
  }
  close(fd);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2050,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x28(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11d0 <main+0x40>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
lea    0xe39(%rip),%rsi
call   1030 <errx@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e09(%rip),%rax
mov    (%rax),%esi
call   10b0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1208 <main+0x78>
mov    0x2dde(%rip),%rax
mov    (%rax),%edi
lea    0xe13(%rip),%rsi
call   1090 <err@plt>
jmp    120d <main+0x7d>
mov    -0x14(%rbp),%edi
lea    -0x2040(%rbp),%rsi
add    -0x28(%rbp),%rsi
mov    $0x2000,%eax
sub    -0x28(%rbp),%rax
mov    %eax,%edx
call   1080 <read@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jle    1468 <main+0x2d8>
mov    -0x38(%rbp),%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x2040(%rbp),%rdi
add    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
sub    -0x20(%rbp),%rsi
movss  0xd98(%rip),%xmm0
call   1070 <memchr@plt>
mov    %rax,-0x2048(%rbp)
cmpq   $0x0,-0x2048(%rbp)
jne    1287 <main+0xf7>
jmp    1439 <main+0x2a9>
mov    -0x2048(%rbp),%rax
lea    -0x2040(%rbp),%rcx
add    -0x20(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
add    $0x3,%rax
add    $0x3,%rax
mov    -0x28(%rbp),%rcx
sub    -0x20(%rbp),%rcx
cmp    %rcx,%rax
jbe    12c2 <main+0x132>
jmp    1439 <main+0x2a9>
mov    -0x2048(%rbp),%rax
movzbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    1301 <main+0x171>
mov    -0x2048(%rbp),%rax
movzbl 0x2(%rax),%eax
cmp    $0x0,%eax
jne    1301 <main+0x171>
mov    -0x2048(%rbp),%rax
movzbl 0x3(%rax),%eax
and    $0x10,%eax
cmp    $0x10,%eax
je     1346 <main+0x1b6>
mov    -0x2048(%rbp),%rax
mov    (%rax),%dl
mov    -0x2048(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x2048(%rbp),%rax
mov    0x2(%rax),%al
mov    -0x2048(%rbp),%rsi
movzbl 0x3(%rsi),%r8d
lea    0xcea(%rip),%rdi
movzbl %dl,%esi
movzbl %cl,%edx
movzbl %al,%ecx
mov    $0x0,%al
call   1050 <warnx@plt>
jmp    1439 <main+0x2a9>
mov    -0x2048(%rbp),%rax
movzbl 0x4(%rax),%eax
cmp    $0x0,%eax
jne    1386 <main+0x1f6>
mov    -0x2048(%rbp),%rax
movzbl 0x5(%rax),%eax
cmp    $0xff,%eax
jne    1386 <main+0x1f6>
mov    -0x2048(%rbp),%rax
movzbl 0x6(%rax),%eax
cmp    $0xff,%eax
je     13be <main+0x22e>
mov    -0x2048(%rbp),%rax
mov    0x4(%rax),%dl
mov    -0x2048(%rbp),%rax
mov    0x5(%rax),%cl
mov    -0x2048(%rbp),%rax
lea    0xc90(%rip),%rdi
movzbl %dl,%esi
movzbl %cl,%edx
movzbl 0x6(%rax),%ecx
mov    $0x0,%al
call   1050 <warnx@plt>
jmp    1439 <main+0x2a9>
mov    -0x30(%rbp),%rsi
lea    0xc87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x20,-0x18(%rbp)
jge    140c <main+0x27c>
mov    -0x2048(%rbp),%rax
movslq -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xc60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    13d7 <main+0x247>
lea    0xc4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rax
add    $0x20,%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    124d <main+0xbd>
jmp    1439 <main+0x2a9>
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x28(%rbp)
lea    -0x2040(%rbp),%rdi
lea    -0x2040(%rbp),%rsi
add    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   10a0 <memmove@plt>
jmp    120d <main+0x7d>
cmpq   $0x0,-0x38(%rbp)
jge    1488 <main+0x2f8>
mov    0x2b5e(%rip),%rax
mov    (%rax),%edi
lea    0xbdc(%rip),%rsi
call   1030 <errx@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    0x2b39(%rip),%rax
mov    (%rax),%eax
add    $0x2050,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2018,%rsp
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     11ce <main+0x2e>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
lea    0xe3b(%rip),%rsi
call   1040 <errx@plt>
mov    0x8(%rbx),%rdi
mov    0x2e0f(%rip),%rax
mov    (%rax),%esi
call   10c0 <open@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    11fb <main+0x5b>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
lea    0xe20(%rip),%rsi
call   10a0 <err@plt>
lea    0x10(%rsp),%r14
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x2000,%edx
call   1090 <read@plt>
mov    %rax,%rbx
test   %rax,%rax
jle    1573 <main+0x3d3>
lea    0xe35(%rip),%r15
xor    %r12d,%r12d
mov    %ebp,0x4(%rsp)
jmp    1270 <main+0xd0>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rbp
mov    %rbx,%r12
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   10b0 <memmove@plt>
lea    (%rsp,%r12,1),%rsi
add    $0x10,%rsi
mov    $0x2000,%edx
sub    %r12d,%edx
mov    0x4(%rsp),%ebp
mov    %ebp,%edi
call   1090 <read@plt>
mov    %rax,%rbx
test   %rax,%rax
jle    1573 <main+0x3d3>
add    %r12,%rbx
mov    %r14,%rdi
movss  0xd82(%rip),%xmm0
mov    %rbx,%rsi
call   1080 <memchr@plt>
test   %rax,%rax
je     1230 <main+0x90>
mov    %rax,%r13
mov    %rbx,0x8(%rsp)
mov    %rbx,%r12
mov    %r14,%rbp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r13,%r14
sub    %rbp,%r14
lea    0x6(%r14),%rax
cmp    %r12,%rax
ja     1236 <main+0x96>
movzbl 0x1(%r13),%eax
movzbl 0x2(%r13),%ecx
mov    %eax,%edx
or     %cl,%dl
jne    1530 <main+0x390>
testb  $0x10,0x3(%r13)
je     152e <main+0x38e>
movzbl 0x4(%r13),%eax
movzbl 0x5(%r13),%edx
test   %al,%al
jne    1555 <main+0x3b5>
cmp    $0xff,%dl
jne    1555 <main+0x3b5>
cmpb   $0xff,0x6(%r13)
jne    1553 <main+0x3b3>
lea    0xd55(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x0(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x1(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x2(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x3(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x4(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x5(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x6(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x7(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x8(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x9(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0xa(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0xb(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0xc(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0xd(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0xe(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0xf(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x10(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x11(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x12(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x13(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x14(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x15(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x16(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x17(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x18(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x19(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x1a(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x1b(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x1c(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x1d(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x1e(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x1f(%r13),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    (%rbx,%r14,1),%rax
add    %r14,%rbx
add    $0x20,%rbx
lea    (%rsp,%rax,1),%rbp
add    $0x30,%rbp
mov    0x8(%rsp),%r12
sub    %rbx,%r12
mov    %rbp,%rdi
movss  0xaeb(%rip),%xmm0
mov    %r12,%rsi
call   1080 <memchr@plt>
mov    %rax,%r13
test   %rax,%rax
jne    12a0 <main+0x100>
jmp    1236 <main+0x96>
xor    %ecx,%ecx
movzbl 0x0(%r13),%esi
movzbl 0x3(%r13),%r8d
movzbl %al,%edx
movzbl %cl,%ecx
lea    0xad4(%rip),%rdi
xor    %eax,%eax
call   1060 <warnx@plt>
jmp    1236 <main+0x96>
mov    $0xff,%dl
movzbl 0x6(%r13),%ecx
movzbl %al,%esi
movzbl %dl,%edx
lea    0xad1(%rip),%rdi
xor    %eax,%eax
call   1060 <warnx@plt>
jmp    1236 <main+0x96>
test   %rbx,%rbx
jns    158d <main+0x3ed>
mov    0x2a59(%rip),%rax
mov    (%rax),%edi
lea    0xad5(%rip),%rsi
call   1040 <errx@plt>
mov    %ebp,%edi
call   1070 <close@plt>
mov    0x2a35(%rip),%rax
mov    (%rax),%eax
add    $0x2018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [18 x i8] c"<isoch data file>\00"
@O_RDONLY = global i32 0
@.str.1 = [5 x i8] c"open\00"
@.str.2 = [29 x i8] c"bad EAV: %02x %02x %02x %02x\00"
@.str.3 = [24 x i8] c"bad ANC: %02x %02x %02x\00"
@.str.4 = [7 x i8] c"%4zi: \00"
@.str.5 = [6 x i8] c"%02x \00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [5 x i8] c"read\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca [8192 x i8]
%13 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %9
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 2
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @errx(i32 %17, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %16, %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = load i32, i32* @O_RDONLY
%24 = call i32 @open(i8* %22, i32 %23)
store i32 %24, i32* %6
%25 = load i32, i32* %6
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %19
%28 = load i32, i32* @EXIT_FAILURE
%29 = call i32 @err(i32 %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %27, %19
br label %31
31: ; preds = %159, %30
%32 = load i32, i32* %6
%33 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%34 = load i64, i64* %9
%35 = getelementptr inbounds i8, i8* %33, i64 %34
%36 = load i64, i64* %9
%37 = sub i64 8192, %36
%38 = trunc i64 %37 to i32
%39 = call i64 @read(i32 %32, i8* %35, i32 %38)
store i64 %39, i64* %11
%40 = icmp sgt i64 %39, 0
br i1 %40, label %41, label %169
41: ; preds = %31
%42 = load i64, i64* %11
%43 = load i64, i64* %9
%44 = add i64 %43, %42
store i64 %44, i64* %9
store i64 0, i64* %8
br label %45
45: ; preds = %158, %41
%46 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%47 = load i64, i64* %8
%48 = getelementptr inbounds i8, i8* %46, i64 %47
%49 = load i64, i64* %9
%50 = load i64, i64* %8
%51 = sub i64 %49, %50
%52 = call i8* @memchr(i8* %48, float -1.000000e+00, i64 %51)
store i8* %52, i8** %13
%53 = load i8*, i8** %13
%54 = icmp ne i8* %53, null
br i1 %54, label %56, label %55
55: ; preds = %45
br label %159
56: ; preds = %45
%57 = load i8*, i8** %13
%58 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%59 = load i64, i64* %8
%60 = getelementptr inbounds i8, i8* %58, i64 %59
%61 = ptrtoint i8* %57 to i64
%62 = ptrtoint i8* %60 to i64
%63 = sub i64 %61, %62
store i64 %63, i64* %10
%64 = load i64, i64* %10
%65 = add i64 %64, 3
%66 = add i64 %65, 3
%67 = load i64, i64* %9
%68 = load i64, i64* %8
%69 = sub i64 %67, %68
%70 = icmp ugt i64 %66, %69
br i1 %70, label %71, label %72
71: ; preds = %56
br label %159
72: ; preds = %56
%73 = load i8*, i8** %13
%74 = getelementptr inbounds i8, i8* %73, i64 1
%75 = load i8, i8* %74
%76 = zext i8 %75 to i32
%77 = icmp ne i32 %76, 0
br i1 %77, label %91, label %78
78: ; preds = %72
%79 = load i8*, i8** %13
%80 = getelementptr inbounds i8, i8* %79, i64 2
%81 = load i8, i8* %80
%82 = zext i8 %81 to i32
%83 = icmp ne i32 %82, 0
br i1 %83, label %91, label %84
84: ; preds = %78
%85 = load i8*, i8** %13
%86 = getelementptr inbounds i8, i8* %85, i64 3
%87 = load i8, i8* %86
%88 = zext i8 %87 to i32
%89 = and i32 %88, 16
%90 = icmp ne i32 %89, 16
br i1 %90, label %91, label %106
91: ; preds = %84, %78, %72
%92 = load i8*, i8** %13
%93 = getelementptr inbounds i8, i8* %92, i64 0
%94 = load i8, i8* %93
%95 = load i8*, i8** %13
%96 = getelementptr inbounds i8, i8* %95, i64 1
%97 = load i8, i8* %96
%98 = load i8*, i8** %13
%99 = getelementptr inbounds i8, i8* %98, i64 2
%100 = load i8, i8* %99
%101 = load i8*, i8** %13
%102 = getelementptr inbounds i8, i8* %101, i64 3
%103 = load i8, i8* %102
%104 = zext i8 %103 to i32
%105 = call i32 (i8*, i8, i8, i8, ...) @warnx(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %94, i8 zeroext %97, i8 zeroext %100, i32 %104)
br label %159
106: ; preds = %84
%107 = load i8*, i8** %13
%108 = getelementptr inbounds i8, i8* %107, i64 4
%109 = load i8, i8* %108
%110 = zext i8 %109 to i32
%111 = icmp ne i32 %110, 0
br i1 %111, label %124, label %112
112: ; preds = %106
%113 = load i8*, i8** %13
%114 = getelementptr inbounds i8, i8* %113, i64 5
%115 = load i8, i8* %114
%116 = zext i8 %115 to i32
%117 = icmp ne i32 %116, 255
br i1 %117, label %124, label %118
118: ; preds = %112
%119 = load i8*, i8** %13
%120 = getelementptr inbounds i8, i8* %119, i64 6
%121 = load i8, i8* %120
%122 = zext i8 %121 to i32
%123 = icmp ne i32 %122, 255
br i1 %123, label %124, label %135
124: ; preds = %118, %112, %106
%125 = load i8*, i8** %13
%126 = getelementptr inbounds i8, i8* %125, i64 4
%127 = load i8, i8* %126
%128 = load i8*, i8** %13
%129 = getelementptr inbounds i8, i8* %128, i64 5
%130 = load i8, i8* %129
%131 = load i8*, i8** %13
%132 = getelementptr inbounds i8, i8* %131, i64 6
%133 = load i8, i8* %132
%134 = call i32 (i8*, i8, i8, i8, ...) @warnx(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8 zeroext %127, i8 zeroext %130, i8 zeroext %133)
br label %159
135: ; preds = %118
%136 = load i64, i64* %10
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i64 %136)
store i32 0, i32* %7
br label %138
138: ; preds = %149, %135
%139 = load i32, i32* %7
%140 = icmp slt i32 %139, 32
br i1 %140, label %141, label %152
141: ; preds = %138
%142 = load i8*, i8** %13
%143 = load i32, i32* %7
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds i8, i8* %142, i64 %144
%146 = load i8, i8* %145
%147 = zext i8 %146 to i32
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %147)
br label %149
149: ; preds = %141
%150 = load i32, i32* %7
%151 = add nsw i32 %150, 1
store i32 %151, i32* %7
br label %138
152: ; preds = %138
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%154 = load i64, i64* %10
%155 = add i64 %154, 32
%156 = load i64, i64* %8
%157 = add i64 %156, %155
store i64 %157, i64* %8
br label %158
158: ; preds = %152
br i1 true, label %45, label %159
159: ; preds = %158, %124, %91, %71, %55
%160 = load i64, i64* %8
%161 = load i64, i64* %9
%162 = sub i64 %161, %160
store i64 %162, i64* %9
%163 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%164 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%165 = load i64, i64* %8
%166 = getelementptr inbounds i8, i8* %164, i64 %165
%167 = load i64, i64* %9
%168 = call i32 @memmove(i8* %163, i8* %166, i64 %167)
br label %31
169: ; preds = %31
%170 = load i64, i64* %11
%171 = icmp slt i64 %170, 0
br i1 %171, label %172, label %175
172: ; preds = %169
%173 = load i32, i32* @EXIT_FAILURE
%174 = call i32 @errx(i32 %173, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %175
175: ; preds = %172, %169
%176 = load i32, i32* %6
%177 = call i32 @close(i32 %176)
%178 = load i32, i32* @EXIT_SUCCESS
ret i32 %178
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [18 x i8] c"<isoch data file>\00"
@O_RDONLY = global i32 0
@.str.1 = [5 x i8] c"open\00"
@.str.2 = [29 x i8] c"bad EAV: %02x %02x %02x %02x\00"
@.str.3 = [24 x i8] c"bad ANC: %02x %02x %02x\00"
@.str.4 = [7 x i8] c"%4zi: \00"
@.str.5 = [6 x i8] c"%02x \00"
@.str.7 = [5 x i8] c"read\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [8192 x i8]
%4 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @errx(i32 %7, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %6, %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 %18
15: ; preds = %9
%16 = load i32, i32* @EXIT_FAILURE
%17 = tail call i32 @err(i32 %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %15, %9
%19 = call i64 @read(i32 %13, i8* %4, i32 8192)
%20 = icmp sgt i64 %19, 0
br i1 %20, label %21, label %213
21: ; preds = %18, %204
%22 = phi i64 [ %211, %204 ], [ %19, %18 ]
%23 = phi i64 [ %206, %204 ], [ 0, %18 ]
%24 = add i64 %22, %23
%25 = call i8* @memchr(i8* %4, float -1.000000e+00, i64 %24)
%26 = icmp eq i8* %25, null
br i1 %26, label %204, label %27
27: ; preds = %21, %74
%28 = phi i8* [ %202, %74 ], [ %25, %21 ]
%29 = phi i64 [ %201, %74 ], [ %24, %21 ]
%30 = phi i8* [ %200, %74 ], [ %4, %21 ]
%31 = phi i64 [ %199, %74 ], [ 0, %21 ]
%32 = ptrtoint i8* %28 to i64
%33 = ptrtoint i8* %30 to i64
%34 = sub i64 %32, %33
%35 = add i64 %34, 6
%36 = icmp ugt i64 %35, %29
br i1 %36, label %204, label %37
37: ; preds = %27
%38 = getelementptr inbounds i8, i8* %28, i64 1
%39 = load i8, i8* %38
%40 = icmp eq i8 %39, 0
%41 = getelementptr inbounds i8, i8* %28, i64 2
%42 = load i8, i8* %41
%43 = icmp eq i8 %42, 0
%44 = select i1 %40, i1 %43, i1 false
br i1 %44, label %45, label %50
45: ; preds = %37
%46 = getelementptr inbounds i8, i8* %28, i64 3
%47 = load i8, i8* %46
%48 = and i8 %47, 16
%49 = icmp eq i8 %48, 0
br i1 %49, label %50, label %57
50: ; preds = %45, %37
%51 = phi i8 [ %42, %37 ], [ 0, %45 ]
%52 = load i8, i8* %28
%53 = getelementptr inbounds i8, i8* %28, i64 3
%54 = load i8, i8* %53
%55 = zext i8 %54 to i32
%56 = call i32 (i8*, i8, i8, i8, ...) @warnx(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %52, i8 zeroext %39, i8 zeroext %51, i32 %55)
br label %204
57: ; preds = %45
%58 = getelementptr inbounds i8, i8* %28, i64 4
%59 = load i8, i8* %58
%60 = icmp eq i8 %59, 0
%61 = getelementptr inbounds i8, i8* %28, i64 5
%62 = load i8, i8* %61
%63 = icmp eq i8 %62, -1
%64 = select i1 %60, i1 %63, i1 false
br i1 %64, label %65, label %69
65: ; preds = %57
%66 = getelementptr inbounds i8, i8* %28, i64 6
%67 = load i8, i8* %66
%68 = icmp eq i8 %67, -1
br i1 %68, label %74, label %69
69: ; preds = %65, %57
%70 = phi i8 [ %62, %57 ], [ -1, %65 ]
%71 = getelementptr inbounds i8, i8* %28, i64 6
%72 = load i8, i8* %71
%73 = call i32 (i8*, i8, i8, i8, ...) @warnx(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8 zeroext %59, i8 zeroext %70, i8 zeroext %72)
br label %204
74: ; preds = %65
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i64 %34)
%76 = load i8, i8* %28
%77 = zext i8 %76 to i32
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %77)
%79 = load i8, i8* %38
%80 = zext i8 %79 to i32
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %80)
%82 = load i8, i8* %41
%83 = zext i8 %82 to i32
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %83)
%85 = load i8, i8* %46
%86 = zext i8 %85 to i32
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %86)
%88 = load i8, i8* %58
%89 = zext i8 %88 to i32
%90 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %89)
%91 = load i8, i8* %61
%92 = zext i8 %91 to i32
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %92)
%94 = load i8, i8* %66
%95 = zext i8 %94 to i32
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %95)
%97 = getelementptr inbounds i8, i8* %28, i64 7
%98 = load i8, i8* %97
%99 = zext i8 %98 to i32
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %99)
%101 = getelementptr inbounds i8, i8* %28, i64 8
%102 = load i8, i8* %101
%103 = zext i8 %102 to i32
%104 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %103)
%105 = getelementptr inbounds i8, i8* %28, i64 9
%106 = load i8, i8* %105
%107 = zext i8 %106 to i32
%108 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %107)
%109 = getelementptr inbounds i8, i8* %28, i64 10
%110 = load i8, i8* %109
%111 = zext i8 %110 to i32
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %111)
%113 = getelementptr inbounds i8, i8* %28, i64 11
%114 = load i8, i8* %113
%115 = zext i8 %114 to i32
%116 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %115)
%117 = getelementptr inbounds i8, i8* %28, i64 12
%118 = load i8, i8* %117
%119 = zext i8 %118 to i32
%120 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %119)
%121 = getelementptr inbounds i8, i8* %28, i64 13
%122 = load i8, i8* %121
%123 = zext i8 %122 to i32
%124 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %123)
%125 = getelementptr inbounds i8, i8* %28, i64 14
%126 = load i8, i8* %125
%127 = zext i8 %126 to i32
%128 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %127)
%129 = getelementptr inbounds i8, i8* %28, i64 15
%130 = load i8, i8* %129
%131 = zext i8 %130 to i32
%132 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %131)
%133 = getelementptr inbounds i8, i8* %28, i64 16
%134 = load i8, i8* %133
%135 = zext i8 %134 to i32
%136 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %135)
%137 = getelementptr inbounds i8, i8* %28, i64 17
%138 = load i8, i8* %137
%139 = zext i8 %138 to i32
%140 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %139)
%141 = getelementptr inbounds i8, i8* %28, i64 18
%142 = load i8, i8* %141
%143 = zext i8 %142 to i32
%144 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %143)
%145 = getelementptr inbounds i8, i8* %28, i64 19
%146 = load i8, i8* %145
%147 = zext i8 %146 to i32
%148 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %147)
%149 = getelementptr inbounds i8, i8* %28, i64 20
%150 = load i8, i8* %149
%151 = zext i8 %150 to i32
%152 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %151)
%153 = getelementptr inbounds i8, i8* %28, i64 21
%154 = load i8, i8* %153
%155 = zext i8 %154 to i32
%156 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %155)
%157 = getelementptr inbounds i8, i8* %28, i64 22
%158 = load i8, i8* %157
%159 = zext i8 %158 to i32
%160 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %159)
%161 = getelementptr inbounds i8, i8* %28, i64 23
%162 = load i8, i8* %161
%163 = zext i8 %162 to i32
%164 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %163)
%165 = getelementptr inbounds i8, i8* %28, i64 24
%166 = load i8, i8* %165
%167 = zext i8 %166 to i32
%168 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %167)
%169 = getelementptr inbounds i8, i8* %28, i64 25
%170 = load i8, i8* %169
%171 = zext i8 %170 to i32
%172 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %171)
%173 = getelementptr inbounds i8, i8* %28, i64 26
%174 = load i8, i8* %173
%175 = zext i8 %174 to i32
%176 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %175)
%177 = getelementptr inbounds i8, i8* %28, i64 27
%178 = load i8, i8* %177
%179 = zext i8 %178 to i32
%180 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %179)
%181 = getelementptr inbounds i8, i8* %28, i64 28
%182 = load i8, i8* %181
%183 = zext i8 %182 to i32
%184 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %183)
%185 = getelementptr inbounds i8, i8* %28, i64 29
%186 = load i8, i8* %185
%187 = zext i8 %186 to i32
%188 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %187)
%189 = getelementptr inbounds i8, i8* %28, i64 30
%190 = load i8, i8* %189
%191 = zext i8 %190 to i32
%192 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %191)
%193 = getelementptr inbounds i8, i8* %28, i64 31
%194 = load i8, i8* %193
%195 = zext i8 %194 to i32
%196 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %195)
%197 = call i32 @putchar(i32 10)
%198 = add i64 %31, 32
%199 = add i64 %198, %34
%200 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 %199
%201 = sub i64 %24, %199
%202 = call i8* @memchr(i8* %200, float -1.000000e+00, i64 %201)
%203 = icmp eq i8* %202, null
br i1 %203, label %204, label %27
204: ; preds = %74, %27, %21, %69, %50
%205 = phi i8* [ %30, %69 ], [ %30, %50 ], [ %4, %21 ], [ %200, %74 ], [ %30, %27 ]
%206 = phi i64 [ %29, %69 ], [ %29, %50 ], [ %24, %21 ], [ %201, %74 ], [ %29, %27 ]
%207 = call i32 @memmove(i8* %4, i8* %205, i64 %206)
%208 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 %206
%209 = trunc i64 %206 to i32
%210 = sub i32 8192, %209
%211 = call i64 @read(i32 %13, i8* %208, i32 %210)
%212 = icmp sgt i64 %211, 0
br i1 %212, label %21, label %213
213: ; preds = %204, %18
%214 = phi i64 [ %19, %18 ], [ %211, %204 ]
%215 = icmp slt i64 %214, 0
br i1 %215, label %216, label %219
216: ; preds = %213
%217 = load i32, i32* @EXIT_FAILURE
%218 = call i32 @errx(i32 %217, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %219
219: ; preds = %216, %213
%220 = call i32 @close(i32 %13)
%221 = load i32, i32* @EXIT_SUCCESS
ret i32 %221
}