#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 square = 4, even = 12, number = 0;
  printf("enter a limit number:\n");
  scanf("%d", &number);
  for (int i = 1; i <= number / 2; even += 8) {
    printf("%d\n", square);
    i++;
    square += even;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
movl   $0xc,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jg     11b8 <main+0x98>
mov    -0x8(%rbp),%esi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0xc(%rbp)
jmp    1169 <main+0x49>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    0xeae(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x2,0x4(%rsp)
jl     11a7 <main+0x77>
mov    $0x4,%r15d
mov    $0xc,%ebp
lea    0xe8e(%rip),%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%r15d
add    $0x8,%ebp
mov    0x4(%rsp),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
add    $0x1,%ebx
cmp    %ecx,%ebx
jl     1180 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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