int main() {
  char s[200] = {"/0"};
  int x, d, l, sp;
  x = l = sp = d = 0;
  printf("\t\tThe great letter counting program %c\n\n", 2);
  printf("Type here the sentence of which you want the letters to be counted: "
         "%c\n",
         31);
  gets(s);
  for (x = 0; x < 200; x++) {
    if (isalpha(s[x]))
      l++;
    if (isspace(s[x]))
      sp++;
    if (isdigit(s[x]))
      d++;
  }
  printf("\n\n\tHere comes the results....\n");
  printf("So....");
  printf("\nIn the previous sentence you had %d letters, %d digits and %d "
         "spaces!\n\n\n",
         l, d, sp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xd0(%rbp),%rdi
xor    %esi,%esi
mov    $0xc8,%edx
call   1050 <memset@plt>
movb   $0x2f,-0xd0(%rbp)
movb   $0x30,-0xcf(%rbp)
movl   $0x0,-0xd8(%rbp)
movl   $0x0,-0xe0(%rbp)
movl   $0x0,-0xdc(%rbp)
movl   $0x0,-0xd4(%rbp)
lea    0xe3e(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe54(%rip),%rdi
mov    $0x1f,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xd0(%rbp),%rdi
mov    $0x0,%al
call   1070 <gets@plt>
movl   $0x0,-0xd4(%rbp)
cmpl   $0xc8,-0xd4(%rbp)
jge    12a6 <main+0x146>
movslq -0xd4(%rbp),%rax
movsbl -0xd0(%rbp,%rax,1),%edi
ff
call   1080 <isalpha@plt>
cmp    $0x0,%eax
je     1235 <main+0xd5>
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xdc(%rbp)
movslq -0xd4(%rbp),%rax
movsbl -0xd0(%rbp,%rax,1),%edi
ff
call   1060 <isspace@plt>
cmp    $0x0,%eax
je     1261 <main+0x101>
mov    -0xe0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe0(%rbp)
movslq -0xd4(%rbp),%rax
movsbl -0xd0(%rbp,%rax,1),%edi
ff
call   1030 <isdigit@plt>
cmp    $0x0,%eax
je     128d <main+0x12d>
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    1292 <main+0x132>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    11f9 <main+0x99>
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdd5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xdc(%rbp),%esi
mov    -0xd8(%rbp),%edx
mov    -0xe0(%rbp),%ecx
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xd0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0xc0(%rsp)
movw   $0x302f,(%rsp)
lea    0xe3e(%rip),%rdi
xor    %ebp,%ebp
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe52(%rip),%rdi
mov    $0x1f,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rdi
xor    %eax,%eax
call   1060 <gets@plt>
xor    %r14d,%r14d
xor    %r12d,%r12d
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
movsbl (%rsp,%rbp,1),%ebx
mov    %ebx,%edi
call   1070 <isalpha@plt>
cmp    $0x1,%eax
sbb    $0xffffffff,%r12d
mov    %ebx,%edi
call   1050 <isspace@plt>
cmp    $0x1,%eax
sbb    $0xffffffff,%r14d
add    $0xffffffd0,%ebx
cmp    $0xa,%ebx
adc    $0x0,%r15d
add    $0x1,%rbp
cmp    $0xc8,%rbp
jne    1200 <main+0xb0>
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
lea    0xe27(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe20(%rip),%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [41 x i8] c"\09\09The great letter counting program %c\0A\0A\00"
@.str.1 = [72 x i8] c"Type here the sentence of which you want the letters to be counted: %c\0A\00"
@.str.2 = [31 x i8] c"\0A\0A\09Here comes the results....\0A\00"
@.str.3 = [7 x i8] c"So....\00"
@.str.4 = [74 x i8] c"\0AIn the previous sentence you had %d letters, %d digits and %d spaces!\0A\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [200 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [200 x i8]* %2 to i8*
%8 = bitcast i8* %7 to [200 x i8]*
%9 = getelementptr inbounds [200 x i8], [200 x i8]* %8, i32 0, i32 0
store i8 47, i8* %9
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %8, i32 0, i32 1
store i8 48, i8* %10
store i32 0, i32* %4
store i32 0, i32* %6
store i32 0, i32* %5
store i32 0, i32* %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 2)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0), i32 31)
%13 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%14 = call i32 (i8*, ...) bitcast (i32 (...)* @gets to i32 (i8*, ...)*)(i8* %13)
store i32 0, i32* %3
br label %15
15: ; preds = %52, %0
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 200
br i1 %17, label %18, label %55
18: ; preds = %15
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = call i32 @isalpha(i32 %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %18
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %29
29: ; preds = %26, %18
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = call i32 @isspace(i32 %34)
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %29
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
br label %40
40: ; preds = %37, %29
%41 = load i32, i32* %3
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = call i32 @isdigit(i32 %45)
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %40
%49 = load i32, i32* %4
%50 = add nsw i32 %49, 1
store i32 %50, i32* %4
br label %51
51: ; preds = %48, %40
br label %52
52: ; preds = %51
%53 = load i32, i32* %3
%54 = add nsw i32 %53, 1
store i32 %54, i32* %3
br label %15
55: ; preds = %15
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%58 = load i32, i32* %5
%59 = load i32, i32* %4
%60 = load i32, i32* %6
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.4, i64 0, i64 0), i32 %58, i32 %59, i32 %60)
%62 = load i32, i32* %1
ret i32 %62
}

LLVM IR (-O2):
@.str = [41 x i8] c"\09\09The great letter counting program %c\0A\0A\00"
@.str.1 = [72 x i8] c"Type here the sentence of which you want the letters to be counted: %c\0A\00"
@.str.3 = [7 x i8] c"So....\00"
@.str.4 = [74 x i8] c"\0AIn the previous sentence you had %d letters, %d digits and %d spaces!\0A\0A\0A\00"
@str = [30 x i8] c"\0A\0A\09Here comes the results....\00"
define i32 @main() {
%1 = alloca [200 x i8]
%2 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
store i8 47, i8* %2
%3 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 1
store i8 48, i8* %3
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 2)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0), i32 31)
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @gets to i32 (i8*, ...)*)(i8* %2)
br label %7
7: ; preds = %0, %7
%8 = phi i64 [ 0, %0 ], [ %27, %7 ]
%9 = phi i32 [ 0, %0 ], [ %22, %7 ]
%10 = phi i32 [ 0, %0 ], [ %18, %7 ]
%11 = phi i32 [ 0, %0 ], [ %26, %7 ]
%12 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 %8
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = call i32 @isalpha(i32 %14)
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i32
%18 = add nuw nsw i32 %10, %17
%19 = call i32 @isspace(i32 %14)
%20 = icmp ne i32 %19, 0
%21 = zext i1 %20 to i32
%22 = add nuw nsw i32 %9, %21
%23 = add nsw i32 %14, -48
%24 = icmp ult i32 %23, 10
%25 = zext i1 %24 to i32
%26 = add nuw nsw i32 %11, %25
%27 = add nuw nsw i64 %8, 1
%28 = icmp eq i64 %27, 200
br i1 %28, label %29, label %7
29: ; preds = %7
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @.str.4, i64 0, i64 0), i32 %18, i32 %26, i32 %22)
ret i32 0
}