#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int, int);
main() {
  int c, espacios = 0, aste = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ')
      ++espacios;
    else if (c == '*')
      ++aste;
  }
  printf("numero de espacios %d numero de asteriscos %d \n", espacios, aste);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     118b <main+0x6b>
cmpl   $0x20,-0x8(%rbp)
jne    116e <main+0x4e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1186 <main+0x66>
cmpl   $0x2a,-0x8(%rbp)
jne    1181 <main+0x61>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1186 <main+0x66>
jmp    113d <main+0x1d>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb4(%rip),%r14
mov    $0x0,%ebp
cmp    (%r14),%eax
jne    1155 <main+0x35>
lea    0xebb(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    116f <main+0x4f>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
je     113e <main+0x1e>
cmp    $0x2a,%eax
je     1160 <main+0x40>
cmp    $0x20,%eax
jne    1163 <main+0x43>
add    $0x1,%ebx
jmp    1163 <main+0x43>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [48 x i8] c"numero de espacios %d numero de asteriscos %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %22, %0
%6 = call i32 (...) @getchar()
store i32 %6, i32* %2
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %23
9: ; preds = %5
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 32
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %22
15: ; preds = %9
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 42
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %21
21: ; preds = %18, %15
br label %22
22: ; preds = %21, %12
br label %5
23: ; preds = %5
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %24, i32 %25)
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [48 x i8] c"numero de espacios %d numero de asteriscos %d \0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %18, label %4
4: ; preds = %0, %12
%5 = phi i32 [ %15, %12 ], [ %1, %0 ]
%6 = phi i32 [ %14, %12 ], [ 0, %0 ]
%7 = phi i32 [ %13, %12 ], [ 0, %0 ]
switch i32 %5, label %12 [
i32 32, label %8
i32 42, label %10
]
8: ; preds = %4
%9 = add nsw i32 %7, 1
br label %12
10: ; preds = %4
%11 = add nsw i32 %6, 1
br label %12
12: ; preds = %4, %10, %8
%13 = phi i32 [ %9, %8 ], [ %7, %10 ], [ %7, %4 ]
%14 = phi i32 [ %6, %8 ], [ %11, %10 ], [ %6, %4 ]
%15 = tail call i32 (...) @getchar()
%16 = load i32, i32* @EOF
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %4
18: ; preds = %12, %0
%19 = phi i32 [ 0, %0 ], [ %13, %12 ]
%20 = phi i32 [ 0, %0 ], [ %14, %12 ]
%21 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %20)
ret i32 0
}