#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 n, odd, square;
  printf("This program prints a table of squares.\n");
  printf("Enter number of entries in table: ");
  scanf("%d", &n);
  odd = 3;
  square = 1;
  for (int i = 1; i <= n; i++) {
    printf("%10d%10d\n", i, square);
    square += odd;
    odd += 2;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x3,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11b0 <main+0x90>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xef2(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    119e <main+0x6e>
mov    $0x3,%r15d
mov    $0x1,%ebx
lea    0xeab(%rip),%r14
xor    %ebp,%ebp
nopl   (%rax)
add    $0x1,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    %r15d,%ebx
add    $0x2,%r15d
cmp    0x4(%rsp),%ebp
jl     1180 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [35 x i8] c"Enter number of entries in table: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [10 x i8] c"%10d%10d\0A\00"
@str = [40 x i8] c"This program prints a table of squares.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %9, %0
ret i32 0
9: ; preds = %0, %9
%10 = phi i32 [ %16, %9 ], [ 1, %0 ]
%11 = phi i32 [ %14, %9 ], [ 1, %0 ]
%12 = phi i32 [ %15, %9 ], [ 3, %0 ]
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %10, i32 %11)
%14 = add nuw nsw i32 %11, %12
%15 = add nuw nsw i32 %12, 2
%16 = add nuw nsw i32 %10, 1
%17 = load i32, i32* %1
%18 = icmp slt i32 %10, %17
br i1 %18, label %9, label %8
}