#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);
void main() {
  char c;
  int letters = 0, space = 0, digital = 0, others = 0;
  while ((c = getchar()) != '\n') {
    if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
      letters++;
    else if (' ' == c)
      space++;
    else if (c >= '0' && c <= '9')
      digital++;
    else
      others++;
  }
  printf("The number of letters is:%d\n", letters);
  printf("The number of space is %d\n", space);
  printf("The number of digital is %d\n", digital);
  printf("The number of others is %d\n", others);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x1(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     11fb <main+0xdb>
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1174 <main+0x54>
movsbl -0x1(%rbp),%eax
cmp    $0x7a,%eax
jle    118e <main+0x6e>
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     119c <main+0x7c>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     119c <main+0x7c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11f6 <main+0xd6>
movsbl -0x1(%rbp),%ecx
mov    $0x20,%eax
cmp    %ecx,%eax
jne    11bb <main+0x9b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11f1 <main+0xd1>
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     11e3 <main+0xc3>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jg     11e3 <main+0xc3>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11ec <main+0xcc>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11f1 <main+0xd1>
jmp    11f6 <main+0xd6>
jmp    1144 <main+0x24>
mov    -0x8(%rbp),%esi
lea    0xdfb(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe09(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    $0x0,%ebp
mov    $0x0,%r15d
mov    $0x0,%r14d
cmp    $0xa,%al
jne    1189 <main+0x69>
lea    0xeb4(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
mov    %r14d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>
xor    %r14d,%r14d
xor    %r15d,%r15d
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    11ae <main+0x8e>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
je     1145 <main+0x25>
mov    %eax,%ecx
and    $0xdf,%cl
add    $0xbf,%cl
cmp    $0x19,%cl
jbe    11a0 <main+0x80>
cmp    $0x20,%al
jne    11d0 <main+0xb0>
add    $0x1,%ebp
jmp    11a3 <main+0x83>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xd0,%al
cmp    $0x9,%al
ja     11dc <main+0xbc>
add    $0x1,%r15d
jmp    11a3 <main+0x83>
add    $0x1,%r14d
jmp    11a3 <main+0x83>

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

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