#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 argc, const char *argv[]) {
  int i, j, x, n, s;
  printf("Please enter a number: ");
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    for (s = 0; s < n - i; s++) {
      printf(" ");
    }
    for (j = 1; j <= i; j++) {
      printf("%d", j);
    }
    for (x = i - 1; x > 0; x--) {
      printf("%d", x);
    }
    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)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     121b <main+0xfb>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x20(%rbp),%ecx
sub    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jge    119b <main+0x7b>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    116e <main+0x4e>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11cd <main+0xad>
mov    -0x18(%rbp),%esi
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a2 <main+0x82>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    11ff <main+0xdf>
mov    -0x1c(%rbp),%esi
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    11d6 <main+0xb6>
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <main+0x3b>
xor    %eax,%eax
add    $0x30,%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    0xec7(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    121a <main+0xea>
mov    $0x1,%r12d
mov    $0x2,%r15d
lea    0xe9e(%rip),%r14
xor    %ebp,%ebp
jmp    11a2 <main+0x72>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r12),%ecx
mov    0xc(%rsp),%eax
add    $0x1,%r15d
add    $0xffffffff,%ebp
cmp    %eax,%r12d
mov    %ecx,%r12d
jge    121a <main+0xea>
cmp    %r12d,%eax
jle    11c8 <main+0x98>
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
sub    %r12d,%eax
cmp    %eax,%ebx
jl     11b0 <main+0x80>
mov    $0x1,%ebx
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x2,%eax
jne    11d0 <main+0xa0>
mov    %r15d,%ebx
cmp    $0x2,%r12d
jb     1180 <main+0x50>
nopw   0x0(%rax,%rax,1)
lea    -0x2(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebx
cmp    $0x2,%ebx
jg     1200 <main+0xd0>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Please enter a number: \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(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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
store i32 1, i32* %6
br label %13
13: ; preds = %54, %2
%14 = load i32, i32* %6
%15 = load i32, i32* %9
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %57
17: ; preds = %13
store i32 0, i32* %10
br label %18
18: ; preds = %26, %17
%19 = load i32, i32* %10
%20 = load i32, i32* %9
%21 = load i32, i32* %6
%22 = sub nsw i32 %20, %21
%23 = icmp slt i32 %19, %22
br i1 %23, label %24, label %29
24: ; preds = %18
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %26
26: ; preds = %24
%27 = load i32, i32* %10
%28 = add nsw i32 %27, 1
store i32 %28, i32* %10
br label %18
29: ; preds = %18
store i32 1, i32* %7
br label %30
30: ; preds = %37, %29
%31 = load i32, i32* %7
%32 = load i32, i32* %6
%33 = icmp sle i32 %31, %32
br i1 %33, label %34, label %40
34: ; preds = %30
%35 = load i32, i32* %7
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %34
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
br label %30
40: ; preds = %30
%41 = load i32, i32* %6
%42 = sub nsw i32 %41, 1
store i32 %42, i32* %8
br label %43
43: ; preds = %49, %40
%44 = load i32, i32* %8
%45 = icmp sgt i32 %44, 0
br i1 %45, label %46, label %52
46: ; preds = %43
%47 = load i32, i32* %8
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %46
%50 = load i32, i32* %8
%51 = add nsw i32 %50, -1
store i32 %51, i32* %8
br label %43
52: ; preds = %43
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %54
54: ; preds = %52
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 1
store i32 %56, i32* %6
br label %13
57: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Please enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 1
br i1 %8, label %40, label %9
9: ; preds = %2, %34
%10 = phi i32 [ %37, %34 ], [ %7, %2 ]
%11 = phi i32 [ %39, %34 ], [ 2, %2 ]
%12 = phi i32 [ %36, %34 ], [ 1, %2 ]
%13 = icmp sgt i32 %10, %12
br i1 %13, label %15, label %14
14: ; preds = %15, %9
br label %24
15: ; preds = %9, %15
%16 = phi i32 [ %18, %15 ], [ 0, %9 ]
%17 = call i32 @putchar(i32 32)
%18 = add nuw nsw i32 %16, 1
%19 = load i32, i32* %3
%20 = sub nsw i32 %19, %12
%21 = icmp slt i32 %18, %20
br i1 %21, label %15, label %14
22: ; preds = %24
%23 = icmp ugt i32 %12, 1
br i1 %23, label %29, label %34
24: ; preds = %14, %24
%25 = phi i32 [ %27, %24 ], [ 1, %14 ]
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = add nuw i32 %25, 1
%28 = icmp eq i32 %27, %11
br i1 %28, label %22, label %24
29: ; preds = %22, %29
%30 = phi i32 [ %31, %29 ], [ %12, %22 ]
%31 = add nsw i32 %30, -1
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = icmp sgt i32 %30, 2
br i1 %33, label %29, label %34
34: ; preds = %29, %22
%35 = call i32 @putchar(i32 10)
%36 = add nuw nsw i32 %12, 1
%37 = load i32, i32* %3
%38 = icmp slt i32 %12, %37
%39 = add nuw i32 %11, 1
br i1 %38, label %9, label %40
40: ; preds = %34, %2
ret i32 0
}