#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_latera(int n) {
  int i;
  int j;
  int k;
  for (i = 0; i < n; i++) {
    for (j = 0; j <= i; j++) {
      printf("*");
    }
    printf("\n");
    if (i == n - 1) {
      for (k = n - 1; k > 0; k--) {
        for (j = 0; j < k; j++) {
          printf("*");
        }
        printf("\n");
      }
    }
  }
}


x86 assembly (clang, -O0):
<triangulo_latera>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ea <triangulo_latera+0xda>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     115b <triangulo_latera+0x4b>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1135 <triangulo_latera+0x25>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    11d7 <triangulo_latera+0xc7>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    11d2 <triangulo_latera+0xc2>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11b8 <triangulo_latera+0xa8>
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1192 <triangulo_latera+0x82>
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1181 <triangulo_latera+0x71>
jmp    11d7 <triangulo_latera+0xc7>
jmp    11dc <triangulo_latera+0xcc>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <triangulo_latera+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<triangulo_latera>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    11b7 <triangulo_latera+0xa7>
mov    %edi,%r15d
lea    -0x1(%r15),%r14d
xor    %r13d,%r13d
mov    $0x1,%r12d
jmp    114d <triangulo_latera+0x3d>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r13d
add    $0x1,%r12d
cmp    %r15d,%r13d
je     11b7 <triangulo_latera+0xa7>
mov    %r12d,%ebx
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1150 <triangulo_latera+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    %r14d,%r13d
jne    1140 <triangulo_latera+0x30>
cmp    $0x1,%r15d
je     1140 <triangulo_latera+0x30>
mov    %r14d,%ebx
nopw   0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1190 <triangulo_latera+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x1(%rbx),%eax
cmp    $0x1,%ebx
mov    %eax,%ebx
jg     1180 <triangulo_latera+0x70>
jmp    1140 <triangulo_latera+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"*\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @triangulo_latera(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %6
6: ; preds = %49, %1
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %52
10: ; preds = %6
store i32 0, i32* %4
br label %11
11: ; preds = %17, %10
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %20
15: ; preds = %11
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %11
20: ; preds = %11
%21 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = load i32, i32* %3
%23 = load i32, i32* %2
%24 = sub nsw i32 %23, 1
%25 = icmp eq i32 %22, %24
br i1 %25, label %26, label %48
26: ; preds = %20
%27 = load i32, i32* %2
%28 = sub nsw i32 %27, 1
store i32 %28, i32* %5
br label %29
29: ; preds = %44, %26
%30 = load i32, i32* %5
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %47
32: ; preds = %29
store i32 0, i32* %4
br label %33
33: ; preds = %39, %32
%34 = load i32, i32* %4
%35 = load i32, i32* %5
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %42
37: ; preds = %33
%38 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %39
39: ; preds = %37
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
br label %33
42: ; preds = %33
%43 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %44
44: ; preds = %42
%45 = load i32, i32* %5
%46 = add nsw i32 %45, -1
store i32 %46, i32* %5
br label %29
47: ; preds = %29
br label %48
48: ; preds = %47, %20
br label %49
49: ; preds = %48
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
store i32 %51, i32* %3
br label %6
52: ; preds = %6
ret void
}

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