#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() {
  char c;
  int letters = 0, space = 0, digit = 0, other = 0;
  printf("Please input a line of String:\n");
  while ((c = getchar()) != '\n') {
    if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')
      letters++;
    else if (c == ' ')
      space++;
    else if (c >= '0' && c <= '9')
      digit++;
    else
      other++;
  }
  printf("The number of alphabet:%d\nThe number of space:%d\nThe number of "
         "numbers:%d\nThe number of other characters:%d\n",
         letters, space, digit, other);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     120c <main+0xec>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1189 <main+0x69>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jle    11a3 <main+0x83>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     11b1 <main+0x91>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     11b1 <main+0x91>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1207 <main+0xe7>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    11cc <main+0xac>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1202 <main+0xe2>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     11f4 <main+0xd4>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     11f4 <main+0xd4>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11fd <main+0xdd>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1202 <main+0xe2>
jmp    1207 <main+0xe7>
jmp    1159 <main+0x39>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    0xe00(%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   %rbx
push   %rax
lea    0xf2f(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    $0x0,%ebp
mov    $0x0,%r15d
mov    $0x0,%r14d
cmp    $0xa,%al
jne    1186 <main+0x56>
lea    0xe98(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r14d,%r14d
xor    %r15d,%r15d
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    11ae <main+0x7e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     1161 <main+0x31>
mov    %eax,%ecx
and    $0xdf,%cl
add    $0xbf,%cl
cmp    $0x19,%cl
jbe    11a0 <main+0x70>
cmp    $0x20,%al
jne    11d0 <main+0xa0>
add    $0x1,%ebp
jmp    11a3 <main+0x73>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xd0,%al
cmp    $0x9,%al
ja     11dc <main+0xac>
add    $0x1,%r15d
jmp    11a3 <main+0x73>
add    $0x1,%r14d
jmp    11a3 <main+0x73>

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

LLVM IR (-O2):
@.str.1 = [109 x i8] c"The number of alphabet:%d\0AThe number of space:%d\0AThe number of numbers:%d\0AThe number of other characters:%d\0A\00"
@str = [31 x i8] c"Please input a line of String:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%2 = tail call signext i8 (...) @getchar()
%3 = icmp eq i8 %2, 10
br i1 %3, label %33, label %4
4: ; preds = %0, %26
%5 = phi i8 [ %31, %26 ], [ %2, %0 ]
%6 = phi i32 [ %30, %26 ], [ 0, %0 ]
%7 = phi i32 [ %29, %26 ], [ 0, %0 ]
%8 = phi i32 [ %28, %26 ], [ 0, %0 ]
%9 = phi i32 [ %27, %26 ], [ 0, %0 ]
%10 = and i8 %5, -33
%11 = add i8 %10, -65
%12 = icmp ult i8 %11, 26
br i1 %12, label %13, label %15
13: ; preds = %4
%14 = add nsw i32 %9, 1
br label %26
15: ; preds = %4
%16 = icmp eq i8 %5, 32
br i1 %16, label %17, label %19
17: ; preds = %15
%18 = add nsw i32 %8, 1
br label %26
19: ; preds = %15
%20 = add i8 %5, -48
%21 = icmp ult i8 %20, 10
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = add nsw i32 %7, 1
br label %26
24: ; preds = %19
%25 = add nsw i32 %6, 1
br label %26
26: ; preds = %17, %24, %22, %13
%27 = phi i32 [ %14, %13 ], [ %9, %17 ], [ %9, %22 ], [ %9, %24 ]
%28 = phi i32 [ %8, %13 ], [ %18, %17 ], [ %8, %22 ], [ %8, %24 ]
%29 = phi i32 [ %7, %13 ], [ %7, %17 ], [ %23, %22 ], [ %7, %24 ]
%30 = phi i32 [ %6, %13 ], [ %6, %17 ], [ %6, %22 ], [ %25, %24 ]
%31 = tail call signext i8 (...) @getchar()
%32 = icmp eq i8 %31, 10
br i1 %32, label %33, label %4
33: ; preds = %26, %0
%34 = phi i32 [ 0, %0 ], [ %27, %26 ]
%35 = phi i32 [ 0, %0 ], [ %28, %26 ]
%36 = phi i32 [ 0, %0 ], [ %29, %26 ]
%37 = phi i32 [ 0, %0 ], [ %30, %26 ]
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([109 x i8], [109 x i8]* @.str.1, i64 0, i64 0), i32 %34, i32 %35, i32 %36, i32 %37)
ret i32 0
}