#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 *, ...);
void triangulo(int fim) {
  int ini = 1, espaco = 0;
  int j, i;
  do {
    printf("\n");
    for (j = 1; j <= espaco; j++)
      printf(" ");
    for (i = ini; i <= fim; i++)
      printf("%d ", i);
    espaco = espaco + 2;
    ini++;
    fim--;
  } while (ini <= fim);
}


x86 assembly (clang, -O0):
<triangulo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1166 <triangulo+0x56>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113e <triangulo+0x2e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1197 <triangulo+0x87>
mov    -0x14(%rbp),%esi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116c <triangulo+0x5c>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jle    1129 <triangulo+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<triangulo>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r13d
mov    $0x1,%ebx
lea    0xec6(%rip),%r14
mov    %edi,%r15d
xor    %r12d,%r12d
jmp    1166 <triangulo+0x46>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x2,%r12d
lea    0x1(%rbx),%eax
add    $0xffffffff,%r15d
add    $0xfffffffe,%r13d
cmp    %r15d,%ebx
mov    %eax,%ebx
jge    11b7 <triangulo+0x97>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12d,%ebp
test   %r12d,%r12d
je     118f <triangulo+0x6f>
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1180 <triangulo+0x60>
cmp    %r15d,%ebx
jg     1150 <triangulo+0x30>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
lea    (%rbx,%rbp,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%r13d
jne    11a0 <triangulo+0x80>
jmp    1150 <triangulo+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.2 = [4 x i8] c"%d \00"
define void @triangulo(i32 %0) {
%2 = add i32 %0, 1
br label %3
3: ; preds = %23, %1
%4 = phi i32 [ %29, %23 ], [ %2, %1 ]
%5 = phi i32 [ %28, %23 ], [ 1, %1 ]
%6 = phi i32 [ %26, %23 ], [ %0, %1 ]
%7 = phi i32 [ %25, %23 ], [ 1, %1 ]
%8 = phi i32 [ %24, %23 ], [ 0, %1 ]
%9 = tail call i32 @putchar(i32 10)
%10 = icmp eq i32 %8, 0
br i1 %10, label %11, label %13
11: ; preds = %13, %3
%12 = icmp sgt i32 %7, %6
br i1 %12, label %23, label %18
13: ; preds = %3, %13
%14 = phi i32 [ %16, %13 ], [ 1, %3 ]
%15 = tail call i32 @putchar(i32 32)
%16 = add nuw i32 %14, 1
%17 = icmp eq i32 %16, %5
br i1 %17, label %11, label %13
18: ; preds = %11, %18
%19 = phi i32 [ %21, %18 ], [ %7, %11 ]
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = add nuw i32 %19, 1
%22 = icmp eq i32 %21, %4
br i1 %22, label %23, label %18
23: ; preds = %18, %11
%24 = add nuw nsw i32 %8, 2
%25 = add nuw nsw i32 %7, 1
%26 = add nsw i32 %6, -1
%27 = icmp slt i32 %7, %26
%28 = add nuw i32 %5, 2
%29 = add i32 %4, -1
br i1 %27, label %3, label %30
30: ; preds = %23
ret void
}