#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*/ _putchar(char);
void print_triangle(int size) {
  int a, b, c, sp, h;
  if (size > 0) {
    for (a = 1; a <= size; a++) {
      sp = size - a;
      h = size - sp;
      for (b = 1; b <= sp; b++)
        _putchar(' ');
      for (c = 1; c <= h; c++)
        _putchar('#');
      _putchar('\n');
    }
  } else
    _putchar('\n');
}


x86 assembly (clang, -O0):
<print_triangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    11bd <print_triangle+0xad>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11b8 <print_triangle+0xa8>
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1175 <print_triangle+0x65>
mov    $0x20,%edi
call   1030 <_putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1151 <print_triangle+0x41>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11a0 <print_triangle+0x90>
mov    $0x23,%edi
call   1030 <_putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117c <print_triangle+0x6c>
mov    $0xa,%edi
call   1030 <_putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112c <print_triangle+0x1c>
jmp    11c7 <print_triangle+0xb7>
mov    $0xa,%edi
call   1030 <_putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_triangle>:
test   %edi,%edi
jle    1192 <print_triangle+0x82>
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%r15d
lea    0x1(%r15),%r14d
mov    $0x1,%ebp
mov    $0x2,%r12d
xchg   %ax,%ax
cmp    %r15d,%ebp
jge    1151 <print_triangle+0x41>
mov    %r15d,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <_putchar@plt>
add    $0xffffffff,%ebx
cmp    %ebx,%ebp
jne    1140 <print_triangle+0x30>
mov    %ebp,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x23,%edi
call   1030 <_putchar@plt>
add    $0xffffffff,%ebx
jne    1160 <print_triangle+0x50>
mov    $0xa,%edi
call   1030 <_putchar@plt>
add    $0x1,%ebp
lea    0x1(%r12),%eax
cmp    %r14d,%r12d
mov    %eax,%r12d
jne    1130 <print_triangle+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xa,%edi
jmp    1030 <_putchar@plt>

LLVM IR (-O0):
define void @print_triangle(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %2
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %47
10: ; preds = %1
store i32 1, i32* %3
br label %11
11: ; preds = %43, %10
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %46
15: ; preds = %11
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = sub nsw i32 %16, %17
store i32 %18, i32* %6
%19 = load i32, i32* %2
%20 = load i32, i32* %6
%21 = sub nsw i32 %19, %20
store i32 %21, i32* %7
store i32 1, i32* %4
br label %22
22: ; preds = %28, %15
%23 = load i32, i32* %4
%24 = load i32, i32* %6
%25 = icmp sle i32 %23, %24
br i1 %25, label %26, label %31
26: ; preds = %22
%27 = call i32 @_putchar(i8 signext 32)
br label %28
28: ; preds = %26
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %22
31: ; preds = %22
store i32 1, i32* %5
br label %32
32: ; preds = %38, %31
%33 = load i32, i32* %5
%34 = load i32, i32* %7
%35 = icmp sle i32 %33, %34
br i1 %35, label %36, label %41
36: ; preds = %32
%37 = call i32 @_putchar(i8 signext 35)
br label %38
38: ; preds = %36
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %32
41: ; preds = %32
%42 = call i32 @_putchar(i8 signext 10)
br label %43
43: ; preds = %41
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 1
store i32 %45, i32* %3
br label %11
46: ; preds = %11
br label %49
47: ; preds = %1
%48 = call i32 @_putchar(i8 signext 10)
br label %49
49: ; preds = %47, %46
ret void
}

LLVM IR (-O2):
define void @print_triangle(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %27
3: ; preds = %1
%4 = add i32 %0, 1
br label %5
5: ; preds = %3, %21
%6 = phi i32 [ 2, %3 ], [ %25, %21 ]
%7 = phi i32 [ %0, %3 ], [ %24, %21 ]
%8 = phi i32 [ 1, %3 ], [ %23, %21 ]
%9 = icmp slt i32 %8, %0
br i1 %9, label %10, label %15
10: ; preds = %5, %10
%11 = phi i32 [ %13, %10 ], [ 1, %5 ]
%12 = tail call i32 @_putchar(i8 signext 32)
%13 = add nuw i32 %11, 1
%14 = icmp eq i32 %13, %7
br i1 %14, label %15, label %10
15: ; preds = %10, %5
br label %16
16: ; preds = %15, %16
%17 = phi i32 [ %19, %16 ], [ 1, %15 ]
%18 = tail call i32 @_putchar(i8 signext 35)
%19 = add nuw i32 %17, 1
%20 = icmp eq i32 %19, %6
br i1 %20, label %21, label %16
21: ; preds = %16
%22 = tail call i32 @_putchar(i8 signext 10)
%23 = add nuw nsw i32 %8, 1
%24 = add i32 %7, -1
%25 = add nuw i32 %6, 1
%26 = icmp eq i32 %6, %4
br i1 %26, label %29, label %5
27: ; preds = %1
%28 = tail call i32 @_putchar(i8 signext 10)
br label %29
29: ; preds = %21, %27
ret void
}