#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 lim_inf, lim_sup, incremento;
  printf("entre com o limite inferior: ");
  scanf("%d", &lim_inf);
  printf("entre com o incremento: ");
  scanf("%d", &incremento);
  printf("entre com o limite superior: ");
  scanf("%d", &lim_sup);
  if (incremento < 1)
    printf("incremento invalido\n");
  else if (lim_inf > lim_sup)
    printf("limites invalidos\n");
  else if (lim_inf == lim_sup)
    printf("%d\n", lim_inf);
  else {
    while (lim_inf <= lim_sup) {
      printf("%d\n", lim_inf);
      lim_inf = lim_inf + incremento;
    }
  }
  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    0xeda(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9e(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x10(%rbp)
jge    11a6 <main+0x86>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1226 <main+0x106>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11c5 <main+0xa5>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1221 <main+0x101>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11e7 <main+0xc7>
mov    -0x8(%rbp),%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121c <main+0xfc>
jmp    11ec <main+0xcc>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1217 <main+0xf7>
mov    -0x8(%rbp),%esi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11ec <main+0xcc>
jmp    121c <main+0xfc>
jmp    1221 <main+0x101>
jmp    1226 <main+0x106>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed4(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    11ac <main+0x7c>
mov    0x4(%rsp),%esi
cmp    0xc(%rsp),%esi
jle    11ba <main+0x8a>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
jmp    11fc <main+0xcc>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
jmp    11fc <main+0xcc>
jne    11cc <main+0x9c>
lea    0xe95(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11fc <main+0xcc>
lea    0xe85(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
add    0x4(%rsp),%esi
mov    %esi,0x4(%rsp)
cmp    0xc(%rsp),%esi
jle    11e0 <main+0xb0>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"entre com o limite inferior: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"entre com o incremento: \00"
@.str.3 = [30 x i8] c"entre com o limite superior: \00"
@.str.4 = [21 x i8] c"incremento invalido\0A\00"
@.str.5 = [19 x i8] c"limites invalidos\0A\00"
@.str.6 = [4 x i8] c"%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 ([30 x i8], [30 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), i32* %2)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %42
15: ; preds = %0
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = icmp sgt i32 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
br label %41
21: ; preds = %15
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = load i32, i32* %2
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %26)
br label %40
28: ; preds = %21
br label %29
29: ; preds = %33, %28
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = icmp sle i32 %30, %31
br i1 %32, label %33, label %39
33: ; preds = %29
%34 = load i32, i32* %2
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %2
%37 = load i32, i32* %4
%38 = add nsw i32 %36, %37
store i32 %38, i32* %2
br label %29
39: ; preds = %29
br label %40
40: ; preds = %39, %25
br label %41
41: ; preds = %40, %19
br label %42
42: ; preds = %41, %13
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"entre com o limite inferior: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"entre com o incremento: \00"
@.str.3 = [30 x i8] c"entre com o limite superior: \00"
@.str.6 = [4 x i8] c"%d\0A\00"
@str = [18 x i8] c"limites invalidos\00"
@str.7 = [20 x i8] c"incremento invalido\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 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* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.7, i64 0, i64 0))
br label %35
17: ; preds = %0
%18 = load i32, i32* %1
%19 = load i32, i32* %2
%20 = icmp sgt i32 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %35
23: ; preds = %17
%24 = icmp eq i32 %18, %19
br i1 %24, label %25, label %27
25: ; preds = %23
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %18)
br label %35
27: ; preds = %23, %27
%28 = phi i32 [ %32, %27 ], [ %18, %23 ]
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %1
%31 = load i32, i32* %3
%32 = add nsw i32 %31, %30
store i32 %32, i32* %1
%33 = load i32, i32* %2
%34 = icmp sgt i32 %32, %33
br i1 %34, label %35, label %27
35: ; preds = %27, %21, %25, %15
ret i32 0
}