#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 n, sqr;
  printf("Enter a number: ");
  scanf("%d", &n);
  for (int i = 2; i <= n; i += 2) {
    sqr = i * i;
    if (sqr >= n) {
      return 0;
    }
    printf("%d\n", sqr);
  }
  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    0xecd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11a1 <main+0x81>
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1182 <main+0x62>
movl   $0x0,-0x4(%rbp)
jmp    11a8 <main+0x88>
mov    -0xc(%rbp),%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x10(%rbp)
jmp    1154 <main+0x34>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
jl     117e <main+0x5e>
mov    $0x2,%ebp
lea    0xebd(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    %ebp,%esi
imul   %ebp,%esi
cmp    %eax,%esi
jge    117e <main+0x5e>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x2,%ebp
mov    0x4(%rsp),%eax
cmp    %eax,%ebp
jle    1160 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [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 ([17 x i8], [17 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)
store i32 2, i32* %4
br label %7
7: ; preds = %22, %0
%8 = load i32, i32* %4
%9 = load i32, i32* %2
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %25
11: ; preds = %7
%12 = load i32, i32* %4
%13 = load i32, i32* %4
%14 = mul nsw i32 %12, %13
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = icmp sge i32 %15, %16
br i1 %17, label %18, label %19
18: ; preds = %11
store i32 0, i32* %1
br label %26
19: ; preds = %11
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %19
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 2
store i32 %24, i32* %4
br label %7
25: ; preds = %7
store i32 0, i32* %1
br label %26
26: ; preds = %25, %18
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 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 = icmp slt i32 %5, 2
br i1 %6, label %17, label %7
7: ; preds = %0, %12
%8 = phi i32 [ %15, %12 ], [ %5, %0 ]
%9 = phi i32 [ %14, %12 ], [ 2, %0 ]
%10 = mul nsw i32 %9, %9
%11 = icmp slt i32 %10, %8
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%14 = add nuw nsw i32 %9, 2
%15 = load i32, i32* %1
%16 = icmp sgt i32 %14, %15
br i1 %16, label %17, label %7
17: ; preds = %7, %12, %0
ret i32 0
}