#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, sp, br, j;
  printf("Vuvedi visochina na triugulnika =  ");
  scanf("%d", &n);
  sp = n;
  for (br = 0; br <= n; br++) {
    for (j = 1; j <= sp; j++)
      printf(" ");
    sp = sp - 1;
    for (j = 1; j < 2 * br; 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    0xee2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11e6 <main+0xc6>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1191 <main+0x71>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116b <main+0x4b>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    11cc <main+0xac>
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a1 <main+0x81>
lea    0xe56(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1158 <main+0x38>
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    0xebd(%rip),%rdi
call   1040 <printf@plt>
lea    0xed5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%r15d
test   %r15d,%r15d
js     11e1 <main+0xb1>
xor    %r12d,%r12d
xor    %r14d,%r14d
jmp    1190 <main+0x60>
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%r15d
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r14),%eax
add    $0x2,%r12d
cmp    0xc(%rsp),%r14d
mov    %eax,%r14d
jge    11e1 <main+0xb1>
cmp    $0x3,%r12d
mov    $0x2,%ebx
cmovae %r12d,%ebx
test   %r15d,%r15d
jle    11bf <main+0x8f>
mov    %r15d,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11b0 <main+0x80>
test   %r14d,%r14d
je     1170 <main+0x40>
add    $0xffffffff,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11d0 <main+0xa0>
jmp    1170 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [36 x i8] c"Vuvedi visochina na triugulnika = \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 ([36 x i8], [36 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, 0
br i1 %6, label %36, label %7
7: ; preds = %0
%8 = add nuw i32 %5, 1
br label %9
9: ; preds = %7, %29
%10 = phi i32 [ 0, %7 ], [ %35, %29 ]
%11 = phi i32 [ %8, %7 ], [ %34, %29 ]
%12 = phi i32 [ 0, %7 ], [ %31, %29 ]
%13 = phi i32 [ %5, %7 ], [ %22, %29 ]
%14 = call i32 @llvm.umax.i32(i32 %10, i32 2)
%15 = icmp slt i32 %13, 1
br i1 %15, label %21, label %16
16: ; preds = %9, %16
%17 = phi i32 [ %19, %16 ], [ 1, %9 ]
%18 = call i32 @putchar(i32 32)
%19 = add nuw i32 %17, 1
%20 = icmp eq i32 %19, %11
br i1 %20, label %21, label %16
21: ; preds = %16, %9
%22 = add nsw i32 %13, -1
%23 = icmp eq i32 %12, 0
br i1 %23, label %29, label %24
24: ; preds = %21, %24
%25 = phi i32 [ %27, %24 ], [ 1, %21 ]
%26 = call i32 @putchar(i32 35)
%27 = add nuw i32 %25, 1
%28 = icmp eq i32 %27, %14
br i1 %28, label %29, label %24
29: ; preds = %24, %21
%30 = call i32 @putchar(i32 10)
%31 = add nuw nsw i32 %12, 1
%32 = load i32, i32* %1
%33 = icmp slt i32 %12, %32
%34 = add i32 %11, -1
%35 = add i32 %10, 2
br i1 %33, label %9, label %36
36: ; preds = %29, %0
ret i32 0
}