#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 *);
void printStairCase(int n) {
  for (int i = 1; i <= n; i++) {
    int j;
    for (j = 0; j < n - i; j++) {
      printf(" ");
    }
    while (j < n) {
      printf("#");
      j++;
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printStairCase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11a5 <printStairCase+0x95>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    1160 <printStairCase+0x50>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1135 <printStairCase+0x25>
jmp    1165 <printStairCase+0x55>
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    118b <printStairCase+0x7b>
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1165 <printStairCase+0x55>
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <printStairCase+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printStairCase>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
jle    1189 <printStairCase+0x79>
mov    %edi,%r15d
mov    $0x1,%r12d
mov    %edi,%r14d
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%r14d
xor    %ebp,%ebp
mov    %r15d,%ebx
cmp    %r15d,%r12d
jge    116d <printStairCase+0x5d>
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    %ebx,%r12d
jne    1140 <printStairCase+0x30>
mov    %r14d,%ebp
jmp    116d <printStairCase+0x5d>
nopw   0x0(%rax,%rax,1)
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %r15d,%ebp
jl     1160 <printStairCase+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r12),%eax
cmp    %r15d,%r12d
mov    %eax,%r12d
jne    1130 <printStairCase+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"#\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @printStairCase(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
br label %5
5: ; preds = %32, %1
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = icmp sle i32 %6, %7
br i1 %8, label %9, label %35
9: ; preds = %5
store i32 0, i32* %4
br label %10
10: ; preds = %18, %9
%11 = load i32, i32* %4
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = sub nsw i32 %12, %13
%15 = icmp slt i32 %11, %14
br i1 %15, label %16, label %21
16: ; preds = %10
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %10
21: ; preds = %10
br label %22
22: ; preds = %26, %21
%23 = load i32, i32* %4
%24 = load i32, i32* %2
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %30
26: ; preds = %22
%27 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %22
30: ; preds = %22
%31 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %32
32: ; preds = %30
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %5
35: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @printStairCase(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %8, label %3
3: ; preds = %1, %22
%4 = phi i32 [ %6, %22 ], [ %0, %1 ]
%5 = phi i32 [ %24, %22 ], [ 1, %1 ]
%6 = add i32 %4, -1
%7 = icmp slt i32 %5, %0
br i1 %7, label %12, label %9
8: ; preds = %22, %1
ret void
9: ; preds = %12, %3
%10 = phi i32 [ 0, %3 ], [ %6, %12 ]
%11 = icmp slt i32 %10, %0
br i1 %11, label %17, label %22
12: ; preds = %3, %12
%13 = phi i32 [ %15, %12 ], [ 0, %3 ]
%14 = tail call i32 @putchar(i32 32)
%15 = add nuw nsw i32 %13, 1
%16 = icmp eq i32 %15, %6
br i1 %16, label %9, label %12
17: ; preds = %9, %17
%18 = phi i32 [ %20, %17 ], [ %10, %9 ]
%19 = tail call i32 @putchar(i32 35)
%20 = add nuw nsw i32 %18, 1
%21 = icmp slt i32 %20, %0
br i1 %21, label %17, label %22
22: ; preds = %17, %9
%23 = tail call i32 @putchar(i32 10)
%24 = add nuw i32 %5, 1
%25 = icmp eq i32 %5, %0
br i1 %25, label %8, label %3
}