#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 *);
int main() {
  int numero1, numero2;
  int suma;
  printf("Ingrese dos numeros enteros como extremos de la sumatoria de "
         "consecutivos.\n");
  printf("numero1 = ");
  scanf("%d", &numero1);
  printf("numero2 = ");
  scanf("%d", &numero2);
  for (suma = 0; numero1 <= numero2; numero1++) {
    suma += numero1;
  }
  printf("Total = %d\n", suma);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf05(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11a3 <main+0x83>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1180 <main+0x60>
mov    -0x10(%rbp),%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeea(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb4(%rip),%r14
mov    %rsp,%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
mov    (%rsp),%edx
mov    %eax,%ecx
sub    %edx,%ecx
jl     11a7 <main+0x77>
lea    0x1(%rdx),%esi
imul   %ecx,%esi
add    %edx,%esi
not    %edx
add    %eax,%edx
imul   %rdx,%rcx
shr    %rcx
add    %esi,%ecx
add    $0x1,%eax
mov    %eax,(%rsp)
mov    %ecx,%ebx
lea    0xe6b(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [76 x i8] c"Ingrese dos numeros enteros como extremos de la sumatoria de consecutivos.\0A\00"
@.str.1 = [11 x i8] c"numero1 = \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [11 x i8] c"numero2 = \00"
@.str.4 = [12 x i8] c"Total = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
store i32 0, i32* %4
br label %10
10: ; preds = %18, %0
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %21
14: ; preds = %10
%15 = load i32, i32* %2
%16 = load i32, i32* %4
%17 = add nsw i32 %16, %15
store i32 %17, i32* %4
br label %18
18: ; preds = %14
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %10
21: ; preds = %10
%22 = load i32, i32* %4
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [11 x i8] c"numero1 = \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [11 x i8] c"numero2 = \00"
@.str.4 = [12 x i8] c"Total = %d\0A\00"
@str = [75 x i8] c"Ingrese dos numeros enteros como extremos de la sumatoria de consecutivos.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = load i32, i32* %1
%12 = icmp slt i32 %10, %11
br i1 %12, label %27, label %13
13: ; preds = %0
%14 = sub i32 %10, %11
%15 = add i32 %11, 1
%16 = mul i32 %14, %15
%17 = add i32 %11, %16
%18 = xor i32 %11, -1
%19 = add i32 %10, %18
%20 = zext i32 %19 to i33
%21 = zext i32 %14 to i33
%22 = mul i33 %20, %21
%23 = lshr i33 %22, 1
%24 = trunc i33 %23 to i32
%25 = add i32 %17, %24
%26 = add i32 %10, 1
store i32 %26, i32* %1
br label %27
27: ; preds = %13, %0
%28 = phi i32 [ %25, %13 ], [ 0, %0 ]
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %28)
ret i32 0
}