#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 O_RDONLY;
int O_SYNC;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ memcmp(char *, char *, int);
int open(char *, int);
int read(int, char *, int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int main(int argc, char **argv) {
  int cdrom, file;
  char buf1[4096];
  char buf2[4096];
  int rc1, rc2, rc3;
  int c1 = 0, c2 = 0;
  if (argc != 3) {
    fprintf(stderr, "Usage: %s <cdrom> <iso-file>\n", argv[0]);
    return 1;
  }
  fprintf(stderr, "Checking CD-ROM ...");
  if ((cdrom = open(argv[1], O_RDONLY | O_SYNC)) == 0) {
    fprintf(stderr, "\n%s: Can't open %s: %s\n", argv[0], argv[1],
            strerror(errno));
    return 1;
  }
  if ((file = open(argv[2], O_RDONLY)) == 0) {
    fprintf(stderr, "\n%s: Can't open %s: %s\n", argv[0], argv[2],
            strerror(errno));
    return 1;
  }
  while ((rc1 = read(file, buf1, 4096)) > 0) {
    for (rc2 = 0; rc2 < rc1; rc2 += rc3) {
      rc3 = read(cdrom, buf2 + rc2, rc1 - rc2);
      if (rc3 == -1) {
        fprintf(stderr, "\n%s: cdrom read error: %s\n", argv[0],
                strerror(errno));
        return 1;
      }
      if (rc3 == 0)
        break;
    }
    if (rc2 != rc1) {
      fprintf(stderr,
              "\n%s: cdrom read error: %d of "
              "%d bytes\n",
              argv[0], rc2, rc1);
      return 1;
    }
    if (memcmp(buf1, buf2, rc2)) {
      fprintf(stderr,
              "\n%s: cdrom data differs from "
              "the iso file\n",
              argv[0]);
      return 1;
    }
    c1 += rc2;
    c2 += rc2;
    if (c1 > (1048576 * 16)) {
      c1 = 0;
      fprintf(stderr, ".");
    }
  }
  if (rc1 == -1) {
    fprintf(stderr, "\n%s: file read error: %s\n", argv[0], strerror(errno));
    return 1;
  }
  fprintf(stderr, " OK (%d MB).\n", c2 / 1048576);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2090,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x2030(%rbp)
movl   $0x0,-0x2034(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11b1 <main+0x61>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe62(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    156a <main+0x41a>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e09(%rip),%rax
mov    (%rax),%esi
mov    0x2e08(%rip),%rax
or     (%rax),%esi
call   1060 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jne    125e <main+0x10e>
mov    0x2dd6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x204c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x2048(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x2040(%rbp)
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x204c(%rbp),%edi
mov    -0x2048(%rbp),%rdx
mov    -0x2040(%rbp),%rcx
mov    %rax,%r8
lea    0xde7(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    156a <main+0x41a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2d73(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jne    12eb <main+0x19b>
mov    0x2d49(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2064(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x2060(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x2058(%rbp)
mov    0x2d15(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x2064(%rbp),%edi
mov    -0x2060(%rbp),%rdx
mov    -0x2058(%rbp),%rcx
mov    %rax,%r8
lea    0xd5a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    156a <main+0x41a>
jmp    12f0 <main+0x1a0>
mov    -0x18(%rbp),%edi
lea    -0x1020(%rbp),%rsi
mov    $0x1000,%edx
call   1030 <read@plt>
mov    %eax,-0x2024(%rbp)
cmp    $0x0,%eax
jle    14da <main+0x38a>
movl   $0x0,-0x2028(%rbp)
mov    -0x2028(%rbp),%eax
cmp    -0x2024(%rbp),%eax
jge    13ea <main+0x29a>
mov    -0x14(%rbp),%edi
lea    -0x2020(%rbp),%rsi
movslq -0x2028(%rbp),%rax
add    %rax,%rsi
mov    -0x2024(%rbp),%edx
sub    -0x2028(%rbp),%edx
call   1030 <read@plt>
mov    %eax,-0x202c(%rbp)
cmpl   $0xffffffff,-0x202c(%rbp)
jne    13bc <main+0x26c>
mov    0x2c62(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2074(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x2070(%rbp)
mov    0x2c3d(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x2074(%rbp),%edi
mov    -0x2070(%rbp),%rdx
mov    %rax,%rcx
lea    0xca1(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    156a <main+0x41a>
cmpl   $0x0,-0x202c(%rbp)
jne    13ce <main+0x27e>
jmp    13ea <main+0x29a>
jmp    13d3 <main+0x283>
mov    -0x202c(%rbp),%eax
add    -0x2028(%rbp),%eax
mov    %eax,-0x2028(%rbp)
jmp    131d <main+0x1cd>
mov    -0x2028(%rbp),%eax
cmp    -0x2024(%rbp),%eax
je     1433 <main+0x2e3>
mov    0x2bcd(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x2028(%rbp),%ecx
mov    -0x2024(%rbp),%r8d
lea    0xc45(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    156a <main+0x41a>
lea    -0x1020(%rbp),%rdi
lea    -0x2020(%rbp),%rsi
mov    -0x2028(%rbp),%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
je     1480 <main+0x330>
mov    0x2b73(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xc1f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    156a <main+0x41a>
mov    -0x2028(%rbp),%eax
add    -0x2030(%rbp),%eax
mov    %eax,-0x2030(%rbp)
mov    -0x2028(%rbp),%eax
add    -0x2034(%rbp),%eax
mov    %eax,-0x2034(%rbp)
cmpl   $0x1000000,-0x2030(%rbp)
jle    14d5 <main+0x385>
movl   $0x0,-0x2030(%rbp)
mov    0x2b0b(%rip),%rax
mov    (%rax),%edi
lea    0xb62(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    12f0 <main+0x1a0>
cmpl   $0xffffffff,-0x2024(%rbp)
jne    153c <main+0x3ec>
mov    0x2ae2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2084(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x2080(%rbp)
mov    0x2abd(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x2084(%rbp),%edi
mov    -0x2080(%rbp),%rdx
mov    %rax,%rcx
lea    0xb8e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    156a <main+0x41a>
mov    0x2a8d(%rip),%rax
mov    (%rax),%edi
mov    -0x2034(%rbp),%eax
mov    $0x100000,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xb75(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2090,%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,%r14
mov    %edi,%eax
mov    0x2e63(%rip),%r12
mov    (%r12),%edi
cmp    $0x3,%eax
jne    11fb <main+0xab>
lea    0xe9d(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x8(%r14),%rdi
mov    0x2e4d(%rip),%rbx
mov    0x2e4e(%rip),%rax
mov    (%rax),%esi
or     (%rbx),%esi
call   1060 <open@plt>
test   %eax,%eax
je     12c3 <main+0x173>
mov    %eax,%ebp
mov    0x10(%r14),%rdi
mov    (%rbx),%esi
call   1060 <open@plt>
test   %eax,%eax
je     12d0 <main+0x180>
mov    %eax,%r15d
lea    0x1010(%rsp),%rsi
mov    %eax,%edi
mov    $0x1000,%edx
call   1030 <read@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    132c <main+0x1dc>
xor    %r12d,%r12d
lea    0x1010(%rsp),%r13
movl   $0x0,0x8(%rsp)
mov    %r15d,0xc(%rsp)
jmp    1234 <main+0xe4>
mov    (%r14),%rdx
lea    0xdfb(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1372 <main+0x222>
mov    %r15d,0x8(%rsp)
add    %ebx,%r12d
mov    0xc(%rsp),%edi
mov    %r13,%rsi
mov    $0x1000,%edx
call   1030 <read@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    138b <main+0x23b>
mov    %r13,%r15
xor    %r13d,%r13d
nopw   0x0(%rax,%rax,1)
movslq %r13d,%rax
lea    (%rsp,%rax,1),%rsi
add    $0x10,%rsi
mov    %ebx,%edx
sub    %eax,%edx
mov    %ebp,%edi
call   1030 <read@plt>
test   %eax,%eax
je     126b <main+0x11b>
cmp    $0xffffffff,%eax
je     1304 <main+0x1b4>
add    %eax,%r13d
cmp    %r13d,%ebx
jg     1240 <main+0xf0>
cmp    %r13d,%ebx
jne    13a6 <main+0x256>
mov    %r15,%r13
mov    %r15,%rdi
lea    0x10(%rsp),%rsi
mov    %ebx,%edx
call   1040 <memcmp@plt>
test   %rax,%rax
jne    13c8 <main+0x278>
mov    0x8(%rsp),%r15d
add    %ebx,%r15d
cmp    $0x1000001,%r15d
jl     1211 <main+0xc1>
mov    0x2d25(%rip),%rax
mov    (%rax),%edi
xor    %r15d,%r15d
lea    0xd79(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1211 <main+0xc1>
mov    (%r12),%ebx
mov    (%r14),%rbp
mov    0x8(%r14),%r14
jmp    12db <main+0x18b>
mov    (%r12),%ebx
mov    (%r14),%rbp
mov    0x10(%r14),%r14
mov    0x2ce6(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xd42(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
mov    %r14,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1372 <main+0x222>
mov    0x2cc5(%rip),%rax
mov    (%rax),%ebx
mov    (%r14),%rbp
mov    0x2cb1(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xd25(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
jmp    1368 <main+0x218>
xor    %edx,%edx
mov    (%r12),%ebp
cmp    $0xffffffff,%ebx
je     134b <main+0x1fb>
lea    0xd93(%rip),%rsi
xor    %ebx,%ebx
mov    %ebp,%edi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1377 <main+0x227>
mov    (%r14),%rbx
mov    0x2c73(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xd54(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x2018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xfffff(%r12),%edx
test   %r12d,%r12d
cmovns %r12d,%edx
sar    $0x14,%edx
mov    0x2c2c(%rip),%r12
jmp    132e <main+0x1de>
mov    0x2c23(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xcac(%rip),%rsi
mov    %r13d,%ecx
mov    %ebx,%r8d
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1372 <main+0x222>
mov    0x2c01(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xcb1(%rip),%rsi
jmp    1205 <main+0xb5>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"Usage: %s <cdrom> <iso-file>\0A\00"
@.str.1 = [20 x i8] c"Checking CD-ROM ...\00"
@O_RDONLY = global i32 0
@O_SYNC = global i32 0
@.str.2 = [24 x i8] c"\0A%s: Can't open %s: %s\0A\00"
@errno = global i32 0
@.str.3 = [27 x i8] c"\0A%s: cdrom read error: %s\0A\00"
@.str.4 = [39 x i8] c"\0A%s: cdrom read error: %d of %d bytes\0A\00"
@.str.5 = [43 x i8] c"\0A%s: cdrom data differs from the iso file\0A\00"
@.str.6 = [2 x i8] c".\00"
@.str.7 = [26 x i8] c"\0A%s: file read error: %s\0A\00"
@.str.8 = [14 x i8] c" OK (%d MB).\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 [4096 x i8]
%9 = alloca [4096 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %13
store i32 0, i32* %14
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 3
br i1 %16, label %17, label %23
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %21)
store i32 1, i32* %3
br label %156
23: ; preds = %2
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = load i32, i32* @O_RDONLY
%30 = load i32, i32* @O_SYNC
%31 = or i32 %29, %30
%32 = call i32 @open(i8* %28, i32 %31)
store i32 %32, i32* %6
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %45
34: ; preds = %23
%35 = load i32, i32* @stderr
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 0
%38 = load i8*, i8** %37
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = load i32, i32* @errno
%43 = call i8* @strerror(i32 %42)
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %38, i8* %41, i8* %43)
store i32 1, i32* %3
br label %156
45: ; preds = %23
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 2
%48 = load i8*, i8** %47
%49 = load i32, i32* @O_RDONLY
%50 = call i32 @open(i8* %48, i32 %49)
store i32 %50, i32* %7
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %63
52: ; preds = %45
%53 = load i32, i32* @stderr
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 0
%56 = load i8*, i8** %55
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 2
%59 = load i8*, i8** %58
%60 = load i32, i32* @errno
%61 = call i8* @strerror(i32 %60)
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %56, i8* %59, i8* %61)
store i32 1, i32* %3
br label %156
63: ; preds = %45
br label %64
64: ; preds = %139, %63
%65 = load i32, i32* %7
%66 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%67 = call i32 @read(i32 %65, i8* %66, i32 4096)
store i32 %67, i32* %10
%68 = icmp sgt i32 %67, 0
br i1 %68, label %69, label %140
69: ; preds = %64
store i32 0, i32* %11
br label %70
70: ; preds = %99, %69
%71 = load i32, i32* %11
%72 = load i32, i32* %10
%73 = icmp slt i32 %71, %72
br i1 %73, label %74, label %103
74: ; preds = %70
%75 = load i32, i32* %6
%76 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%77 = load i32, i32* %11
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8, i8* %76, i64 %78
%80 = load i32, i32* %10
%81 = load i32, i32* %11
%82 = sub nsw i32 %80, %81
%83 = call i32 @read(i32 %75, i8* %79, i32 %82)
store i32 %83, i32* %12
%84 = load i32, i32* %12
%85 = icmp eq i32 %84, -1
br i1 %85, label %86, label %94
86: ; preds = %74
%87 = load i32, i32* @stderr
%88 = load i8**, i8*** %5
%89 = getelementptr inbounds i8*, i8** %88, i64 0
%90 = load i8*, i8** %89
%91 = load i32, i32* @errno
%92 = call i8* @strerror(i32 %91)
%93 = call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %90, i8* %92)
store i32 1, i32* %3
br label %156
94: ; preds = %74
%95 = load i32, i32* %12
%96 = icmp eq i32 %95, 0
br i1 %96, label %97, label %98
97: ; preds = %94
br label %103
98: ; preds = %94
br label %99
99: ; preds = %98
%100 = load i32, i32* %12
%101 = load i32, i32* %11
%102 = add nsw i32 %101, %100
store i32 %102, i32* %11
br label %70
103: ; preds = %97, %70
%104 = load i32, i32* %11
%105 = load i32, i32* %10
%106 = icmp ne i32 %104, %105
br i1 %106, label %107, label %115
107: ; preds = %103
%108 = load i32, i32* @stderr
%109 = load i8**, i8*** %5
%110 = getelementptr inbounds i8*, i8** %109, i64 0
%111 = load i8*, i8** %110
%112 = load i32, i32* %11
%113 = load i32, i32* %10
%114 = call i32 (i32, i8*, ...) @fprintf(i32 %108, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i8* %111, i32 %112, i32 %113)
store i32 1, i32* %3
br label %156
115: ; preds = %103
%116 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%117 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%118 = load i32, i32* %11
%119 = call i64 @memcmp(i8* %116, i8* %117, i32 %118)
%120 = icmp ne i64 %119, 0
br i1 %120, label %121, label %127
121: ; preds = %115
%122 = load i32, i32* @stderr
%123 = load i8**, i8*** %5
%124 = getelementptr inbounds i8*, i8** %123, i64 0
%125 = load i8*, i8** %124
%126 = call i32 (i32, i8*, ...) @fprintf(i32 %122, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i8* %125)
store i32 1, i32* %3
br label %156
127: ; preds = %115
%128 = load i32, i32* %11
%129 = load i32, i32* %13
%130 = add nsw i32 %129, %128
store i32 %130, i32* %13
%131 = load i32, i32* %11
%132 = load i32, i32* %14
%133 = add nsw i32 %132, %131
store i32 %133, i32* %14
%134 = load i32, i32* %13
%135 = icmp sgt i32 %134, 16777216
br i1 %135, label %136, label %139
136: ; preds = %127
store i32 0, i32* %13
%137 = load i32, i32* @stderr
%138 = call i32 (i32, i8*, ...) @fprintf(i32 %137, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %139
139: ; preds = %136, %127
br label %64
140: ; preds = %64
%141 = load i32, i32* %10
%142 = icmp eq i32 %141, -1
br i1 %142, label %143, label %151
143: ; preds = %140
%144 = load i32, i32* @stderr
%145 = load i8**, i8*** %5
%146 = getelementptr inbounds i8*, i8** %145, i64 0
%147 = load i8*, i8** %146
%148 = load i32, i32* @errno
%149 = call i8* @strerror(i32 %148)
%150 = call i32 (i32, i8*, ...) @fprintf(i32 %144, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %147, i8* %149)
store i32 1, i32* %3
br label %156
151: ; preds = %140
%152 = load i32, i32* @stderr
%153 = load i32, i32* %14
%154 = sdiv i32 %153, 1048576
%155 = call i32 (i32, i8*, ...) @fprintf(i32 %152, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i32 %154)
store i32 0, i32* %3
br label %156
156: ; preds = %151, %143, %121, %107, %86, %52, %34, %17
%157 = load i32, i32* %3
ret i32 %157
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"Usage: %s <cdrom> <iso-file>\0A\00"
@.str.1 = [20 x i8] c"Checking CD-ROM ...\00"
@O_RDONLY = global i32 0
@O_SYNC = global i32 0
@.str.2 = [24 x i8] c"\0A%s: Can't open %s: %s\0A\00"
@errno = global i32 0
@.str.3 = [27 x i8] c"\0A%s: cdrom read error: %s\0A\00"
@.str.4 = [39 x i8] c"\0A%s: cdrom read error: %d of %d bytes\0A\00"
@.str.5 = [43 x i8] c"\0A%s: cdrom data differs from the iso file\0A\00"
@.str.6 = [2 x i8] c".\00"
@.str.7 = [26 x i8] c"\0A%s: file read error: %s\0A\00"
@.str.8 = [14 x i8] c" OK (%d MB).\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
%4 = alloca [4096 x i8]
%5 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 3
%8 = load i32, i32* @stderr
br i1 %7, label %12, label %9
9: ; preds = %2
%10 = load i8*, i8** %1
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %102
12: ; preds = %2
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = load i32, i32* @O_RDONLY
%17 = load i32, i32* @O_SYNC
%18 = or i32 %17, %16
%19 = tail call i32 @open(i8* %15, i32 %18)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %12
%22 = load i32, i32* @stderr
%23 = load i8*, i8** %1
%24 = load i8*, i8** %14
%25 = load i32, i32* @errno
%26 = tail call i8* @strerror(i32 %25)
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %23, i8* %24, i8* %26)
br label %102
28: ; preds = %12
%29 = getelementptr inbounds i8*, i8** %1, i64 2
%30 = load i8*, i8** %29
%31 = load i32, i32* @O_RDONLY
%32 = tail call i32 @open(i8* %30, i32 %31)
%33 = icmp eq i32 %32, 0
br i1 %33, label %37, label %34
34: ; preds = %28
%35 = call i32 @read(i32 %32, i8* %5, i32 4096)
%36 = icmp sgt i32 %35, 0
br i1 %36, label %44, label %90
37: ; preds = %28
%38 = load i32, i32* @stderr
%39 = load i8*, i8** %1
%40 = load i8*, i8** %29
%41 = load i32, i32* @errno
%42 = tail call i8* @strerror(i32 %41)
%43 = tail call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %39, i8* %40, i8* %42)
br label %102
44: ; preds = %34, %84
%45 = phi i32 [ %86, %84 ], [ %35, %34 ]
%46 = phi i32 [ %79, %84 ], [ 0, %34 ]
%47 = phi i32 [ %85, %84 ], [ 0, %34 ]
br label %48
48: ; preds = %44, %60
%49 = phi i32 [ %61, %60 ], [ 0, %44 ]
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 %50
%52 = sub nsw i32 %45, %49
%53 = call i32 @read(i32 %19, i8* %51, i32 %52)
switch i32 %53, label %60 [
i32 -1, label %54
i32 0, label %63
]
54: ; preds = %48
%55 = load i32, i32* @stderr
%56 = load i8*, i8** %1
%57 = load i32, i32* @errno
%58 = call i8* @strerror(i32 %57)
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %56, i8* %58)
br label %102
60: ; preds = %48
%61 = add nsw i32 %53, %49
%62 = icmp sgt i32 %45, %61
br i1 %62, label %48, label %63
63: ; preds = %60, %48
%64 = phi i32 [ %61, %60 ], [ %49, %48 ]
%65 = icmp eq i32 %45, %64
br i1 %65, label %70, label %66
66: ; preds = %63
%67 = load i32, i32* @stderr
%68 = load i8*, i8** %1
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i8* %68, i32 %64, i32 %45)
br label %102
70: ; preds = %63
%71 = call i64 @memcmp(i8* %5, i8* %6, i32 %45)
%72 = icmp eq i64 %71, 0
br i1 %72, label %77, label %73
73: ; preds = %70
%74 = load i32, i32* @stderr
%75 = load i8*, i8** %1
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i8* %75)
br label %102
77: ; preds = %70
%78 = add nsw i32 %45, %47
%79 = add nsw i32 %45, %46
%80 = icmp sgt i32 %78, 16777216
br i1 %80, label %81, label %84
81: ; preds = %77
%82 = load i32, i32* @stderr
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %84
84: ; preds = %81, %77
%85 = phi i32 [ 0, %81 ], [ %78, %77 ]
%86 = call i32 @read(i32 %32, i8* %5, i32 4096)
%87 = icmp sgt i32 %86, 0
br i1 %87, label %44, label %88
88: ; preds = %84
%89 = sdiv i32 %79, 1048576
br label %90
90: ; preds = %88, %34
%91 = phi i32 [ 0, %34 ], [ %89, %88 ]
%92 = phi i32 [ %35, %34 ], [ %86, %88 ]
%93 = icmp eq i32 %92, -1
%94 = load i32, i32* @stderr
br i1 %93, label %95, label %100
95: ; preds = %90
%96 = load i8*, i8** %1
%97 = load i32, i32* @errno
%98 = call i8* @strerror(i32 %97)
%99 = call i32 (i32, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %96, i8* %98)
br label %102
100: ; preds = %90
%101 = call i32 (i32, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i32 %91)
br label %102
102: ; preds = %100, %95, %73, %66, %54, %37, %21, %9
%103 = phi i32 [ 1, %9 ], [ 1, %21 ], [ 1, %37 ], [ 1, %54 ], [ 1, %66 ], [ 1, %73 ], [ 1, %95 ], [ 0, %100 ]
ret i32 %103
}