#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 */
char EOF;
int /*<<< orphan*/ exit(int);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *, int, int, int);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int tcnt, bcnt, ncnt, i;
  FILE *in;
  char ch;
  if (argc == 1) {
    fprintf(stderr, "Missing input file(s).\n");
    exit(1);
  }
  for (i = 1; i < argc; i++) {
    in = fopen(argv[i], "r");
    tcnt = bcnt = ncnt = 0;
    if (in == NULL) {
      perror(argv[i]);
      continue;
    }
    while ((ch = fgetc(in)) != EOF) {
      if (ch == '\t') {
        tcnt++;
      } else if (ch == ' ') {
        bcnt++;
      } else if (ch == '\n') {
        ncnt++;
      }
    }
    printf("%s: tabs: %d; blanks: %d; newlines: %d\n", argv[i], tcnt, bcnt,
           ncnt);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    119f <main+0x3f>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
lea    0xe70(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12b5 <main+0x155>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe53(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1204 <main+0xa4>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <perror@plt>
jmp    12a7 <main+0x147>
jmp    1209 <main+0xa9>
mov    -0x28(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x29(%rbp)
movsbl %al,%eax
mov    0x2dc9(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1285 <main+0x125>
movsbl -0x29(%rbp),%eax
cmp    $0x9,%eax
jne    1245 <main+0xe5>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1280 <main+0x120>
movsbl -0x29(%rbp),%eax
cmp    $0x20,%eax
jne    1260 <main+0x100>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    127b <main+0x11b>
movsbl -0x29(%rbp),%eax
cmp    $0xa,%eax
jne    1276 <main+0x116>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    127b <main+0x11b>
jmp    1280 <main+0x120>
jmp    1209 <main+0xa9>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    0xd78(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11a6 <main+0x46>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x1,%edi
je     1277 <main+0x117>
jle    1266 <main+0x106>
mov    %rsi,%rbx
mov    %edi,%eax
mov    %rax,0x10(%rsp)
mov    $0x1,%r14d
mov    0x2e54(%rip),%r12
mov    %rsi,0x8(%rsp)
nopl   0x0(%rax)
mov    (%rbx,%r14,8),%rdi
lea    0xe6d(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     1256 <main+0xf6>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <fgetc@plt>
xor    %r13d,%r13d
mov    $0x0,%r15d
mov    $0x0,%ebp
cmp    (%r12),%al
jne    1210 <main+0xb0>
mov    0x8(%rsp),%rbx
mov    (%rbx,%r14,8),%rsi
lea    0xe32(%rip),%rdi
mov    %ebp,%edx
mov    %r15d,%ecx
mov    %r13d,%r8d
call   1030 <printf@plt>
add    $0x1,%r14
cmp    0x10(%rsp),%r14
jne    11a0 <main+0x40>
jmp    1266 <main+0x106>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %ebp,%ebp
xor    %r15d,%r15d
xor    %r13d,%r13d
jmp    1232 <main+0xd2>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r13d
mov    %rbx,%rdi
call   1040 <fgetc@plt>
cmp    (%r12),%al
je     11d8 <main+0x78>
cmp    $0x20,%al
je     1250 <main+0xf0>
cmp    $0xa,%al
je     1220 <main+0xc0>
cmp    $0x9,%al
jne    1224 <main+0xc4>
add    $0x1,%ebp
jmp    1224 <main+0xc4>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r15d
jmp    1224 <main+0xc4>
mov    0x8(%rsp),%rbx
mov    (%rbx,%r14,8),%rdi
call   1070 <perror@plt>
jmp    11f5 <main+0x95>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d5a(%rip),%rax
mov    (%rax),%edi
lea    0xd79(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Missing input file(s).\0A\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i8 0
@.str.2 = [40 x i8] c"%s: tabs: %d; blanks: %d; newlines: %d\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 i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %2
store i32 1, i32* %9
br label %19
19: ; preds = %81, %18
%20 = load i32, i32* %9
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %84
23: ; preds = %19
%24 = load i8**, i8*** %5
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %29, i32** %10
store i32 0, i32* %8
store i32 0, i32* %7
store i32 0, i32* %6
%30 = load i32*, i32** %10
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %39
32: ; preds = %23
%33 = load i8**, i8*** %5
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8*, i8** %33, i64 %35
%37 = load i8*, i8** %36
%38 = call i32 @perror(i8* %37)
br label %81
39: ; preds = %23
br label %40
40: ; preds = %70, %39
%41 = load i32*, i32** %10
%42 = call signext i8 @fgetc(i32* %41)
store i8 %42, i8* %11
%43 = sext i8 %42 to i32
%44 = load i8, i8* @EOF
%45 = sext i8 %44 to i32
%46 = icmp ne i32 %43, %45
br i1 %46, label %47, label %71
47: ; preds = %40
%48 = load i8, i8* %11
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 9
br i1 %50, label %51, label %54
51: ; preds = %47
%52 = load i32, i32* %6
%53 = add nsw i32 %52, 1
store i32 %53, i32* %6
br label %70
54: ; preds = %47
%55 = load i8, i8* %11
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 32
br i1 %57, label %58, label %61
58: ; preds = %54
%59 = load i32, i32* %7
%60 = add nsw i32 %59, 1
store i32 %60, i32* %7
br label %69
61: ; preds = %54
%62 = load i8, i8* %11
%63 = sext i8 %62 to i32
%64 = icmp eq i32 %63, 10
br i1 %64, label %65, label %68
65: ; preds = %61
%66 = load i32, i32* %8
%67 = add nsw i32 %66, 1
store i32 %67, i32* %8
br label %68
68: ; preds = %65, %61
br label %69
69: ; preds = %68, %58
br label %70
70: ; preds = %69, %51
br label %40
71: ; preds = %40
%72 = load i8**, i8*** %5
%73 = load i32, i32* %9
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8*, i8** %72, i64 %74
%76 = load i8*, i8** %75
%77 = load i32, i32* %6
%78 = load i32, i32* %7
%79 = load i32, i32* %8
%80 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %76, i32 %77, i32 %78, i32 %79)
br label %81
81: ; preds = %71, %32
%82 = load i32, i32* %9
%83 = add nsw i32 %82, 1
store i32 %83, i32* %9
br label %19
84: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Missing input file(s).\0A\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i8 0
@.str.2 = [40 x i8] c"%s: tabs: %d; blanks: %d; newlines: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %52
6: ; preds = %4
%7 = zext i32 %0 to i64
br label %12
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %6, %49
%13 = phi i64 [ 1, %6 ], [ %50, %49 ]
%14 = getelementptr inbounds i8*, i8** %1, i64 %13
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %22, label %18
18: ; preds = %12
%19 = tail call signext i8 @fgetc(i32* %16)
%20 = load i8, i8* @EOF
%21 = icmp eq i8 %19, %20
br i1 %21, label %43, label %25
22: ; preds = %12
%23 = load i8*, i8** %14
%24 = tail call i32 @perror(i8* %23)
br label %49
25: ; preds = %18, %36
%26 = phi i8 [ %40, %36 ], [ %19, %18 ]
%27 = phi i32 [ %39, %36 ], [ 0, %18 ]
%28 = phi i32 [ %38, %36 ], [ 0, %18 ]
%29 = phi i32 [ %37, %36 ], [ 0, %18 ]
switch i8 %26, label %36 [
i8 9, label %30
i8 32, label %32
i8 10, label %34
]
30: ; preds = %25
%31 = add nsw i32 %27, 1
br label %36
32: ; preds = %25
%33 = add nsw i32 %28, 1
br label %36
34: ; preds = %25
%35 = add nsw i32 %29, 1
br label %36
36: ; preds = %25, %32, %34, %30
%37 = phi i32 [ %29, %30 ], [ %29, %32 ], [ %35, %34 ], [ %29, %25 ]
%38 = phi i32 [ %28, %30 ], [ %33, %32 ], [ %28, %34 ], [ %28, %25 ]
%39 = phi i32 [ %31, %30 ], [ %27, %32 ], [ %27, %34 ], [ %27, %25 ]
%40 = tail call signext i8 @fgetc(i32* %16)
%41 = load i8, i8* @EOF
%42 = icmp eq i8 %40, %41
br i1 %42, label %43, label %25
43: ; preds = %36, %18
%44 = phi i32 [ 0, %18 ], [ %37, %36 ]
%45 = phi i32 [ 0, %18 ], [ %38, %36 ]
%46 = phi i32 [ 0, %18 ], [ %39, %36 ]
%47 = load i8*, i8** %14
%48 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %47, i32 %46, i32 %45, i32 %44)
br label %49
49: ; preds = %43, %22
%50 = add nuw nsw i64 %13, 1
%51 = icmp eq i64 %50, %7
br i1 %51, label %52, label %12
52: ; preds = %49, %4
ret i32 0
}