#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 i, j, h, b;
  printf("Enter the height\n");
  scanf("%d", &h);
  for (i = 1; i <= h; i++) {
    for (b = 1; b <= i; b++) {
      printf(" ");
    }
    for (j = h; j >= i; j--) {
      printf("* ");
    }
    printf("\n");
  }
  return 0;
}


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    0xed0(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11d1 <main+0xb1>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     118b <main+0x6b>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1165 <main+0x45>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     11b7 <main+0x97>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1191 <main+0x71>
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1152 <main+0x32>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
lea    0xea5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11d1 <main+0x91>
mov    $0x1,%ebx
lea    0xe8b(%rip),%r14
jmp    1195 <main+0x55>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
cmp    0xc(%rsp),%ebx
mov    %eax,%ebx
jge    11d1 <main+0x91>
mov    %ebx,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11a0 <main+0x60>
mov    0xc(%rsp),%ebp
cmp    %ebx,%ebp
jl     1180 <main+0x40>
add    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1050 <printf@plt>
add    $0xffffffff,%ebp
cmp    %ebx,%ebp
jg     11c0 <main+0x80>
jmp    1180 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Enter the height\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [3 x i8] c"* \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 ([18 x i8], [18 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* %4)
store i32 1, i32* %2
br label %8
8: ; preds = %35, %0
%9 = load i32, i32* %2
%10 = load i32, i32* %4
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %38
12: ; preds = %8
store i32 1, i32* %5
br label %13
13: ; preds = %19, %12
%14 = load i32, i32* %5
%15 = load i32, i32* %2
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %13
22: ; preds = %13
%23 = load i32, i32* %4
store i32 %23, i32* %3
br label %24
24: ; preds = %30, %22
%25 = load i32, i32* %3
%26 = load i32, i32* %2
%27 = icmp sge i32 %25, %26
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %30
30: ; preds = %28
%31 = load i32, i32* %3
%32 = add nsw i32 %31, -1
store i32 %32, i32* %3
br label %24
33: ; preds = %24
%34 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %35
35: ; preds = %33
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %8
38: ; preds = %8
ret i32 0
}

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