#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, char *, int);
int main(int argc, char *argv[]) {
  char line[1024];
  int i;
  for (i = 1; i < argc; ++i) {
    if (argv[i][0] == '-') {
      if (argv[i][1] == 'o')
        ++i;
    } else {
      FILE *f = fopen(argv[i], "r");
      int k = 0;
      while (fgets(line, 1024, f)) {
        ++k;
        printf("%s:\n  %d error 615\n", argv[i], k);
      }
      fclose(f);
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x414(%rbp)
mov    -0x414(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1265 <main+0x125>
mov    -0x10(%rbp),%rax
movslq -0x414(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11bd <main+0x7d>
mov    -0x10(%rbp),%rax
movslq -0x414(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl 0x1(%rax),%eax
cmp    $0x6f,%eax
jne    11b8 <main+0x78>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    124c <main+0x10c>
mov    -0x10(%rbp),%rax
movslq -0x414(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe2d(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x420(%rbp)
movl   $0x0,-0x424(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x420(%rbp),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     1240 <main+0x100>
mov    -0x424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x424(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x414(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x424(%rbp),%edx
lea    0xdcc(%rip),%rdi
call   1040 <printf@plt>
jmp    11e9 <main+0xa9>
mov    -0x420(%rbp),%rdi
call   1030 <fclose@plt>
jmp    1251 <main+0x111>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    1163 <main+0x23>
mov    $0x1,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
cmp    $0x2,%edi
jl     120a <main+0xca>
mov    %rsi,%rbx
mov    %edi,%ecx
mov    $0x1,%edx
lea    0x10(%rsp),%r15
lea    0xe92(%rip),%r13
mov    %edi,0x8(%rsp)
jmp    1192 <main+0x52>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
cmpb   $0x6f,0x1(%rdi)
sete   %al
add    %eax,%edx
add    $0x1,%edx
cmp    %ecx,%edx
jge    120a <main+0xca>
movslq %edx,%r12
mov    (%rbx,%r12,8),%rdi
cmpb   $0x2d,(%rdi)
je     1180 <main+0x40>
mov    %edx,0xc(%rsp)
lea    0xe57(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbp
mov    %r15,%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     11f8 <main+0xb8>
mov    $0x1,%r14d
nopl   0x0(%rax)
mov    (%rbx,%r12,8),%rsi
mov    %r13,%rdi
mov    %r14d,%edx
call   1040 <printf@plt>
mov    %r15,%rdi
mov    $0x400,%esi
mov    %rbp,%rdx
call   1050 <fgets@plt>
add    $0x1,%r14d
test   %rax,%rax
jne    11d0 <main+0x90>
mov    %rbp,%rdi
call   1030 <fclose@plt>
mov    0x8(%rsp),%ecx
mov    0xc(%rsp),%edx
jmp    118b <main+0x4b>
mov    $0x1,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [20 x i8] c"%s:\0A %d error 615\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %7
br label %10
10: ; preds = %64, %2
%11 = load i32, i32* %7
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %67
14: ; preds = %10
%15 = load i8**, i8*** %5
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 45
br i1 %23, label %24, label %38
24: ; preds = %14
%25 = load i8**, i8*** %5
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = getelementptr inbounds i8, i8* %29, i64 1
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 111
br i1 %33, label %34, label %37
34: ; preds = %24
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %37
37: ; preds = %34, %24
br label %63
38: ; preds = %14
%39 = load i8**, i8*** %5
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %39, i64 %41
%43 = load i8*, i8** %42
%44 = call i32* @fopen(i8* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %44, i32** %8
store i32 0, i32* %9
br label %45
45: ; preds = %50, %38
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%47 = load i32*, i32** %8
%48 = call i64 @fgets(i8* %46, i32 1024, i32* %47)
%49 = icmp ne i64 %48, 0
br i1 %49, label %50, label %60
50: ; preds = %45
%51 = load i32, i32* %9
%52 = add nsw i32 %51, 1
store i32 %52, i32* %9
%53 = load i8**, i8*** %5
%54 = load i32, i32* %7
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8*, i8** %53, i64 %55
%57 = load i8*, i8** %56
%58 = load i32, i32* %9
%59 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %57, i32 %58)
br label %45
60: ; preds = %45
%61 = load i32*, i32** %8
%62 = call i32 @fclose(i32* %61)
br label %63
63: ; preds = %60, %37
br label %64
64: ; preds = %63
%65 = load i32, i32* %7
%66 = add nsw i32 %65, 1
store i32 %66, i32* %7
br label %10
67: ; preds = %10
ret i32 1
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [20 x i8] c"%s:\0A %d error 615\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 sgt i32 %0, 1
br i1 %5, label %6, label %36
6: ; preds = %2, %32
%7 = phi i32 [ %34, %32 ], [ 1, %2 ]
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 45
br i1 %12, label %13, label %19
13: ; preds = %6
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 111
%17 = zext i1 %16 to i32
%18 = add nsw i32 %7, %17
br label %32
19: ; preds = %6
%20 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%21 = call i64 @fgets(i8* %4, i32 1024, i32* %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %30, label %23
23: ; preds = %19, %23
%24 = phi i32 [ %25, %23 ], [ 0, %19 ]
%25 = add nuw nsw i32 %24, 1
%26 = load i8*, i8** %9
%27 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %26, i32 %25)
%28 = call i64 @fgets(i8* %4, i32 1024, i32* %20)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %23
30: ; preds = %23, %19
%31 = call i32 @fclose(i32* %20)
br label %32
32: ; preds = %13, %30
%33 = phi i32 [ %7, %30 ], [ %18, %13 ]
%34 = add nsw i32 %33, 1
%35 = icmp slt i32 %34, %0
br i1 %35, label %6, label %36
36: ; preds = %32, %2
ret i32 1
}