#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() {
  int rows = 0;
  printf("for n = ");
  scanf("%d", &rows);
  if (rows > 1 && rows < 10) {
    int i;
    for (i = 1; i < (rows + 1); i++) {
      int space = i;
      int out = 0;
      while (!out) {
        if (space < rows) {
          printf(" ");
          space++;
        } else
          out = !out;
      }
      int num = i;
      int j;
      for (j = 0; j < i; j++) {
        printf("%d", num);
        num == 9 ? num = 0 : num++;
      }
      printf("\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jle    1259 <main+0x139>
cmpl   $0xa,-0x8(%rbp)
jge    1259 <main+0x139>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1254 <main+0x134>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11a3 <main+0x83>
jmp    11e1 <main+0xc1>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11cb <main+0xab>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11dc <main+0xbc>
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
jmp    118d <main+0x6d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1238 <main+0x118>
mov    -0x18(%rbp),%esi
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x9,-0x18(%rbp)
jne    1221 <main+0x101>
movl   $0x0,-0x18(%rbp)
jmp    122a <main+0x10a>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ee <main+0xce>
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116f <main+0x4f>
jmp    1259 <main+0x139>
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
movl   $0x0,0xc(%rsp)
lea    0xeb5(%rip),%rdi
xor    %r12d,%r12d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xead(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
lea    -0xa(%rax),%ecx
cmp    $0xfffffff8,%ecx
jb     11e7 <main+0xb7>
mov    $0x1,%r15d
lea    0xe8a(%rip),%r14
nop
cmp    %eax,%r15d
jge    11a3 <main+0x73>
mov    %r15d,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    0xc(%rsp),%ebx
jl     1190 <main+0x60>
mov    %r15d,%ebp
mov    %r15d,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x9,%ebx
lea    0x1(%rbx),%eax
cmove  %r12d,%eax
mov    %eax,%ebx
add    $0xffffffff,%ebp
jne    11b0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r15),%ecx
mov    0xc(%rsp),%eax
cmp    %eax,%r15d
mov    %ecx,%r15d
jl     1180 <main+0x50>
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"for n = \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c" \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
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %67
12: ; preds = %0
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 10
br i1 %14, label %15, label %67
15: ; preds = %12
store i32 1, i32* %3
br label %16
16: ; preds = %63, %15
%17 = load i32, i32* %3
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
%20 = icmp slt i32 %17, %19
br i1 %20, label %21, label %66
21: ; preds = %16
%22 = load i32, i32* %3
store i32 %22, i32* %4
store i32 0, i32* %5
br label %23
23: ; preds = %40, %21
%24 = load i32, i32* %5
%25 = icmp ne i32 %24, 0
%26 = xor i1 %25, true
br i1 %26, label %27, label %41
27: ; preds = %23
%28 = load i32, i32* %4
%29 = load i32, i32* %2
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %35
31: ; preds = %27
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
br label %40
35: ; preds = %27
%36 = load i32, i32* %5
%37 = icmp ne i32 %36, 0
%38 = xor i1 %37, true
%39 = zext i1 %38 to i32
store i32 %39, i32* %5
br label %40
40: ; preds = %35, %31
br label %23
41: ; preds = %23
%42 = load i32, i32* %3
store i32 %42, i32* %6
store i32 0, i32* %7
br label %43
43: ; preds = %58, %41
%44 = load i32, i32* %7
%45 = load i32, i32* %3
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %61
47: ; preds = %43
%48 = load i32, i32* %6
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %6
%51 = icmp eq i32 %50, 9
br i1 %51, label %52, label %53
52: ; preds = %47
store i32 0, i32* %6
br label %56
53: ; preds = %47
%54 = load i32, i32* %6
%55 = add nsw i32 %54, 1
store i32 %55, i32* %6
br label %56
56: ; preds = %53, %52
%57 = phi i32 [ 0, %52 ], [ %54, %53 ]
br label %58
58: ; preds = %56
%59 = load i32, i32* %7
%60 = add nsw i32 %59, 1
store i32 %60, i32* %7
br label %43
61: ; preds = %43
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %63
63: ; preds = %61
%64 = load i32, i32* %3
%65 = add nsw i32 %64, 1
store i32 %65, i32* %3
br label %16
66: ; preds = %16
br label %67
67: ; preds = %66, %12, %0
ret i32 0
}

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