#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 */
char EOF;
char getchar();
scalar_t__ islower(char);
scalar_t__ isupper(char);
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  int up = 0, lo = 0;
  char ch;
  while ((ch = getchar()) != EOF) {
    if (isupper(ch))
      up++;
    else if (islower(ch))
      lo++;
  }
  printf("%d upper-case letters, and %d lower-case letters.\n", up, lo);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0xd(%rbp)
movsbl %al,%eax
mov    0x2e77(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11c3 <main+0x83>
movsbl -0xd(%rbp),%edi
call   1060 <isupper@plt>
cmp    $0x0,%rax
je     119d <main+0x5d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11be <main+0x7e>
movsbl -0xd(%rbp),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     11b9 <main+0x79>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11be <main+0x7e>
jmp    115d <main+0x1d>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe30(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %r14d,%r14d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e90(%rip),%r15
mov    $0x0,%ebp
cmp    (%r15),%al
jne    1180 <main+0x40>
lea    0xe97(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    11ab <main+0x6b>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <islower@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%r14d
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r15),%al
je     1162 <main+0x22>
movsbl %al,%ebx
mov    %ebx,%edi
call   1060 <isupper@plt>
test   %rax,%rax
je     1190 <main+0x50>
add    $0x1,%ebp
jmp    119f <main+0x5f>

LLVM IR (-O0):
@EOF = global i8 0
@.str = [51 x i8] c"%d upper-case letters, and %d lower-case letters.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %26, %0
%6 = call signext i8 (...) @getchar()
store i8 %6, i8* %4
%7 = sext i8 %6 to i32
%8 = load i8, i8* @EOF
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %7, %9
br i1 %10, label %11, label %27
11: ; preds = %5
%12 = load i8, i8* %4
%13 = call i64 @isupper(i8 signext %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %26
18: ; preds = %11
%19 = load i8, i8* %4
%20 = call i64 @islower(i8 signext %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %25
25: ; preds = %22, %18
br label %26
26: ; preds = %25, %15
br label %5
27: ; preds = %5
%28 = load i32, i32* %2
%29 = load i32, i32* %3
%30 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %28, i32 %29)
ret i32 0
}

LLVM IR (-O2):
@EOF = global i8 0
@.str = [51 x i8] c"%d upper-case letters, and %d lower-case letters.\0A\00"
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %23, label %4
4: ; preds = %0, %17
%5 = phi i8 [ %20, %17 ], [ %1, %0 ]
%6 = phi i32 [ %19, %17 ], [ 0, %0 ]
%7 = phi i32 [ %18, %17 ], [ 0, %0 ]
%8 = tail call i64 @isupper(i8 signext %5)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %4
%11 = add nsw i32 %6, 1
br label %17
12: ; preds = %4
%13 = tail call i64 @islower(i8 signext %5)
%14 = icmp ne i64 %13, 0
%15 = zext i1 %14 to i32
%16 = add nsw i32 %7, %15
br label %17
17: ; preds = %12, %10
%18 = phi i32 [ %7, %10 ], [ %16, %12 ]
%19 = phi i32 [ %11, %10 ], [ %6, %12 ]
%20 = tail call signext i8 (...) @getchar()
%21 = load i8, i8* @EOF
%22 = icmp eq i8 %20, %21
br i1 %22, label %23, label %4
23: ; preds = %17, %0
%24 = phi i32 [ 0, %0 ], [ %18, %17 ]
%25 = phi i32 [ 0, %0 ], [ %19, %17 ]
%26 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %25, i32 %24)
ret i32 0
}