#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 /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  FILE *arquivo;
  int c;
  int cl = 0;
  int cb = 0;
  int cp = 0;
  int x = 0;
  char t[51];
  scanf("%s", t);
  arquivo = fopen(t, "r");
  c = getc(arquivo);
  while (c != -1) {
    cb++;
    if (c == '\n')
      cl = cl + 1;
    if ((c != ' ') && (c != '\n') && (!x)) {
      x = 1;
    }
    if (((c == ' ') || (c == '\n')) && (x)) {
      x = 0;
      cp++;
    }
    printf("%i %c %x\n", c, c, c);
    c = getc(arquivo);
  }
  printf("L=%i P=%i B=%i\n", cl, cp, cb);
  fclose(arquivo);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
lea    -0x60(%rbp),%rsi
lea    0xe7a(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x60(%rbp),%rdi
lea    0xe6d(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <getc@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     124a <main+0xfa>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0xa,-0x14(%rbp)
jne    11d1 <main+0x81>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x20,-0x14(%rbp)
je     11f6 <main+0xa6>
cmpl   $0xa,-0x14(%rbp)
je     11f6 <main+0xa6>
cmpl   $0x0,-0x24(%rbp)
jne    11f6 <main+0xa6>
movl   $0x1,-0x24(%rbp)
cmpl   $0x20,-0x14(%rbp)
je     120a <main+0xba>
cmpl   $0xa,-0x14(%rbp)
jne    1224 <main+0xd4>
cmpl   $0x0,-0x24(%rbp)
je     1224 <main+0xd4>
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xdd1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <getc@plt>
mov    %eax,-0x14(%rbp)
jmp    11ab <main+0x5b>
mov    -0x18(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xdb5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xe9b(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0xe8c(%rip),%rsi
mov    %rbx,%rdi
call   1060 <fopen@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1070 <getc@plt>
cmp    $0xffffffff,%eax
je     11fb <main+0xab>
lea    0xe6f(%rip),%r12
xor    %ecx,%ecx
xor    %ebp,%ebp
xor    %r15d,%r15d
xor    %r13d,%r13d
add    $0x1,%r15d
xor    %edx,%edx
cmp    $0xa,%eax
sete   %dl
add    %edx,%r13d
cmp    $0x20,%eax
sete   %bl
or     %bl,%dl
test   %ecx,%ecx
mov    $0x1,%ebx
cmovne %ecx,%ebx
test   %dl,%dl
cmovne %ecx,%ebx
test   %ebx,%ebx
setne  %cl
and    %dl,%cl
movzbl %cl,%ecx
add    %ecx,%ebp
test   %cl,%cl
mov    $0x0,%ecx
cmovne %ecx,%ebx
mov    %r12,%rdi
mov    %eax,%esi
mov    %eax,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
mov    %r14,%rdi
call   1070 <getc@plt>
mov    %ebx,%ecx
cmp    $0xffffffff,%eax
jne    11a0 <main+0x50>
jmp    1203 <main+0xb3>
xor    %r13d,%r13d
xor    %r15d,%r15d
xor    %ebp,%ebp
lea    0xe05(%rip),%rdi
mov    %r13d,%esi
mov    %ebp,%edx
mov    %r15d,%ecx
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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