#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);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int total;
  int counter = 0;
  scanf("%d", &total);
  for (int col = 1; col <= total; col++) {
    for (int row = 1; row < col; row++) {
      counter += 1;
      printf("%d ", counter);
    }
    counter += 1;
    printf("%d\n", counter);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11b8 <main+0x98>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1192 <main+0x72>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1160 <main+0x40>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114d <main+0x2d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11be <main+0x9e>
xor    %ebx,%ebx
mov    $0x1,%ebp
lea    0xeb2(%rip),%r15
lea    0xeaf(%rip),%r14
mov    $0x1,%r13d
xor    %r12d,%r12d
jmp    1193 <main+0x73>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r12d
mov    %r14,%rdi
mov    %r12d,%esi
call   1030 <printf@plt>
add    %r13d,%ebp
lea    0x1(%r13),%eax
add    $0x1,%ebx
cmp    0x4(%rsp),%r13d
mov    %eax,%r13d
jge    11be <main+0x9e>
cmp    $0x2,%r13d
jb     1170 <main+0x50>
add    %ebx,%r12d
xor    %r14d,%r14d
nop
lea    (%r14,%rbp,1),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%r14d
cmp    %r14d,%ebx
jne    11a0 <main+0x80>
lea    0xe4b(%rip),%r14
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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