#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 *);
void main() {
  int n, i, j = 1;
  printf("\nKolko visok da e triagalnika?");
  scanf("%d", &n);
  while (n > 0) {
    printf("\n");
    for (i = 1; i < n; i++)
      printf(" ");
    for (i = 0; i < j; i++)
      printf("#");
    for (i = 1; i < n; i++)
      printf(" ");
    j += 2;
    n--;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0xc(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x4(%rbp)
jle    11ff <main+0xdf>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    118e <main+0x6e>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1168 <main+0x48>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11bb <main+0x9b>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1195 <main+0x75>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11e8 <main+0xc8>
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c2 <main+0xa2>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    114b <main+0x2b>
lea    0xe1c(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
call   1040 <printf@plt>
lea    0xed9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11f1 <main+0xc1>
mov    $0x1,%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpl   $0x2,0x4(%rsp)
mov    %ebx,%ebp
jl     11a0 <main+0x70>
mov    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     1180 <main+0x50>
mov    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11a0 <main+0x70>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
jl     11ea <main+0xba>
mov    $0x1,%ebp
nopl   (%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    0x4(%rsp),%eax
cmp    %eax,%ebp
jl     11c0 <main+0x90>
add    $0x2,%ebx
lea    -0x1(%rax),%ecx
mov    %ecx,0x4(%rsp)
cmp    $0x1,%eax
jg     1160 <main+0x30>
jmp    11f1 <main+0xc1>
add    $0xffffffff,%eax
mov    %eax,0x4(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"\0AKolko visok da e triagalnika?\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [2 x i8] c"#\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 1, i32* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
br label %6
6: ; preds = %40, %0
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %45
9: ; preds = %6
%10 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %2
br label %11
11: ; preds = %17, %9
%12 = load i32, i32* %2
%13 = load i32, i32* %1
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %20
15: ; preds = %11
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %17
17: ; preds = %15
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %11
20: ; preds = %11
store i32 0, i32* %2
br label %21
21: ; preds = %27, %20
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %30
25: ; preds = %21
%26 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %27
27: ; preds = %25
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %21
30: ; preds = %21
store i32 1, i32* %2
br label %31
31: ; preds = %37, %30
%32 = load i32, i32* %2
%33 = load i32, i32* %1
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %40
35: ; preds = %31
%36 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %37
37: ; preds = %35
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %2
br label %31
40: ; preds = %31
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 2
store i32 %42, i32* %3
%43 = load i32, i32* %1
%44 = add nsw i32 %43, -1
store i32 %44, i32* %1
br label %6
45: ; preds = %6
%46 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

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