#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 *, int *);
scalar_t__ sqrt(int);
int main(void) {
  int a, b, i;
  float s;
  do {
    printf("Limite inferior:");
    scanf("%d", &a);
    if (a < 0) {
      printf("No puede ser negativo\n");
    }
  } while (a < 0);
  do {
    printf("limite superior:");
    scanf("%d", &b);
    if (b < a) {
      printf("No puede ser menor que %d\n", a);
    }
  } while (b < a);
  s = 0.0;
  for (i = a; i <= b; i++) {
    s += sqrt(i);
  }
  printf("Sumatorio de raices de %d a %d: %f\n", a, b, s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jge    1175 <main+0x45>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117a <main+0x4a>
cmpl   $0x0,-0x8(%rbp)
jl     113f <main+0xf>
jmp    1189 <main+0x59>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe73(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c4 <main+0x94>
mov    -0x8(%rbp),%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c9 <main+0x99>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1189 <main+0x59>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1214 <main+0xe4>
mov    -0x10(%rbp),%edi
call   1050 <sqrt@plt>
cvtsi2ss %rax,%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11e3 <main+0xb3>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe2d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xeac(%rip),%r14
lea    0xeb6(%rip),%r15
lea    0x4(%rsp),%rbx
lea    0xefd(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jns    119b <main+0x5b>
mov    %r12,%rdi
call   1030 <puts@plt>
cmpl   $0x0,0x4(%rsp)
js     1170 <main+0x30>
lea    0xe72(%rip),%r14
lea    0xe68(%rip),%r15
lea    0xc(%rsp),%r12
lea    0xe70(%rip),%r13
jmp    11c4 <main+0x84>
nopw   0x0(%rax,%rax,1)
cmp    %ebx,%eax
jge    11fb <main+0xbb>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
mov    0x4(%rsp),%ebx
cmp    %ebx,%eax
jge    11c0 <main+0x80>
mov    %r13,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%eax
mov    0x4(%rsp),%ebx
jmp    11c0 <main+0x80>
xorps  %xmm0,%xmm0
xchg   %ax,%ax
movss  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1060 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  0x8(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x8(%rsp)
movss  0x8(%rsp),%xmm0
lea    0x1(%rbx),%eax
mov    0xc(%rsp),%edx
cmp    %edx,%ebx
mov    %eax,%ebx
jl     1200 <main+0xc0>
mov    0x4(%rsp),%esi
cvtss2sd %xmm0,%xmm0
lea    0xdf9(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Limite inferior:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"No puede ser negativo\0A\00"
@.str.3 = [17 x i8] c"limite superior:\00"
@.str.4 = [27 x i8] c"No puede ser menor que %d\0A\00"
@.str.5 = [36 x i8] c"Sumatorio de raices de %d a %d: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
store i32 0, i32* %1
br label %6
6: ; preds = %14, %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %11, %6
br label %14
14: ; preds = %13
%15 = load i32, i32* %2
%16 = icmp slt i32 %15, 0
br i1 %16, label %6, label %17
17: ; preds = %14
br label %18
18: ; preds = %28, %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%21 = load i32, i32* %3
%22 = load i32, i32* %2
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %27
24: ; preds = %18
%25 = load i32, i32* %2
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %24, %18
br label %28
28: ; preds = %27
%29 = load i32, i32* %3
%30 = load i32, i32* %2
%31 = icmp slt i32 %29, %30
br i1 %31, label %18, label %32
32: ; preds = %28
store float 0.000000e+00, float* %5
%33 = load i32, i32* %2
store i32 %33, i32* %4
br label %34
34: ; preds = %44, %32
%35 = load i32, i32* %4
%36 = load i32, i32* %3
%37 = icmp sle i32 %35, %36
br i1 %37, label %38, label %47
38: ; preds = %34
%39 = load i32, i32* %4
%40 = call i64 @sqrt(i32 %39)
%41 = sitofp i64 %40 to float
%42 = load float, float* %5
%43 = fadd float %42, %41
store float %43, float* %5
br label %44
44: ; preds = %38
%45 = load i32, i32* %4
%46 = add nsw i32 %45, 1
store i32 %46, i32* %4
br label %34
47: ; preds = %34
%48 = load i32, i32* %2
%49 = load i32, i32* %3
%50 = load float, float* %5
%51 = fpext float %50 to double
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 %48, i32 %49, double %51)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Limite inferior:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [17 x i8] c"limite superior:\00"
@.str.4 = [27 x i8] c"No puede ser menor que %d\0A\00"
@.str.5 = [36 x i8] c"Sumatorio de raices de %d a %d: %f\0A\00"
@str = [22 x i8] c"No puede ser negativo\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %10, %0
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%12 = load i32, i32* %1
%13 = icmp slt i32 %12, 0
br i1 %13, label %5, label %14
14: ; preds = %5, %10
br label %15
15: ; preds = %14, %25
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%18 = load i32, i32* %2
%19 = load i32, i32* %1
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %25
21: ; preds = %15
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%23 = load i32, i32* %2
%24 = load i32, i32* %1
br label %25
25: ; preds = %15, %21
%26 = phi i32 [ %19, %15 ], [ %24, %21 ]
%27 = phi i32 [ %18, %15 ], [ %23, %21 ]
%28 = icmp slt i32 %27, %26
br i1 %28, label %15, label %29
29: ; preds = %25, %29
%30 = phi float [ %34, %29 ], [ 0.000000e+00, %25 ]
%31 = phi i32 [ %35, %29 ], [ %26, %25 ]
%32 = call i64 @sqrt(i32 %31)
%33 = sitofp i64 %32 to float
%34 = fadd float %30, %33
%35 = add nsw i32 %31, 1
%36 = load i32, i32* %2
%37 = icmp slt i32 %31, %36
br i1 %37, label %29, label %38
38: ; preds = %29
%39 = load i32, i32* %1
%40 = fpext float %34 to double
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 %39, i32 %36, double %40)
ret i32 0
}