#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(void) {
  int n1 = 0, cont = 0, impar = 0;
  printf("Digite um numero: ");
  scanf("%d", &n1);
  printf("Os %d primeiros numeros impares sao: \n", n1);
  while (impar < n1) {
    if (cont % 2 == 1) {
      printf("\n%d", cont);
      impar++;
    }
    cont++;
  }
}


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)
movl   $0x0,-0x10(%rbp)
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11bb <main+0x9b>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    11ad <main+0x8d>
mov    -0xc(%rbp),%esi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1173 <main+0x53>
mov    -0x4(%rbp),%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    0xec9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11a2 <main+0x82>
lea    0xeca(%rip),%r14
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    1187 <main+0x67>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    %eax,%ebx
jge    11a2 <main+0x82>
test   $0x1,%bpl
je     1180 <main+0x60>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
jmp    1180 <main+0x60>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Digite um numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [39 x i8] c"Os %d primeiros numeros impares sao: \0A\00"
@.str.3 = [4 x i8] c"\0A%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 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 = load i32, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %22, %0
%10 = load i32, i32* %4
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %25
13: ; preds = %9
%14 = load i32, i32* %3
%15 = srem i32 %14, 2
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %22
22: ; preds = %17, %13
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %9
25: ; preds = %9
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
@.str = [19 x i8] c"Digite um numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [39 x i8] c"Os %d primeiros numeros impares sao: \0A\00"
@.str.3 = [4 x i8] c"\0A%d\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 ([19 x i8], [19 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 ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %24
9: ; preds = %0, %19
%10 = phi i32 [ %20, %19 ], [ %7, %0 ]
%11 = phi i32 [ %21, %19 ], [ 0, %0 ]
%12 = phi i32 [ %22, %19 ], [ 0, %0 ]
%13 = and i32 %12, 1
%14 = icmp eq i32 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %9
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%17 = add nsw i32 %11, 1
%18 = load i32, i32* %1
br label %19
19: ; preds = %15, %9
%20 = phi i32 [ %18, %15 ], [ %10, %9 ]
%21 = phi i32 [ %17, %15 ], [ %11, %9 ]
%22 = add nuw nsw i32 %12, 1
%23 = icmp slt i32 %21, %20
br i1 %23, label %9, label %24
24: ; preds = %19, %0
ret i32 0
}