#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 */
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int i, n;
  char ch;
  printf("This program prints a table of squares.\n");
  printf("Enter number of entries in table:");
  scanf("%d", &n);
  getchar();
  for (i = 1; i <= n; i++) {
    printf("%10d%10d\n", i, i * i);
    if (i % 24 == 0) {
      printf("Press Enter to continue...");
      ch = getchar();
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11dc <main+0xac>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
imul   -0x8(%rbp),%edx
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11c9 <main+0x99>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0xd(%rbp)
jmp    11ce <main+0x9e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1179 <main+0x49>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
lea    0xea2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmpl   $0x0,0x4(%rsp)
jle    11f2 <main+0xb2>
mov    $0x1,%ebx
mov    $0xaaaaaaab,%r12d
lea    0xe8f(%rip),%r15
xor    %ebp,%ebp
jmp    11a9 <main+0x69>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    0x4(%rsp),%ebp
jge    11f2 <main+0xb2>
mov    %ebp,%r13d
lea    0x1(%r13),%ebp
mov    %ebx,%eax
imul   %r12,%rax
shr    $0x24,%rax
lea    (%rax,%rax,2),%eax
lea    -0x1(,%rax,8),%r14d
ff
mov    %ebp,%edx
imul   %ebp,%edx
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13d,%r14d
jne    11a0 <main+0x60>
lea    0xe4d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
jmp    11a0 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
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 = [34 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.4 = [27 x i8] c"Press Enter to continue...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%8 = call signext i8 (...) @getchar()
store i32 1, i32* %2
br label %9
9: ; preds = %26, %0
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %29
13: ; preds = %9
%14 = load i32, i32* %2
%15 = load i32, i32* %2
%16 = load i32, i32* %2
%17 = mul nsw i32 %15, %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %14, i32 %17)
%19 = load i32, i32* %2
%20 = srem i32 %19, 24
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %13
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%24 = call signext i8 (...) @getchar()
store i8 %24, i8* %4
br label %25
25: ; preds = %22, %13
br label %26
26: ; preds = %25
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %9
29: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [34 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.4 = [27 x i8] c"Press Enter to continue...\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 ([34 x i8], [34 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 = call signext i8 (...) @getchar()
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 1
br i1 %8, label %22, label %9
9: ; preds = %0, %18
%10 = phi i32 [ %19, %18 ], [ 1, %0 ]
%11 = mul nsw i32 %10, %10
%12 = 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)
%13 = urem i32 %10, 24
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %9
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%17 = call signext i8 (...) @getchar()
br label %18
18: ; preds = %9, %15
%19 = add nuw nsw i32 %10, 1
%20 = load i32, i32* %1
%21 = icmp slt i32 %10, %20
br i1 %21, label %9, label %22
22: ; preds = %18, %0
ret i32 0
}