#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*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  int total, file, i;
  FILE *fd, *lfd;
  char buf[1024], lfb[256];
  char *s;
  if (argc < 2) {
    fd = stdin;
    file = 0;
    while (fgets(buf, 1023, fd))
      file++;
    printf("%d\n", file);
    return (0);
  }
  if (!strcmp(argv[1], "-l")) {
    lfd = NULL;
    if (!strcmp(argv[2], "-"))
      lfd = stdin;
    if (!lfd)
      lfd = fopen(argv[2], "rt");
    if (!lfd) {
      printf("%s: can't open list %s\n", argv[0], argv[2]);
      return (-1);
    }
    total = 0;
    while (!feof(lfd)) {
      memset(lfb, 0, 256);
      fgets(lfb, 255, lfd);
      s = lfb;
      while (*s) {
        if (*s > ' ')
          break;
        s++;
      }
      if (!*s)
        continue;
      while (*s > ' ')
        s++;
      *s = 0;
      file = 0;
      fd = fopen(lfb, "rt");
      if (!fd)
        continue;
      while (fgets(buf, 1023, fd))
        file++;
      fclose(fd);
      total += file;
    }
    printf("total %d\n", total);
    return (0);
  }
  total = 0;
  for (i = 1; i < argc; i++) {
    file = 0;
    fd = fopen(argv[i], "rt");
    if (!fd)
      continue;
    while (fgets(buf, 1023, fd))
      file++;
    fclose(fd);
    printf("%s %d\n", argv[i], file);
    total += file;
  }
  printf("total %d in %d files\n", total, argc - 1);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x540,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11f2 <main+0x82>
mov    0x2e4e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x430(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x3ff,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     11d5 <main+0x65>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a8 <main+0x38>
mov    -0x18(%rbp),%esi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14ef <main+0x37f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdff(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1415 <main+0x2a5>
movq   $0x0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xddd(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1242 <main+0xd2>
mov    0x2dad(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1265 <main+0xf5>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xda9(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1299 <main+0x129>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xd82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14ef <main+0x37f>
movl   $0x0,-0x14(%rbp)
mov    -0x30(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12be <main+0x14e>
jmp    13f8 <main+0x288>
lea    -0x530(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
lea    -0x530(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    $0xff,%esi
call   1060 <fgets@plt>
lea    -0x530(%rbp),%rax
mov    %rax,-0x538(%rbp)
mov    -0x538(%rbp),%rax
cmpb   $0x0,(%rax)
je     1333 <main+0x1c3>
mov    -0x538(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jle    131c <main+0x1ac>
jmp    1333 <main+0x1c3>
mov    -0x538(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x538(%rbp)
jmp    12f4 <main+0x184>
mov    -0x538(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1348 <main+0x1d8>
jmp    12a0 <main+0x130>
jmp    134d <main+0x1dd>
mov    -0x538(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jle    1377 <main+0x207>
mov    -0x538(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x538(%rbp)
jmp    134d <main+0x1dd>
mov    -0x538(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x0,-0x18(%rbp)
lea    -0x530(%rbp),%rdi
lea    0xc6f(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    13af <main+0x23f>
jmp    12a0 <main+0x130>
jmp    13b4 <main+0x244>
lea    -0x430(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x3ff,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     13e1 <main+0x271>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    13b4 <main+0x244>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    12a0 <main+0x130>
mov    -0x14(%rbp),%esi
lea    0xc1e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14ef <main+0x37f>
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    14d1 <main+0x361>
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xbbc(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1462 <main+0x2f2>
jmp    14c3 <main+0x353>
jmp    1467 <main+0x2f7>
lea    -0x430(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x3ff,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     1494 <main+0x324>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1467 <main+0x2f7>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x18(%rbp),%edx
lea    0xb77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1423 <main+0x2b3>
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
lea    0xb50(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x540,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x528,%rsp
cmp    $0x1,%edi
jg     11c9 <main+0x59>
mov    0x2e5b(%rip),%rax
mov    (%rax),%rbp
mov    $0xffffffff,%ebx
lea    0x120(%rsp),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    $0x3ff,%esi
mov    %rbp,%rdx
call   1060 <fgets@plt>
add    $0x1,%ebx
test   %rax,%rax
jne    11a0 <main+0x30>
lea    0xe67(%rip),%rdi
xor    %r14d,%r14d
mov    %ebx,%esi
jmp    1302 <main+0x192>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%r15
lea    0xe27(%rip),%rsi
mov    %r15,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
mov    %rbx,0x8(%rsp)
je     12a4 <main+0x134>
mov    %ebp,0x14(%rsp)
mov    %ebp,%eax
mov    %rax,0x18(%rsp)
mov    $0x1,%r12d
lea    0x120(%rsp),%r14
xor    %r13d,%r13d
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
lea    0xdeb(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     1270 <main+0x100>
mov    %rax,%rbp
mov    $0xffffffff,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    $0x3ff,%esi
mov    %rbp,%rdx
call   1060 <fgets@plt>
add    $0x1,%ebx
test   %rax,%rax
jne    1230 <main+0xc0>
mov    %rbp,%rdi
call   1030 <fclose@plt>
mov    0x8(%rsp),%rbp
mov    0x0(%rbp,%r12,8),%rsi
lea    0xdc9(%rip),%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebx,%r13d
jmp    1275 <main+0x105>
nop
mov    0x8(%rsp),%rbp
add    $0x1,%r12
cmp    0x18(%rsp),%r12
je     1287 <main+0x117>
mov    0x0(%rbp,%r12,8),%r15
jmp    1210 <main+0xa0>
mov    0x14(%rsp),%edx
add    $0xffffffff,%edx
lea    0xd9c(%rip),%rdi
xor    %r14d,%r14d
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1309 <main+0x199>
mov    0x10(%rbx),%rbp
lea    0xd54(%rip),%rsi
mov    %rbp,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
jne    12ca <main+0x15a>
mov    0x2d26(%rip),%rax
mov    (%rax),%rbx
test   %rbx,%rbx
jne    12e5 <main+0x175>
lea    0xd34(%rip),%rsi
mov    %rbp,%rdi
call   1090 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     13fa <main+0x28a>
mov    %rbx,%rdi
call   1080 <feof@plt>
xor    %r14d,%r14d
mov    $0x0,%ebp
test   %eax,%eax
je     131e <main+0x1ae>
lea    0xd20(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14d,%eax
add    $0x528,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
lea    0x1f(%rsp),%r13
lea    0x20(%rsp),%r15
jmp    1356 <main+0x1e6>
nopl   0x0(%rax)
mov    %rax,%rcx
movb   $0x0,(%rcx)
mov    %r15,%rdi
lea    0xcc5(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
jne    13af <main+0x23f>
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    12f9 <main+0x189>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
mov    %r15,%rdi
mov    $0xff,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
mov    %r13,%rax
nopl   0x0(%rax,%rax,1)
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
je     1391 <main+0x221>
cmp    $0x21,%cl
jl     1380 <main+0x210>
test   %cl,%cl
je     134a <main+0x1da>
cmp    $0x21,%cl
jl     1330 <main+0x1c0>
nopw   0x0(%rax,%rax,1)
lea    0x1(%rax),%rcx
cmpb   $0x20,0x1(%rax)
mov    %rcx,%rax
jg     13a0 <main+0x230>
jmp    1333 <main+0x1c3>
mov    %rax,%r12
add    $0xffffffff,%ebp
lea    0x120(%rsp),%r13
nopl   (%rax)
mov    %r13,%rdi
mov    $0x3ff,%esi
mov    %r12,%rdx
call   1060 <fgets@plt>
add    $0x1,%ebp
test   %rax,%rax
jne    13c0 <main+0x250>
mov    %r12,%rdi
call   1030 <fclose@plt>
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %eax,%eax
lea    0x1f(%rsp),%r13
je     1356 <main+0x1e6>
jmp    12f9 <main+0x189>
mov    0x8(%rsp),%rax
mov    (%rax),%rsi
mov    0x10(%rax),%rdx
lea    0xbfb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%r14d
jmp    1309 <main+0x199>

LLVM IR (-O0):
@stdin = global i32* null
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [3 x i8] c"-l\00"
@.str.2 = [2 x i8] c"-\00"
@.str.3 = [3 x i8] c"rt\00"
@.str.4 = [24 x i8] c"%s: can't open list %s\0A\00"
@.str.5 = [10 x i8] c"total %d\0A\00"
@.str.6 = [7 x i8] c"%s %d\0A\00"
@.str.7 = [22 x i8] c"total %d in %d files\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 i32
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca [1024 x i8]
%12 = alloca [256 x i8]
%13 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 2
br i1 %15, label %16, label %29
16: ; preds = %2
%17 = load i32*, i32** @stdin
store i32* %17, i32** %9
store i32 0, i32* %7
br label %18
18: ; preds = %23, %16
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%20 = load i32*, i32** %9
%21 = call i64 @fgets(i8* %19, i32 1023, i32* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %18
26: ; preds = %18
%27 = load i32, i32* %7
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
store i32 0, i32* %3
br label %172
29: ; preds = %2
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %127, label %35
35: ; preds = %29
store i32* null, i32** %10
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i32 @strcmp(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%40 = icmp ne i32 %39, 0
br i1 %40, label %43, label %41
41: ; preds = %35
%42 = load i32*, i32** @stdin
store i32* %42, i32** %10
br label %43
43: ; preds = %41, %35
%44 = load i32*, i32** %10
%45 = icmp ne i32* %44, null
br i1 %45, label %51, label %46
46: ; preds = %43
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 2
%49 = load i8*, i8** %48
%50 = call i32* @fopen(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %50, i32** %10
br label %51
51: ; preds = %46, %43
%52 = load i32*, i32** %10
%53 = icmp ne i32* %52, null
br i1 %53, label %62, label %54
54: ; preds = %51
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 0
%57 = load i8*, i8** %56
%58 = load i8**, i8*** %5
%59 = getelementptr inbounds i8*, i8** %58, i64 2
%60 = load i8*, i8** %59
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %57, i8* %60)
store i32 -1, i32* %3
br label %172
62: ; preds = %51
store i32 0, i32* %6
br label %63
63: ; preds = %118, %108, %92, %62
%64 = load i32*, i32** %10
%65 = call i32 @feof(i32* %64)
%66 = icmp ne i32 %65, 0
%67 = xor i1 %66, true
br i1 %67, label %68, label %124
68: ; preds = %63
%69 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%70 = call i32 @memset(i8* %69, i32 0, i32 256)
%71 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%72 = load i32*, i32** %10
%73 = call i64 @fgets(i8* %71, i32 255, i32* %72)
%74 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
store i8* %74, i8** %13
br label %75
75: ; preds = %85, %68
%76 = load i8*, i8** %13
%77 = load i8, i8* %76
%78 = icmp ne i8 %77, 0
br i1 %78, label %79, label %88
79: ; preds = %75
%80 = load i8*, i8** %13
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = icmp sgt i32 %82, 32
br i1 %83, label %84, label %85
84: ; preds = %79
br label %88
85: ; preds = %79
%86 = load i8*, i8** %13
%87 = getelementptr inbounds i8, i8* %86, i32 1
store i8* %87, i8** %13
br label %75
88: ; preds = %84, %75
%89 = load i8*, i8** %13
%90 = load i8, i8* %89
%91 = icmp ne i8 %90, 0
br i1 %91, label %93, label %92
92: ; preds = %88
br label %63
93: ; preds = %88
br label %94
94: ; preds = %99, %93
%95 = load i8*, i8** %13
%96 = load i8, i8* %95
%97 = sext i8 %96 to i32
%98 = icmp sgt i32 %97, 32
br i1 %98, label %99, label %102
99: ; preds = %94
%100 = load i8*, i8** %13
%101 = getelementptr inbounds i8, i8* %100, i32 1
store i8* %101, i8** %13
br label %94
102: ; preds = %94
%103 = load i8*, i8** %13
store i8 0, i8* %103
store i32 0, i32* %7
%104 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%105 = call i32* @fopen(i8* %104, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %105, i32** %9
%106 = load i32*, i32** %9
%107 = icmp ne i32* %106, null
br i1 %107, label %109, label %108
108: ; preds = %102
br label %63
109: ; preds = %102
br label %110
110: ; preds = %115, %109
%111 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%112 = load i32*, i32** %9
%113 = call i64 @fgets(i8* %111, i32 1023, i32* %112)
%114 = icmp ne i64 %113, 0
br i1 %114, label %115, label %118
115: ; preds = %110
%116 = load i32, i32* %7
%117 = add nsw i32 %116, 1
store i32 %117, i32* %7
br label %110
118: ; preds = %110
%119 = load i32*, i32** %9
%120 = call i32 @fclose(i32* %119)
%121 = load i32, i32* %7
%122 = load i32, i32* %6
%123 = add nsw i32 %122, %121
store i32 %123, i32* %6
br label %63
124: ; preds = %63
%125 = load i32, i32* %6
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %125)
store i32 0, i32* %3
br label %172
127: ; preds = %29
store i32 0, i32* %6
store i32 1, i32* %8
br label %128
128: ; preds = %164, %127
%129 = load i32, i32* %8
%130 = load i32, i32* %4
%131 = icmp slt i32 %129, %130
br i1 %131, label %132, label %167
132: ; preds = %128
store i32 0, i32* %7
%133 = load i8**, i8*** %5
%134 = load i32, i32* %8
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i8*, i8** %133, i64 %135
%137 = load i8*, i8** %136
%138 = call i32* @fopen(i8* %137, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %138, i32** %9
%139 = load i32*, i32** %9
%140 = icmp ne i32* %139, null
br i1 %140, label %142, label %141
141: ; preds = %132
br label %164
142: ; preds = %132
br label %143
143: ; preds = %148, %142
%144 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%145 = load i32*, i32** %9
%146 = call i64 @fgets(i8* %144, i32 1023, i32* %145)
%147 = icmp ne i64 %146, 0
br i1 %147, label %148, label %151
148: ; preds = %143
%149 = load i32, i32* %7
%150 = add nsw i32 %149, 1
store i32 %150, i32* %7
br label %143
151: ; preds = %143
%152 = load i32*, i32** %9
%153 = call i32 @fclose(i32* %152)
%154 = load i8**, i8*** %5
%155 = load i32, i32* %8
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds i8*, i8** %154, i64 %156
%158 = load i8*, i8** %157
%159 = load i32, i32* %7
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %158, i32 %159)
%161 = load i32, i32* %7
%162 = load i32, i32* %6
%163 = add nsw i32 %162, %161
store i32 %163, i32* %6
br label %164
164: ; preds = %151, %141
%165 = load i32, i32* %8
%166 = add nsw i32 %165, 1
store i32 %166, i32* %8
br label %128
167: ; preds = %128
%168 = load i32, i32* %6
%169 = load i32, i32* %4
%170 = sub nsw i32 %169, 1
%171 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i32 %168, i32 %170)
store i32 0, i32* %3
br label %172
172: ; preds = %167, %124, %54, %26
%173 = load i32, i32* %3
ret i32 %173
}

LLVM IR (-O2):
@stdin = global i32* null
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [3 x i8] c"-l\00"
@.str.2 = [2 x i8] c"-\00"
@.str.3 = [3 x i8] c"rt\00"
@.str.4 = [24 x i8] c"%s: can't open list %s\0A\00"
@.str.5 = [10 x i8] c"total %d\0A\00"
@.str.6 = [7 x i8] c"%s %d\0A\00"
@.str.7 = [22 x i8] c"total %d in %d files\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 2
br i1 %7, label %8, label %17
8: ; preds = %2
%9 = load i32*, i32** @stdin
br label %10
10: ; preds = %10, %8
%11 = phi i32 [ 0, %8 ], [ %14, %10 ]
%12 = call i64 @fgets(i8* %5, i32 1023, i32* %9)
%13 = icmp eq i64 %12, 0
%14 = add nuw nsw i32 %11, 1
br i1 %13, label %15, label %10
15: ; preds = %10
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %109
17: ; preds = %2
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = tail call i32 @strcmp(i8* dereferenceable(1) %19, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %17
%23 = zext i32 %0 to i64
br label %82
24: ; preds = %17
%25 = getelementptr inbounds i8*, i8** %1, i64 2
%26 = load i8*, i8** %25
%27 = tail call i32 @strcmp(i8* dereferenceable(1) %26, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
%29 = load i32*, i32** @stdin
%30 = icmp eq i32* %29, null
%31 = select i1 %28, i1 true, i1 %30
br i1 %31, label %32, label %35
32: ; preds = %24
%33 = tail call i32* @fopen(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%34 = icmp eq i32* %33, null
br i1 %34, label %39, label %35
35: ; preds = %24, %32
%36 = phi i32* [ %33, %32 ], [ %29, %24 ]
%37 = call i32 @feof(i32* %36)
%38 = icmp eq i32 %37, 0
br i1 %38, label %77, label %79
39: ; preds = %32
%40 = load i8*, i8** %1
%41 = load i8*, i8** %25
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %40, i8* %41)
br label %109
43: ; preds = %77, %54
%44 = call i32 @memset(i8* %6, i32 0, i32 256)
%45 = call i64 @fgets(i8* %6, i32 255, i32* %36)
br label %46
46: ; preds = %46, %43
%47 = phi i8* [ %6, %43 ], [ %52, %46 ]
%48 = load i8, i8* %47
%49 = icmp eq i8 %48, 0
%50 = icmp sgt i8 %48, 32
%51 = or i1 %49, %50
%52 = getelementptr inbounds i8, i8* %47, i64 1
br i1 %51, label %53, label %46
53: ; preds = %46
br i1 %49, label %54, label %57
54: ; preds = %53, %63
%55 = call i32 @feof(i32* %36)
%56 = icmp eq i32 %55, 0
br i1 %56, label %43, label %79
57: ; preds = %53
br i1 %50, label %58, label %63
58: ; preds = %57, %58
%59 = phi i8* [ %60, %58 ], [ %47, %57 ]
%60 = getelementptr inbounds i8, i8* %59, i64 1
%61 = load i8, i8* %60
%62 = icmp sgt i8 %61, 32
br i1 %62, label %58, label %63
63: ; preds = %58, %57
%64 = phi i8* [ %47, %57 ], [ %60, %58 ]
store i8 0, i8* %64
%65 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%66 = icmp eq i32* %65, null
br i1 %66, label %54, label %67
67: ; preds = %63, %67
%68 = phi i32 [ %71, %67 ], [ 0, %63 ]
%69 = call i64 @fgets(i8* %5, i32 1023, i32* %65)
%70 = icmp eq i64 %69, 0
%71 = add nuw nsw i32 %68, 1
br i1 %70, label %72, label %67
72: ; preds = %67
%73 = call i32 @fclose(i32* %65)
%74 = add nuw nsw i32 %68, %78
%75 = call i32 @feof(i32* %36)
%76 = icmp eq i32 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %35, %72
%78 = phi i32 [ %74, %72 ], [ 0, %35 ]
br label %43
79: ; preds = %72, %54, %35
%80 = phi i32 [ 0, %35 ], [ %78, %54 ], [ %74, %72 ]
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %80)
br label %109
82: ; preds = %103, %22
%83 = phi i8* [ %19, %22 ], [ %105, %103 ]
%84 = phi i64 [ 1, %22 ], [ %101, %103 ]
%85 = phi i32 [ 0, %22 ], [ %100, %103 ]
%86 = getelementptr inbounds i8*, i8** %1, i64 %84
%87 = call i32* @fopen(i8* %83, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%88 = icmp eq i32* %87, null
br i1 %88, label %99, label %89
89: ; preds = %82, %89
%90 = phi i32 [ %93, %89 ], [ 0, %82 ]
%91 = call i64 @fgets(i8* %5, i32 1023, i32* %87)
%92 = icmp eq i64 %91, 0
%93 = add nuw nsw i32 %90, 1
br i1 %92, label %94, label %89
94: ; preds = %89
%95 = call i32 @fclose(i32* %87)
%96 = load i8*, i8** %86
%97 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %96, i32 %90)
%98 = add nsw i32 %90, %85
br label %99
99: ; preds = %82, %94
%100 = phi i32 [ %98, %94 ], [ %85, %82 ]
%101 = add nuw nsw i64 %84, 1
%102 = icmp eq i64 %101, %23
br i1 %102, label %106, label %103
103: ; preds = %99
%104 = getelementptr inbounds i8*, i8** %1, i64 %101
%105 = load i8*, i8** %104
br label %82
106: ; preds = %99
%107 = add nsw i32 %0, -1
%108 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i32 %100, i32 %107)
br label %109
109: ; preds = %106, %79, %39, %15
%110 = phi i32 [ 0, %15 ], [ 0, %106 ], [ 0, %79 ], [ -1, %39 ]
ret i32 %110
}