#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 */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  if (argc < 2)
    return 1;
  int n, i, c, a = 1;
  time_t t;
  srand((unsigned)time(&t));
  n = (int)argv[1][0];
  for (i = 1; i <= n; i++) {
    for (c = 1; c <= i; c++) {
      printf("%d ", a);
      a++;
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    115c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    11f2 <main+0xc2>
movl   $0x1,-0x20(%rbp)
lea    -0x24(%rbp),%rdi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11eb <main+0xbb>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11cf <main+0x9f>
mov    -0x20(%rbp),%esi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    119b <main+0x6b>
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1188 <main+0x58>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
cmp    $0x2,%edi
jl     11da <main+0x9a>
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0xc(%rsp),%rdi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    0x8(%rbx),%rax
movzbl (%rax),%r14d
test   %r14b,%r14b
jle    11cc <main+0x8c>
mov    $0x1,%r12d
lea    0xe78(%rip),%r15
mov    $0x1,%ebx
nopl   (%rax)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%r12,%rbp,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    11a0 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    %ebx,%r12d
lea    0x1(%rbx),%eax
cmp    %r14d,%ebx
mov    %eax,%ebx
jne    1190 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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