#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 row, base, n, temp;
  scanf("%d", &n);
  temp = n;
  for (row = 1; row <= n; row++) {
    for (base = 1; base < temp; base++)
      printf(" ");
    temp--;
    for (base = 1; base <= 2 * row - 1; base++)
      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
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11dd <main+0xbd>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1185 <main+0x65>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115f <main+0x3f>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11c3 <main+0xa3>
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1195 <main+0x75>
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114c <main+0x2c>
xor    %eax,%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    0xecd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%r14d
test   %r14d,%r14d
jle    11b8 <main+0x98>
mov    $0x1,%r12d
mov    %r14d,%r15d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x2,%r15d
jl     1181 <main+0x61>
mov    %r14d,%ebp
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    %ebp,%ebx
jne    1170 <main+0x50>
add    $0xffffffff,%r15d
mov    %r12d,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x24,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1190 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
add    $0x2,%r12d
cmp    0xc(%rsp),%ebx
mov    %eax,%ebx
jl     1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\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 slt i32 %4, 1
br i1 %5, label %29, label %6
6: ; preds = %0, %23
%7 = phi i32 [ %28, %23 ], [ 2, %0 ]
%8 = phi i32 [ %17, %23 ], [ %4, %0 ]
%9 = phi i32 [ %25, %23 ], [ 1, %0 ]
%10 = icmp sgt i32 %8, 1
br i1 %10, label %11, label %16
11: ; preds = %6, %11
%12 = phi i32 [ %14, %11 ], [ 1, %6 ]
%13 = call i32 @putchar(i32 32)
%14 = add nuw nsw i32 %12, 1
%15 = icmp eq i32 %14, %8
br i1 %15, label %16, label %11
16: ; preds = %11, %6
%17 = add nsw i32 %8, -1
br label %18
18: ; preds = %16, %18
%19 = phi i32 [ %21, %18 ], [ 1, %16 ]
%20 = call i32 @putchar(i32 36)
%21 = add nuw i32 %19, 1
%22 = icmp eq i32 %21, %7
br i1 %22, label %23, label %18
23: ; preds = %18
%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 i32 %7, 2
br i1 %27, label %6, label %29
29: ; preds = %23, %0
ret i32 0
}