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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ isspace(char);
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ stderr;
int strlen(char *);
void check_file(int *had_err, const char *fn, int dos, int trailing,
                int firstspace, int maxlen) {
  FILE *fp;
  int ln_nbr;
  char ln[4096];
  int msgs = 0;
  int max_msgs = 20;
  int length;
  int position = 2;
  int pos;
  if ((fp = fopen(fn, "r")) == NULL) {
    perror(fn);
    *had_err = 1;
    return;
  }
  ln_nbr = 1;
  while (fgets(ln, sizeof(ln), fp) != NULL) {
    length = strlen(ln);
    if (ln[length - 1] != '\n') {
      fprintf(stderr, "error: %s:%d: line is missing LF:\n%s\n", fn, ln_nbr,
              ln);
      *had_err = 1;
      ++msgs;
      continue;
    }
    pos = 0;
    for (int i = 0; i < length - 1; i++) {
      ++pos;
      if (ln[i] == '\t') {
        pos += (8 - pos % 8) % 8;
      }
    }
    if (pos > maxlen) {
      fprintf(stderr, "error: %s:%d: line too long (%d):\n%s\n", fn, ln_nbr,
              pos, ln);
      *had_err = 1;
      ++msgs;
    }
    if (firstspace) {
      if (ln[0] == ' ' && ln[1] != '*') {
        fprintf(stderr,
                "error: %s:%d: invalid indention (SP at column 1):"
                "\n%s\n",
                fn, ln_nbr, ln);
        *had_err = 1;
        ++msgs;
      }
    }
    if (trailing) {
      if (dos) {
        if (length > position && ln[length - 1] == '\n' &&
            ln[length - 2] == '\r') {
          position = 3;
        } else {
          position = 2;
        }
      }
      if (length > position && isspace(ln[length - position])) {
        fprintf(stderr,
                "error: %s:%d: trailing whitespace at end of line:"
                "\n%s\n",
                fn, ln_nbr, ln);
        *had_err = 1;
        ++msgs;
      }
    }
    ++ln_nbr;
    if (msgs == max_msgs) {
      fprintf(stderr, "reached max %d messages, not reporting more\n",
              max_msgs);
      goto done;
    }
  }
done:
  fclose(fp);
}


x86 assembly (clang, -O0):
<check_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1050,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
movl   $0x0,-0x1034(%rbp)
movl   $0x14,-0x1038(%rbp)
movl   $0x2,-0x1040(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe46(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    11e5 <check_file+0x75>
mov    -0x10(%rbp),%rdi
call   1090 <perror@plt>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
jmp    1517 <check_file+0x3a7>
movl   $0x1,-0x2c(%rbp)
lea    -0x1030(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x1000,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     1509 <check_file+0x399>
lea    -0x1030(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x103c(%rbp)
mov    -0x103c(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x1030(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
je     127c <check_file+0x10c>
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
lea    -0x1030(%rbp),%r8
lea    0xdab(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x1034(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1034(%rbp)
jmp    11ec <check_file+0x7c>
movl   $0x0,-0x1044(%rbp)
movl   $0x0,-0x1048(%rbp)
mov    -0x1048(%rbp),%eax
mov    -0x103c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1310 <check_file+0x1a0>
mov    -0x1044(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1044(%rbp)
movslq -0x1048(%rbp),%rax
movsbl -0x1030(%rbp,%rax,1),%eax
ff
cmp    $0x9,%eax
jne    12f7 <check_file+0x187>
mov    -0x1044(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x8,%eax
sub    %edx,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
add    -0x1044(%rbp),%edx
mov    %edx,-0x1044(%rbp)
jmp    12fc <check_file+0x18c>
mov    -0x1048(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1048(%rbp)
jmp    1290 <check_file+0x120>
mov    -0x1044(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1364 <check_file+0x1f4>
mov    0x2cba(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
mov    -0x1044(%rbp),%r8d
lea    -0x1030(%rbp),%r9
lea    0xce4(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x1034(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1034(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     13d1 <check_file+0x261>
movsbl -0x1030(%rbp),%eax
cmp    $0x20,%eax
jne    13cc <check_file+0x25c>
movsbl -0x102f(%rbp),%eax
cmp    $0x2a,%eax
je     13cc <check_file+0x25c>
mov    0x2c4b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
lea    -0x1030(%rbp),%r8
lea    0xca2(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x1034(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1034(%rbp)
jmp    13d1 <check_file+0x261>
cmpl   $0x0,-0x18(%rbp)
je     14c7 <check_file+0x357>
cmpl   $0x0,-0x14(%rbp)
je     144d <check_file+0x2dd>
mov    -0x103c(%rbp),%eax
cmp    -0x1040(%rbp),%eax
jle    143e <check_file+0x2ce>
mov    -0x103c(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x1030(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    143e <check_file+0x2ce>
mov    -0x103c(%rbp),%eax
sub    $0x2,%eax
cltq
movsbl -0x1030(%rbp,%rax,1),%eax
ff
cmp    $0xd,%eax
jne    143e <check_file+0x2ce>
movl   $0x3,-0x1040(%rbp)
jmp    1448 <check_file+0x2d8>
movl   $0x2,-0x1040(%rbp)
jmp    144d <check_file+0x2dd>
mov    -0x103c(%rbp),%eax
cmp    -0x1040(%rbp),%eax
jle    14c2 <check_file+0x352>
mov    -0x103c(%rbp),%eax
sub    -0x1040(%rbp),%eax
cltq
movsbl -0x1030(%rbp,%rax,1),%edi
ff
call   1050 <isspace@plt>
cmp    $0x0,%rax
je     14c2 <check_file+0x352>
mov    0x2b55(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
lea    -0x1030(%rbp),%r8
lea    0xbe2(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x1034(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1034(%rbp)
jmp    14c7 <check_file+0x357>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x1034(%rbp),%eax
cmp    -0x1038(%rbp),%eax
jne    1504 <check_file+0x394>
mov    0x2af7(%rip),%rax
mov    (%rax),%edi
mov    -0x1038(%rbp),%edx
lea    0xbc2(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    150e <check_file+0x39e>
jmp    11ec <check_file+0x7c>
jmp    150e <check_file+0x39e>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x1050,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1038,%rsp
mov    %r9d,0x2c(%rsp)
mov    %r8d,0x28(%rsp)
mov    %ecx,0x24(%rsp)
mov    %edx,0x20(%rsp)
mov    %rsi,%rbp
mov    %rdi,0x10(%rsp)
lea    0xe5e(%rip),%rsi
mov    %rbp,%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     1400 <check_file+0x290>
mov    %rax,%rbx
mov    $0x2,%ecx
lea    0x30(%rsp),%r15
xor    %r14d,%r14d
mov    $0x1,%r13d
mov    %ecx,0xc(%rsp)
nopl   (%rax)
mov    %r15,%rdi
mov    $0x1000,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     13e6 <check_file+0x276>
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %eax,%r12d
cltq
cmpb   $0xa,0x2f(%rsp,%rax,1)
je     1230 <check_file+0xc0>
mov    0x2ddc(%rip),%rax
mov    (%rax),%edi
lea    0xdf5(%rip),%rsi
mov    %rbp,%rdx
mov    %r13d,%ecx
mov    %r15,%r8
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x10(%rsp),%rax
movl   $0x1,(%rax)
add    $0x1,%r14d
jmp    11d0 <check_file+0x60>
xchg   %ax,%ax
lea    -0x1(%rax),%r9
xor    %r8d,%r8d
cmp    $0x2,%eax
mov    $0x1,%edi
jl     12a9 <check_file+0x139>
mov    %r9d,%eax
cmp    $0x1,%r9d
jne    1251 <check_file+0xe1>
xor    %ecx,%ecx
xor    %r8d,%r8d
jmp    1292 <check_file+0x122>
mov    %eax,%edx
and    $0xfffffffe,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
nopl   0x0(%rax,%rax,1)
mov    %r8d,%esi
or     $0xfffffff8,%esi
neg    %esi
cmpb   $0x9,0x30(%rsp,%rcx,1)
cmovne %edi,%esi
add    %r8d,%esi
mov    %esi,%r8d
or     $0xfffffff8,%r8d
neg    %r8d
cmpb   $0x9,0x31(%rsp,%rcx,1)
cmovne %edi,%r8d
add    %esi,%r8d
add    $0x2,%rcx
cmp    %rcx,%rdx
jne    1260 <check_file+0xf0>
test   $0x1,%al
je     12a9 <check_file+0x139>
mov    %r8d,%eax
or     $0xfffffff8,%eax
neg    %eax
cmpb   $0x9,0x30(%rsp,%rcx,1)
cmovne %edi,%eax
add    %eax,%r8d
cmp    0x2c(%rsp),%r8d
jle    12e9 <check_file+0x179>
mov    0x2d29(%rip),%rax
mov    (%rax),%edi
lea    0xd68(%rip),%rsi
mov    %rbp,%rdx
mov    %r13d,%ecx
mov    %r9,0x18(%rsp)
mov    %r15,%r9
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x18(%rsp),%r9
mov    0x10(%rsp),%rax
movl   $0x1,(%rax)
add    $0x1,%r14d
mov    0xc(%rsp),%ecx
cmpl   $0x0,0x28(%rsp)
je     133f <check_file+0x1cf>
cmpb   $0x20,0x30(%rsp)
jne    133f <check_file+0x1cf>
cmpb   $0x2a,0x31(%rsp)
je     133f <check_file+0x1cf>
mov    0x2cd7(%rip),%rax
mov    (%rax),%edi
lea    0xd3c(%rip),%rsi
mov    %rbp,%rdx
mov    %r13d,%ecx
mov    %r15,%r8
xor    %eax,%eax
mov    %r9,0x18(%rsp)
call   1070 <fprintf@plt>
mov    0x18(%rsp),%r9
mov    0xc(%rsp),%ecx
mov    0x10(%rsp),%rax
movl   $0x1,(%rax)
add    $0x1,%r14d
cmpl   $0x0,0x24(%rsp)
je     13bc <check_file+0x24c>
cmpl   $0x0,0x20(%rsp)
je     1370 <check_file+0x200>
cmp    %ecx,%r12d
jle    136b <check_file+0x1fb>
cmpb   $0xa,0x30(%rsp,%r9,1)
jne    136b <check_file+0x1fb>
lea    -0x2(%r12),%eax
mov    $0x3,%ecx
cmpb   $0xd,0x30(%rsp,%rax,1)
je     1370 <check_file+0x200>
mov    $0x2,%ecx
sub    %ecx,%r12d
jle    13bc <check_file+0x24c>
mov    %ecx,0xc(%rsp)
movsbl 0x30(%rsp,%r12,1),%edi
call   1050 <isspace@plt>
test   %rax,%rax
je     13b8 <check_file+0x248>
mov    0x2c50(%rip),%rax
mov    (%rax),%edi
lea    0xceb(%rip),%rsi
mov    %rbp,%rdx
mov    %r13d,%ecx
mov    %r15,%r8
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x10(%rsp),%rax
movl   $0x1,(%rax)
add    $0x1,%r14d
mov    0xc(%rsp),%ecx
add    $0x1,%r13d
cmp    $0x14,%r14d
jne    11c9 <check_file+0x59>
mov    0x2c0f(%rip),%rax
mov    (%rax),%edi
lea    0xce0(%rip),%rsi
mov    $0x14,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x1038,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbp,%rdi
call   1090 <perror@plt>
mov    0x10(%rsp),%rax
movl   $0x1,(%rax)
jmp    13ee <check_file+0x27e>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [38 x i8] c"error: %s:%d: line is missing LF:\0A%s\0A\00"
@.str.2 = [38 x i8] c"error: %s:%d: line too long (%d):\0A%s\0A\00"
@.str.3 = [54 x i8] c"error: %s:%d: invalid indention (SP at column 1):\0A%s\0A\00"
@.str.4 = [54 x i8] c"error: %s:%d: trailing whitespace at end of line:\0A%s\0A\00"
@.str.5 = [45 x i8] c"reached max %d messages, not reporting more\0A\00"
define void @check_file(i32* %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i32
%15 = alloca [4096 x i8]
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
store i32* %0, i32** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
store i32 0, i32* %16
store i32 20, i32* %17
store i32 2, i32* %19
%22 = load i8*, i8** %8
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %23, i32** %13
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %29
25: ; preds = %6
%26 = load i8*, i8** %8
%27 = call i32 @perror(i8* %26)
%28 = load i32*, i32** %7
store i32 1, i32* %28
br label %184
29: ; preds = %6
store i32 1, i32* %14
br label %30
30: ; preds = %179, %45, %29
%31 = getelementptr inbounds [4096 x i8], [4096 x i8]* %15, i64 0, i64 0
%32 = load i32*, i32** %13
%33 = call i32* @fgets(i8* %31, i32 4096, i32* %32)
%34 = icmp ne i32* %33, null
br i1 %34, label %35, label %180
35: ; preds = %30
%36 = getelementptr inbounds [4096 x i8], [4096 x i8]* %15, i64 0, i64 0
%37 = call i32 @strlen(i8* %36)
store i32 %37, i32* %18
%38 = load i32, i32* %18
%39 = sub nsw i32 %38, 1
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [4096 x i8], [4096 x i8]* %15, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp ne i32 %43, 10
br i1 %44, label %45, label %54
45: ; preds = %35
%46 = load i32, i32* @stderr
%47 = load i8*, i8** %8
%48 = load i32, i32* %14
%49 = getelementptr inbounds [4096 x i8], [4096 x i8]* %15, i64 0, i64 0
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %47, i32 %48, i8* %49)
%51 = load i32*, i32** %7
store i32 1, i32* %51
%52 = load i32, i32* %16
%53 = add nsw i32 %52, 1
store i32 %53, i32* %16
br label %30
54: ; preds = %35
store i32 0, i32* %20
store i32 0, i32* %21
br label %55
55: ; preds = %77, %54
%56 = load i32, i32* %21
%57 = load i32, i32* %18
%58 = sub nsw i32 %57, 1
%59 = icmp slt i32 %56, %58
br i1 %59, label %60, label %80
60: ; preds = %55
%61 = load i32, i32* %20
%62 = add nsw i32 %61, 1
store i32 %62, i32* %20
%63 = load i32, i32* %21
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [4096 x i8], [4096 x i8]* %15, i64 0, i64 %64
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = icmp eq i32 %67, 9
br i1 %68, label %69, label %76
69: ; preds = %60
%70 = load i32, i32* %20
%71 = srem i32 %70, 8
%72 = sub nsw i32 8, %71
%73 = srem i32 %72, 8
%74 = load i32, i32* %20
%75 = add nsw i32 %74, %73
store i32 %75, i32* %20
br label %76
76: ; preds = %69, %60
br label %77
77: ; preds = %76
%78 = load i32, i32* %21
%79 = add nsw i32 %78, 1
store i32 %79, i32* %21
br label %55
80: ; preds = %55
%81 = load i32, i32* %20
%82 = load i32, i32* %12
%83 = icmp sgt i32 %81, %82
br i1 %83, label %84, label %94
84: ; preds = %80
%85 = load i32, i32* @stderr
%86 = load i8*, i8** %8
%87 = load i32, i32* %14
%88 = load i32, i32* %20
%89 = getelementptr inbounds [4096 x i8], [4096 x i8]* %15, i64 0, i64 0
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %86, i32 %87, i32 %88, i8* %89)
%91 = load i32*, i32** %7
store i32 1, i32* %91
%92 = load i32, i32* %16
%93 = add nsw i32 %92, 1
store i32 %93, i32* %16
br label %94
94: ; preds = %84, %80
%95 = load i32, i32* %11
%96 = icmp ne i32 %95, 0
br i1 %96, label %97, label %117
97: ; preds = %94
%98 = getelementptr inbounds [4096 x i8], [4096 x i8]* %15, i64 0, i64 0
%99 = load i8, i8* %98
%100 = sext i8 %99 to i32
%101 = icmp eq i32 %100, 32
br i1 %101, label %102, label %116
102: ; preds = %97
%103 = getelementptr inbounds [4096 x i8], [4096 x i8]* %15, i64 0, i64 1
%104 = load i8, i8* %103
%105 = sext i8 %104 to i32
%106 = icmp ne i32 %105, 42
br i1 %106, label %107, label %116
107: ; preds = %102
%108 = load i32, i32* @stderr
%109 = load i8*, i8** %8
%110 = load i32, i32* %14
%111 = getelementptr inbounds [4096 x i8], [4096 x i8]* %15, i64 0, i64 0
%112 = call i32 (i32, i8*, ...) @fprintf(i32 %108, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i8* %109, i32 %110, i8* %111)
%113 = load i32*, i32** %7
store i32 1, i32* %113
%114 = load i32, i32* %16
%115 = add nsw i32 %114, 1
store i32 %115, i32* %16
br label %116
116: ; preds = %107, %102, %97
br label %117
117: ; preds = %116, %94
%118 = load i32, i32* %10
%119 = icmp ne i32 %118, 0
br i1 %119, label %120, label %169
120: ; preds = %117
%121 = load i32, i32* %9
%122 = icmp ne i32 %121, 0
br i1 %122, label %123, label %146
123: ; preds = %120
%124 = load i32, i32* %18
%125 = load i32, i32* %19
%126 = icmp sgt i32 %124, %125
br i1 %126, label %127, label %144
127: ; preds = %123
%128 = load i32, i32* %18
%129 = sub nsw i32 %128, 1
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds [4096 x i8], [4096 x i8]* %15, i64 0, i64 %130
%132 = load i8, i8* %131
%133 = sext i8 %132 to i32
%134 = icmp eq i32 %133, 10
br i1 %134, label %135, label %144
135: ; preds = %127
%136 = load i32, i32* %18
%137 = sub nsw i32 %136, 2
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds [4096 x i8], [4096 x i8]* %15, i64 0, i64 %138
%140 = load i8, i8* %139
%141 = sext i8 %140 to i32
%142 = icmp eq i32 %141, 13
br i1 %142, label %143, label %144
143: ; preds = %135
store i32 3, i32* %19
br label %145
144: ; preds = %135, %127, %123
store i32 2, i32* %19
br label %145
145: ; preds = %144, %143
br label %146
146: ; preds = %145, %120
%147 = load i32, i32* %18
%148 = load i32, i32* %19
%149 = icmp sgt i32 %147, %148
br i1 %149, label %150, label %168
150: ; preds = %146
%151 = load i32, i32* %18
%152 = load i32, i32* %19
%153 = sub nsw i32 %151, %152
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds [4096 x i8], [4096 x i8]* %15, i64 0, i64 %154
%156 = load i8, i8* %155
%157 = call i64 @isspace(i8 signext %156)
%158 = icmp ne i64 %157, 0
br i1 %158, label %159, label %168
159: ; preds = %150
%160 = load i32, i32* @stderr
%161 = load i8*, i8** %8
%162 = load i32, i32* %14
%163 = getelementptr inbounds [4096 x i8], [4096 x i8]* %15, i64 0, i64 0
%164 = call i32 (i32, i8*, ...) @fprintf(i32 %160, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i8* %161, i32 %162, i8* %163)
%165 = load i32*, i32** %7
store i32 1, i32* %165
%166 = load i32, i32* %16
%167 = add nsw i32 %166, 1
store i32 %167, i32* %16
br label %168
168: ; preds = %159, %150, %146
br label %169
169: ; preds = %168, %117
%170 = load i32, i32* %14
%171 = add nsw i32 %170, 1
store i32 %171, i32* %14
%172 = load i32, i32* %16
%173 = load i32, i32* %17
%174 = icmp eq i32 %172, %173
br i1 %174, label %175, label %179
175: ; preds = %169
%176 = load i32, i32* @stderr
%177 = load i32, i32* %17
%178 = call i32 (i32, i8*, ...) @fprintf(i32 %176, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i32 %177)
br label %181
179: ; preds = %169
br label %30
180: ; preds = %30
br label %181
181: ; preds = %180, %175
%182 = load i32*, i32** %13
%183 = call i32 @fclose(i32* %182)
br label %184
184: ; preds = %181, %25
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [38 x i8] c"error: %s:%d: line is missing LF:\0A%s\0A\00"
@.str.2 = [38 x i8] c"error: %s:%d: line too long (%d):\0A%s\0A\00"
@.str.3 = [54 x i8] c"error: %s:%d: invalid indention (SP at column 1):\0A%s\0A\00"
@.str.4 = [54 x i8] c"error: %s:%d: trailing whitespace at end of line:\0A%s\0A\00"
@.str.5 = [45 x i8] c"reached max %d messages, not reporting more\0A\00"
define void @check_file(i32* nocapture writeonly %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca [4096 x i8]
%8 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%9 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %16, label %11
11: ; preds = %6
%12 = icmp eq i32 %4, 0
%13 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 1
%14 = icmp eq i32 %3, 0
%15 = icmp eq i32 %2, 0
br label %129
16: ; preds = %6
%17 = tail call i32 @perror(i8* %1)
store i32 1, i32* %0
br label %140
18: ; preds = %129, %35
%19 = phi i32 [ %38, %35 ], [ %130, %129 ]
%20 = call i32 @strlen(i8* %8)
%21 = add nsw i32 %20, -1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 10
br i1 %25, label %26, label %35
26: ; preds = %18
%27 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 %22
%28 = icmp sgt i32 %20, 1
br i1 %28, label %29, label %54
29: ; preds = %26
%30 = zext i32 %21 to i64
%31 = and i64 %30, 1
%32 = icmp eq i32 %21, 1
br i1 %32, label %41, label %33
33: ; preds = %29
%34 = and i64 %30, 4294967294
br label %57
35: ; preds = %18
%36 = load i32, i32* @stderr
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %1, i32 %131, i8* %8)
store i32 1, i32* %0
%38 = add nsw i32 %19, 1
%39 = call i32* @fgets(i8* %8, i32 4096, i32* %9)
%40 = icmp eq i32* %39, null
br i1 %40, label %138, label %18
41: ; preds = %57, %29
%42 = phi i32 [ undef, %29 ], [ %75, %57 ]
%43 = phi i64 [ 0, %29 ], [ %76, %57 ]
%44 = phi i32 [ 0, %29 ], [ %75, %57 ]
%45 = icmp eq i64 %31, 0
br i1 %45, label %54, label %46
46: ; preds = %41
%47 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 %43
%48 = load i8, i8* %47
%49 = icmp eq i8 %48, 9
%50 = or i32 %44, -8
%51 = sub nsw i32 0, %50
%52 = select i1 %49, i32 %51, i32 1
%53 = add i32 %44, %52
br label %54
54: ; preds = %46, %41, %26
%55 = phi i32 [ 0, %26 ], [ %42, %41 ], [ %53, %46 ]
%56 = icmp sgt i32 %55, %5
br i1 %56, label %79, label %83
57: ; preds = %57, %33
%58 = phi i64 [ 0, %33 ], [ %76, %57 ]
%59 = phi i32 [ 0, %33 ], [ %75, %57 ]
%60 = phi i64 [ 0, %33 ], [ %77, %57 ]
%61 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 %58
%62 = load i8, i8* %61
%63 = icmp eq i8 %62, 9
%64 = or i32 %59, -8
%65 = sub nsw i32 0, %64
%66 = select i1 %63, i32 %65, i32 1
%67 = add i32 %59, %66
%68 = or i64 %58, 1
%69 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 %68
%70 = load i8, i8* %69
%71 = icmp eq i8 %70, 9
%72 = or i32 %67, -8
%73 = sub nsw i32 0, %72
%74 = select i1 %71, i32 %73, i32 1
%75 = add i32 %67, %74
%76 = add nuw nsw i64 %58, 2
%77 = add i64 %60, 2
%78 = icmp eq i64 %77, %34
br i1 %78, label %41, label %57
79: ; preds = %54
%80 = load i32, i32* @stderr
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %1, i32 %131, i32 %55, i8* %8)
store i32 1, i32* %0
%82 = add nsw i32 %19, 1
br label %83
83: ; preds = %79, %54
%84 = phi i32 [ %82, %79 ], [ %19, %54 ]
br i1 %12, label %95, label %85
85: ; preds = %83
%86 = load i8, i8* %8
%87 = icmp eq i8 %86, 32
%88 = load i8, i8* %13
%89 = icmp ne i8 %88, 42
%90 = select i1 %87, i1 %89, i1 false
br i1 %90, label %91, label %95
91: ; preds = %85
%92 = load i32, i32* @stderr
%93 = call i32 (i32, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i8* %1, i32 %131, i8* %8)
store i32 1, i32* %0
%94 = add nsw i32 %84, 1
br label %95
95: ; preds = %85, %91, %83
%96 = phi i32 [ %94, %91 ], [ %84, %85 ], [ %84, %83 ]
br i1 %14, label %124, label %97
97: ; preds = %95
br i1 %15, label %110, label %98
98: ; preds = %97
%99 = icmp sgt i32 %20, %132
br i1 %99, label %100, label %109
100: ; preds = %98
%101 = load i8, i8* %27
%102 = icmp eq i8 %101, 10
br i1 %102, label %103, label %109
103: ; preds = %100
%104 = add nsw i32 %20, -2
%105 = zext i32 %104 to i64
%106 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 %105
%107 = load i8, i8* %106
%108 = icmp eq i8 %107, 13
br i1 %108, label %110, label %109
109: ; preds = %103, %100, %98
br label %110
110: ; preds = %103, %109, %97
%111 = phi i32 [ 2, %109 ], [ %132, %97 ], [ 3, %103 ]
%112 = icmp sgt i32 %20, %111
br i1 %112, label %113, label %124
113: ; preds = %110
%114 = sub nsw i32 %20, %111
%115 = zext i32 %114 to i64
%116 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 %115
%117 = load i8, i8* %116
%118 = call i64 @isspace(i8 signext %117)
%119 = icmp eq i64 %118, 0
br i1 %119, label %124, label %120
120: ; preds = %113
%121 = load i32, i32* @stderr
%122 = call i32 (i32, i8*, ...) @fprintf(i32 %121, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i8* %1, i32 %131, i8* %8)
store i32 1, i32* %0
%123 = add nsw i32 %96, 1
br label %124
124: ; preds = %110, %113, %120, %95
%125 = phi i32 [ %123, %120 ], [ %96, %113 ], [ %96, %110 ], [ %96, %95 ]
%126 = phi i32 [ %111, %120 ], [ %111, %113 ], [ %111, %110 ], [ %132, %95 ]
%127 = add nuw nsw i32 %131, 1
%128 = icmp eq i32 %125, 20
br i1 %128, label %135, label %129
129: ; preds = %11, %124
%130 = phi i32 [ 0, %11 ], [ %125, %124 ]
%131 = phi i32 [ 1, %11 ], [ %127, %124 ]
%132 = phi i32 [ 2, %11 ], [ %126, %124 ]
%133 = call i32* @fgets(i8* %8, i32 4096, i32* %9)
%134 = icmp eq i32* %133, null
br i1 %134, label %138, label %18
135: ; preds = %124
%136 = load i32, i32* @stderr
%137 = call i32 (i32, i8*, ...) @fprintf(i32 %136, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i32 20)
br label %138
138: ; preds = %129, %35, %135
%139 = call i32 @fclose(i32* %9)
br label %140
140: ; preds = %138, %16
ret void
}