#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 t;
  int i, ch = 0, space = 0, num = 0, others = 0;
  printf("Please input a string:");
  while ((t = getchar()) != '\n')
    if ((t >= 'a' && t <= 'z') || (t >= 'A' && t <= 'Z'))
      ch++;
    else if (t == ' ')
      space++;
    else if (t >= '0' && t <= '9')
      num++;
    else
      others++;
  printf("The number of English characters,spaces,numbers,other characters "
         "are:%d %d %d %d\n",
         ch, space, num, others);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%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    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1207 <main+0xe7>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    11cc <main+0xac>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%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    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11fd <main+0xdd>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1202 <main+0xe2>
jmp    1207 <main+0xe7>
jmp    1159 <main+0x39>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    0xdf7(%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    0xed2(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    $0x0,%ebp
mov    $0x0,%r15d
mov    $0x0,%r14d
cmp    $0xa,%al
jne    1178 <main+0x58>
lea    0xebd(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
xor    %eax,%eax
call   1030 <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    119e <main+0x7e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
je     1153 <main+0x33>
mov    %eax,%ecx
and    $0xdf,%cl
add    $0xbf,%cl
cmp    $0x19,%cl
jbe    1190 <main+0x70>
cmp    $0x20,%al
jne    11c0 <main+0xa0>
add    $0x1,%ebp
jmp    1193 <main+0x73>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xd0,%al
cmp    $0x9,%al
ja     11cc <main+0xac>
add    $0x1,%r15d
jmp    1193 <main+0x73>
add    $0x1,%r14d
jmp    1193 <main+0x73>

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

LLVM IR (-O2):
@.str = [23 x i8] c"Please input a string:\00"
@.str.1 = [82 x i8] c"The number of English characters,spaces,numbers,other characters are:%d %d %d %d\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 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 ([82 x i8], [82 x i8]* @.str.1, i64 0, i64 0), i32 %34, i32 %35, i32 %36, i32 %37)
ret i32 0
}