#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 */
int /*<<< orphan*/ gets(char *);
scalar_t__ isalpha(char);
scalar_t__ isdigit(char);
scalar_t__ isspace(char);
int /*<<< orphan*/ printf(char *, int, ...);
int main() {
  char adress[200];
  int x, space, digit, alpha;
  x = space = digit = alpha = 0;
  printf("Please enter here you adress: %c\n", 31);
  gets(adress);
  while (adress[x]) {
    if (isspace(adress[x]))
      space++;
    else if (isdigit(adress[x]))
      digit++;
    else if (isalpha(adress[x]))
      alpha++;
    x++;
  }
  printf("\n\nSo, just as a funny fact..,\n\tIn your adress you have %d "
         "letters, %d numbers and %d spaces\n\n",
         alpha, digit, space);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xe0(%rbp)
movl   $0x0,-0xdc(%rbp)
movl   $0x0,-0xd8(%rbp)
movl   $0x0,-0xd4(%rbp)
lea    0xe6f(%rip),%rdi
mov    $0x1f,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xd0(%rbp),%rdi
call   1060 <gets@plt>
movslq -0xd4(%rbp),%rax
cmpb   $0x0,-0xd0(%rbp,%rax,1)
je     126d <main+0x11d>
movslq -0xd4(%rbp),%rax
movsbl -0xd0(%rbp,%rax,1),%edi
ff
call   1050 <isspace@plt>
cmp    $0x0,%rax
je     11f0 <main+0xa0>
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    1259 <main+0x109>
movslq -0xd4(%rbp),%rax
movsbl -0xd0(%rbp,%rax,1),%edi
ff
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1222 <main+0xd2>
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xdc(%rbp)
jmp    1254 <main+0x104>
movslq -0xd4(%rbp),%rax
movsbl -0xd0(%rbp,%rax,1),%edi
ff
call   1070 <isalpha@plt>
cmp    $0x0,%rax
je     124f <main+0xff>
mov    -0xe0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe0(%rbp)
jmp    1254 <main+0x104>
jmp    1259 <main+0x109>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    11a9 <main+0x59>
mov    -0xe0(%rbp),%esi
mov    -0xdc(%rbp),%edx
mov    -0xd8(%rbp),%ecx
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xc8,%rsp
lea    0xe9c(%rip),%rdi
xor    %ebx,%ebx
mov    $0x1f,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rbp
mov    %rbp,%rdi
call   1060 <gets@plt>
mov    (%rsp),%al
mov    $0x0,%r15d
mov    $0x0,%r14d
test   %al,%al
je     11e3 <main+0x93>
xor    %r14d,%r14d
xor    %r15d,%r15d
xor    %ebx,%ebx
jmp    11af <main+0x5f>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
movzbl 0x1(%rbp),%eax
add    $0x1,%rbp
test   %al,%al
je     11e3 <main+0x93>
movsbl %al,%edi
call   1050 <isspace@plt>
test   %rax,%rax
jne    11a0 <main+0x50>
movsbl 0x0(%rbp),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     11d0 <main+0x80>
add    $0x1,%r15d
jmp    11a3 <main+0x53>
movsbl 0x0(%rbp),%edi
call   1070 <isalpha@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%r14d
jmp    11a3 <main+0x53>
lea    0xe38(%rip),%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Please enter here you adress: %c\0A\00"
@.str.1 = [94 x i8] c"\0A\0ASo, just as a funny fact..,\0A\09In your adress you have %d letters, %d numbers and %d spaces\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
store i32 0, i32* %6
store i32 0, i32* %5
store i32 0, i32* %4
store i32 0, i32* %3
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 31)
%8 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%9 = call i32 @gets(i8* %8)
br label %10
10: ; preds = %48, %0
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = icmp ne i8 %14, 0
br i1 %15, label %16, label %51
16: ; preds = %10
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = call i64 @isspace(i8 signext %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %16
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %48
26: ; preds = %16
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = call i64 @isdigit(i8 signext %30)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %26
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %47
36: ; preds = %26
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = call i64 @isalpha(i8 signext %40)
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %36
%44 = load i32, i32* %6
%45 = add nsw i32 %44, 1
store i32 %45, i32* %6
br label %46
46: ; preds = %43, %36
br label %47
47: ; preds = %46, %33
br label %48
48: ; preds = %47, %23
%49 = load i32, i32* %3
%50 = add nsw i32 %49, 1
store i32 %50, i32* %3
br label %10
51: ; preds = %10
%52 = load i32, i32* %6
%53 = load i32, i32* %5
%54 = load i32, i32* %4
%55 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.1, i64 0, i64 0), i32 %52, i32 %53, i32 %54)
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"Please enter here you adress: %c\0A\00"
@.str.1 = [94 x i8] c"\0A\0ASo, just as a funny fact..,\0A\09In your adress you have %d letters, %d numbers and %d spaces\0A\0A\00"
define i32 @main() {
%1 = alloca [200 x i8]
%2 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 31)
%4 = call i32 @gets(i8* %2)
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 0
br i1 %6, label %38, label %7
7: ; preds = %0, %30
%8 = phi i64 [ %34, %30 ], [ 0, %0 ]
%9 = phi i8 [ %36, %30 ], [ %5, %0 ]
%10 = phi i8* [ %35, %30 ], [ %2, %0 ]
%11 = phi i32 [ %33, %30 ], [ 0, %0 ]
%12 = phi i32 [ %32, %30 ], [ 0, %0 ]
%13 = phi i32 [ %31, %30 ], [ 0, %0 ]
%14 = call i64 @isspace(i8 signext %9)
%15 = icmp eq i64 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %7
%17 = add nsw i32 %13, 1
br label %30
18: ; preds = %7
%19 = load i8, i8* %10
%20 = call i64 @isdigit(i8 signext %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %18
%23 = add nsw i32 %12, 1
br label %30
24: ; preds = %18
%25 = load i8, i8* %10
%26 = call i64 @isalpha(i8 signext %25)
%27 = icmp ne i64 %26, 0
%28 = zext i1 %27 to i32
%29 = add nsw i32 %11, %28
br label %30
30: ; preds = %24, %22, %16
%31 = phi i32 [ %17, %16 ], [ %13, %22 ], [ %13, %24 ]
%32 = phi i32 [ %12, %16 ], [ %23, %22 ], [ %12, %24 ]
%33 = phi i32 [ %11, %16 ], [ %11, %22 ], [ %29, %24 ]
%34 = add nuw i64 %8, 1
%35 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 0
br i1 %37, label %38, label %7
38: ; preds = %30, %0
%39 = phi i32 [ 0, %0 ], [ %31, %30 ]
%40 = phi i32 [ 0, %0 ], [ %32, %30 ]
%41 = phi i32 [ 0, %0 ], [ %33, %30 ]
%42 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.1, i64 0, i64 0), i32 %41, i32 %40, i32 %39)
ret i32 0
}