#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 *, long *);
int main(void) {
  long int i, n;
  printf("This program prints a table of squares.\n");
  printf("Enter the number of entries in table: ");
  scanf("%ld", &n);
  for (i = 1; i <= n; i++) {
    printf("%10ld\t%10ld\n", i, i * i);
  }
  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    0xefe(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
movq   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jg     119d <main+0x7d>
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rdx
imul   -0x10(%rbp),%rdx
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1163 <main+0x43>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xefd(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed2(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
cmpq   $0x0,(%rsp)
jle    118e <main+0x5e>
lea    0xec0(%rip),%r14
xor    %ebx,%ebx
nopl   (%rax)
add    $0x1,%rbx
mov    %rbx,%rdx
imul   %rbx,%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    (%rsp),%rbx
jl     1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [41 x i8] c"This program prints a table of squares.\0A\00"
@.str.1 = [39 x i8] c"Enter the number of entries in table: \00"
@.str.2 = [4 x i8] c"%ld\00"
@.str.3 = [13 x i8] c"%10ld\09%10ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %3)
store i64 1, i64* %2
br label %7
7: ; preds = %17, %0
%8 = load i64, i64* %2
%9 = load i64, i64* %3
%10 = icmp sle i64 %8, %9
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = load i64, i64* %2
%13 = load i64, i64* %2
%14 = load i64, i64* %2
%15 = mul nsw i64 %13, %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i64 %12, i64 %15)
br label %17
17: ; preds = %11
%18 = load i64, i64* %2
%19 = add nsw i64 %18, 1
store i64 %19, i64* %2
br label %7
20: ; preds = %7
ret i32 0
}

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