#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;
  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..");
      while (getchar() != '\n')
        ;
    }
  }
  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    0xeea(%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     11ef <main+0xbf>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
imul   -0x8(%rbp),%edx
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11dc <main+0xac>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11d7 <main+0xa7>
jmp    11bf <main+0x8f>
jmp    11dc <main+0xac>
jmp    11e1 <main+0xb1>
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   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xefa(%rip),%rdi
call   1030 <puts@plt>
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmpl   $0x0,0xc(%rsp)
jle    11ed <main+0xad>
mov    $0x1,%ebx
lea    0xe98(%rip),%r14
lea    0xe9b(%rip),%r15
jmp    11ab <main+0x6b>
nopw   0x0(%rax,%rax,1)
lea    0x1(%rbx),%eax
cmp    0xc(%rsp),%ebx
mov    %eax,%ebx
jge    11ed <main+0xad>
mov    %ebx,%edx
imul   %ebx,%edx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
imul   $0xaaaaaaab,%ebx,%eax
ror    $0x3,%eax
cmp    $0xaaaaaaa,%eax
ja     11a0 <main+0x60>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    11e0 <main+0xa0>
jmp    11a0 <main+0x60>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
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"
@.str.4 = [26 x i8] c"Press enter to continue..\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
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 ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%7 = call signext i8 (...) @getchar()
store i32 1, i32* %2
br label %8
8: ; preds = %30, %0
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %33
12: ; preds = %8
%13 = load i32, i32* %2
%14 = load i32, i32* %2
%15 = load i32, i32* %2
%16 = mul nsw i32 %14, %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %13, i32 %16)
%18 = load i32, i32* %2
%19 = srem i32 %18, 24
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %29
21: ; preds = %12
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %23
23: ; preds = %27, %21
%24 = call signext i8 (...) @getchar()
%25 = sext i8 %24 to i32
%26 = icmp ne i32 %25, 10
br i1 %26, label %27, label %28
27: ; preds = %23
br label %23
28: ; preds = %23
br label %29
29: ; preds = %28, %12
br label %30
30: ; preds = %29
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %8
33: ; preds = %8
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.4 = [26 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 ([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 = call signext i8 (...) @getchar()
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 1
br i1 %8, label %24, label %9
9: ; preds = %0, %20
%10 = phi i32 [ %21, %20 ], [ 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 %20
15: ; preds = %9
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %17
17: ; preds = %17, %15
%18 = call signext i8 (...) @getchar()
%19 = icmp eq i8 %18, 10
br i1 %19, label %20, label %17
20: ; preds = %17, %9
%21 = add nuw nsw i32 %10, 1
%22 = load i32, i32* %1
%23 = icmp slt i32 %10, %22
br i1 %23, label %9, label %24
24: ; preds = %20, %0
ret i32 0
}