#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 x, y, n;
  scanf("%d", &n);
  for (y = 0; y < n; y++, printf("\n"))
    for (x = n; x > 0; printf(x-- + y < n ? "  " : "# "))
      ;
  ;
  for (y = 0; y < n; y++, printf("\n"))
    for (x = n; x > 0; printf(x-- + y < n ? "# " : "  "))
      ;
  ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11b5 <main+0x95>
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1196 <main+0x76>
jmp    1167 <main+0x47>
mov    -0x8(%rbp),%ecx
mov    %ecx,%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
add    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%edx
lea    0xe87(%rip),%rdi
lea    0xe7d(%rip),%rax
cmp    %edx,%ecx
cmovl  %rax,%rdi
call   1030 <printf@plt>
jmp    1158 <main+0x38>
jmp    119b <main+0x7b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
jmp    1146 <main+0x26>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    122b <main+0x10b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    120c <main+0xec>
jmp    11dd <main+0xbd>
mov    -0x8(%rbp),%ecx
mov    %ecx,%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
add    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%edx
lea    0xe0e(%rip),%rdi
lea    0xe0a(%rip),%rax
cmp    %edx,%ecx
cmovl  %rax,%rdi
call   1030 <printf@plt>
jmp    11ce <main+0xae>
jmp    1211 <main+0xf1>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    0xde8(%rip),%rdi
call   1030 <printf@plt>
jmp    11bc <main+0x9c>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xec1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%ebx
test   %ebx,%ebx
jle    1232 <main+0x102>
xor    %r15d,%r15d
lea    0xea7(%rip),%r14
lea    0xe9d(%rip),%r12
jmp    1187 <main+0x57>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%ebx
cmp    %ebx,%r15d
jge    11c2 <main+0x92>
test   %ebx,%ebx
jle    1170 <main+0x40>
mov    %r14,%rdi
call   1040 <printf@plt>
cmp    $0x1,%ebx
je     1170 <main+0x40>
add    $0x1,%ebx
jmp    11ad <main+0x7d>
nopl   (%rax)
call   1040 <printf@plt>
add    $0xffffffff,%ebx
cmp    $0x2,%ebx
jle    1170 <main+0x40>
lea    (%r15,%rbx,1),%eax
add    $0xfffffffe,%eax
mov    %r12,%rdi
cmp    0x4(%rsp),%eax
jl     11a0 <main+0x70>
mov    %r14,%rdi
jmp    11a0 <main+0x70>
test   %ebx,%ebx
jle    1232 <main+0x102>
xor    %r15d,%r15d
lea    0xe33(%rip),%r14
lea    0xe2f(%rip),%r12
jmp    11f7 <main+0xc7>
nopl   0x0(%rax)
add    $0x1,%r15d
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%ebx
cmp    %ebx,%r15d
jge    1232 <main+0x102>
test   %ebx,%ebx
jle    11e0 <main+0xb0>
mov    %r14,%rdi
call   1040 <printf@plt>
cmp    $0x1,%ebx
je     11e0 <main+0xb0>
add    $0x1,%ebx
jmp    121d <main+0xed>
nopl   (%rax)
call   1040 <printf@plt>
add    $0xffffffff,%ebx
cmp    $0x2,%ebx
jle    11e0 <main+0xb0>
lea    (%r15,%rbx,1),%eax
add    $0xfffffffe,%eax
mov    %r12,%rdi
cmp    0x4(%rsp),%eax
jl     1210 <main+0xe0>
mov    %r14,%rdi
jmp    1210 <main+0xe0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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