#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*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, int);
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ isalpha(char);
char toupper(char);
int main(int argc, char **argv) {
  int counts[26] = {0};
  FILE *inp = fopen(argv[1], "r");
  while (!feof(inp)) {
    char ch = getc(inp);
    if (!isalpha(ch))
      continue;
    ++counts[toupper(ch) - 'A'];
  }
  fclose(inp);
  FILE *out = fopen(argv[2], "w");
  for (int c = 0; c < 26; ++c)
    fprintf(out, "%c : %6d\n", (c + 'A'), counts[c]);
  fclose(out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x68,%edx
call   1050 <memset@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe48(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11e5 <main+0x65>
jmp    1235 <main+0xb5>
mov    -0x88(%rbp),%rdi
call   10a0 <getc@plt>
mov    %al,-0x89(%rbp)
movsbl -0x89(%rbp),%edi
call   1080 <isalpha@plt>
cmp    $0x0,%eax
jne    1211 <main+0x91>
jmp    11c4 <main+0x44>
movsbl -0x89(%rbp),%edi
call   1030 <toupper@plt>
movsbl %al,%eax
sub    $0x41,%eax
cltq
mov    -0x80(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x80(%rbp,%rax,4)
jmp    11c4 <main+0x44>
mov    -0x88(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdb2(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x98(%rbp)
movl   $0x0,-0x9c(%rbp)
cmpl   $0x1a,-0x9c(%rbp)
jge    12ae <main+0x12e>
mov    -0x98(%rbp),%rdi
mov    -0x9c(%rbp),%edx
add    $0x41,%edx
movslq -0x9c(%rbp),%rax
mov    -0x80(%rbp,%rax,4),%ecx
lea    0xd6f(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
jmp    1266 <main+0xe6>
mov    -0x98(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %rsi,%r14
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x60(%rsp)
mov    0x8(%rsi),%rdi
lea    0xe51(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
jmp    11c3 <main+0x53>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %eax,%eax
jne    11f7 <main+0x87>
mov    %rbx,%rdi
call   1090 <getc@plt>
movsbl %al,%ebp
mov    %ebp,%edi
call   1070 <isalpha@plt>
test   %eax,%eax
je     11c0 <main+0x50>
mov    %ebp,%edi
call   1030 <toupper@plt>
movsbq %al,%rax
addl   $0x1,-0x104(%rsp,%rax,4)
01
jmp    11c0 <main+0x50>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x10(%r14),%rdi
lea    0xdf8(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
xor    %ebp,%ebp
lea    0xde9(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%rsp,%rbp,4),%ecx
lea    0x41(%rbp),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <fprintf@plt>
add    $0x1,%rbp
cmp    $0x1a,%rbp
jne    1220 <main+0xb0>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [10 x i8] c"%c : %6d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [26 x i32]
%7 = alloca i32*
%8 = alloca i8
%9 = alloca i32*
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [26 x i32]* %6 to i8*
%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** %7
br label %16
16: ; preds = %28, %27, %2
%17 = load i32*, i32** %7
%18 = call i32 @feof(i32* %17)
%19 = icmp ne i32 %18, 0
%20 = xor i1 %19, true
br i1 %20, label %21, label %37
21: ; preds = %16
%22 = load i32*, i32** %7
%23 = call signext i8 @getc(i32* %22)
store i8 %23, i8* %8
%24 = load i8, i8* %8
%25 = call i32 @isalpha(i8 signext %24)
%26 = icmp ne i32 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %21
br label %16
28: ; preds = %21
%29 = load i8, i8* %8
%30 = call signext i8 @toupper(i8 signext %29)
%31 = sext i8 %30 to i32
%32 = sub nsw i32 %31, 65
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [26 x i32], [26 x i32]* %6, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = add nsw i32 %35, 1
store i32 %36, i32* %34
br label %16
37: ; preds = %16
%38 = load i32*, i32** %7
%39 = call i32 @fclose(i32* %38)
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 2
%42 = load i8*, i8** %41
%43 = call i32* @fopen(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %43, i32** %9
store i32 0, i32* %10
br label %44
44: ; preds = %56, %37
%45 = load i32, i32* %10
%46 = icmp slt i32 %45, 26
br i1 %46, label %47, label %59
47: ; preds = %44
%48 = load i32*, i32** %9
%49 = load i32, i32* %10
%50 = add nsw i32 %49, 65
%51 = load i32, i32* %10
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [26 x i32], [26 x i32]* %6, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = call i32 @fprintf(i32* %48, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %50, i32 %54)
br label %56
56: ; preds = %47
%57 = load i32, i32* %10
%58 = add nsw i32 %57, 1
store i32 %58, i32* %10
br label %44
59: ; preds = %44
%60 = load i32*, i32** %9
%61 = call i32 @fclose(i32* %60)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [10 x i8] c"%c : %6d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [26 x i32]
%4 = bitcast [26 x i32]* %3 to i8*
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @feof(i32* %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %24
10: ; preds = %2, %21
%11 = tail call signext i8 @getc(i32* %7)
%12 = tail call i32 @isalpha(i8 signext %11)
%13 = icmp eq i32 %12, 0
br i1 %13, label %21, label %14
14: ; preds = %10
%15 = tail call signext i8 @toupper(i8 signext %11)
%16 = sext i8 %15 to i64
%17 = add nsw i64 %16, -65
%18 = getelementptr inbounds [26 x i32], [26 x i32]* %3, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = add nsw i32 %19, 1
store i32 %20, i32* %18
br label %21
21: ; preds = %10, %14
%22 = tail call i32 @feof(i32* %7)
%23 = icmp eq i32 %22, 0
br i1 %23, label %10, label %24
24: ; preds = %21, %2
%25 = tail call i32 @fclose(i32* %7)
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
%28 = tail call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %31
29: ; preds = %31
%30 = tail call i32 @fclose(i32* %28)
ret i32 0
31: ; preds = %24, %31
%32 = phi i64 [ 0, %24 ], [ %38, %31 ]
%33 = getelementptr inbounds [26 x i32], [26 x i32]* %3, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = trunc i64 %32 to i32
%36 = add i32 %35, 65
%37 = tail call i32 @fprintf(i32* %28, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %36, i32 %34)
%38 = add nuw nsw i64 %32, 1
%39 = icmp eq i64 %38, 26
br i1 %39, label %29, label %31
}