#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 */

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *const);
scalar_t__ isupper(char);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char tolower(char);
int main(int argc, char **argv) {
  const char *const prog = argv[0];
  char input[256];
  char tallyOrder[] = "abcde";
  int inputLen;
  int tallyCnt[5];
  while (fgets(input, 256, stdin)) {
    if (strcmp(input, "") == 0) {
      fprintf(stderr, "%s: Error, empty string.\n", prog);
      return EXIT_FAILURE;
    }
    memset(tallyCnt, 0, 5 * sizeof(int));
    strcpy(tallyOrder, "abcde");
    inputLen = strlen(input);
    for (int i = 0; i < inputLen; i++)
      tallyCnt[tolower(input[i]) - 'a'] += isupper(input[i]) ? -1 : 1;
    for (int i = 0; i < 5; i++)
      for (int j = i + 1; j < 5; j++)
        if (tallyCnt[j] > tallyCnt[i]) {
          int tempVal;
          int tempLetter;
          tempVal = tallyCnt[i];
          tallyCnt[i] = tallyCnt[j];
          tallyCnt[j] = tempVal;
          tempLetter = tallyOrder[i];
          tallyOrder[i] = tallyOrder[j];
          tallyOrder[j] = tempLetter;
        }
    printf("%s: ", prog);
    for (int i = 0; i < 5; i++)
      printf("%c: %d ", tallyOrder[i], tallyCnt[i]);
    printf("\n");
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    0xe46(%rip),%eax
mov    %eax,-0x126(%rbp)
mov    0xe3d(%rip),%ax
mov    %ax,-0x122(%rbp)
lea    -0x120(%rbp),%rdi
mov    0x2e0c(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     148c <main+0x2fc>
lea    -0x120(%rbp),%rdi
lea    0xe1f(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1239 <main+0xa9>
mov    0x2dc2(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xde3(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2da1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1498 <main+0x308>
lea    -0x140(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1060 <memset@plt>
lea    -0x126(%rbp),%rdi
lea    0xda6(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x120(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x12c(%rbp)
movl   $0x0,-0x144(%rbp)
mov    -0x144(%rbp),%eax
cmp    -0x12c(%rbp),%eax
jge    12ff <main+0x16f>
movslq -0x144(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%edi
ff
call   10b0 <isupper@plt>
mov    %rax,%rdx
mov    $0x1,%eax
mov    $0xffffffff,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x15c(%rbp)
movslq -0x144(%rbp),%rax
movsbl -0x120(%rbp,%rax,1),%edi
ff
call   10a0 <tolower@plt>
mov    -0x15c(%rbp),%ecx
movsbl %al,%eax
sub    $0x61,%eax
cltq
add    -0x140(%rbp,%rax,4),%ecx
mov    %ecx,-0x140(%rbp,%rax,4)
mov    -0x144(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x144(%rbp)
jmp    127b <main+0xeb>
movl   $0x0,-0x148(%rbp)
cmpl   $0x5,-0x148(%rbp)
jge    1411 <main+0x281>
mov    -0x148(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14c(%rbp)
cmpl   $0x5,-0x14c(%rbp)
jge    13f8 <main+0x268>
movslq -0x14c(%rbp),%rax
mov    -0x140(%rbp,%rax,4),%eax
movslq -0x148(%rbp),%rcx
cmp    -0x140(%rbp,%rcx,4),%eax
jle    13df <main+0x24f>
movslq -0x148(%rbp),%rax
mov    -0x140(%rbp,%rax,4),%eax
mov    %eax,-0x150(%rbp)
movslq -0x14c(%rbp),%rax
mov    -0x140(%rbp,%rax,4),%ecx
movslq -0x148(%rbp),%rax
mov    %ecx,-0x140(%rbp,%rax,4)
mov    -0x150(%rbp),%ecx
movslq -0x14c(%rbp),%rax
mov    %ecx,-0x140(%rbp,%rax,4)
movslq -0x148(%rbp),%rax
movsbl -0x126(%rbp,%rax,1),%eax
ff
mov    %eax,-0x154(%rbp)
movslq -0x14c(%rbp),%rax
mov    -0x126(%rbp,%rax,1),%cl
movslq -0x148(%rbp),%rax
mov    %cl,-0x126(%rbp,%rax,1)
mov    -0x154(%rbp),%eax
mov    %al,%cl
movslq -0x14c(%rbp),%rax
mov    %cl,-0x126(%rbp,%rax,1)
jmp    13e4 <main+0x254>
mov    -0x14c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14c(%rbp)
jmp    1325 <main+0x195>
jmp    13fd <main+0x26d>
mov    -0x148(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x148(%rbp)
jmp    1309 <main+0x179>
mov    -0x18(%rbp),%rsi
lea    0xc04(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x158(%rbp)
cmpl   $0x5,-0x158(%rbp)
jge    1479 <main+0x2e9>
movslq -0x158(%rbp),%rax
movsbl -0x126(%rbp,%rax,1),%esi
ff
movslq -0x158(%rbp),%rax
mov    -0x140(%rbp,%rax,4),%edx
lea    0xbc7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x158(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x158(%rbp)
jmp    142d <main+0x29d>
lea    0xb9e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11ce <main+0x3e>
mov    0x2b35(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    (%rsi),%r15
movw   $0x65,0xc(%rsp)
movl   $0x64636261,0x8(%rsp)
64
mov    0x2e1e(%rip),%rax
mov    (%rax),%edx
lea    0x30(%rsp),%rdi
mov    $0x100,%esi
call   1080 <fgets@plt>
mov    0x2de6(%rip),%rcx
test   %rax,%rax
je     14bd <main+0x31d>
lea    0x30(%rsp),%rbx
lea    0xe2e(%rip),%r13
jmp    1299 <main+0xf9>
nopl   0x0(%rax)
lea    0xe19(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x8(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x9(%rsp),%esi
mov    0x14(%rsp),%edx
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xa(%rsp),%esi
mov    0x18(%rsp),%edx
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xb(%rsp),%esi
mov    0x1c(%rsp),%edx
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xc(%rsp),%esi
mov    0x20(%rsp),%edx
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2d67(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1080 <fgets@plt>
test   %rax,%rax
je     1495 <main+0x2f5>
mov    %rbx,%rdi
lea    0xd76(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     149e <main+0x2fe>
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1070 <memset@plt>
lea    0x8(%rsp),%rdi
lea    0xd4c(%rip),%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    1322 <main+0x182>
mov    %eax,%r12d
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nop
movsbl 0x30(%rsp,%r14,1),%edi
call   10c0 <isupper@plt>
neg    %rax
sbb    %ebp,%ebp
or     $0x1,%ebp
movsbl 0x30(%rsp,%r14,1),%edi
call   10b0 <tolower@plt>
movsbq %al,%rax
add    %ebp,-0x174(%rsp,%rax,4)
add    $0x1,%r14
cmp    %r14,%r12
jne    12f0 <main+0x150>
mov    0x10(%rsp),%eax
mov    0x14(%rsp),%ecx
cmp    %eax,%ecx
jle    1340 <main+0x1a0>
mov    %ecx,0x10(%rsp)
mov    %eax,0x14(%rsp)
rolw   $0x8,0x8(%rsp)
jmp    1342 <main+0x1a2>
xchg   %ax,%ax
mov    %eax,%ecx
mov    0x18(%rsp),%eax
cmp    %ecx,%eax
jle    1370 <main+0x1d0>
mov    %eax,0x10(%rsp)
mov    %ecx,0x18(%rsp)
mov    0x8(%rsp),%cl
mov    0xa(%rsp),%dl
mov    %dl,0x8(%rsp)
mov    %cl,0xa(%rsp)
jmp    1372 <main+0x1d2>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ecx,%eax
mov    0x1c(%rsp),%ecx
cmp    %eax,%ecx
jle    13a0 <main+0x200>
mov    %ecx,0x10(%rsp)
mov    %eax,0x1c(%rsp)
mov    0x8(%rsp),%al
mov    0xb(%rsp),%dl
mov    %dl,0x8(%rsp)
mov    %al,0xb(%rsp)
jmp    13a2 <main+0x202>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %eax,%ecx
mov    0x20(%rsp),%eax
cmp    %ecx,%eax
jle    13c2 <main+0x222>
mov    %eax,0x10(%rsp)
mov    %ecx,0x20(%rsp)
mov    0x8(%rsp),%al
mov    0xc(%rsp),%cl
mov    %cl,0x8(%rsp)
mov    %al,0xc(%rsp)
mov    0x14(%rsp),%eax
mov    0x18(%rsp),%ecx
cmp    %eax,%ecx
jle    13e0 <main+0x240>
mov    %ecx,0x14(%rsp)
mov    %eax,0x18(%rsp)
rolw   $0x8,0x9(%rsp)
jmp    13e2 <main+0x242>
xchg   %ax,%ax
mov    %eax,%ecx
mov    0x1c(%rsp),%eax
cmp    %ecx,%eax
jle    1410 <main+0x270>
mov    %eax,0x14(%rsp)
mov    %ecx,0x1c(%rsp)
mov    0x9(%rsp),%cl
mov    0xb(%rsp),%dl
mov    %dl,0x9(%rsp)
mov    %cl,0xb(%rsp)
jmp    1412 <main+0x272>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ecx,%eax
mov    0x20(%rsp),%ecx
cmp    %eax,%ecx
jle    1432 <main+0x292>
mov    %ecx,0x14(%rsp)
mov    %eax,0x20(%rsp)
mov    0x9(%rsp),%al
mov    0xc(%rsp),%cl
mov    %cl,0x9(%rsp)
mov    %al,0xc(%rsp)
mov    0x18(%rsp),%ecx
mov    0x1c(%rsp),%eax
cmp    %ecx,%eax
jle    1450 <main+0x2b0>
mov    %eax,0x18(%rsp)
mov    %ecx,0x1c(%rsp)
rolw   $0x8,0xa(%rsp)
jmp    1452 <main+0x2b2>
xchg   %ax,%ax
mov    %ecx,%eax
mov    0x20(%rsp),%ecx
cmp    %eax,%ecx
jle    1472 <main+0x2d2>
mov    %ecx,0x18(%rsp)
mov    %eax,0x20(%rsp)
mov    0xa(%rsp),%al
mov    0xc(%rsp),%cl
mov    %cl,0xa(%rsp)
mov    %al,0xc(%rsp)
mov    0x1c(%rsp),%eax
mov    0x20(%rsp),%ecx
cmp    %eax,%ecx
jle    1200 <main+0x60>
mov    %ecx,0x1c(%rsp)
mov    %eax,0x20(%rsp)
rolw   $0x8,0xb(%rsp)
jmp    1200 <main+0x60>
mov    0x2b2c(%rip),%rcx
jmp    14bd <main+0x31d>
mov    0x2b33(%rip),%rax
mov    (%rax),%edi
lea    0xb52(%rip),%rsi
mov    %r15,%rdx
call   10a0 <fprintf@plt>
mov    0x2b13(%rip),%rcx
mov    (%rcx),%eax
add    $0x138,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.tallyOrder = [6 x i8] c"abcde\00"
@stdin = global i32 0
@.str = [1 x i8] zeroinitializer
@stderr = global i32 0
@.str.1 = [26 x i8] c"%s: Error, empty string.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [6 x i8] c"abcde\00"
@.str.3 = [5 x i8] c"%s: \00"
@.str.4 = [8 x i8] c"%c: %d \00"
@.str.5 = [2 x i8] c"\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [256 x i8]
%8 = alloca [6 x i8]
%9 = alloca i32
%10 = alloca [5 x i32]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
store i8* %19, i8** %6
%20 = bitcast [6 x i8]* %8 to i8*
br label %21
21: ; preds = %150, %2
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%23 = load i32, i32* @stdin
%24 = call i64 @fgets(i8* %22, i32 256, i32 %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %152
26: ; preds = %21
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %26
%31 = load i32, i32* @stderr
%32 = load i8*, i8** %6
%33 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %32)
%34 = load i32, i32* @EXIT_FAILURE
store i32 %34, i32* %3
br label %154
35: ; preds = %26
%36 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 0
%37 = call i32 @memset(i32* %36, i32 0, i32 20)
%38 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%39 = call i32 @strcpy(i8* %38, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%40 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%41 = call i32 @strlen(i8* %40)
store i32 %41, i32* %9
store i32 0, i32* %11
br label %42
42: ; preds = %66, %35
%43 = load i32, i32* %11
%44 = load i32, i32* %9
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %69
46: ; preds = %42
%47 = load i32, i32* %11
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 %48
%50 = load i8, i8* %49
%51 = call i64 @isupper(i8 signext %50)
%52 = icmp ne i64 %51, 0
%53 = zext i1 %52 to i64
%54 = select i1 %52, i32 -1, i32 1
%55 = load i32, i32* %11
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = call signext i8 @tolower(i8 signext %58)
%60 = sext i8 %59 to i32
%61 = sub nsw i32 %60, 97
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 %62
%64 = load i32, i32* %63
%65 = add nsw i32 %64, %54
store i32 %65, i32* %63
br label %66
66: ; preds = %46
%67 = load i32, i32* %11
%68 = add nsw i32 %67, 1
store i32 %68, i32* %11
br label %42
69: ; preds = %42
store i32 0, i32* %12
br label %70
70: ; preds = %127, %69
%71 = load i32, i32* %12
%72 = icmp slt i32 %71, 5
br i1 %72, label %73, label %130
73: ; preds = %70
%74 = load i32, i32* %12
%75 = add nsw i32 %74, 1
store i32 %75, i32* %13
br label %76
76: ; preds = %123, %73
%77 = load i32, i32* %13
%78 = icmp slt i32 %77, 5
br i1 %78, label %79, label %126
79: ; preds = %76
%80 = load i32, i32* %13
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 %81
%83 = load i32, i32* %82
%84 = load i32, i32* %12
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 %85
%87 = load i32, i32* %86
%88 = icmp sgt i32 %83, %87
br i1 %88, label %89, label %122
89: ; preds = %79
%90 = load i32, i32* %12
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 %91
%93 = load i32, i32* %92
store i32 %93, i32* %14
%94 = load i32, i32* %13
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 %95
%97 = load i32, i32* %96
%98 = load i32, i32* %12
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 %99
store i32 %97, i32* %100
%101 = load i32, i32* %14
%102 = load i32, i32* %13
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 %103
store i32 %101, i32* %104
%105 = load i32, i32* %12
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 %106
%108 = load i8, i8* %107
%109 = sext i8 %108 to i32
store i32 %109, i32* %15
%110 = load i32, i32* %13
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 %111
%113 = load i8, i8* %112
%114 = load i32, i32* %12
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 %115
store i8 %113, i8* %116
%117 = load i32, i32* %15
%118 = trunc i32 %117 to i8
%119 = load i32, i32* %13
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 %120
store i8 %118, i8* %121
br label %122
122: ; preds = %89, %79
br label %123
123: ; preds = %122
%124 = load i32, i32* %13
%125 = add nsw i32 %124, 1
store i32 %125, i32* %13
br label %76
126: ; preds = %76
br label %127
127: ; preds = %126
%128 = load i32, i32* %12
%129 = add nsw i32 %128, 1
store i32 %129, i32* %12
br label %70
130: ; preds = %70
%131 = load i8*, i8** %6
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %131)
store i32 0, i32* %16
br label %133
133: ; preds = %147, %130
%134 = load i32, i32* %16
%135 = icmp slt i32 %134, 5
br i1 %135, label %136, label %150
136: ; preds = %133
%137 = load i32, i32* %16
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 %138
%140 = load i8, i8* %139
%141 = sext i8 %140 to i32
%142 = load i32, i32* %16
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 %143
%145 = load i32, i32* %144
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 %141, i32 %145)
br label %147
147: ; preds = %136
%148 = load i32, i32* %16
%149 = add nsw i32 %148, 1
store i32 %149, i32* %16
br label %133
150: ; preds = %133
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %21
152: ; preds = %21
%153 = load i32, i32* @EXIT_SUCCESS
store i32 %153, i32* %3
br label %154
154: ; preds = %152, %30
%155 = load i32, i32* %3
ret i32 %155
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [1 x i8] zeroinitializer
@stderr = global i32 0
@.str.1 = [26 x i8] c"%s: Error, empty string.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [6 x i8] c"abcde\00"
@.str.3 = [5 x i8] c"%s: \00"
@.str.4 = [8 x i8] c"%c: %d \00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = alloca [6 x i8]
%5 = alloca [5 x i32]
%6 = load i8*, i8** %1
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%9 = bitcast [5 x i32]* %5 to i8*
%10 = load i32, i32* @stdin
%11 = call i64 @fgets(i8* %7, i32 256, i32 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %174, label %13
13: ; preds = %2
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 1
%16 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 1
%17 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 2
%18 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 2
%19 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 3
%20 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 3
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 4
%22 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 4
%23 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 1
%24 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 1
%25 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 2
%26 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 2
%27 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 3
%28 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 3
%29 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 4
%30 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 4
%31 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 2
%32 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 2
%33 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 3
%34 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 3
%35 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 4
%36 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 4
%37 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 3
%38 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 3
%39 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 4
%40 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 4
%41 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 1
%42 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 1
%43 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 2
%44 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 2
%45 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 3
%46 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 3
%47 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 4
%48 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 4
br label %49
49: ; preds = %13, %120
%50 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %49
%53 = load i32, i32* @stderr
%54 = call i32 @fprintf(i32 %53, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %174
55: ; preds = %49
%56 = call i32 @memset(i32* %14, i32 0, i32 20)
%57 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%58 = call i32 @strlen(i8* %7)
%59 = icmp sgt i32 %58, 0
br i1 %59, label %60, label %146
60: ; preds = %55
%61 = zext i32 %58 to i64
br label %62
62: ; preds = %60, %62
%63 = phi i64 [ 0, %60 ], [ %76, %62 ]
%64 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %63
%65 = load i8, i8* %64
%66 = call i64 @isupper(i8 signext %65)
%67 = icmp eq i64 %66, 0
%68 = select i1 %67, i32 1, i32 -1
%69 = load i8, i8* %64
%70 = call signext i8 @tolower(i8 signext %69)
%71 = sext i8 %70 to i64
%72 = add nsw i64 %71, -97
%73 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 %72
%74 = load i32, i32* %73
%75 = add nsw i32 %74, %68
store i32 %75, i32* %73
%76 = add nuw nsw i64 %63, 1
%77 = icmp eq i64 %76, %61
br i1 %77, label %146, label %62
78: ; preds = %171, %167
%79 = load i32, i32* %25
%80 = load i32, i32* %23
%81 = icmp sgt i32 %79, %80
br i1 %81, label %82, label %85
82: ; preds = %78
store i32 %79, i32* %23
store i32 %80, i32* %25
%83 = load i8, i8* %24
%84 = load i8, i8* %26
store i8 %84, i8* %24
store i8 %83, i8* %26
br label %85
85: ; preds = %82, %78
%86 = phi i32 [ %79, %82 ], [ %80, %78 ]
%87 = load i32, i32* %27
%88 = icmp sgt i32 %87, %86
br i1 %88, label %89, label %92
89: ; preds = %85
store i32 %87, i32* %23
store i32 %86, i32* %27
%90 = load i8, i8* %24
%91 = load i8, i8* %28
store i8 %91, i8* %24
store i8 %90, i8* %28
br label %92
92: ; preds = %89, %85
%93 = phi i32 [ %87, %89 ], [ %86, %85 ]
%94 = load i32, i32* %29
%95 = icmp sgt i32 %94, %93
br i1 %95, label %96, label %99
96: ; preds = %92
store i32 %94, i32* %23
store i32 %93, i32* %29
%97 = load i8, i8* %24
%98 = load i8, i8* %30
store i8 %98, i8* %24
store i8 %97, i8* %30
br label %99
99: ; preds = %96, %92
%100 = load i32, i32* %33
%101 = load i32, i32* %31
%102 = icmp sgt i32 %100, %101
br i1 %102, label %103, label %106
103: ; preds = %99
store i32 %100, i32* %31
store i32 %101, i32* %33
%104 = load i8, i8* %32
%105 = load i8, i8* %34
store i8 %105, i8* %32
store i8 %104, i8* %34
br label %106
106: ; preds = %103, %99
%107 = phi i32 [ %100, %103 ], [ %101, %99 ]
%108 = load i32, i32* %35
%109 = icmp sgt i32 %108, %107
br i1 %109, label %110, label %113
110: ; preds = %106
store i32 %108, i32* %31
store i32 %107, i32* %35
%111 = load i8, i8* %32
%112 = load i8, i8* %36
store i8 %112, i8* %32
store i8 %111, i8* %36
br label %113
113: ; preds = %110, %106
%114 = load i32, i32* %39
%115 = load i32, i32* %37
%116 = icmp sgt i32 %114, %115
br i1 %116, label %117, label %120
117: ; preds = %113
store i32 %114, i32* %37
store i32 %115, i32* %39
%118 = load i8, i8* %38
%119 = load i8, i8* %40
store i8 %119, i8* %38
store i8 %118, i8* %40
br label %120
120: ; preds = %117, %113
%121 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%122 = load i8, i8* %8
%123 = sext i8 %122 to i32
%124 = load i32, i32* %14
%125 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 %123, i32 %124)
%126 = load i8, i8* %41
%127 = sext i8 %126 to i32
%128 = load i32, i32* %42
%129 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 %127, i32 %128)
%130 = load i8, i8* %43
%131 = sext i8 %130 to i32
%132 = load i32, i32* %44
%133 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 %131, i32 %132)
%134 = load i8, i8* %45
%135 = sext i8 %134 to i32
%136 = load i32, i32* %46
%137 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 %135, i32 %136)
%138 = load i8, i8* %47
%139 = sext i8 %138 to i32
%140 = load i32, i32* %48
%141 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 %139, i32 %140)
%142 = call i32 @putchar(i32 10)
%143 = load i32, i32* @stdin
%144 = call i64 @fgets(i8* %7, i32 256, i32 %143)
%145 = icmp eq i64 %144, 0
br i1 %145, label %174, label %49
146: ; preds = %62, %55
%147 = load i32, i32* %15
%148 = load i32, i32* %14
%149 = icmp sgt i32 %147, %148
br i1 %149, label %150, label %153
150: ; preds = %146
store i32 %147, i32* %14
store i32 %148, i32* %15
%151 = load i8, i8* %8
%152 = load i8, i8* %16
store i8 %152, i8* %8
store i8 %151, i8* %16
br label %153
153: ; preds = %146, %150
%154 = phi i32 [ %148, %146 ], [ %147, %150 ]
%155 = load i32, i32* %17
%156 = icmp sgt i32 %155, %154
br i1 %156, label %157, label %160
157: ; preds = %153
store i32 %155, i32* %14
store i32 %154, i32* %17
%158 = load i8, i8* %8
%159 = load i8, i8* %18
store i8 %159, i8* %8
store i8 %158, i8* %18
br label %160
160: ; preds = %157, %153
%161 = phi i32 [ %155, %157 ], [ %154, %153 ]
%162 = load i32, i32* %19
%163 = icmp sgt i32 %162, %161
br i1 %163, label %164, label %167
164: ; preds = %160
store i32 %162, i32* %14
store i32 %161, i32* %19
%165 = load i8, i8* %8
%166 = load i8, i8* %20
store i8 %166, i8* %8
store i8 %165, i8* %20
br label %167
167: ; preds = %164, %160
%168 = phi i32 [ %162, %164 ], [ %161, %160 ]
%169 = load i32, i32* %21
%170 = icmp sgt i32 %169, %168
br i1 %170, label %171, label %78
171: ; preds = %167
store i32 %169, i32* %14
store i32 %168, i32* %21
%172 = load i8, i8* %8
%173 = load i8, i8* %22
store i8 %173, i8* %8
store i8 %172, i8* %22
br label %78
174: ; preds = %120, %2, %52
%175 = phi i32* [ @EXIT_FAILURE, %52 ], [ @EXIT_SUCCESS, %2 ], [ @EXIT_SUCCESS, %120 ]
%176 = load i32, i32* %175
ret i32 %176
}