#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 *, size_t *);
int main() {
  size_t n;
  printf("Please enter an integer (1 <= n <= 20): ");
  scanf("%lu", &n);
  int row, col, counter;
  for (row = 1; row <= n; row++) {
    counter = row;
    for (col = 1; col <= n; col++) {
      printf("%d ", counter++);
    }
    printf("\n");
  }
  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
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    -0x10(%rbp),%rax
ja     11c0 <main+0xa0>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x1,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
ja     11a4 <main+0x84>
mov    -0x1c(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116f <main+0x4f>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1154 <main+0x34>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedb(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
cmpq   $0x0,0x8(%rsp)
je     11b1 <main+0x81>
mov    $0x1,%r15d
lea    0xec0(%rip),%r14
nopl   (%rax)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,0x8(%rsp)
ja     1180 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r15),%rax
cmp    %r15,0x8(%rsp)
mov    %rax,%r15
ja     1170 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Please enter an integer (1 <= n <= 20): \00"
@.str.1 = [4 x i8] c"%lu\00"
@.str.2 = [4 x i8] c"%d \00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%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 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %2)
store i32 1, i32* %3
br label %8
8: ; preds = %29, %0
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = load i64, i64* %2
%12 = icmp ule i64 %10, %11
br i1 %12, label %13, label %32
13: ; preds = %8
%14 = load i32, i32* %3
store i32 %14, i32* %5
store i32 1, i32* %4
br label %15
15: ; preds = %24, %13
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = load i64, i64* %2
%19 = icmp ule i64 %17, %18
br i1 %19, label %20, label %27
20: ; preds = %15
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %21)
br label %24
24: ; preds = %20
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %15
27: ; preds = %15
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %27
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %8
32: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"Please enter an integer (1 <= n <= 20): \00"
@.str.1 = [4 x i8] c"%lu\00"
@.str.2 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%5 = load i64, i64* %1
%6 = icmp eq i64 %5, 0
br i1 %6, label %23, label %7
7: ; preds = %0, %18
%8 = phi i64 [ %20, %18 ], [ 1, %0 ]
%9 = trunc i64 %8 to i32
br label %10
10: ; preds = %7, %10
%11 = phi i64 [ 1, %7 ], [ %15, %10 ]
%12 = phi i32 [ %9, %7 ], [ %13, %10 ]
%13 = add nuw nsw i32 %12, 1
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%15 = add nuw i64 %11, 1
%16 = load i64, i64* %1
%17 = icmp ugt i64 %16, %11
br i1 %17, label %10, label %18
18: ; preds = %10
%19 = call i32 @putchar(i32 10)
%20 = add nuw i64 %8, 1
%21 = load i64, i64* %1
%22 = icmp ugt i64 %21, %8
br i1 %22, label %7, label %23
23: ; preds = %18, %0
ret i32 0
}