#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 getchar();
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int letter, blank, digit, other, i;
  char ch;
  printf("Input 10 characters: ");
  letter = blank = digit = other = 0;
  for (i = 1; i <= 10; i++) {
    ch = getchar();
    if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))
      letter++;
    else if (ch == ' ' || ch == '\n')
      blank++;
    else if (ch >= '0' && ch <= '9')
      digit++;
    else
      other++;
  }
  printf("letter=%d, blank=%d, digit=%d, other=%d", letter, blank, digit,
         other);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jg     122c <main+0x10c>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x61,%eax
jl     118e <main+0x6e>
movsbl -0x19(%rbp),%eax
cmp    $0x7a,%eax
jle    11a8 <main+0x88>
movsbl -0x19(%rbp),%eax
cmp    $0x41,%eax
jl     11b6 <main+0x96>
movsbl -0x19(%rbp),%eax
cmp    $0x5a,%eax
jg     11b6 <main+0x96>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1219 <main+0xf9>
movsbl -0x19(%rbp),%eax
cmp    $0x20,%eax
je     11d0 <main+0xb0>
movsbl -0x19(%rbp),%eax
cmp    $0xa,%eax
jne    11de <main+0xbe>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1214 <main+0xf4>
movsbl -0x19(%rbp),%eax
cmp    $0x30,%eax
jl     1206 <main+0xe6>
movsbl -0x19(%rbp),%eax
cmp    $0x39,%eax
jg     1206 <main+0xe6>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    120f <main+0xef>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1214 <main+0xf4>
jmp    1219 <main+0xf9>
jmp    121e <main+0xfe>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1160 <main+0x40>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xed1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xa,%ebp
xor    %ebx,%ebx
xor    %r14d,%r14d
xor    %r15d,%r15d
xor    %r12d,%r12d
jmp    1158 <main+0x38>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
add    $0xffffffff,%ebp
je     118c <main+0x6c>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ecx
and    $0xdf,%cl
add    $0xbf,%cl
cmp    $0x19,%cl
jbe    1150 <main+0x30>
cmp    $0x20,%al
je     1174 <main+0x54>
cmp    $0xa,%al
jne    117a <main+0x5a>
add    $0x1,%r12d
jmp    1153 <main+0x33>
add    $0xd0,%al
cmp    $0x9,%al
ja     1186 <main+0x66>
add    $0x1,%r15d
jmp    1153 <main+0x33>
add    $0x1,%r14d
jmp    1153 <main+0x33>
lea    0xe83(%rip),%rdi
mov    %ebx,%esi
mov    %r12d,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Input 10 characters: \00"
@.str.1 = [40 x i8] c"letter=%d, blank=%d, digit=%d, other=%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
store i32 0, i32* %4
store i32 0, i32* %3
store i32 0, i32* %2
store i32 1, i32* %6
br label %9
9: ; preds = %60, %0
%10 = load i32, i32* %6
%11 = icmp sle i32 %10, 10
br i1 %11, label %12, label %63
12: ; preds = %9
%13 = call signext i8 (...) @getchar()
store i8 %13, i8* %7
%14 = load i8, i8* %7
%15 = sext i8 %14 to i32
%16 = icmp sge i32 %15, 97
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = load i8, i8* %7
%19 = sext i8 %18 to i32
%20 = icmp sle i32 %19, 122
br i1 %20, label %29, label %21
21: ; preds = %17, %12
%22 = load i8, i8* %7
%23 = sext i8 %22 to i32
%24 = icmp sge i32 %23, 65
br i1 %24, label %25, label %32
25: ; preds = %21
%26 = load i8, i8* %7
%27 = sext i8 %26 to i32
%28 = icmp sle i32 %27, 90
br i1 %28, label %29, label %32
29: ; preds = %25, %17
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
br label %59
32: ; preds = %25, %21
%33 = load i8, i8* %7
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 32
br i1 %35, label %40, label %36
36: ; preds = %32
%37 = load i8, i8* %7
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 10
br i1 %39, label %40, label %43
40: ; preds = %36, %32
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
br label %58
43: ; preds = %36
%44 = load i8, i8* %7
%45 = sext i8 %44 to i32
%46 = icmp sge i32 %45, 48
br i1 %46, label %47, label %54
47: ; preds = %43
%48 = load i8, i8* %7
%49 = sext i8 %48 to i32
%50 = icmp sle i32 %49, 57
br i1 %50, label %51, label %54
51: ; preds = %47
%52 = load i32, i32* %4
%53 = add nsw i32 %52, 1
store i32 %53, i32* %4
br label %57
54: ; preds = %47, %43
%55 = load i32, i32* %5
%56 = add nsw i32 %55, 1
store i32 %56, i32* %5
br label %57
57: ; preds = %54, %51
br label %58
58: ; preds = %57, %40
br label %59
59: ; preds = %58, %29
br label %60
60: ; preds = %59
%61 = load i32, i32* %6
%62 = add nsw i32 %61, 1
store i32 %62, i32* %6
br label %9
63: ; preds = %9
%64 = load i32, i32* %2
%65 = load i32, i32* %3
%66 = load i32, i32* %4
%67 = load i32, i32* %5
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %64, i32 %65, i32 %66, i32 %67)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Input 10 characters: \00"
@.str.1 = [40 x i8] c"letter=%d, blank=%d, digit=%d, other=%d\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %24
%3 = phi i32 [ 0, %0 ], [ %28, %24 ]
%4 = phi i32 [ 1, %0 ], [ %29, %24 ]
%5 = phi i32 [ 0, %0 ], [ %27, %24 ]
%6 = phi i32 [ 0, %0 ], [ %26, %24 ]
%7 = phi i32 [ 0, %0 ], [ %25, %24 ]
%8 = tail call signext i8 (...) @getchar()
%9 = and i8 %8, -33
%10 = add i8 %9, -65
%11 = icmp ult i8 %10, 26
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = add nsw i32 %3, 1
br label %24
14: ; preds = %2
switch i8 %8, label %17 [
i8 32, label %15
i8 10, label %15
]
15: ; preds = %14, %14
%16 = add nsw i32 %7, 1
br label %24
17: ; preds = %14
%18 = add i8 %8, -48
%19 = icmp ult i8 %18, 10
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = add nsw i32 %6, 1
br label %24
22: ; preds = %17
%23 = add nsw i32 %5, 1
br label %24
24: ; preds = %12, %20, %22, %15
%25 = phi i32 [ %7, %12 ], [ %16, %15 ], [ %7, %20 ], [ %7, %22 ]
%26 = phi i32 [ %6, %12 ], [ %6, %15 ], [ %21, %20 ], [ %6, %22 ]
%27 = phi i32 [ %5, %12 ], [ %5, %15 ], [ %5, %20 ], [ %23, %22 ]
%28 = phi i32 [ %13, %12 ], [ %3, %15 ], [ %3, %20 ], [ %3, %22 ]
%29 = add nuw nsw i32 %4, 1
%30 = icmp eq i32 %29, 11
br i1 %30, label %31, label %2
31: ; preds = %24
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %28, i32 %25, i32 %26, i32 %27)
ret i32 0
}