#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 *);
int main() {
  int num = 0, contador = 0;
  printf("\nDigite um numero inteiro, menor que 1000: ");
  scanf("%d", &num);
  printf("\nImpressão de 1000 até o número informado: %d\n", num);
  for (contador = 1000; contador >= num; contador = contador - 2) {
    printf("\n\tContador = %d, não chegou no número informado: %d", contador,
           num);
  }
  printf("\n\tFora do laço. Valor do contador = %d\n", contador);
  printf("\t\tFim do programa\n");
  system("pause");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf2f(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x3e8,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     11b1 <main+0x81>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    1183 <main+0x53>
mov    -0xc(%rbp),%esi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xef4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xef9(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf30(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%edx
mov    $0x3e8,%ebx
cmp    $0x3e8,%edx
jg     11b7 <main+0x77>
mov    $0x3e8,%ebx
lea    0xec4(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xfffffffe,%ebx
mov    0x4(%rsp),%edx
cmp    %edx,%ebx
jge    11a0 <main+0x60>
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xef5(%rip),%rdi
call   1030 <puts@plt>
lea    0xee3(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [44 x i8] c"\0ADigite um numero inteiro, menor que 1000: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [50 x i8] c"\0AImpress\C3\A3o de 1000 at\C3\A9 o n\C3\BAmero informado: %d\0A\00"
@.str.3 = [54 x i8] c"\0A\09Contador = %d, n\C3\A3o chegou no n\C3\BAmero informado: %d\00"
@.str.4 = [41 x i8] c"\0A\09Fora do la\C3\A7o. Valor do contador = %d\0A\00"
@.str.5 = [19 x i8] c"\09\09Fim do programa\0A\00"
@.str.6 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %6)
store i32 1000, i32* %3
br label %8
8: ; preds = %16, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp sge i32 %9, %10
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i32 %13, i32 %14)
br label %16
16: ; preds = %12
%17 = load i32, i32* %3
%18 = sub nsw i32 %17, 2
store i32 %18, i32* %3
br label %8
19: ; preds = %8
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%23 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [44 x i8] c"\0ADigite um numero inteiro, menor que 1000: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [50 x i8] c"\0AImpress\C3\A3o de 1000 at\C3\A9 o n\C3\BAmero informado: %d\0A\00"
@.str.3 = [54 x i8] c"\0A\09Contador = %d, n\C3\A3o chegou no n\C3\BAmero informado: %d\00"
@.str.4 = [41 x i8] c"\0A\09Fora do la\C3\A7o. Valor do contador = %d\0A\00"
@.str.6 = [6 x i8] c"pause\00"
@str = [18 x i8] c"\09\09Fim do programa\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 1000
br i1 %8, label %16, label %9
9: ; preds = %0, %9
%10 = phi i32 [ %14, %9 ], [ %7, %0 ]
%11 = phi i32 [ %13, %9 ], [ 1000, %0 ]
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i32 %11, i32 %10)
%13 = add nsw i32 %11, -2
%14 = load i32, i32* %1
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %9
16: ; preds = %9, %0
%17 = phi i32 [ 1000, %0 ], [ %13, %9 ]
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i32 %17)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%20 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}