#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*/ *fopen(char *, char *);
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int, int, int);
int main(int argc, char *argv[]) {
  FILE *arquivo;
  int c;
  int cl = 0;
  int cb = 0;
  int cp = 0;
  int flag = 1;
  arquivo = fopen(argv[1], "r");
  c = getc(arquivo);
  while (c != -1) {
    cb++;
    if (c == '\n')
      cl = cl + 1;
    if ((c == ' ') || (c == '\n') || (c == '\t')) {
      if (flag == 0) {
        flag = 1;
        cp++;
      }
    } else
      flag = 0;
    c = getc(arquivo);
  }
  fclose(arquivo);
  printf("L=%i P=%i B=%i\n", cl, cp, cb);
  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)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7f(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <getc@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
je     1211 <main+0xd1>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jne    11bc <main+0x7c>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x20,-0x1c(%rbp)
je     11da <main+0x9a>
cmpl   $0xa,-0x1c(%rbp)
je     11da <main+0x9a>
cmpl   $0x9,-0x1c(%rbp)
jne    11f9 <main+0xb9>
cmpl   $0x0,-0x2c(%rbp)
jne    11f4 <main+0xb4>
movl   $0x1,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1200 <main+0xc0>
movl   $0x0,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <getc@plt>
mov    %eax,-0x1c(%rbp)
jmp    1196 <main+0x56>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    0xdd8(%rip),%rdi
call   1040 <printf@plt>
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
push   %rax
mov    0x8(%rsi),%rdi
lea    0xeaa(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1060 <getc@plt>
cmp    $0xffffffff,%eax
je     11cc <main+0x8c>
xor    %r15d,%r15d
mov    $0x1,%r13d
movabs $0x100000600,%r12
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    11a7 <main+0x67>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %r13d,%r13d
mov    %dl,%cl
add    %ecx,%ebp
mov    %r14,%rdi
call   1060 <getc@plt>
add    $0x1,%ebx
cmp    $0xffffffff,%eax
je     11d3 <main+0x93>
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %dl
cmp    $0x20,%eax
ja     1190 <main+0x50>
mov    %eax,%eax
bt     %rax,%r12
jae    1190 <main+0x50>
cmp    $0x1,%r13d
adc    $0x0,%r15d
mov    $0x1,%r13d
jmp    1193 <main+0x53>
xor    %ebp,%ebp
xor    %ebx,%ebx
xor    %r15d,%r15d
mov    %r14,%rdi
call   1030 <fclose@plt>
lea    0xe20(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%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 = [16 x i8] c"L=%i P=%i B=%i\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 i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 1, i32* %11
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %15, i32** %6
%16 = load i32*, i32** %6
%17 = call i32 @getc(i32* %16)
store i32 %17, i32* %7
br label %18
18: ; preds = %46, %2
%19 = load i32, i32* %7
%20 = icmp ne i32 %19, -1
br i1 %20, label %21, label %49
21: ; preds = %18
%22 = load i32, i32* %9
%23 = add nsw i32 %22, 1
store i32 %23, i32* %9
%24 = load i32, i32* %7
%25 = icmp eq i32 %24, 10
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
br label %29
29: ; preds = %26, %21
%30 = load i32, i32* %7
%31 = icmp eq i32 %30, 32
br i1 %31, label %38, label %32
32: ; preds = %29
%33 = load i32, i32* %7
%34 = icmp eq i32 %33, 10
br i1 %34, label %38, label %35
35: ; preds = %32
%36 = load i32, i32* %7
%37 = icmp eq i32 %36, 9
br i1 %37, label %38, label %45
38: ; preds = %35, %32, %29
%39 = load i32, i32* %11
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %38
store i32 1, i32* %11
%42 = load i32, i32* %10
%43 = add nsw i32 %42, 1
store i32 %43, i32* %10
br label %44
44: ; preds = %41, %38
br label %46
45: ; preds = %35
store i32 0, i32* %11
br label %46
46: ; preds = %45, %44
%47 = load i32*, i32** %6
%48 = call i32 @getc(i32* %47)
store i32 %48, i32* %7
br label %18
49: ; preds = %18
%50 = load i32*, i32** %6
%51 = call i32 @fclose(i32* %50)
%52 = load i32, i32* %8
%53 = load i32, i32* %10
%54 = load i32, i32* %9
%55 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %52, i32 %53, i32 %54)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [16 x i8] c"L=%i P=%i B=%i\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @getc(i32* %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %27, label %8
8: ; preds = %2, %22
%9 = phi i32 [ %24, %22 ], [ 1, %2 ]
%10 = phi i32 [ %23, %22 ], [ 0, %2 ]
%11 = phi i32 [ %14, %22 ], [ 0, %2 ]
%12 = phi i32 [ %17, %22 ], [ 0, %2 ]
%13 = phi i32 [ %25, %22 ], [ %6, %2 ]
%14 = add nuw nsw i32 %11, 1
%15 = icmp eq i32 %13, 10
%16 = zext i1 %15 to i32
%17 = add nuw nsw i32 %12, %16
switch i32 %13, label %22 [
i32 32, label %18
i32 10, label %18
i32 9, label %18
]
18: ; preds = %8, %8, %8
%19 = icmp eq i32 %9, 0
%20 = zext i1 %19 to i32
%21 = add nsw i32 %10, %20
br label %22
22: ; preds = %18, %8
%23 = phi i32 [ %21, %18 ], [ %10, %8 ]
%24 = phi i32 [ 1, %18 ], [ 0, %8 ]
%25 = tail call i32 @getc(i32* %5)
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %8
27: ; preds = %22, %2
%28 = phi i32 [ 0, %2 ], [ %17, %22 ]
%29 = phi i32 [ 0, %2 ], [ %14, %22 ]
%30 = phi i32 [ 0, %2 ], [ %23, %22 ]
%31 = tail call i32 @fclose(i32* %5)
%32 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %28, i32 %30, i32 %29)
ret i32 0
}