#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 /*<<< orphan*/ system(char *);
main() {
  int A, B, x;
  int soma = 0;
  int N1, N2;
  do {
    printf("Insira um numero inteiro: ");
    scanf("%d", &A);
    printf("Insira outro numero inteiro: ");
    scanf("%d", &B);
    system("cls");
  } while ((A == B) || (A == (B + 1)) || (A == (B - 1)));
  printf("A = %d; B = %d\n", A, B);
  if (B < A) {
    x = A;
    A = B;
    B = x;
  }
  printf("Soma = ");
  for (int i = A; i <= B; i++) {
    printf("%d + ", i);
    soma = soma + i;
  }
  printf(" = %d", soma);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf03(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee5(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeb0(%rip),%rdi
call   1030 <system@plt>
mov    -0x8(%rbp),%ecx
mov    $0x1,%al
cmp    -0xc(%rbp),%ecx
mov    %al,-0x21(%rbp)
je     11c6 <main+0x96>
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%edx
add    $0x1,%edx
mov    $0x1,%al
cmp    %edx,%ecx
mov    %al,-0x21(%rbp)
je     11c6 <main+0x96>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1146 <main+0x16>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1203 <main+0xd3>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     124b <main+0x11b>
mov    -0x20(%rbp),%esi
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1217 <main+0xe7>
mov    -0x14(%rbp),%esi
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%r14
lea    0xf15(%rip),%rbx
lea    0x4(%rsp),%r15
lea    0xec6(%rip),%r12
mov    %rsp,%r13
lea    0xeda(%rip),%rbp
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    %rbp,%rdi
call   1030 <system@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0x1(%rdx),%eax
cmp    %edx,%esi
je     1160 <main+0x30>
lea    -0x1(%rdx),%ecx
cmp    %eax,%esi
je     1160 <main+0x30>
cmp    %ecx,%esi
je     1160 <main+0x30>
lea    0xe8b(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%eax
mov    0x4(%rsp),%ecx
cmp    %ecx,%eax
jge    11cd <main+0x9d>
mov    %eax,0x4(%rsp)
mov    %ecx,(%rsp)
lea    0xe79(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%ebp
cmp    (%rsp),%ebp
jg     1208 <main+0xd8>
lea    0xe6a(%rip),%r14
xor    %ebx,%ebx
nopl   (%rax)
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
lea    0x1(%rbp),%eax
cmp    (%rsp),%ebp
mov    %eax,%ebp
jl     11f0 <main+0xc0>
lea    0xe4c(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Insira um numero inteiro: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"Insira outro numero inteiro: \00"
@.str.3 = [4 x i8] c"cls\00"
@.str.4 = [16 x i8] c"A = %d; B = %d\0A\00"
@.str.5 = [8 x i8] c"Soma = \00"
@.str.6 = [6 x i8] c"%d + \00"
@.str.7 = [6 x i8] c" = %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
br label %9
9: ; preds = %29, %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%14 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %15
15: ; preds = %9
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = icmp eq i32 %16, %17
br i1 %18, label %29, label %19
19: ; preds = %15
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
%23 = icmp eq i32 %20, %22
br i1 %23, label %29, label %24
24: ; preds = %19
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = sub nsw i32 %26, 1
%28 = icmp eq i32 %25, %27
br label %29
29: ; preds = %24, %19, %15
%30 = phi i1 [ true, %19 ], [ true, %15 ], [ %28, %24 ]
br i1 %30, label %9, label %31
31: ; preds = %29
%32 = load i32, i32* %2
%33 = load i32, i32* %3
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %32, i32 %33)
%35 = load i32, i32* %3
%36 = load i32, i32* %2
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %42
38: ; preds = %31
%39 = load i32, i32* %2
store i32 %39, i32* %4
%40 = load i32, i32* %3
store i32 %40, i32* %2
%41 = load i32, i32* %4
store i32 %41, i32* %3
br label %42
42: ; preds = %38, %31
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%44 = load i32, i32* %2
store i32 %44, i32* %8
br label %45
45: ; preds = %55, %42
%46 = load i32, i32* %8
%47 = load i32, i32* %3
%48 = icmp sle i32 %46, %47
br i1 %48, label %49, label %58
49: ; preds = %45
%50 = load i32, i32* %8
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %50)
%52 = load i32, i32* %5
%53 = load i32, i32* %8
%54 = add nsw i32 %52, %53
store i32 %54, i32* %5
br label %55
55: ; preds = %49
%56 = load i32, i32* %8
%57 = add nsw i32 %56, 1
store i32 %57, i32* %8
br label %45
58: ; preds = %45
%59 = load i32, i32* %5
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %59)
%61 = load i32, i32* %1
ret i32 %61
}

LLVM IR (-O2):
@.str = [27 x i8] c"Insira um numero inteiro: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"Insira outro numero inteiro: \00"
@.str.3 = [4 x i8] c"cls\00"
@.str.4 = [16 x i8] c"A = %d; B = %d\0A\00"
@.str.5 = [8 x i8] c"Soma = \00"
@.str.6 = [6 x i8] c"%d + \00"
@.str.7 = [6 x i8] c" = %d\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 = %5, %0
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 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 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = icmp eq i32 %11, %12
%14 = add nsw i32 %12, 1
%15 = icmp eq i32 %11, %14
%16 = select i1 %13, i1 true, i1 %15
%17 = add nsw i32 %12, -1
%18 = icmp eq i32 %11, %17
%19 = select i1 %16, i1 true, i1 %18
br i1 %19, label %5, label %20
20: ; preds = %5
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %11, i32 %12)
%22 = load i32, i32* %2
%23 = load i32, i32* %1
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %26
25: ; preds = %20
store i32 %22, i32* %1
store i32 %23, i32* %2
br label %26
26: ; preds = %25, %20
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%28 = load i32, i32* %1
%29 = load i32, i32* %2
%30 = icmp sgt i32 %28, %29
br i1 %30, label %31, label %34
31: ; preds = %34, %26
%32 = phi i32 [ 0, %26 ], [ %38, %34 ]
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %32)
ret i32 0
34: ; preds = %26, %34
%35 = phi i32 [ %39, %34 ], [ %28, %26 ]
%36 = phi i32 [ %38, %34 ], [ 0, %26 ]
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %35)
%38 = add nsw i32 %35, %36
%39 = add nsw i32 %35, 1
%40 = load i32, i32* %2
%41 = icmp slt i32 %35, %40
br i1 %41, label %34, label %31
}