#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 n;
  char ch;
  printf("this program prints a table of square\n");
  printf("enter number of entries in table\n");
  scanf("%d", &n);
  ch = getchar();
  for (int i = 1; i <= n; i++) {
    printf("%10d%10d\n", i, i * i);
    if ((i % 24) == 0) {
      printf("press enter to continue...");
      while (getchar() == '\r') {
        break;
      }
    }
  }
}


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    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x9(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11f2 <main+0xc2>
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%edx
imul   -0x10(%rbp),%edx
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11df <main+0xaf>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xd,%eax
jne    11da <main+0xaa>
jmp    11da <main+0xaa>
jmp    11df <main+0xaf>
jmp    11e4 <main+0xb4>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117c <main+0x4c>
mov    -0x4(%rbp),%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    0xed6(%rip),%rdi
call   1030 <puts@plt>
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
lea    0xe96(%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    0xe6f(%rip),%r15
xor    %ebp,%ebp
jmp    11a9 <main+0x69>
nopl   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    0xe2b(%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 = [39 x i8] c"this program prints a table of square\0A\00"
@.str.1 = [34 x i8] c"enter number of entries in table\0A\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 i8
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 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* %2)
%8 = call signext i8 (...) @getchar()
store i8 %8, i8* %3
store i32 1, i32* %4
br label %9
9: ; preds = %31, %0
%10 = load i32, i32* %4
%11 = load i32, i32* %2
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %34
13: ; preds = %9
%14 = load i32, i32* %4
%15 = load i32, i32* %4
%16 = load i32, i32* %4
%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* %4
%20 = srem i32 %19, 24
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %13
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %24
24: ; preds = %22
%25 = call signext i8 (...) @getchar()
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 13
br i1 %27, label %28, label %29
28: ; preds = %24
br label %29
29: ; preds = %28, %24
br label %30
30: ; preds = %29, %13
br label %31
31: ; preds = %30
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %9
34: ; preds = %9
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@.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 = [38 x i8] c"this program prints a table of square\00"
@str.5 = [33 x i8] c"enter number of entries in table\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.5, 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 %9, label %10
9: ; preds = %19, %0
ret i32 0
10: ; preds = %0, %19
%11 = phi i32 [ %20, %19 ], [ 1, %0 ]
%12 = mul nsw i32 %11, %11
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %11, i32 %12)
%14 = urem i32 %11, 24
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %10
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%18 = call signext i8 (...) @getchar()
br label %19
19: ; preds = %10, %16
%20 = add nuw nsw i32 %11, 1
%21 = load i32, i32* %1
%22 = icmp slt i32 %11, %21
br i1 %22, label %10, label %9
}