#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, n1, a = 0, b = 0;
  char c = '$';
  printf("Vavedi n - ");
  scanf("%d", &n);
  while (n != 0) {
    n1 = n;
    while (n1 != 0) {
      printf(" ");
      n1--;
    }
    while (a >= 0) {
      printf("%c", c);
      a--;
    }
    b = b + 2;
    a = b;
    n--;
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movb   $0x24,-0x15(%rbp)
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     11ef <main+0xcf>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1195 <main+0x75>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    116f <main+0x4f>
jmp    119a <main+0x7a>
cmpl   $0x0,-0x10(%rbp)
jl     11c4 <main+0xa4>
movsbl -0x15(%rbp),%esi
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    119a <main+0x7a>
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    115f <main+0x3f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%ebp
test   %ebp,%ebp
je     11a9 <main+0x79>
mov    $0x1,%ebx
nop
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1160 <main+0x30>
mov    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x24,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jg     1180 <main+0x50>
addl   $0xffffffff,0x4(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%ebp
add    $0x2,%ebx
test   %ebp,%ebp
jne    1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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