#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 getchar();
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int numero, cincosE = 0, cincosD = 0, realState = 0;
  printf("Introduce un numero real: ");
  while (((numero = getchar()) >= '0' && numero <= '9') || numero == '.') {
    if (numero == '.') {
      realState = 1;
    }
    if (realState == 0) {
      if (numero == '5')
        cincosE += 1;
    } else {
      if (numero == '5')
        cincosD += 1;
    }
  }
  printf("Hay %d cincos (5) en la parte entera y %d cincos (5) en la parte "
         "decimal.\n",
         cincosE, cincosD);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x30,%eax
jl     1174 <main+0x54>
mov    $0x1,%al
cmpl   $0x39,-0x8(%rbp)
mov    %al,-0x15(%rbp)
jle    117e <main+0x5e>
cmpl   $0x2e,-0x8(%rbp)
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    118e <main+0x6e>
jmp    11de <main+0xbe>
cmpl   $0x2e,-0x8(%rbp)
jne    119f <main+0x7f>
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11c1 <main+0xa1>
cmpl   $0x35,-0x8(%rbp)
jne    11bc <main+0x9c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11d9 <main+0xb9>
cmpl   $0x35,-0x8(%rbp)
jne    11d4 <main+0xb4>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11d9 <main+0xb9>
jmp    1152 <main+0x32>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xed5(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0x2e,%eax
sete   %cl
je     1151 <main+0x31>
lea    -0x30(%rax),%edx
mov    $0x0,%ebp
cmp    $0x9,%edx
ja     11a1 <main+0x81>
xor    %edx,%edx
xor    %ebp,%ebp
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
mov    $0x1,%ebx
test   $0x1,%cl
jne    116c <main+0x4c>
mov    %edx,%ebx
xor    %ecx,%ecx
cmp    $0x35,%eax
sete   %cl
test   %ebx,%ebx
mov    $0x0,%eax
cmove  %ecx,%eax
cmove  %ebx,%ecx
add    %eax,%r14d
add    %ecx,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
lea    -0x30(%rax),%esi
mov    %ebx,%edx
cmp    $0x2e,%eax
sete   %cl
je     1160 <main+0x40>
mov    %ebx,%edx
cmp    $0xa,%esi
jb     1160 <main+0x40>
lea    0xe73(%rip),%rdi
mov    %r14d,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Introduce un numero real: \00"
@.str.1 = [75 x i8] c"Hay %d cincos (5) en la parte entera y %d cincos (5) en la parte decimal.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %39, %0
%8 = call i32 (...) @getchar()
store i32 %8, i32* %2
%9 = icmp sge i32 %8, 48
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp sle i32 %11, 57
br i1 %12, label %16, label %13
13: ; preds = %10, %7
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 46
br label %16
16: ; preds = %13, %10
%17 = phi i1 [ true, %10 ], [ %15, %13 ]
br i1 %17, label %18, label %40
18: ; preds = %16
%19 = load i32, i32* %2
%20 = icmp eq i32 %19, 46
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 1, i32* %5
br label %22
22: ; preds = %21, %18
%23 = load i32, i32* %5
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %22
%26 = load i32, i32* %2
%27 = icmp eq i32 %26, 53
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %31
31: ; preds = %28, %25
br label %39
32: ; preds = %22
%33 = load i32, i32* %2
%34 = icmp eq i32 %33, 53
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %38
38: ; preds = %35, %32
br label %39
39: ; preds = %38, %31
br label %7
40: ; preds = %16
%41 = load i32, i32* %3
%42 = load i32, i32* %4
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.1, i64 0, i64 0), i32 %41, i32 %42)
%44 = load i32, i32* %1
ret i32 %44
}

LLVM IR (-O2):
@.str = [27 x i8] c"Introduce un numero real: \00"
@.str.1 = [75 x i8] c"Hay %d cincos (5) en la parte entera y %d cincos (5) en la parte decimal.\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
%3 = add i32 %2, -48
%4 = icmp ult i32 %3, 10
%5 = icmp eq i32 %2, 46
%6 = or i1 %5, %4
br i1 %6, label %7, label %26
7: ; preds = %0, %7
%8 = phi i1 [ %24, %7 ], [ %5, %0 ]
%9 = phi i32 [ %21, %7 ], [ %2, %0 ]
%10 = phi i32 [ %13, %7 ], [ 0, %0 ]
%11 = phi i32 [ %20, %7 ], [ 0, %0 ]
%12 = phi i32 [ %18, %7 ], [ 0, %0 ]
%13 = select i1 %8, i32 1, i32 %10
%14 = icmp eq i32 %13, 0
%15 = icmp eq i32 %9, 53
%16 = zext i1 %15 to i32
%17 = select i1 %14, i32 %16, i32 0
%18 = add nuw nsw i32 %12, %17
%19 = select i1 %14, i32 0, i32 %16
%20 = add nuw nsw i32 %11, %19
%21 = tail call i32 (...) @getchar()
%22 = add i32 %21, -48
%23 = icmp ult i32 %22, 10
%24 = icmp eq i32 %21, 46
%25 = or i1 %24, %23
br i1 %25, label %7, label %26
26: ; preds = %7, %0
%27 = phi i32 [ 0, %0 ], [ %18, %7 ]
%28 = phi i32 [ 0, %0 ], [ %20, %7 ]
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @.str.1, i64 0, i64 0), i32 %27, i32 %28)
ret i32 0
}