#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 EOF;
int fgetc(int /*<<< orphan*/ *);
scalar_t__ usable(int);
void count(FILE *f, unsigned one_d[256], unsigned long long *t1,
           unsigned two_d[256][256], unsigned long long *t2) {
  int last_c = 0, c = 0;
  while ((c = fgetc(f)) != EOF) {
    if (usable(c)) {
      one_d[c]++;
      (*t1)++;
    }
    if (usable(last_c) || usable(c)) {
      two_d[last_c][c]++;
      (*t2)++;
    }
    last_c = c;
  }
}


x86 assembly (clang, -O0):
<count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x30(%rbp)
mov    0x2e8b(%rip),%rcx
cmp    (%rcx),%eax
je     11ef <count+0xcf>
mov    -0x30(%rbp),%edi
call   1030 <usable@plt>
cmp    $0x0,%rax
je     1196 <count+0x76>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x2c(%rbp),%edi
call   1030 <usable@plt>
cmp    $0x0,%rax
jne    11ba <count+0x9a>
mov    -0x30(%rbp),%edi
call   1030 <usable@plt>
cmp    $0x0,%rax
je     11e4 <count+0xc4>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
shl    $0xa,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x30(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    114a <count+0x2a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<count>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,%r14
mov    %rcx,%r13
mov    %rdx,0x10(%rsp)
mov    %rsi,0x8(%rsp)
mov    %rdi,%rbx
call   1040 <fgetc@plt>
mov    0x2e9b(%rip),%rcx
cmp    (%rcx),%eax
jne    1160 <count+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
jmp    1199 <count+0x79>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movslq %ebp,%rax
shl    $0xa,%rax
add    %r13,%rax
addl   $0x1,(%rax,%r12,4)
addq   $0x1,(%r14)
mov    %rbx,%rdi
call   1040 <fgetc@plt>
mov    %r15d,%ebp
mov    0x2e53(%rip),%rcx
cmp    (%rcx),%eax
je     1151 <count+0x31>
mov    %eax,%r15d
mov    %eax,%edi
call   1030 <usable@plt>
movslq %r15d,%r12
test   %rax,%rax
je     11be <count+0x9e>
mov    0x8(%rsp),%rax
addl   $0x1,(%rax,%r12,4)
mov    0x10(%rsp),%rax
addq   $0x1,(%rax)
mov    %ebp,%edi
call   1030 <usable@plt>
test   %rax,%rax
jne    1170 <count+0x50>
mov    %r15d,%edi
call   1030 <usable@plt>
test   %rax,%rax
jne    1170 <count+0x50>
jmp    1183 <count+0x63>

LLVM IR (-O0):
@EOF = global i32 0
define void @count(i32* %0, i32* %1, i64* %2, [256 x i32]* %3, i64* %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i64*
%9 = alloca [256 x i32]*
%10 = alloca i64*
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store i64* %2, i64** %8
store [256 x i32]* %3, [256 x i32]** %9
store i64* %4, i64** %10
store i32 0, i32* %11
store i32 0, i32* %12
br label %13
13: ; preds = %53, %5
%14 = load i32*, i32** %6
%15 = call i32 @fgetc(i32* %14)
store i32 %15, i32* %12
%16 = load i32, i32* @EOF
%17 = icmp ne i32 %15, %16
br i1 %17, label %18, label %55
18: ; preds = %13
%19 = load i32, i32* %12
%20 = call i64 @usable(i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %32
22: ; preds = %18
%23 = load i32*, i32** %7
%24 = load i32, i32* %12
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
%27 = load i32, i32* %26
%28 = add i32 %27, 1
store i32 %28, i32* %26
%29 = load i64*, i64** %8
%30 = load i64, i64* %29
%31 = add i64 %30, 1
store i64 %31, i64* %29
br label %32
32: ; preds = %22, %18
%33 = load i32, i32* %11
%34 = call i64 @usable(i32 %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %40, label %36
36: ; preds = %32
%37 = load i32, i32* %12
%38 = call i64 @usable(i32 %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %53
40: ; preds = %36, %32
%41 = load [256 x i32]*, [256 x i32]** %9
%42 = load i32, i32* %11
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [256 x i32], [256 x i32]* %41, i64 %43
%45 = load i32, i32* %12
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [256 x i32], [256 x i32]* %44, i64 0, i64 %46
%48 = load i32, i32* %47
%49 = add i32 %48, 1
store i32 %49, i32* %47
%50 = load i64*, i64** %10
%51 = load i64, i64* %50
%52 = add i64 %51, 1
store i64 %52, i64* %50
br label %53
53: ; preds = %40, %36
%54 = load i32, i32* %12
store i32 %54, i32* %11
br label %13
55: ; preds = %13
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @count(i32* nocapture %0, i32* nocapture %1, i64* nocapture %2, [256 x i32]* nocapture %3, i64* nocapture %4) {
%6 = tail call i32 @fgetc(i32* %0)
%7 = load i32, i32* @EOF
%8 = icmp eq i32 %6, %7
br i1 %8, label %39, label %9
9: ; preds = %5, %35
%10 = phi i32 [ %36, %35 ], [ %6, %5 ]
%11 = phi i32 [ %10, %35 ], [ 0, %5 ]
%12 = tail call i64 @usable(i32 %10)
%13 = icmp eq i64 %12, 0
br i1 %13, label %21, label %14
14: ; preds = %9
%15 = sext i32 %10 to i64
%16 = getelementptr inbounds i32, i32* %1, i64 %15
%17 = load i32, i32* %16
%18 = add i32 %17, 1
store i32 %18, i32* %16
%19 = load i64, i64* %2
%20 = add i64 %19, 1
store i64 %20, i64* %2
br label %21
21: ; preds = %14, %9
%22 = tail call i64 @usable(i32 %11)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = tail call i64 @usable(i32 %10)
%26 = icmp eq i64 %25, 0
br i1 %26, label %35, label %27
27: ; preds = %24, %21
%28 = sext i32 %11 to i64
%29 = sext i32 %10 to i64
%30 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 %28, i64 %29
%31 = load i32, i32* %30
%32 = add i32 %31, 1
store i32 %32, i32* %30
%33 = load i64, i64* %4
%34 = add i64 %33, 1
store i64 %34, i64* %4
br label %35
35: ; preds = %27, %24
%36 = tail call i32 @fgetc(i32* %0)
%37 = load i32, i32* @EOF
%38 = icmp eq i32 %36, %37
br i1 %38, label %39, label %9
39: ; preds = %35, %5
ret void
}