#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 *, int *);
int main(void) {
  int n, i, j, k;
  printf("Limit : ");
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    k = i + 1;
    for (j = 0; j < n - i; k += n - j, j++)
      printf("%2d ", k);
    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    0xec5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c8 <main+0xa8>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    11ac <main+0x8c>
mov    -0x14(%rbp),%esi
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
sub    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1170 <main+0x50>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1154 <main+0x34>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11c0 <main+0x90>
lea    0xea2(%rip),%r15
xor    %r12d,%r12d
jmp    1186 <main+0x56>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%eax
mov    %r14d,%r12d
cmp    %eax,%r14d
jge    11c0 <main+0x90>
lea    0x1(%r12),%r14d
cmp    %r12d,%eax
jle    1170 <main+0x40>
xor    %ebx,%ebx
mov    %r14d,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%eax
sub    %ebx,%ebp
add    %eax,%ebp
add    $0x1,%ebx
sub    %r12d,%eax
cmp    %eax,%ebx
jl     11a0 <main+0x70>
jmp    1170 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Limit : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c"%2d \00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %8
8: ; preds = %34, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %37
12: ; preds = %8
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %5
store i32 0, i32* %4
br label %15
15: ; preds = %24, %12
%16 = load i32, i32* %4
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = sub nsw i32 %17, %18
%20 = icmp slt i32 %16, %19
br i1 %20, label %21, label %32
21: ; preds = %15
%22 = load i32, i32* %5
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %21
%25 = load i32, i32* %2
%26 = load i32, i32* %4
%27 = sub nsw i32 %25, %26
%28 = load i32, i32* %5
%29 = add nsw i32 %28, %27
store i32 %29, i32* %5
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %15
32: ; preds = %15
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %34
34: ; preds = %32
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %8
37: ; preds = %8
ret i32 0
}

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