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

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ bcopy(char *, char *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ perror(char *);
int read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
int write(int, char *, int);
int main(int ac, char **av) {
  FILE *af;
  char *acc, *user, *host;
  char buf[1024], *p, *end;
  int cc, n, ipc = -1, fpc = -1;
  if (ac != 4) {
    fprintf(stderr, "Usage:\t%s accounting-file user host\n", av[0]);
    exit(2);
  }
  acc = av[1];
  user = av[2];
  host = av[3];
  while ((cc = read(0, buf, sizeof(buf))) > 0) {
    if (ipc < 0 && *buf == '*') {
      for (p = buf, end = buf + cc; p < end; p++) {
        if (*p == '\n' || *p == '\r') {
          break;
        }
      }
      if (p == end) {
        fprintf(stderr, "Can't find initial page count!\n");
        exit(2);
      }
      p++;
      ipc = atoi(buf + 1);
      cc -= (p - buf);
      if (cc != 0) {
        bcopy(p, buf, cc);
      }
    } else {
      for (p = buf + cc - 1; p >= buf; p--) {
        if (*p != '\n' && *p != '\r') {
          break;
        }
      }
      if (p < buf) {
        fprintf(stderr, "Can't find final page count!\n");
        exit(2);
      }
      for (; p >= buf; p--) {
        if (*p == '\n' || *p == '\r') {
          break;
        }
      }
      if (p < buf) {
        p = buf;
      } else {
        cc -= p - buf;
        p++;
      }
      if (*p == '*') {
        n = atoi(p + 1);
        fpc = ((n) > (fpc) ? (n) : (fpc));
      }
    }
    if (cc != 0 && write(2, buf, cc) != cc) {
      fprintf(stderr, "write 1: 2 %p %d\n", buf, cc);
      perror("write");
      exit(2);
    }
  }
  if (cc < 0) {
    perror("read");
    exit(2);
  }
  if (ipc < 0) {
    fprintf(stderr, "Didn't find initial page count!\n");
    exit(2);
  }
  if (fpc < 0) {
    fprintf(stderr, "Didn't find final page count!\n");
    exit(2);
  }
  if ((af = fopen(acc, "a")) != NULL) {
    fprintf(af, "%7.2f\t%s:%s\n", (float)(fpc - ipc), host, user);
  } else {
    perror(acc);
    exit(2);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x460,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x44c(%rbp)
ff ff ff
movl   $0xffffffff,-0x450(%rbp)
ff ff ff
cmpl   $0x4,-0x8(%rbp)
je     11e0 <main+0x60>
mov    0x2e22(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe31(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x30(%rbp)
lea    -0x430(%rbp),%rsi
xor    %edi,%edi
mov    $0x400,%edx
call   1040 <read@plt>
mov    %eax,-0x444(%rbp)
cmp    $0x0,%eax
jle    15ba <main+0x43a>
cmpl   $0x0,-0x44c(%rbp)
jge    136e <main+0x1ee>
movsbl -0x430(%rbp),%eax
cmp    $0x2a,%eax
jne    136e <main+0x1ee>
lea    -0x430(%rbp),%rax
mov    %rax,-0x438(%rbp)
lea    -0x430(%rbp),%rax
movslq -0x444(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x440(%rbp)
mov    -0x438(%rbp),%rax
cmp    -0x440(%rbp),%rax
jae    12c4 <main+0x144>
mov    -0x438(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     12a3 <main+0x123>
mov    -0x438(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
jne    12a8 <main+0x128>
jmp    12c4 <main+0x144>
jmp    12ad <main+0x12d>
mov    -0x438(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x438(%rbp)
jmp    1269 <main+0xe9>
mov    -0x438(%rbp),%rax
cmp    -0x440(%rbp),%rax
jne    12fa <main+0x17a>
mov    0x2d01(%rip),%rax
movslq (%rax),%rdi
lea    0xd3c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   10a0 <exit@plt>
mov    -0x438(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x438(%rbp)
lea    -0x430(%rbp),%rdi
add    $0x1,%rdi
call   1090 <atoi@plt>
mov    %eax,-0x44c(%rbp)
mov    -0x438(%rbp),%rcx
lea    -0x430(%rbp),%rax
sub    %rax,%rcx
movslq -0x444(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x444(%rbp)
cmpl   $0x0,-0x444(%rbp)
je     1369 <main+0x1e9>
mov    -0x438(%rbp),%rdi
lea    -0x430(%rbp),%rsi
mov    -0x444(%rbp),%edx
call   1060 <bcopy@plt>
jmp    154a <main+0x3ca>
lea    -0x430(%rbp),%rax
movslq -0x444(%rbp),%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x438(%rbp)
mov    -0x438(%rbp),%rax
lea    -0x430(%rbp),%rcx
cmp    %rcx,%rax
jb     13e8 <main+0x268>
mov    -0x438(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     13cc <main+0x24c>
mov    -0x438(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
je     13cc <main+0x24c>
jmp    13e8 <main+0x268>
jmp    13d1 <main+0x251>
mov    -0x438(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x438(%rbp)
jmp    138a <main+0x20a>
mov    -0x438(%rbp),%rax
lea    -0x430(%rbp),%rcx
cmp    %rcx,%rax
jae    1421 <main+0x2a1>
mov    0x2bda(%rip),%rax
movslq (%rax),%rdi
lea    0xc35(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   10a0 <exit@plt>
jmp    1426 <main+0x2a6>
mov    -0x438(%rbp),%rax
lea    -0x430(%rbp),%rcx
cmp    %rcx,%rax
jb     1484 <main+0x304>
mov    -0x438(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     1463 <main+0x2e3>
mov    -0x438(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
jne    1468 <main+0x2e8>
jmp    1484 <main+0x304>
jmp    146d <main+0x2ed>
mov    -0x438(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x438(%rbp)
jmp    1426 <main+0x2a6>
mov    -0x438(%rbp),%rax
lea    -0x430(%rbp),%rcx
cmp    %rcx,%rax
jae    14ae <main+0x32e>
lea    -0x430(%rbp),%rax
mov    %rax,-0x438(%rbp)
jmp    14e1 <main+0x361>
mov    -0x438(%rbp),%rcx
lea    -0x430(%rbp),%rax
sub    %rax,%rcx
movslq -0x444(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x444(%rbp)
mov    -0x438(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x438(%rbp)
mov    -0x438(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
jne    1545 <main+0x3c5>
mov    -0x438(%rbp),%rdi
add    $0x1,%rdi
call   1090 <atoi@plt>
mov    %eax,-0x448(%rbp)
mov    -0x448(%rbp),%eax
cmp    -0x450(%rbp),%eax
jle    152d <main+0x3ad>
mov    -0x448(%rbp),%eax
mov    %eax,-0x454(%rbp)
jmp    1539 <main+0x3b9>
mov    -0x450(%rbp),%eax
mov    %eax,-0x454(%rbp)
mov    -0x454(%rbp),%eax
mov    %eax,-0x450(%rbp)
jmp    154a <main+0x3ca>
cmpl   $0x0,-0x444(%rbp)
je     15b5 <main+0x435>
lea    -0x430(%rbp),%rsi
mov    -0x444(%rbp),%edx
mov    $0x2,%edi
call   1030 <write@plt>
cmp    -0x444(%rbp),%eax
je     15b5 <main+0x435>
mov    0x2a5f(%rip),%rax
movslq (%rax),%rdi
lea    -0x430(%rbp),%rdx
mov    -0x444(%rbp),%ecx
lea    0xacb(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
lea    0xacf(%rip),%rdi
call   1080 <perror@plt>
mov    $0x2,%edi
call   10a0 <exit@plt>
jmp    1204 <main+0x84>
cmpl   $0x0,-0x444(%rbp)
jge    15dd <main+0x45d>
lea    0xaad(%rip),%rdi
call   1080 <perror@plt>
mov    $0x2,%edi
call   10a0 <exit@plt>
cmpl   $0x0,-0x44c(%rbp)
jge    160c <main+0x48c>
mov    0x29ef(%rip),%rax
movslq (%rax),%rdi
lea    0xa85(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   10a0 <exit@plt>
cmpl   $0x0,-0x450(%rbp)
jge    163b <main+0x4bb>
mov    0x29c0(%rip),%rax
movslq (%rax),%rdi
lea    0xa77(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   10a0 <exit@plt>
mov    -0x20(%rbp),%rdi
lea    0xa7a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     168c <main+0x50c>
mov    -0x18(%rbp),%rdi
mov    -0x450(%rbp),%eax
sub    -0x44c(%rbp),%eax
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0xa42(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
jmp    169f <main+0x51f>
mov    -0x20(%rbp),%rdi
call   1080 <perror@plt>
mov    $0x2,%edi
call   10a0 <exit@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
cmp    $0x4,%edi
jne    1358 <main+0x1c8>
mov    0x8(%rsi),%r15
mov    0x10(%rsi),%rbx
mov    0x18(%rsi),%rbp
lea    0x20(%rsp),%r14
xor    %edi,%edi
mov    %r14,%rsi
mov    $0x400,%edx
call   1040 <read@plt>
test   %eax,%eax
jle    137d <main+0x1ed>
mov    %r15,0x18(%rsp)
mov    %rbp,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    $0xffffffff,%r12d
mov    $0xffffffff,%ebp
jmp    121e <main+0x8e>
xchg   %ax,%ax
mov    $0x2,%edi
mov    %r14,%rsi
mov    %ebx,%edx
call   1030 <write@plt>
cmp    %ebx,%eax
jne    13dd <main+0x24d>
xor    %edi,%edi
mov    %r14,%rsi
mov    $0x400,%edx
call   1040 <read@plt>
test   %eax,%eax
jle    13ad <main+0x21d>
mov    %eax,%r15d
lea    (%rsp,%r15,1),%rdi
add    $0x20,%rdi
test   %ebp,%ebp
jns    12a0 <main+0x110>
cmpb   $0x2a,0x20(%rsp)
jne    12a0 <main+0x110>
mov    $0x2a,%al
lea    0x21(%rsp),%r13
cmp    $0xa,%al
je     1256 <main+0xc6>
nop
cmp    $0xd,%al
je     1256 <main+0xc6>
cmp    %rdi,%r13
jae    125a <main+0xca>
movzbl 0x0(%r13),%eax
add    $0x1,%r13
cmp    $0xa,%al
jne    1240 <main+0xb0>
add    $0xffffffffffffffff,%r13
cmp    %rdi,%r13
je     1405 <main+0x275>
add    $0x1,%r13
lea    0x21(%rsp),%rdi
call   1090 <atoi@plt>
mov    %eax,%ebp
mov    %r14d,%ebx
sub    %r13d,%ebx
add    %r15d,%ebx
je     1207 <main+0x77>
mov    %r14,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1060 <memmove@plt>
jmp    11f0 <main+0x60>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0xffffffffffffffff,%rdi
cmp    %r14,%rdi
jb     1395 <main+0x205>
mov    $0x1,%ebx
mov    %r14,%rax
jmp    12d4 <main+0x144>
nopw   0x0(%rax,%rax,1)
add    $0xffffffffffffffff,%rdi
add    $0x1,%ebx
add    $0xffffffffffffffff,%rax
cmp    %r14,%rdi
jb     1395 <main+0x205>
movzbl (%rdi),%ecx
cmp    $0xa,%cl
je     12c0 <main+0x130>
cmp    $0xd,%cl
je     12c0 <main+0x130>
cmp    %r14,%rdi
jae    1320 <main+0x190>
mov    $0x1,%al
mov    %r15d,%ebx
mov    %r14,%rcx
cmpb   $0x2a,(%rcx)
jne    130e <main+0x17e>
add    $0x2,%rdi
test   %al,%al
lea    0x21(%rsp),%rax
cmovne %rax,%rdi
call   1090 <atoi@plt>
cmp    %r12d,%eax
cmovg  %eax,%r12d
test   %ebx,%ebx
jne    11f0 <main+0x60>
jmp    1207 <main+0x77>
nopl   0x0(%rax,%rax,1)
cmp    $0xa,%cl
je     1343 <main+0x1b3>
cmp    $0xd,%cl
je     1343 <main+0x1b3>
lea    (%rax,%r15,1),%rdi
add    $0xfffffffffffffffe,%rdi
cmp    %r14,%rdi
jb     12e6 <main+0x156>
movzbl (%rdi),%ecx
add    $0x1,%ebx
add    $0xffffffffffffffff,%rax
jmp    1320 <main+0x190>
lea    (%rax,%r15,1),%rcx
lea    (%rax,%r15,1),%rdi
add    $0xffffffffffffffff,%rdi
xor    %eax,%eax
cmpb   $0x2a,(%rcx)
je     12f3 <main+0x163>
jmp    130e <main+0x17e>
mov    0x2c81(%rip),%rax
movslq (%rax),%rdi
mov    (%rsi),%rdx
lea    0xc94(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   10a0 <exit@plt>
jns    13b3 <main+0x223>
lea    0xcf5(%rip),%rdi
call   1080 <perror@plt>
mov    $0x2,%edi
call   10a0 <exit@plt>
mov    0x2c44(%rip),%rax
movslq (%rax),%rcx
lea    0xc9f(%rip),%rdi
mov    $0x1d,%esi
jmp    13c9 <main+0x239>
js     137f <main+0x1ef>
test   %ebp,%ebp
jns    141d <main+0x28d>
mov    0x2c26(%rip),%rax
movslq (%rax),%rcx
lea    0xcbc(%rip),%rdi
mov    $0x20,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
mov    $0x2,%edi
call   10a0 <exit@plt>
mov    0x2bfc(%rip),%rax
movslq (%rax),%rdi
lea    0xc75(%rip),%rsi
lea    0x20(%rsp),%rdx
mov    %ebx,%ecx
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xc72(%rip),%rdi
jmp    1386 <main+0x1f6>
mov    0x2bd4(%rip),%rax
movslq (%rax),%rcx
lea    0xc0f(%rip),%rdi
mov    $0x1f,%esi
jmp    13c9 <main+0x239>
test   %r12d,%r12d
jns    143a <main+0x2aa>
mov    0x2bb7(%rip),%rax
movslq (%rax),%rcx
lea    0xc6e(%rip),%rdi
mov    $0x1e,%esi
jmp    13c9 <main+0x239>
lea    0xc7f(%rip),%rsi
mov    0x18(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <fopen@plt>
test   %rax,%rax
jne    145b <main+0x2cb>
mov    %rbx,%rdi
jmp    1386 <main+0x1f6>
sub    %ebp,%r12d
cvtsi2ss %r12d,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc54(%rip),%rsi
mov    %rax,%rdi
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%rcx
mov    $0x1,%al
call   1050 <fprintf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"Usage:\09%s accounting-file user host\0A\00"
@.str.1 = [32 x i8] c"Can't find initial page count!\0A\00"
@.str.2 = [30 x i8] c"Can't find final page count!\0A\00"
@.str.3 = [18 x i8] c"write 1: 2 %p %d\0A\00"
@.str.4 = [6 x i8] c"write\00"
@.str.5 = [5 x i8] c"read\00"
@.str.6 = [33 x i8] c"Didn't find initial page count!\0A\00"
@.str.7 = [31 x i8] c"Didn't find final page count!\0A\00"
@.str.8 = [2 x i8] c"a\00"
@.str.9 = [13 x i8] c"%7.2f\09%s:%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca [1024 x i8]
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %15
store i32 -1, i32* %16
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 4
br i1 %18, label %19, label %28
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to i32*
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = call i32 @exit(i32 2)
unreachable
28: ; preds = %2
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
store i8* %31, i8** %7
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 2
%34 = load i8*, i8** %33
store i8* %34, i8** %8
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 3
%37 = load i8*, i8** %36
store i8* %37, i8** %9
br label %38
38: ; preds = %218, %28
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%40 = call i32 @read(i32 0, i8* %39, i32 1024)
store i32 %40, i32* %13
%41 = icmp sgt i32 %40, 0
br i1 %41, label %42, label %219
42: ; preds = %38
%43 = load i32, i32* %15
%44 = icmp slt i32 %43, 0
br i1 %44, label %45, label %108
45: ; preds = %42
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 42
br i1 %49, label %50, label %108
50: ; preds = %45
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
store i8* %51, i8** %11
%52 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%53 = load i32, i32* %13
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* %52, i64 %54
store i8* %55, i8** %12
br label %56
56: ; preds = %72, %50
%57 = load i8*, i8** %11
%58 = load i8*, i8** %12
%59 = icmp ult i8* %57, %58
br i1 %59, label %60, label %75
60: ; preds = %56
%61 = load i8*, i8** %11
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = icmp eq i32 %63, 10
br i1 %64, label %70, label %65
65: ; preds = %60
%66 = load i8*, i8** %11
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = icmp eq i32 %68, 13
br i1 %69, label %70, label %71
70: ; preds = %65, %60
br label %75
71: ; preds = %65
br label %72
72: ; preds = %71
%73 = load i8*, i8** %11
%74 = getelementptr inbounds i8, i8* %73, i32 1
store i8* %74, i8** %11
br label %56
75: ; preds = %70, %56
%76 = load i8*, i8** %11
%77 = load i8*, i8** %12
%78 = icmp eq i8* %76, %77
br i1 %78, label %79, label %85
79: ; preds = %75
%80 = load i32, i32* @stderr
%81 = sext i32 %80 to i64
%82 = inttoptr i64 %81 to i32*
%83 = call i32 (i32*, i8*, ...) @fprintf(i32* %82, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%84 = call i32 @exit(i32 2)
unreachable
85: ; preds = %75
%86 = load i8*, i8** %11
%87 = getelementptr inbounds i8, i8* %86, i32 1
store i8* %87, i8** %11
%88 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%89 = getelementptr inbounds i8, i8* %88, i64 1
%90 = call i32 @atoi(i8* %89)
store i32 %90, i32* %15
%91 = load i8*, i8** %11
%92 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%93 = ptrtoint i8* %91 to i64
%94 = ptrtoint i8* %92 to i64
%95 = sub i64 %93, %94
%96 = load i32, i32* %13
%97 = sext i32 %96 to i64
%98 = sub nsw i64 %97, %95
%99 = trunc i64 %98 to i32
store i32 %99, i32* %13
%100 = load i32, i32* %13
%101 = icmp ne i32 %100, 0
br i1 %101, label %102, label %107
102: ; preds = %85
%103 = load i8*, i8** %11
%104 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%105 = load i32, i32* %13
%106 = call i32 @bcopy(i8* %103, i8* %104, i32 %105)
br label %107
107: ; preds = %102, %85
br label %200
108: ; preds = %45, %42
%109 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%110 = load i32, i32* %13
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i8, i8* %109, i64 %111
%113 = getelementptr inbounds i8, i8* %112, i64 -1
store i8* %113, i8** %11
br label %114
114: ; preds = %130, %108
%115 = load i8*, i8** %11
%116 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%117 = icmp uge i8* %115, %116
br i1 %117, label %118, label %133
118: ; preds = %114
%119 = load i8*, i8** %11
%120 = load i8, i8* %119
%121 = sext i8 %120 to i32
%122 = icmp ne i32 %121, 10
br i1 %122, label %123, label %129
123: ; preds = %118
%124 = load i8*, i8** %11
%125 = load i8, i8* %124
%126 = sext i8 %125 to i32
%127 = icmp ne i32 %126, 13
br i1 %127, label %128, label %129
128: ; preds = %123
br label %133
129: ; preds = %123, %118
br label %130
130: ; preds = %129
%131 = load i8*, i8** %11
%132 = getelementptr inbounds i8, i8* %131, i32 -1
store i8* %132, i8** %11
br label %114
133: ; preds = %128, %114
%134 = load i8*, i8** %11
%135 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%136 = icmp ult i8* %134, %135
br i1 %136, label %137, label %143
137: ; preds = %133
%138 = load i32, i32* @stderr
%139 = sext i32 %138 to i64
%140 = inttoptr i64 %139 to i32*
%141 = call i32 (i32*, i8*, ...) @fprintf(i32* %140, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%142 = call i32 @exit(i32 2)
unreachable
143: ; preds = %133
br label %144
144: ; preds = %160, %143
%145 = load i8*, i8** %11
%146 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%147 = icmp uge i8* %145, %146
br i1 %147, label %148, label %163
148: ; preds = %144
%149 = load i8*, i8** %11
%150 = load i8, i8* %149
%151 = sext i8 %150 to i32
%152 = icmp eq i32 %151, 10
br i1 %152, label %158, label %153
153: ; preds = %148
%154 = load i8*, i8** %11
%155 = load i8, i8* %154
%156 = sext i8 %155 to i32
%157 = icmp eq i32 %156, 13
br i1 %157, label %158, label %159
158: ; preds = %153, %148
br label %163
159: ; preds = %153
br label %160
160: ; preds = %159
%161 = load i8*, i8** %11
%162 = getelementptr inbounds i8, i8* %161, i32 -1
store i8* %162, i8** %11
br label %144
163: ; preds = %158, %144
%164 = load i8*, i8** %11
%165 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%166 = icmp ult i8* %164, %165
br i1 %166, label %167, label %169
167: ; preds = %163
%168 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
store i8* %168, i8** %11
br label %181
169: ; preds = %163
%170 = load i8*, i8** %11
%171 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%172 = ptrtoint i8* %170 to i64
%173 = ptrtoint i8* %171 to i64
%174 = sub i64 %172, %173
%175 = load i32, i32* %13
%176 = sext i32 %175 to i64
%177 = sub nsw i64 %176, %174
%178 = trunc i64 %177 to i32
store i32 %178, i32* %13
%179 = load i8*, i8** %11
%180 = getelementptr inbounds i8, i8* %179, i32 1
store i8* %180, i8** %11
br label %181
181: ; preds = %169, %167
%182 = load i8*, i8** %11
%183 = load i8, i8* %182
%184 = sext i8 %183 to i32
%185 = icmp eq i32 %184, 42
br i1 %185, label %186, label %199
186: ; preds = %181
%187 = load i8*, i8** %11
%188 = getelementptr inbounds i8, i8* %187, i64 1
%189 = call i32 @atoi(i8* %188)
store i32 %189, i32* %14
%190 = load i32, i32* %14
%191 = load i32, i32* %16
%192 = icmp sgt i32 %190, %191
br i1 %192, label %193, label %195
193: ; preds = %186
%194 = load i32, i32* %14
br label %197
195: ; preds = %186
%196 = load i32, i32* %16
br label %197
197: ; preds = %195, %193
%198 = phi i32 [ %194, %193 ], [ %196, %195 ]
store i32 %198, i32* %16
br label %199
199: ; preds = %197, %181
br label %200
200: ; preds = %199, %107
%201 = load i32, i32* %13
%202 = icmp ne i32 %201, 0
br i1 %202, label %203, label %218
203: ; preds = %200
%204 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%205 = load i32, i32* %13
%206 = call i32 @write(i32 2, i8* %204, i32 %205)
%207 = load i32, i32* %13
%208 = icmp ne i32 %206, %207
br i1 %208, label %209, label %218
209: ; preds = %203
%210 = load i32, i32* @stderr
%211 = sext i32 %210 to i64
%212 = inttoptr i64 %211 to i32*
%213 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%214 = load i32, i32* %13
%215 = call i32 (i32*, i8*, ...) @fprintf(i32* %212, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %213, i32 %214)
%216 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%217 = call i32 @exit(i32 2)
unreachable
218: ; preds = %203, %200
br label %38
219: ; preds = %38
%220 = load i32, i32* %13
%221 = icmp slt i32 %220, 0
br i1 %221, label %222, label %225
222: ; preds = %219
%223 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%224 = call i32 @exit(i32 2)
unreachable
225: ; preds = %219
%226 = load i32, i32* %15
%227 = icmp slt i32 %226, 0
br i1 %227, label %228, label %234
228: ; preds = %225
%229 = load i32, i32* @stderr
%230 = sext i32 %229 to i64
%231 = inttoptr i64 %230 to i32*
%232 = call i32 (i32*, i8*, ...) @fprintf(i32* %231, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
%233 = call i32 @exit(i32 2)
unreachable
234: ; preds = %225
%235 = load i32, i32* %16
%236 = icmp slt i32 %235, 0
br i1 %236, label %237, label %243
237: ; preds = %234
%238 = load i32, i32* @stderr
%239 = sext i32 %238 to i64
%240 = inttoptr i64 %239 to i32*
%241 = call i32 (i32*, i8*, ...) @fprintf(i32* %240, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
%242 = call i32 @exit(i32 2)
unreachable
243: ; preds = %234
%244 = load i8*, i8** %7
%245 = call i32* @fopen(i8* %244, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32* %245, i32** %6
%246 = icmp ne i32* %245, null
br i1 %246, label %247, label %257
247: ; preds = %243
%248 = load i32*, i32** %6
%249 = load i32, i32* %16
%250 = load i32, i32* %15
%251 = sub nsw i32 %249, %250
%252 = sitofp i32 %251 to float
%253 = fpext float %252 to double
%254 = load i8*, i8** %9
%255 = load i8*, i8** %8
%256 = call i32 (i32*, i8*, ...) @fprintf(i32* %248, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), double %253, i8* %254, i8* %255)
br label %261
257: ; preds = %243
%258 = load i8*, i8** %7
%259 = call i32 @perror(i8* %258)
%260 = call i32 @exit(i32 2)
unreachable
261: ; preds = %247
%262 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"Usage:\09%s accounting-file user host\0A\00"
@.str.1 = [32 x i8] c"Can't find initial page count!\0A\00"
@.str.2 = [30 x i8] c"Can't find final page count!\0A\00"
@.str.3 = [18 x i8] c"write 1: 2 %p %d\0A\00"
@.str.4 = [6 x i8] c"write\00"
@.str.5 = [5 x i8] c"read\00"
@.str.6 = [33 x i8] c"Didn't find initial page count!\0A\00"
@.str.7 = [31 x i8] c"Didn't find final page count!\0A\00"
@.str.8 = [2 x i8] c"a\00"
@.str.9 = [13 x i8] c"%7.2f\09%s:%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 4
br i1 %5, label %13, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
%10 = load i8*, i8** %1
%11 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = tail call i32 @exit(i32 2)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = getelementptr inbounds i8*, i8** %1, i64 3
%19 = load i8*, i8** %18
%20 = call i32 @read(i32 0, i8* %4, i32 1024)
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %128
22: ; preds = %13
%23 = ptrtoint [1024 x i8]* %3 to i64
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 1
br label %25
25: ; preds = %22, %121
%26 = phi i32 [ %20, %22 ], [ %124, %121 ]
%27 = phi i32 [ -1, %22 ], [ %122, %121 ]
%28 = phi i32 [ -1, %22 ], [ %123, %121 ]
%29 = icmp slt i32 %28, 0
%30 = load i8, i8* %4
%31 = icmp eq i8 %30, 42
%32 = select i1 %29, i1 %31, i1 false
%33 = zext i32 %26 to i64
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %33
br i1 %32, label %35, label %61
35: ; preds = %25, %41
%36 = phi i8 [ %42, %41 ], [ 42, %25 ]
%37 = phi i8* [ %39, %41 ], [ %4, %25 ]
switch i8 %36, label %38 [
i8 10, label %43
i8 13, label %43
]
38: ; preds = %35
%39 = getelementptr inbounds i8, i8* %37, i64 1
%40 = icmp ult i8* %39, %34
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = load i8, i8* %39
br label %35
43: ; preds = %38, %35, %35
%44 = phi i8* [ %39, %38 ], [ %37, %35 ], [ %37, %35 ]
%45 = icmp eq i8* %44, %34
br i1 %45, label %46, label %52
46: ; preds = %43
%47 = load i32, i32* @stderr
%48 = sext i32 %47 to i64
%49 = inttoptr i64 %48 to i32*
%50 = call i64 @fwrite(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i64 31, i64 1, i32* %49)
%51 = call i32 @exit(i32 2)
unreachable
52: ; preds = %43
%53 = getelementptr inbounds i8, i8* %44, i64 1
%54 = call i32 @atoi(i8* %24)
%55 = ptrtoint i8* %53 to i64
%56 = sub i64 %23, %55
%57 = trunc i64 %56 to i32
%58 = add i32 %26, %57
%59 = icmp eq i32 %58, 0
br i1 %59, label %121, label %60
60: ; preds = %52
br label %108
61: ; preds = %25
%62 = getelementptr inbounds i8, i8* %34, i64 -1
%63 = icmp ult i8* %62, %4
br i1 %63, label %72, label %64
64: ; preds = %61, %69
%65 = phi i8* [ %70, %69 ], [ %62, %61 ]
%66 = load i8, i8* %65
switch i8 %66, label %67 [
i8 10, label %69
i8 13, label %69
]
67: ; preds = %64
%68 = icmp ult i8* %65, %4
br i1 %68, label %92, label %78
69: ; preds = %64, %64
%70 = getelementptr inbounds i8, i8* %65, i64 -1
%71 = icmp ult i8* %70, %4
br i1 %71, label %72, label %64
72: ; preds = %61, %69
%73 = load i32, i32* @stderr
%74 = sext i32 %73 to i64
%75 = inttoptr i64 %74 to i32*
%76 = call i64 @fwrite(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i64 29, i64 1, i32* %75)
%77 = call i32 @exit(i32 2)
unreachable
78: ; preds = %67, %84
%79 = phi i8 [ %85, %84 ], [ %66, %67 ]
%80 = phi i8* [ %82, %84 ], [ %65, %67 ]
switch i8 %79, label %81 [
i8 10, label %86
i8 13, label %86
]
81: ; preds = %78
%82 = getelementptr inbounds i8, i8* %80, i64 -1
%83 = icmp ult i8* %82, %4
br i1 %83, label %92, label %84
84: ; preds = %81
%85 = load i8, i8* %82
br label %78
86: ; preds = %78, %78
%87 = ptrtoint i8* %80 to i64
%88 = sub i64 %23, %87
%89 = trunc i64 %88 to i32
%90 = getelementptr inbounds i8, i8* %80, i64 1
%91 = add i32 %26, %89
br label %92
92: ; preds = %81, %67, %86
%93 = phi i32 [ %91, %86 ], [ %26, %67 ], [ %26, %81 ]
%94 = phi i8* [ %80, %86 ], [ %65, %67 ], [ %82, %81 ]
%95 = phi i1 [ false, %86 ], [ true, %67 ], [ true, %81 ]
%96 = phi i8* [ %90, %86 ], [ %4, %67 ], [ %4, %81 ]
%97 = load i8, i8* %96
%98 = icmp eq i8 %97, 42
br i1 %98, label %99, label %105
99: ; preds = %92
%100 = getelementptr inbounds i8, i8* %94, i64 2
%101 = select i1 %95, i8* %24, i8* %100
%102 = call i32 @atoi(i8* %101)
%103 = icmp sgt i32 %102, %27
%104 = select i1 %103, i32 %102, i32 %27
br label %105
105: ; preds = %92, %99
%106 = phi i32 [ %104, %99 ], [ %27, %92 ]
%107 = icmp eq i32 %93, 0
br i1 %107, label %121, label %108
108: ; preds = %60, %105
%109 = phi i32 [ %27, %60 ], [ %106, %105 ]
%110 = phi i32 [ %54, %60 ], [ %28, %105 ]
%111 = phi i32 [ %58, %60 ], [ %93, %105 ]
%112 = call i32 @write(i32 2, i8* %4, i32 %111)
%113 = icmp eq i32 %112, %111
br i1 %113, label %121, label %114
114: ; preds = %108
%115 = load i32, i32* @stderr
%116 = sext i32 %115 to i64
%117 = inttoptr i64 %116 to i32*
%118 = call i32 (i32*, i8*, ...) @fprintf(i32* %117, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %4, i32 %111)
%119 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%120 = call i32 @exit(i32 2)
unreachable
121: ; preds = %52, %108, %105
%122 = phi i32 [ %109, %108 ], [ %106, %105 ], [ %27, %52 ]
%123 = phi i32 [ %110, %108 ], [ %28, %105 ], [ %54, %52 ]
%124 = call i32 @read(i32 0, i8* %4, i32 1024)
%125 = icmp sgt i32 %124, 0
br i1 %125, label %25, label %126
126: ; preds = %121
%127 = icmp slt i32 %124, 0
br i1 %127, label %130, label %133
128: ; preds = %13
%129 = icmp slt i32 %20, 0
br i1 %129, label %130, label %135
130: ; preds = %128, %126
%131 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%132 = call i32 @exit(i32 2)
unreachable
133: ; preds = %126
%134 = icmp slt i32 %123, 0
br i1 %134, label %135, label %141
135: ; preds = %128, %133
%136 = load i32, i32* @stderr
%137 = sext i32 %136 to i64
%138 = inttoptr i64 %137 to i32*
%139 = call i64 @fwrite(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i64 32, i64 1, i32* %138)
%140 = call i32 @exit(i32 2)
unreachable
141: ; preds = %133
%142 = icmp slt i32 %122, 0
br i1 %142, label %143, label %149
143: ; preds = %141
%144 = load i32, i32* @stderr
%145 = sext i32 %144 to i64
%146 = inttoptr i64 %145 to i32*
%147 = call i64 @fwrite(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i64 30, i64 1, i32* %146)
%148 = call i32 @exit(i32 2)
unreachable
149: ; preds = %141
%150 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%151 = icmp eq i32* %150, null
br i1 %151, label %158, label %152
152: ; preds = %149
%153 = sub nsw i32 %122, %123
%154 = sitofp i32 %153 to float
%155 = fpext float %154 to double
%156 = call i32 (i32*, i8*, ...) @fprintf(i32* %150, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), double %155, i8* %19, i8* %17)
%157 = call i32 @exit(i32 0)
unreachable
158: ; preds = %149
%159 = call i32 @perror(i8* %15)
%160 = call i32 @exit(i32 2)
unreachable
}