#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
double strtod(char *, int /*<<< orphan*/ *);
int validar_es_flotante(char *);
double Suma(double a, double b) {
  char buffer[9];
  bool band = false;
  int enteroDummy = 0;
  do {
    printf("Enter a number: ");
    scanf("%s", buffer);
    if ((band = validar_es_flotante(buffer)) == false)
      printf("Please only integer or floating.\n");
  } while (band == false);
  a = strtod(buffer, NULL);
  do {
    printf("Enter a number: ");
    scanf("%s", buffer);
    if ((band = validar_es_flotante(buffer)) == false)
      printf("Please only integer or floating.\n");
  } while (band == false);
  b = strtod(buffer, NULL);
  return (a + b);
}


x86 assembly (clang, -O0):
<Suma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
lea    -0x19(%rbp),%rsi
lea    0xe9a(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x19(%rbp),%rdi
call   1060 <validar_es_flotante@plt>
mov    %eax,-0x20(%rbp)
cmp    $0x0,%eax
jne    119d <Suma+0x5d>
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
jmp    11a2 <Suma+0x62>
cmpl   $0x0,-0x20(%rbp)
je     1160 <Suma+0x20>
lea    -0x19(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
movsd  %xmm0,-0x8(%rbp)
lea    0xe3b(%rip),%rdi
call   1040 <printf@plt>
lea    -0x19(%rbp),%rsi
lea    0xe3c(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x19(%rbp),%rdi
call   1060 <validar_es_flotante@plt>
mov    %eax,-0x20(%rbp)
cmp    $0x0,%eax
jne    11fb <Suma+0xbb>
lea    0xe1e(%rip),%rdi
call   1040 <printf@plt>
jmp    1200 <Suma+0xc0>
cmpl   $0x0,-0x20(%rbp)
je     11be <Suma+0x7e>
lea    -0x19(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Suma>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe9e(%rip),%rdi
call   1050 <printf@plt>
lea    0xea3(%rip),%rdi
lea    0x7(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1070 <validar_es_flotante@plt>
test   %eax,%eax
jne    11d7 <Suma+0x87>
lea    0xe86(%rip),%r14
lea    0xe6b(%rip),%r15
lea    0xe75(%rip),%r12
lea    0x7(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1070 <validar_es_flotante@plt>
test   %eax,%eax
je     11b0 <Suma+0x60>
lea    0x7(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <strtod@plt>
movsd  %xmm0,0x10(%rsp)
lea    0xe0d(%rip),%rdi
call   1050 <printf@plt>
lea    0xe12(%rip),%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1070 <validar_es_flotante@plt>
test   %eax,%eax
jne    1257 <Suma+0x107>
lea    0xdfa(%rip),%r14
lea    0xddf(%rip),%r15
lea    0xde9(%rip),%r12
lea    0x7(%rsp),%rbx
nopl   (%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1070 <validar_es_flotante@plt>
test   %eax,%eax
je     1230 <Suma+0xe0>
lea    0x7(%rsp),%rdi
xor    %esi,%esi
call   1040 <strtod@plt>
addsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [34 x i8] c"Please only integer or floating.\0A\00"
define double @Suma(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca [9 x i8]
%6 = alloca i32
%7 = alloca i32
store double %0, double* %3
store double %1, double* %4
store i32 0, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %18, %2
%9 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%13 = call i32 @validar_es_flotante(i8* %12)
store i32 %13, i32* %6
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %8
%16 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %8
br label %18
18: ; preds = %17
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 0
br i1 %20, label %8, label %21
21: ; preds = %18
%22 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%23 = call double @strtod(i8* %22, i32* null)
store double %23, double* %3
br label %24
24: ; preds = %34, %21
%25 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%26 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%29 = call i32 @validar_es_flotante(i8* %28)
store i32 %29, i32* %6
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %24
%32 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %31, %24
br label %34
34: ; preds = %33
%35 = load i32, i32* %6
%36 = icmp eq i32 %35, 0
br i1 %36, label %24, label %37
37: ; preds = %34
%38 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%39 = call double @strtod(i8* %38, i32* null)
store double %39, double* %4
%40 = load double, double* %3
%41 = load double, double* %4
%42 = fadd double %40, %41
ret double %42
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%s\00"
@str.3 = [33 x i8] c"Please only integer or floating.\00"
define double @Suma(double %0, double %1) {
%3 = alloca [9 x i8]
%4 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = call i32 @validar_es_flotante(i8* %4)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %2, %9
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.3, i64 0, i64 0))
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%13 = call i32 @validar_es_flotante(i8* %4)
%14 = icmp eq i32 %13, 0
br i1 %14, label %9, label %15
15: ; preds = %9, %2
%16 = call double @strtod(i8* nocapture %4, i32* null)
%17 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%19 = call i32 @validar_es_flotante(i8* %4)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %15, %21
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.3, i64 0, i64 0))
%23 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%25 = call i32 @validar_es_flotante(i8* %4)
%26 = icmp eq i32 %25, 0
br i1 %26, label %21, label %27
27: ; preds = %21, %15
%28 = call double @strtod(i8* nocapture %4, i32* null)
%29 = fadd double %16, %28
ret double %29
}