#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*/ escreveCaracter(char, int);
int /*<<< orphan*/ escreveNumerosAsc(int, int);
int /*<<< orphan*/ escreveNumerosDesc(int, int);
int /*<<< orphan*/ putchar(char);
void piramide(int N) {
  int i;
  for (i = 1; i <= N; ++i) {
    escreveCaracter('\t', (N - i));
    escreveNumerosAsc(1, i);
    escreveNumerosDesc(i - 1, 1);
    putchar('\n');
  }
}


x86 assembly (clang, -O0):
<piramide>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11a3 <piramide+0x63>
mov    -0x4(%rbp),%esi
sub    -0x8(%rbp),%esi
mov    $0x9,%edi
call   1060 <escreveCaracter@plt>
mov    -0x8(%rbp),%esi
mov    $0x1,%edi
call   1040 <escreveNumerosAsc@plt>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    $0x1,%esi
call   1050 <escreveNumerosDesc@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1152 <piramide+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<piramide>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
jle    119c <piramide+0x5c>
mov    %edi,%r14d
lea    -0x1(%r14),%ebp
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x9,%edi
mov    %ebp,%esi
call   1060 <escreveCaracter@plt>
mov    $0x1,%edi
mov    %ebx,%esi
call   1040 <escreveNumerosAsc@plt>
lea    -0x1(%rbx),%edi
mov    $0x1,%esi
call   1050 <escreveNumerosDesc@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
lea    0x1(%rbx),%eax
cmp    %r14d,%ebx
mov    %eax,%ebx
jne    1160 <piramide+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @piramide(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
br label %4
4: ; preds = %19, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp sle i32 %5, %6
br i1 %7, label %8, label %22
8: ; preds = %4
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = sub nsw i32 %9, %10
%12 = call i32 @escreveCaracter(i8 signext 9, i32 %11)
%13 = load i32, i32* %3
%14 = call i32 @escreveNumerosAsc(i32 1, i32 %13)
%15 = load i32, i32* %3
%16 = sub nsw i32 %15, 1
%17 = call i32 @escreveNumerosDesc(i32 %16, i32 1)
%18 = call i32 @putchar(i8 signext 10)
br label %19
19: ; preds = %8
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %4
22: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @piramide(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %13, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %11, %3 ], [ 1, %1 ]
%5 = sub nsw i32 %0, %4
%6 = tail call i32 @escreveCaracter(i8 signext 9, i32 %5)
%7 = tail call i32 @escreveNumerosAsc(i32 1, i32 %4)
%8 = add nsw i32 %4, -1
%9 = tail call i32 @escreveNumerosDesc(i32 %8, i32 1)
%10 = tail call i32 @putchar(i8 signext 10)
%11 = add nuw i32 %4, 1
%12 = icmp eq i32 %4, %0
br i1 %12, label %13, label %3
13: ; preds = %3, %1
ret void
}