#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
void main() {
  int n, y, x, z, c;
  char op;
  do {
    printf("Introduzca el tipo de piramide que desea imprimir\n"
           "1- Asendente\n"
           "2- Desendente\n"
           "3- Asendente invertido\n"
           "4- Desendente invertido\n"
           "x- Salir\n"
           "\n"
           "Elija la opcion:\n");
    scanf("%c", &op);
    while ((c = getchar()) != '\n' && c != EOF) {
    }
    if (op != 'x') {
      printf("Dimencion de la piramide:");
      scanf("%d", &n);
      while ((c = getchar()) != '\n' && c != EOF) {
      }
    }
    switch (op) {
    case '1':
      printf("\n\n\n\n\n");
      for (y = 1; y <= n; y++) {
        for (x = 1; x <= y; x++) {
          printf("%d", x);
        }
        printf("\n");
      }
      printf("\n\n\n\n\n");
      break;
    case '2':
      printf("......\n");
      for (y = 0; y < n; y++) {
        for (x = 1; x <= (n - y); x++) {
          printf("%d", x);
        }
        printf("\n");
      }
      printf("......\n");
      break;
    case '3':
      printf("\n\n");
      for (y = 0; y < n; y++) {
        for (z = 1; z < (n - y); z++) {
          printf(" ");
        }
        for (x = z; x <= n; x++) {
          printf("%d", x);
        }
        printf("\n");
      }
      printf("\n\n");
      break;
    case '4':
      printf("\n\n");
      for (y = 0; y < n; y++) {
        for (x = 0; x < y; x++) {
          printf(" ");
        }
        for (x = 1 + y; x <= n; x++) {
          printf("%d", x);
        }
        printf("\n");
      }
      printf("\n\n");
      break;
    case 'x':
      break;
    default:
      printf("No elegiste una opcion valida!!!!\n");
      break;
    }
  } while (op != 'x');
  return;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf4b(%rip),%rdi
lea    -0x15(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x16(%rbp)
je     1184 <main+0x54>
mov    -0x14(%rbp),%eax
mov    0x2e6c(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
test   $0x1,%al
jne    1194 <main+0x64>
jmp    1199 <main+0x69>
jmp    1158 <main+0x28>
movsbl -0x15(%rbp),%eax
cmp    $0x78,%eax
je     120c <main+0xdc>
lea    0xeee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x17(%rbp)
je     11f2 <main+0xc2>
mov    -0x14(%rbp),%eax
mov    0x2dfe(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x17(%rbp)
mov    -0x17(%rbp),%al
test   $0x1,%al
jne    1202 <main+0xd2>
jmp    1207 <main+0xd7>
jmp    11c6 <main+0x96>
jmp    120c <main+0xdc>
movsbl -0x15(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x31,%eax
je     1265 <main+0x135>
jmp    1221 <main+0xf1>
mov    -0x1c(%rbp),%eax
sub    $0x32,%eax
je     12e7 <main+0x1b7>
jmp    1232 <main+0x102>
mov    -0x1c(%rbp),%eax
sub    $0x33,%eax
je     136e <main+0x23e>
jmp    1243 <main+0x113>
mov    -0x1c(%rbp),%eax
sub    $0x34,%eax
je     1423 <main+0x2f3>
jmp    1254 <main+0x124>
mov    -0x1c(%rbp),%eax
sub    $0x78,%eax
je     14d6 <main+0x3a6>
jmp    14db <main+0x3ab>
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     12d4 <main+0x1a4>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     12b8 <main+0x188>
mov    -0xc(%rbp),%esi
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    128d <main+0x15d>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    127a <main+0x14a>
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14e9 <main+0x3b9>
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    135b <main+0x22b>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jg     133f <main+0x20f>
mov    -0xc(%rbp),%esi
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    130f <main+0x1df>
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12fc <main+0x1cc>
lea    0xd5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14e9 <main+0x3b9>
lea    0xd46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1410 <main+0x2e0>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    13c3 <main+0x293>
lea    0xd18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1396 <main+0x266>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     13f4 <main+0x2c4>
mov    -0xc(%rbp),%esi
lea    0xcd6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    13c9 <main+0x299>
lea    0xcc1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1383 <main+0x253>
lea    0xca4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14e9 <main+0x3b9>
lea    0xc91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    14c3 <main+0x393>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1473 <main+0x343>
lea    0xc68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    144b <main+0x31b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     14a7 <main+0x377>
mov    -0xc(%rbp),%esi
lea    0xc23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    147c <main+0x34c>
lea    0xc0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1438 <main+0x308>
lea    0xbf1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14e9 <main+0x3b9>
jmp    14e9 <main+0x3b9>
lea    0xbe6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14ee <main+0x3be>
movsbl -0x15(%rbp),%eax
cmp    $0x78,%eax
jne    1138 <main+0x8>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%r12
lea    0xea7(%rip),%rbp
lea    0x3(%rsp),%r15
mov    0x2e73(%rip),%r14
lea    0xeb1(%rip),%r13
jmp    11a2 <main+0x52>
lea    0xf4c(%rip),%rdi
lea    0xea4(%rip),%r12
lea    0x3(%rsp),%r15
call   1040 <puts@plt>
mov    0x3(%rsp),%al
cmp    $0x78,%al
je     14c0 <main+0x370>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%eax
je     11d1 <main+0x81>
cmp    (%r14),%eax
jne    11c0 <main+0x70>
cmpb   $0x78,0x3(%rsp)
je     14c0 <main+0x370>
lea    0xe30(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%eax
je     1211 <main+0xc1>
cmp    (%r14),%eax
jne    1200 <main+0xb0>
mov    0x3(%rsp),%al
movsbl %al,%ecx
lea    -0x31(%rcx),%edx
cmp    $0x3,%edx
ja     12e0 <main+0x190>
lea    0xdd5(%rip),%rcx
movslq (%rcx,%rdx,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %rbp,%rbx
mov    %r12,%rbp
lea    0xe8d(%rip),%r15
mov    %r15,%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x4(%rsp)
mov    %r15,%rdi
mov    %rbx,%rbp
lea    0x3(%rsp),%r15
jle    1191 <main+0x41>
mov    $0x1,%r12d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x2,%eax
jne    1280 <main+0x130>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r12),%eax
add    $0xffffffff,%ebx
cmp    0x4(%rsp),%r12d
mov    %eax,%r12d
jl     1270 <main+0x120>
lea    0xe0d(%rip),%rdi
lea    0xd68(%rip),%r12
lea    0xd41(%rip),%rbp
jmp    118c <main+0x3c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xdec(%rip),%rdi
cmp    $0x78,%ecx
jne    1191 <main+0x41>
jmp    119a <main+0x4a>
mov    %rbp,%rbx
lea    0xdc8(%rip),%rbp
mov    %rbp,%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%eax
mov    %rbp,%rdi
mov    %rbx,%rbp
test   %eax,%eax
jle    1191 <main+0x41>
xor    %ebx,%ebx
jmp    1339 <main+0x1e9>
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0x4(%rsp),%eax
cmp    %eax,%ebx
jge    149a <main+0x34a>
cmp    %ebx,%eax
jle    1320 <main+0x1d0>
xor    %ebp,%ebp
nop
add    $0x1,%ebp
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%eax
sub    %ebx,%eax
cmp    %eax,%ebp
jl     1340 <main+0x1f0>
jmp    1320 <main+0x1d0>
mov    %rbp,%rbx
lea    0xd6c(%rip),%rbp
mov    %rbp,%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%eax
mov    %rbp,%rdi
mov    %rbx,%rbp
test   %eax,%eax
jle    1191 <main+0x41>
xor    %ebx,%ebx
jmp    13a9 <main+0x259>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0x4(%rsp),%eax
cmp    %eax,%ebx
jge    14ad <main+0x35d>
mov    %eax,%ecx
sub    %ebx,%ecx
mov    $0x1,%ebp
cmp    $0x2,%ecx
jl     13d9 <main+0x289>
mov    $0x1,%ebp
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    0x4(%rsp),%eax
mov    %eax,%ecx
sub    %ebx,%ecx
cmp    %ecx,%ebp
jl     13c0 <main+0x270>
cmp    %eax,%ebp
jg     1390 <main+0x240>
nopl   (%rax)
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x1(%rbp),%eax
cmp    0x4(%rsp),%ebp
mov    %eax,%ebp
jl     13e0 <main+0x290>
jmp    1390 <main+0x240>
mov    %rbp,%rbx
lea    0xcce(%rip),%rbp
mov    %rbp,%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%eax
mov    %rbp,%rdi
mov    %rbx,%rbp
test   %eax,%eax
jle    1191 <main+0x41>
xor    %r12d,%r12d
jmp    1449 <main+0x2f9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
mov    %ebx,%r12d
cmp    %eax,%ebx
jge    117e <main+0x2e>
test   %r12d,%r12d
je     1473 <main+0x323>
mov    %r12d,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1460 <main+0x310>
mov    0x4(%rsp),%eax
lea    0x1(%r12),%ebx
cmp    %eax,%r12d
jge    1430 <main+0x2e0>
nopl   (%rax)
add    $0x1,%r12d
mov    %r13,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    0x4(%rsp),%r12d
jl     1480 <main+0x330>
jmp    1430 <main+0x2e0>
lea    0xc26(%rip),%rdi
lea    0xb68(%rip),%rbp
jmp    118c <main+0x3c>
lea    0xc1d(%rip),%rdi
lea    0xb55(%rip),%rbp
jmp    118c <main+0x3c>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [152 x i8] c"Introduzca el tipo de piramide que desea imprimir\0A1- Asendente\0A2- Desendente\0A3- Asendente invertido\0A4- Desendente invertido\0Ax- Salir\0A\0AElija la opcion:\0A\00"
@.str.1 = [3 x i8] c"%c\00"
@EOF = global i32 0
@.str.2 = [26 x i8] c"Dimencion de la piramide:\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [6 x i8] c"\0A\0A\0A\0A\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [8 x i8] c"......\0A\00"
@.str.7 = [3 x i8] c"\0A\0A\00"
@.str.8 = [2 x i8] c" \00"
@.str.9 = [35 x i8] c"No elegiste una opcion valida!!!!\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
br label %7
7: ; preds = %168, %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %10
10: ; preds = %19, %7
%11 = call i32 (...) @getchar()
store i32 %11, i32* %5
%12 = icmp ne i32 %11, 10
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* %5
%15 = load i32, i32* @EOF
%16 = icmp ne i32 %14, %15
br label %17
17: ; preds = %13, %10
%18 = phi i1 [ false, %10 ], [ %16, %13 ]
br i1 %18, label %19, label %20
19: ; preds = %17
br label %10
20: ; preds = %17
%21 = load i8, i8* %6
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 120
br i1 %23, label %24, label %38
24: ; preds = %20
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
br label %27
27: ; preds = %36, %24
%28 = call i32 (...) @getchar()
store i32 %28, i32* %5
%29 = icmp ne i32 %28, 10
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = load i32, i32* %5
%32 = load i32, i32* @EOF
%33 = icmp ne i32 %31, %32
br label %34
34: ; preds = %30, %27
%35 = phi i1 [ false, %27 ], [ %33, %30 ]
br i1 %35, label %36, label %37
36: ; preds = %34
br label %27
37: ; preds = %34
br label %38
38: ; preds = %37, %20
%39 = load i8, i8* %6
%40 = sext i8 %39 to i32
switch i32 %40, label %165 [
i32 49, label %41
i32 50, label %65
i32 51, label %91
i32 52, label %128
i32 120, label %164
]
41: ; preds = %38
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %2
br label %43
43: ; preds = %60, %41
%44 = load i32, i32* %2
%45 = load i32, i32* %1
%46 = icmp sle i32 %44, %45
br i1 %46, label %47, label %63
47: ; preds = %43
store i32 1, i32* %3
br label %48
48: ; preds = %55, %47
%49 = load i32, i32* %3
%50 = load i32, i32* %2
%51 = icmp sle i32 %49, %50
br i1 %51, label %52, label %58
52: ; preds = %48
%53 = load i32, i32* %3
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %53)
br label %55
55: ; preds = %52
%56 = load i32, i32* %3
%57 = add nsw i32 %56, 1
store i32 %57, i32* %3
br label %48
58: ; preds = %48
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %60
60: ; preds = %58
%61 = load i32, i32* %2
%62 = add nsw i32 %61, 1
store i32 %62, i32* %2
br label %43
63: ; preds = %43
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %167
65: ; preds = %38
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %2
br label %67
67: ; preds = %86, %65
%68 = load i32, i32* %2
%69 = load i32, i32* %1
%70 = icmp slt i32 %68, %69
br i1 %70, label %71, label %89
71: ; preds = %67
store i32 1, i32* %3
br label %72
72: ; preds = %81, %71
%73 = load i32, i32* %3
%74 = load i32, i32* %1
%75 = load i32, i32* %2
%76 = sub nsw i32 %74, %75
%77 = icmp sle i32 %73, %76
br i1 %77, label %78, label %84
78: ; preds = %72
%79 = load i32, i32* %3
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %79)
br label %81
81: ; preds = %78
%82 = load i32, i32* %3
%83 = add nsw i32 %82, 1
store i32 %83, i32* %3
br label %72
84: ; preds = %72
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %86
86: ; preds = %84
%87 = load i32, i32* %2
%88 = add nsw i32 %87, 1
store i32 %88, i32* %2
br label %67
89: ; preds = %67
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %167
91: ; preds = %38
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %2
br label %93
93: ; preds = %123, %91
%94 = load i32, i32* %2
%95 = load i32, i32* %1
%96 = icmp slt i32 %94, %95
br i1 %96, label %97, label %126
97: ; preds = %93
store i32 1, i32* %4
br label %98
98: ; preds = %106, %97
%99 = load i32, i32* %4
%100 = load i32, i32* %1
%101 = load i32, i32* %2
%102 = sub nsw i32 %100, %101
%103 = icmp slt i32 %99, %102
br i1 %103, label %104, label %109
104: ; preds = %98
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %106
106: ; preds = %104
%107 = load i32, i32* %4
%108 = add nsw i32 %107, 1
store i32 %108, i32* %4
br label %98
109: ; preds = %98
%110 = load i32, i32* %4
store i32 %110, i32* %3
br label %111
111: ; preds = %118, %109
%112 = load i32, i32* %3
%113 = load i32, i32* %1
%114 = icmp sle i32 %112, %113
br i1 %114, label %115, label %121
115: ; preds = %111
%116 = load i32, i32* %3
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %116)
br label %118
118: ; preds = %115
%119 = load i32, i32* %3
%120 = add nsw i32 %119, 1
store i32 %120, i32* %3
br label %111
121: ; preds = %111
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %123
123: ; preds = %121
%124 = load i32, i32* %2
%125 = add nsw i32 %124, 1
store i32 %125, i32* %2
br label %93
126: ; preds = %93
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %167
128: ; preds = %38
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %2
br label %130
130: ; preds = %159, %128
%131 = load i32, i32* %2
%132 = load i32, i32* %1
%133 = icmp slt i32 %131, %132
br i1 %133, label %134, label %162
134: ; preds = %130
store i32 0, i32* %3
br label %135
135: ; preds = %141, %134
%136 = load i32, i32* %3
%137 = load i32, i32* %2
%138 = icmp slt i32 %136, %137
br i1 %138, label %139, label %144
139: ; preds = %135
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %141
141: ; preds = %139
%142 = load i32, i32* %3
%143 = add nsw i32 %142, 1
store i32 %143, i32* %3
br label %135
144: ; preds = %135
%145 = load i32, i32* %2
%146 = add nsw i32 1, %145
store i32 %146, i32* %3
br label %147
147: ; preds = %154, %144
%148 = load i32, i32* %3
%149 = load i32, i32* %1
%150 = icmp sle i32 %148, %149
br i1 %150, label %151, label %157
151: ; preds = %147
%152 = load i32, i32* %3
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %152)
br label %154
154: ; preds = %151
%155 = load i32, i32* %3
%156 = add nsw i32 %155, 1
store i32 %156, i32* %3
br label %147
157: ; preds = %147
%158 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %159
159: ; preds = %157
%160 = load i32, i32* %2
%161 = add nsw i32 %160, 1
store i32 %161, i32* %2
br label %130
162: ; preds = %130
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %167
164: ; preds = %38
br label %167
165: ; preds = %38
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0))
br label %167
167: ; preds = %165, %164, %162, %126, %89, %63
br label %168
168: ; preds = %167
%169 = load i8, i8* %6
%170 = sext i8 %169 to i32
%171 = icmp ne i32 %170, 120
br i1 %171, label %7, label %172
172: ; preds = %168
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%c\00"
@EOF = global i32 0
@.str.2 = [26 x i8] c"Dimencion de la piramide:\00"
@.str.3 = [3 x i8] c"%d\00"
@str = [151 x i8] c"Introduzca el tipo de piramide que desea imprimir\0A1- Asendente\0A2- Desendente\0A3- Asendente invertido\0A4- Desendente invertido\0Ax- Salir\0A\0AElija la opcion:\00"
@str.13 = [2 x i8] c"\0A\00"
@str.15 = [7 x i8] c"......\00"
@str.17 = [5 x i8] c"\0A\0A\0A\0A\00"
@str.18 = [34 x i8] c"No elegiste una opcion valida!!!!\00"
define void @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
br label %4
4: ; preds = %130, %0
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([151 x i8], [151 x i8]* @str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %7
7: ; preds = %7, %4
%8 = call i32 (...) @getchar()
%9 = icmp ne i32 %8, 10
%10 = load i32, i32* @EOF
%11 = icmp ne i32 %8, %10
%12 = select i1 %9, i1 %11, i1 false
br i1 %12, label %7, label %13
13: ; preds = %7
%14 = load i8, i8* %2
%15 = icmp eq i8 %14, 120
br i1 %15, label %133, label %16
16: ; preds = %13
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
br label %19
19: ; preds = %19, %16
%20 = call i32 (...) @getchar()
%21 = icmp ne i32 %20, 10
%22 = load i32, i32* @EOF
%23 = icmp ne i32 %20, %22
%24 = select i1 %21, i1 %23, i1 false
br i1 %24, label %19, label %25
25: ; preds = %19
%26 = load i8, i8* %2
%27 = sext i8 %26 to i32
switch i32 %27, label %126 [
i32 49, label %28
i32 50, label %46
i32 51, label %66
i32 52, label %97
i32 120, label %130
]
28: ; preds = %25
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.17, i64 0, i64 0))
%30 = load i32, i32* %1
%31 = icmp slt i32 %30, 1
br i1 %31, label %126, label %32
32: ; preds = %28, %40
%33 = phi i32 [ %45, %40 ], [ 2, %28 ]
%34 = phi i32 [ %42, %40 ], [ 1, %28 ]
br label %35
35: ; preds = %32, %35
%36 = phi i32 [ 1, %32 ], [ %38, %35 ]
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%38 = add nuw i32 %36, 1
%39 = icmp eq i32 %38, %33
br i1 %39, label %40, label %35
40: ; preds = %35
%41 = call i32 @putchar(i32 10)
%42 = add nuw nsw i32 %34, 1
%43 = load i32, i32* %1
%44 = icmp slt i32 %34, %43
%45 = add nuw i32 %33, 1
br i1 %44, label %32, label %126
46: ; preds = %25
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.15, i64 0, i64 0))
%48 = load i32, i32* %1
%49 = icmp sgt i32 %48, 0
br i1 %49, label %50, label %126
50: ; preds = %46, %61
%51 = phi i32 [ %64, %61 ], [ %48, %46 ]
%52 = phi i32 [ %63, %61 ], [ 0, %46 ]
%53 = icmp sgt i32 %51, %52
br i1 %53, label %54, label %61
54: ; preds = %50, %54
%55 = phi i32 [ %57, %54 ], [ 1, %50 ]
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %55)
%57 = add nuw nsw i32 %55, 1
%58 = load i32, i32* %1
%59 = sub nsw i32 %58, %52
%60 = icmp slt i32 %55, %59
br i1 %60, label %54, label %61
61: ; preds = %54, %50
%62 = call i32 @putchar(i32 10)
%63 = add nuw nsw i32 %52, 1
%64 = load i32, i32* %1
%65 = icmp slt i32 %63, %64
br i1 %65, label %50, label %126
66: ; preds = %25
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.13, i64 0, i64 0))
%68 = load i32, i32* %1
%69 = icmp sgt i32 %68, 0
br i1 %69, label %70, label %126
70: ; preds = %66, %92
%71 = phi i32 [ %95, %92 ], [ %68, %66 ]
%72 = phi i32 [ %94, %92 ], [ 0, %66 ]
%73 = sub nsw i32 %71, %72
%74 = icmp sgt i32 %73, 1
br i1 %74, label %79, label %75
75: ; preds = %79, %70
%76 = phi i32 [ %71, %70 ], [ %83, %79 ]
%77 = phi i32 [ 1, %70 ], [ %82, %79 ]
%78 = icmp sgt i32 %77, %76
br i1 %78, label %92, label %86
79: ; preds = %70, %79
%80 = phi i32 [ %82, %79 ], [ 1, %70 ]
%81 = call i32 @putchar(i32 32)
%82 = add nuw nsw i32 %80, 1
%83 = load i32, i32* %1
%84 = sub nsw i32 %83, %72
%85 = icmp slt i32 %82, %84
br i1 %85, label %79, label %75
86: ; preds = %75, %86
%87 = phi i32 [ %89, %86 ], [ %77, %75 ]
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %87)
%89 = add nuw nsw i32 %87, 1
%90 = load i32, i32* %1
%91 = icmp slt i32 %87, %90
br i1 %91, label %86, label %92
92: ; preds = %86, %75
%93 = call i32 @putchar(i32 10)
%94 = add nuw nsw i32 %72, 1
%95 = load i32, i32* %1
%96 = icmp slt i32 %94, %95
br i1 %96, label %70, label %126
97: ; preds = %25
%98 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.13, i64 0, i64 0))
%99 = load i32, i32* %1
%100 = icmp sgt i32 %99, 0
br i1 %100, label %101, label %126
101: ; preds = %97, %122
%102 = phi i32 [ %124, %122 ], [ %99, %97 ]
%103 = phi i32 [ %114, %122 ], [ 0, %97 ]
%104 = icmp eq i32 %103, 0
br i1 %104, label %112, label %105
105: ; preds = %101, %105
%106 = phi i32 [ %108, %105 ], [ 0, %101 ]
%107 = call i32 @putchar(i32 32)
%108 = add nuw nsw i32 %106, 1
%109 = icmp eq i32 %108, %103
br i1 %109, label %110, label %105
110: ; preds = %105
%111 = load i32, i32* %1
br label %112
112: ; preds = %110, %101
%113 = phi i32 [ %111, %110 ], [ %102, %101 ]
%114 = add nuw nsw i32 %103, 1
%115 = icmp slt i32 %103, %113
br i1 %115, label %116, label %122
116: ; preds = %112, %116
%117 = phi i32 [ %119, %116 ], [ %114, %112 ]
%118 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %117)
%119 = add nuw nsw i32 %117, 1
%120 = load i32, i32* %1
%121 = icmp slt i32 %117, %120
br i1 %121, label %116, label %122
122: ; preds = %116, %112
%123 = call i32 @putchar(i32 10)
%124 = load i32, i32* %1
%125 = icmp slt i32 %114, %124
br i1 %125, label %101, label %126
126: ; preds = %122, %92, %61, %40, %25, %97, %66, %46, %28
%127 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @str.17, i64 0, i64 0), %28 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @str.15, i64 0, i64 0), %46 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.13, i64 0, i64 0), %66 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.13, i64 0, i64 0), %97 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @str.18, i64 0, i64 0), %25 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @str.17, i64 0, i64 0), %40 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @str.15, i64 0, i64 0), %61 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.13, i64 0, i64 0), %92 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.13, i64 0, i64 0), %122 ]
%128 = call i32 @puts(i8* dereferenceable(1) %127)
%129 = load i8, i8* %2
br label %130
130: ; preds = %126, %25
%131 = phi i8 [ %129, %126 ], [ %26, %25 ]
%132 = icmp eq i8 %131, 120
br i1 %132, label %133, label %4
133: ; preds = %13, %130
ret void
}