#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, 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");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    1206 <main+0xe6>
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1195 <main+0x75>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116f <main+0x4f>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11c2 <main+0xa2>
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    119c <main+0x7c>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ef <main+0xcf>
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c9 <main+0xa9>
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1152 <main+0x32>
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
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>
xor    %eax,%eax
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 i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %7
7: ; preds = %41, %0
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %46
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %12
12: ; preds = %18, %10
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %16
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %12
21: ; preds = %12
store i32 0, i32* %3
br label %22
22: ; preds = %28, %21
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %31
26: ; preds = %22
%27 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %28
28: ; preds = %26
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %22
31: ; preds = %22
store i32 1, i32* %3
br label %32
32: ; preds = %38, %31
%33 = load i32, i32* %3
%34 = load i32, i32* %2
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %41
36: ; preds = %32
%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* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %32
41: ; preds = %32
%42 = load i32, i32* %4
%43 = add nsw i32 %42, 2
store i32 %43, i32* %4
%44 = load i32, i32* %2
%45 = add nsw i32 %44, -1
store i32 %45, i32* %2
br label %7
46: ; preds = %7
%47 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"\0AKolko visok da e triagalnika?\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 @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 i32 0
}