#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 n, i, s, k;
  printf("enter n:");
  scanf("%d", &n);
  for (i = n; i >= 1; i--) {
    for (s = 0; s < n - i; s++)
      printf("  ");
    for (k = i; k <= 2 * i - 1; k++)
      printf("1 ");
    for (k = 0; k < i - 1; k++)
      printf("1 ");
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jl     120d <main+0xed>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    118d <main+0x6d>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1162 <main+0x42>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11c1 <main+0xa1>
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1193 <main+0x73>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11f3 <main+0xd3>
lea    0xe2f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c8 <main+0xa8>
lea    0xe18(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1151 <main+0x31>
mov    -0x4(%rbp),%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
call   1040 <printf@plt>
lea    0xeba(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1205 <main+0xd5>
lea    0xea0(%rip),%r14
lea    0xe9c(%rip),%r15
mov    %eax,%ebx
cmp    %ebx,%eax
jle    11a5 <main+0x75>
nopl   0x0(%rax)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%ebp
mov    0xc(%rsp),%eax
sub    %ebx,%eax
cmp    %eax,%ebp
jl     1190 <main+0x60>
lea    (%rbx,%rbx,1),%eax
mov    %ebx,%ebp
cmp    %eax,%ebx
jge    11bd <main+0x8d>
xchg   %ax,%ax
mov    %r15,%rdi
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    11b0 <main+0x80>
cmp    $0x2,%ebx
jl     11fb <main+0xcb>
lea    -0x1(%rbx),%r12d
mov    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    11d0 <main+0xa0>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x2,%ebx
jl     1205 <main+0xd5>
mov    0xc(%rsp),%eax
mov    %r12d,%ebx
cmp    %ebx,%eax
jg     1180 <main+0x50>
jmp    11a5 <main+0x75>
mov    $0xa,%edi
call   1030 <putchar@plt>
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"enter n:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [3 x i8] c" \00"
@.str.3 = [3 x i8] c"1 \00"
@.str.4 = [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 @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)
%8 = load i32, i32* %2
store i32 %8, i32* %3
br label %9
9: ; preds = %50, %0
%10 = load i32, i32* %3
%11 = icmp sge i32 %10, 1
br i1 %11, label %12, label %53
12: ; preds = %9
store i32 0, i32* %4
br label %13
13: ; preds = %21, %12
%14 = load i32, i32* %4
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = sub nsw i32 %15, %16
%18 = icmp slt i32 %14, %17
br i1 %18, label %19, label %24
19: ; preds = %13
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %13
24: ; preds = %13
%25 = load i32, i32* %3
store i32 %25, i32* %5
br label %26
26: ; preds = %34, %24
%27 = load i32, i32* %5
%28 = load i32, i32* %3
%29 = mul nsw i32 2, %28
%30 = sub nsw i32 %29, 1
%31 = icmp sle i32 %27, %30
br i1 %31, label %32, label %37
32: ; preds = %26
%33 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %34
34: ; preds = %32
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %26
37: ; preds = %26
store i32 0, i32* %5
br label %38
38: ; preds = %45, %37
%39 = load i32, i32* %5
%40 = load i32, i32* %3
%41 = sub nsw i32 %40, 1
%42 = icmp slt i32 %39, %41
br i1 %42, label %43, label %48
43: ; preds = %38
%44 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %45
45: ; preds = %43
%46 = load i32, i32* %5
%47 = add nsw i32 %46, 1
store i32 %47, i32* %5
br label %38
48: ; preds = %38
%49 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %50
50: ; preds = %48
%51 = load i32, i32* %3
%52 = add nsw i32 %51, -1
store i32 %52, i32* %3
br label %9
53: ; preds = %9
%54 = load i32, i32* %1
ret i32 %54
}

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