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

/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ feof(int /*<<< orphan*/ *);
scalar_t__ ferror(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, char *);
scalar_t__ hash_file(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
char *strerror(int /*<<< orphan*/);
size_t strlen(char *);
int /*<<< orphan*/ unescapefname(char *);
int check_file(const char *fname) {
  FILE *fp;
  char linebuf[4096];
  char *line;
  char *p;
  size_t n;
  int rc = 0;
  int escaped;
  if (*fname == '-' && !fname[1])
    fp = stdin;
  else
    fp = fopen(fname, "r");
  if (!fp) {
    fprintf(stderr,
            "sha1sum"
            ": can't open `%s': %s\n",
            fname, strerror(errno));
    return -1;
  }
  while (fgets(linebuf, sizeof(linebuf) - 1, fp)) {
    escaped = (*linebuf == '\\');
    line = linebuf + escaped;
    n = strlen(line);
    if (!n || line[n - 1] != '\n') {
      fprintf(stderr,
              "sha1sum"
              ": error reading `%s': %s\n",
              fname, feof(fp) ? "last linefeed missing" : "line too long");
      rc = -1;
      break;
    }
    line[--n] = 0;
    if (n && line[n - 1] == '\r')
      line[--n] = 0;
    if (!*line)
      continue;
    if (n < (20 * 2 + 2) || line[(20 * 2 + 2) - 2] != ' ') {
      fprintf(stderr,
              "sha1sum"
              ": error parsing `%s': %s\n",
              fname, "invalid line");
      rc = -1;
      continue;
    }
    line[(20 * 2 + 2) - 2] = 0;
    for (p = line; *p; p++)
      if (*p >= 'A' && *p <= 'Z')
        *p |= 0x20;
    if (escaped)
      unescapefname(line + (20 * 2 + 2));
    if (hash_file(line + (20 * 2 + 2), line))
      rc = -1;
  }
  if (ferror(fp)) {
    fprintf(stderr,
            "sha1sum"
            ":error reading `%s': %s\n",
            fname, strerror(errno));
    rc = -1;
  }
  if (fp != stdin)
    fclose(fp);
  return rc;
}


x86 assembly (clang, -O0):
<check_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1070,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x103c(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11ea <check_file+0x4a>
mov    -0x10(%rbp),%rax
cmpb   $0x0,0x1(%rax)
jne    11ea <check_file+0x4a>
mov    0x2e0a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    11fe <check_file+0x5e>
mov    -0x10(%rbp),%rdi
lea    0xe0b(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1259 <check_file+0xb9>
mov    0x2dc8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x104c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x1048(%rbp)
mov    0x2da6(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x104c(%rbp),%edi
mov    -0x1048(%rbp),%rdx
mov    %rax,%rcx
lea    0xdba(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1574 <check_file+0x3d4>
jmp    125e <check_file+0xbe>
lea    -0x1020(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0xfff,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     14ed <check_file+0x34d>
movsbl -0x1020(%rbp),%eax
cmp    $0x5c,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1040(%rbp)
lea    -0x1020(%rbp),%rax
movslq -0x1040(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x1028(%rbp)
mov    -0x1028(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x1038(%rbp)
cmpq   $0x0,-0x1038(%rbp)
je     12ed <check_file+0x14d>
mov    -0x1028(%rbp),%rax
mov    -0x1038(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
je     1351 <check_file+0x1b1>
mov    0x2ce4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x105c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x1058(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <feof@plt>
mov    -0x105c(%rbp),%edi
mov    -0x1058(%rbp),%rdx
mov    %rax,%rsi
lea    0xd30(%rip),%rcx
lea    0xd13(%rip),%rax
cmp    $0x0,%rsi
cmovne %rax,%rcx
lea    0xce3(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x103c(%rbp)
ff ff ff
jmp    14ed <check_file+0x34d>
mov    -0x1028(%rbp),%rax
mov    -0x1038(%rbp),%rcx
mov    %rcx,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x1038(%rbp)
movb   $0x0,-0x1(%rax,%rcx,1)
cmpq   $0x0,-0x1038(%rbp)
je     13c0 <check_file+0x220>
mov    -0x1028(%rbp),%rax
mov    -0x1038(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xd,%eax
jne    13c0 <check_file+0x220>
mov    -0x1028(%rbp),%rax
mov    -0x1038(%rbp),%rcx
mov    %rcx,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x1038(%rbp)
movb   $0x0,-0x1(%rax,%rcx,1)
mov    -0x1028(%rbp),%rax
cmpb   $0x0,(%rax)
jne    13d5 <check_file+0x235>
jmp    125e <check_file+0xbe>
cmpq   $0x2a,-0x1038(%rbp)
2a
jb     13f7 <check_file+0x257>
mov    -0x1028(%rbp),%rax
movsbl 0x28(%rax),%eax
cmp    $0x20,%eax
je     1426 <check_file+0x286>
mov    0x2bda(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xc5a(%rip),%rsi
lea    0xc74(%rip),%rcx
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x103c(%rbp)
ff ff ff
jmp    125e <check_file+0xbe>
mov    -0x1028(%rbp),%rax
movb   $0x0,0x28(%rax)
mov    -0x1028(%rbp),%rax
mov    %rax,-0x1030(%rbp)
mov    -0x1030(%rbp),%rax
cmpb   $0x0,(%rax)
je     14a0 <check_file+0x300>
mov    -0x1030(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     1484 <check_file+0x2e4>
mov    -0x1030(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jg     1484 <check_file+0x2e4>
mov    -0x1030(%rbp),%rax
movsbl (%rax),%ecx
or     $0x20,%ecx
mov    %cl,(%rax)
jmp    1489 <check_file+0x2e9>
mov    -0x1030(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1030(%rbp)
jmp    143f <check_file+0x29f>
cmpl   $0x0,-0x1040(%rbp)
je     14bd <check_file+0x31d>
mov    -0x1028(%rbp),%rdi
add    $0x2a,%rdi
call   10b0 <unescapefname@plt>
mov    -0x1028(%rbp),%rdi
add    $0x2a,%rdi
mov    -0x1028(%rbp),%rsi
call   1090 <hash_file@plt>
cmp    $0x0,%rax
je     14e8 <check_file+0x348>
movl   $0xffffffff,-0x103c(%rbp)
ff ff ff
jmp    125e <check_file+0xbe>
mov    -0x18(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     154e <check_file+0x3ae>
mov    0x2ad1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x106c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x1068(%rbp)
mov    0x2aaf(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x106c(%rbp),%edi
mov    -0x1068(%rbp),%rdx
mov    %rax,%rcx
lea    0xb54(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x103c(%rbp)
ff ff ff
mov    -0x18(%rbp),%rax
mov    0x2a8f(%rip),%rcx
cmp    (%rcx),%rax
je     156b <check_file+0x3cb>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x103c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1070,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1008,%rsp
mov    %rdi,%r14
cmpb   $0x2d,(%rdi)
jne    11c4 <check_file+0x24>
cmpb   $0x0,0x1(%r14)
je     13ab <check_file+0x20b>
lea    0xe35(%rip),%rsi
mov    %r14,%rdi
call   10a0 <fopen@plt>
mov    %rax,%rbx
test   %rbx,%rbx
je     13be <check_file+0x21e>
mov    %rsp,%rdi
mov    $0xfff,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     1358 <check_file+0x1b8>
mov    %rsp,%r15
jmp    1225 <check_file+0x85>
nop
mov    (%r12),%al
test   %al,%al
jne    1289 <check_file+0xe9>
mov    %r15,%rdi
mov    $0xfff,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1358 <check_file+0x1b8>
mov    (%rsp),%r13b
xor    %eax,%eax
cmp    $0x5c,%r13b
sete   %al
lea    (%rsp,%rax,1),%r12
mov    %r12,%rdi
call   1050 <strlen@plt>
test   %rax,%rax
je     131c <check_file+0x17c>
cmpb   $0xa,-0x1(%r12,%rax,1)
jne    131c <check_file+0x17c>
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
movb   $0x0,(%r12,%rcx,1)
je     1280 <check_file+0xe0>
cmpb   $0xd,-0x2(%r12,%rax,1)
jne    1200 <check_file+0x60>
add    $0xfffffffffffffffe,%rax
movb   $0x0,(%r12,%rax,1)
mov    %rax,%rcx
jmp    1200 <check_file+0x60>
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,(%r12)
je     120c <check_file+0x6c>
jmp    12ca <check_file+0x12a>
cmp    $0x2a,%rcx
jb     12ca <check_file+0x12a>
cmpb   $0x20,0x28(%r12)
jne    12ca <check_file+0x12a>
xor    %ecx,%ecx
cmp    $0x5c,%r13b
sete   %cl
movb   $0x0,0x28(%r12)
lea    0x1(%rsp),%rdx
add    %rdx,%rcx
jmp    12bb <check_file+0x11b>
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
je     12f3 <check_file+0x153>
lea    -0x41(%rax),%edx
cmp    $0x19,%dl
ja     12b0 <check_file+0x110>
or     $0x20,%al
mov    %al,-0x1(%rcx)
jmp    12b0 <check_file+0x110>
mov    0x2d07(%rip),%rax
mov    (%rax),%edi
lea    0xd8b(%rip),%rsi
mov    %r14,%rdx
lea    0xda2(%rip),%rcx
call   1070 <fprintf@plt>
mov    $0xffffffff,%ebp
jmp    120c <check_file+0x6c>
cmp    $0x5c,%r13b
jne    1303 <check_file+0x163>
lea    0x2a(%r12),%rdi
call   10b0 <unescapefname@plt>
lea    0x2a(%r12),%rdi
mov    %r12,%rsi
call   1090 <hash_file@plt>
neg    %rax
sbb    %eax,%eax
or     %eax,%ebp
jmp    120c <check_file+0x6c>
mov    0x2cb5(%rip),%rax
mov    (%rax),%ebp
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %rax,%rax
lea    0xd20(%rip),%rax
lea    0xd03(%rip),%rcx
cmove  %rax,%rcx
lea    0xcd7(%rip),%rsi
mov    %ebp,%edi
mov    %r14,%rdx
call   1070 <fprintf@plt>
mov    $0xffffffff,%ebp
mov    %rbx,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
je     1395 <check_file+0x1f5>
mov    0x2c6c(%rip),%rax
mov    (%rax),%ebp
mov    0x2c5b(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd10(%rip),%rsi
mov    %ebp,%edi
mov    %r14,%rdx
mov    %rax,%rcx
call   1070 <fprintf@plt>
mov    $0xffffffff,%ebp
mov    0x2c4c(%rip),%rax
cmp    (%rax),%rbx
je     13ee <check_file+0x24e>
mov    %rbx,%rdi
call   1040 <fclose@plt>
jmp    13ee <check_file+0x24e>
mov    0x2c36(%rip),%rax
mov    (%rax),%rbx
test   %rbx,%rbx
jne    11df <check_file+0x3f>
mov    0x2c13(%rip),%rax
mov    (%rax),%ebx
mov    0x2c02(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xc26(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %rax,%rcx
call   1070 <fprintf@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x1008,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [30 x i8] c"sha1sum: can't open `%s': %s\0A\00"
@errno = global i32 0
@.str.2 = [33 x i8] c"sha1sum: error reading `%s': %s\0A\00"
@.str.3 = [22 x i8] c"last linefeed missing\00"
@.str.4 = [14 x i8] c"line too long\00"
@.str.5 = [33 x i8] c"sha1sum: error parsing `%s': %s\0A\00"
@.str.6 = [13 x i8] c"invalid line\00"
@.str.7 = [32 x i8] c"sha1sum:error reading `%s': %s\0A\00"
define i32 @check_file(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca [4096 x i8]
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %9
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 45
br i1 %14, label %15, label %22
15: ; preds = %1
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = load i8, i8* %17
%19 = icmp ne i8 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %15
%21 = load i32*, i32** @stdin
store i32* %21, i32** %4
br label %25
22: ; preds = %15, %1
%23 = load i8*, i8** %3
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %24, i32** %4
br label %25
25: ; preds = %22, %20
%26 = load i32*, i32** %4
%27 = icmp ne i32* %26, null
br i1 %27, label %34, label %28
28: ; preds = %25
%29 = load i32, i32* @stderr
%30 = load i8*, i8** %3
%31 = load i32, i32* @errno
%32 = call i8* @strerror(i32 %31)
%33 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %30, i8* %32)
store i32 -1, i32* %2
br label %171
34: ; preds = %25
br label %35
35: ; preds = %151, %105, %95, %34
%36 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%37 = load i32*, i32** %4
%38 = call i64 @fgets(i8* %36, i32 4095, i32* %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %152
40: ; preds = %35
%41 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 92
%45 = zext i1 %44 to i32
store i32 %45, i32* %10
%46 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%47 = load i32, i32* %10
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
store i8* %49, i8** %6
%50 = load i8*, i8** %6
%51 = call i64 @strlen(i8* %50)
store i64 %51, i64* %8
%52 = load i64, i64* %8
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %62
54: ; preds = %40
%55 = load i8*, i8** %6
%56 = load i64, i64* %8
%57 = sub i64 %56, 1
%58 = getelementptr inbounds i8, i8* %55, i64 %57
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = icmp ne i32 %60, 10
br i1 %61, label %62, label %71
62: ; preds = %54, %40
%63 = load i32, i32* @stderr
%64 = load i8*, i8** %3
%65 = load i32*, i32** %4
%66 = call i64 @feof(i32* %65)
%67 = icmp ne i64 %66, 0
%68 = zext i1 %67 to i64
%69 = select i1 %67, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0)
%70 = call i32 @fprintf(i32 %63, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %64, i8* %69)
store i32 -1, i32* %9
br label %152
71: ; preds = %54
%72 = load i8*, i8** %6
%73 = load i64, i64* %8
%74 = add i64 %73, -1
store i64 %74, i64* %8
%75 = getelementptr inbounds i8, i8* %72, i64 %74
store i8 0, i8* %75
%76 = load i64, i64* %8
%77 = icmp ne i64 %76, 0
br i1 %77, label %78, label %91
78: ; preds = %71
%79 = load i8*, i8** %6
%80 = load i64, i64* %8
%81 = sub i64 %80, 1
%82 = getelementptr inbounds i8, i8* %79, i64 %81
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = icmp eq i32 %84, 13
br i1 %85, label %86, label %91
86: ; preds = %78
%87 = load i8*, i8** %6
%88 = load i64, i64* %8
%89 = add i64 %88, -1
store i64 %89, i64* %8
%90 = getelementptr inbounds i8, i8* %87, i64 %89
store i8 0, i8* %90
br label %91
91: ; preds = %86, %78, %71
%92 = load i8*, i8** %6
%93 = load i8, i8* %92
%94 = icmp ne i8 %93, 0
br i1 %94, label %96, label %95
95: ; preds = %91
br label %35
96: ; preds = %91
%97 = load i64, i64* %8
%98 = icmp ult i64 %97, 42
br i1 %98, label %105, label %99
99: ; preds = %96
%100 = load i8*, i8** %6
%101 = getelementptr inbounds i8, i8* %100, i64 40
%102 = load i8, i8* %101
%103 = sext i8 %102 to i32
%104 = icmp ne i32 %103, 32
br i1 %104, label %105, label %109
105: ; preds = %99, %96
%106 = load i32, i32* @stderr
%107 = load i8*, i8** %3
%108 = call i32 @fprintf(i32 %106, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i8* %107, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %9
br label %35
109: ; preds = %99
%110 = load i8*, i8** %6
%111 = getelementptr inbounds i8, i8* %110, i64 40
store i8 0, i8* %111
%112 = load i8*, i8** %6
store i8* %112, i8** %7
br label %113
113: ; preds = %134, %109
%114 = load i8*, i8** %7
%115 = load i8, i8* %114
%116 = icmp ne i8 %115, 0
br i1 %116, label %117, label %137
117: ; preds = %113
%118 = load i8*, i8** %7
%119 = load i8, i8* %118
%120 = sext i8 %119 to i32
%121 = icmp sge i32 %120, 65
br i1 %121, label %122, label %133
122: ; preds = %117
%123 = load i8*, i8** %7
%124 = load i8, i8* %123
%125 = sext i8 %124 to i32
%126 = icmp sle i32 %125, 90
br i1 %126, label %127, label %133
127: ; preds = %122
%128 = load i8*, i8** %7
%129 = load i8, i8* %128
%130 = sext i8 %129 to i32
%131 = or i32 %130, 32
%132 = trunc i32 %131 to i8
store i8 %132, i8* %128
br label %133
133: ; preds = %127, %122, %117
br label %134
134: ; preds = %133
%135 = load i8*, i8** %7
%136 = getelementptr inbounds i8, i8* %135, i32 1
store i8* %136, i8** %7
br label %113
137: ; preds = %113
%138 = load i32, i32* %10
%139 = icmp ne i32 %138, 0
br i1 %139, label %140, label %144
140: ; preds = %137
%141 = load i8*, i8** %6
%142 = getelementptr inbounds i8, i8* %141, i64 42
%143 = call i32 @unescapefname(i8* %142)
br label %144
144: ; preds = %140, %137
%145 = load i8*, i8** %6
%146 = getelementptr inbounds i8, i8* %145, i64 42
%147 = load i8*, i8** %6
%148 = call i64 @hash_file(i8* %146, i8* %147)
%149 = icmp ne i64 %148, 0
br i1 %149, label %150, label %151
150: ; preds = %144
store i32 -1, i32* %9
br label %151
151: ; preds = %150, %144
br label %35
152: ; preds = %62, %35
%153 = load i32*, i32** %4
%154 = call i64 @ferror(i32* %153)
%155 = icmp ne i64 %154, 0
br i1 %155, label %156, label %162
156: ; preds = %152
%157 = load i32, i32* @stderr
%158 = load i8*, i8** %3
%159 = load i32, i32* @errno
%160 = call i8* @strerror(i32 %159)
%161 = call i32 @fprintf(i32 %157, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* %158, i8* %160)
store i32 -1, i32* %9
br label %162
162: ; preds = %156, %152
%163 = load i32*, i32** %4
%164 = load i32*, i32** @stdin
%165 = icmp ne i32* %163, %164
br i1 %165, label %166, label %169
166: ; preds = %162
%167 = load i32*, i32** %4
%168 = call i32 @fclose(i32* %167)
br label %169
169: ; preds = %166, %162
%170 = load i32, i32* %9
store i32 %170, i32* %2
br label %171
171: ; preds = %169, %28
%172 = load i32, i32* %2
ret i32 %172
}

LLVM IR (-O2):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [30 x i8] c"sha1sum: can't open `%s': %s\0A\00"
@errno = global i32 0
@.str.2 = [33 x i8] c"sha1sum: error reading `%s': %s\0A\00"
@.str.3 = [22 x i8] c"last linefeed missing\00"
@.str.4 = [14 x i8] c"line too long\00"
@.str.5 = [33 x i8] c"sha1sum: error parsing `%s': %s\0A\00"
@.str.6 = [13 x i8] c"invalid line\00"
@.str.7 = [32 x i8] c"sha1sum:error reading `%s': %s\0A\00"
define i32 @check_file(i8* %0) {
%2 = alloca [4096 x i8]
%3 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 45
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = load i32*, i32** @stdin
br label %14
12: ; preds = %6, %1
%13 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %10
%15 = phi i32* [ %13, %12 ], [ %11, %10 ]
%16 = icmp eq i32* %15, null
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = call i64 @fgets(i8* %3, i32 4095, i32* %15)
%19 = icmp eq i64 %18, 0
br i1 %19, label %97, label %74
20: ; preds = %14
%21 = load i32, i32* @stderr
%22 = load i32, i32* @errno
%23 = tail call i8* @strerror(i32 %22)
%24 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %23)
br label %112
25: ; preds = %74, %55
%26 = load i8, i8* %3
%27 = icmp eq i8 %26, 92
%28 = zext i1 %27 to i64
%29 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 %28
%30 = call i64 @strlen(i8* %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %37, label %32
32: ; preds = %25
%33 = add i64 %30, -1
%34 = getelementptr inbounds i8, i8* %29, i64 %33
%35 = load i8, i8* %34
%36 = icmp eq i8 %35, 10
br i1 %36, label %43, label %37
37: ; preds = %32, %25
%38 = load i32, i32* @stderr
%39 = call i64 @feof(i32* %15)
%40 = icmp eq i64 %39, 0
%41 = select i1 %40, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0)
%42 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %41)
br label %97
43: ; preds = %32
store i8 0, i8* %34
%44 = icmp eq i64 %33, 0
br i1 %44, label %58, label %45
45: ; preds = %43
%46 = add i64 %30, -2
%47 = getelementptr inbounds i8, i8* %29, i64 %46
%48 = load i8, i8* %47
%49 = icmp eq i8 %48, 13
br i1 %49, label %50, label %51
50: ; preds = %45
store i8 0, i8* %47
br label %51
51: ; preds = %50, %45
%52 = phi i64 [ %46, %50 ], [ %33, %45 ]
%53 = load i8, i8* %29
%54 = icmp eq i8 %53, 0
br i1 %54, label %55, label %61
55: ; preds = %51, %58
%56 = call i64 @fgets(i8* %3, i32 4095, i32* %15)
%57 = icmp eq i64 %56, 0
br i1 %57, label %97, label %25
58: ; preds = %43
%59 = load i8, i8* %29
%60 = icmp eq i8 %59, 0
br i1 %60, label %55, label %67
61: ; preds = %51
%62 = icmp ult i64 %52, 42
br i1 %62, label %67, label %63
63: ; preds = %61
%64 = getelementptr inbounds i8, i8* %29, i64 40
%65 = load i8, i8* %64
%66 = icmp eq i8 %65, 32
br i1 %66, label %76, label %67
67: ; preds = %58, %63, %61
%68 = load i32, i32* @stderr
%69 = call i32 @fprintf(i32 %68, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %70
70: ; preds = %67, %92
%71 = phi i32 [ %96, %92 ], [ -1, %67 ]
%72 = call i64 @fgets(i8* %3, i32 4095, i32* %15)
%73 = icmp eq i64 %72, 0
br i1 %73, label %97, label %74
74: ; preds = %17, %70
%75 = phi i32 [ %71, %70 ], [ 0, %17 ]
br label %25
76: ; preds = %63
store i8 0, i8* %64
br label %77
77: ; preds = %76, %84
%78 = phi i8 [ %86, %84 ], [ %53, %76 ]
%79 = phi i8* [ %85, %84 ], [ %29, %76 ]
%80 = add i8 %78, -65
%81 = icmp ult i8 %80, 26
br i1 %81, label %82, label %84
82: ; preds = %77
%83 = or i8 %78, 32
store i8 %83, i8* %79
br label %84
84: ; preds = %77, %82
%85 = getelementptr inbounds i8, i8* %79, i64 1
%86 = load i8, i8* %85
%87 = icmp eq i8 %86, 0
br i1 %87, label %88, label %77
88: ; preds = %84
br i1 %27, label %89, label %92
89: ; preds = %88
%90 = getelementptr inbounds i8, i8* %29, i64 42
%91 = call i32 @unescapefname(i8* %90)
br label %92
92: ; preds = %89, %88
%93 = getelementptr inbounds i8, i8* %29, i64 42
%94 = call i64 @hash_file(i8* %93, i8* %29)
%95 = icmp eq i64 %94, 0
%96 = select i1 %95, i32 %75, i32 -1
br label %70
97: ; preds = %70, %55, %17, %37
%98 = phi i32 [ -1, %37 ], [ 0, %17 ], [ %75, %55 ], [ %71, %70 ]
%99 = call i64 @ferror(i32* %15)
%100 = icmp eq i64 %99, 0
br i1 %100, label %106, label %101
101: ; preds = %97
%102 = load i32, i32* @stderr
%103 = load i32, i32* @errno
%104 = call i8* @strerror(i32 %103)
%105 = call i32 @fprintf(i32 %102, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* %0, i8* %104)
br label %106
106: ; preds = %101, %97
%107 = phi i32 [ -1, %101 ], [ %98, %97 ]
%108 = load i32*, i32** @stdin
%109 = icmp eq i32* %15, %108
br i1 %109, label %112, label %110
110: ; preds = %106
%111 = call i32 @fclose(i32* %15)
br label %112
112: ; preds = %106, %110, %20
%113 = phi i32 [ -1, %20 ], [ %107, %110 ], [ %107, %106 ]
ret i32 %113
}