#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 positivo: ");
  scanf("%d", &num);
  printf("\nImpressão de 0 até o número informado: %d\n", num);
  do {
    printf("\n\tContador = %d, não chegou no número informado: %d", contador,
           num);
    printf("\n\tIncrementar contador");
    contador++;
  } while (contador < num);
  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    0xf25(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xef3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     117c <main+0x4c>
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeec(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf22(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%edx
lea    0xec8(%rip),%r14
lea    0xef7(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebp
mov    0xc(%rsp),%edx
cmp    %edx,%ebp
jl     11a0 <main+0x60>
lea    0xedf(%rip),%rdi
call   1030 <puts@plt>
lea    0xecd(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"\0ADigite um numero inteiro positivo: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [47 x i8] c"\0AImpress\C3\A3o de 0 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 = [23 x i8] c"\0A\09Incrementar contador\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 ([37 x i8], [37 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 ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %15, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i32 %9, i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %15
15: ; preds = %8
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = icmp slt i32 %16, %17
br i1 %18, label %8, label %19
19: ; preds = %15
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%21 = 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 = [37 x i8] c"\0ADigite um numero inteiro positivo: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [47 x i8] c"\0AImpress\C3\A3o de 0 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 = [23 x i8] c"\0A\09Incrementar contador\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 ([37 x i8], [37 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 ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %1
br label %8
8: ; preds = %8, %0
%9 = phi i32 [ %7, %0 ], [ %14, %8 ]
%10 = phi i32 [ 0, %0 ], [ %13, %8 ]
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i32 %10, i32 %9)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%13 = add nuw nsw i32 %10, 1
%14 = load i32, i32* %1
%15 = icmp slt i32 %13, %14
br i1 %15, label %8, label %16
16: ; preds = %8
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%18 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}