#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 *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, j, x;
  scanf("%d", &x);
  printf("\n------------ Exemplo 1 ------------\n\n");
  for (i = 0; i < x; i++) {
    for (j = 0; j < x; j++) {
      printf("* ");
    }
    printf("\n");
  }
  printf("\n------------ Exemplo 2 ------------\n\n");
  int k = 1;
  for (i = 0; i < x; i++) {
    for (j = 0; j < k; j++) {
      printf("* ");
    }
    k++;
    printf("\n");
  }
  printf("\n------------ Exemplo 3 ------------\n\n");
  k = x;
  for (i = 0; i < x; i++) {
    for (j = 0; j < k; j++) {
      printf("* ");
    }
    k--;
    printf("\n");
  }
  printf("\n------------ Exemplo 4 ------------\n\n");
  k = 0;
  for (i = 0; i < x; i++) {
    for (j = 0; j < x; j++) {
      printf(j >= k ? "* " : "  ");
    }
    k++;
    printf("\n");
  }
  printf("\n------------ Exemplo 5 ------------\n\n");
  k = x - 1;
  for (i = 0; i < x; i++) {
    for (j = 0; j < x; j++) {
      printf(j < k ? "  " : "* ");
    }
    k--;
    printf("\n");
  }
  printf("\n------------ Exemplo 6 ------------\n\n");
  k = 1;
  int r = 0;
  for (i = 0; i < x + (x - 1); i++) {
    for (j = 0; j < k; j++) {
      printf("* ");
    }
    if (k == x) {
      r = 1;
    }
    if (r == 0) {
      k++;
    } else {
      k--;
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11a5 <main+0x85>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    118b <main+0x6b>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1165 <main+0x45>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1152 <main+0x32>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    121b <main+0xfb>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f8 <main+0xd8>
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11d2 <main+0xb2>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11bf <main+0x9f>
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1290 <main+0x170>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    126d <main+0x14d>
lea    0xdd0(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1247 <main+0x127>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
lea    0xdab(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1234 <main+0x114>
lea    0xde4(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1319 <main+0x1f9>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    12f6 <main+0x1d6>
mov    -0xc(%rbp),%ecx
mov    -0x14(%rbp),%edx
lea    0xdcc(%rip),%rdi
lea    0xd4d(%rip),%rax
cmp    %edx,%ecx
cmovge %rax,%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12bd <main+0x19d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
lea    0xd22(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12aa <main+0x18a>
lea    0xd85(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    13a4 <main+0x284>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1381 <main+0x261>
mov    -0xc(%rbp),%ecx
mov    -0x14(%rbp),%edx
lea    0xcc9(%rip),%rdi
lea    0xd3a(%rip),%rax
cmp    %edx,%ecx
cmovl  %rax,%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1348 <main+0x228>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
lea    0xc97(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1335 <main+0x215>
lea    0xd21(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
add    %edx,%ecx
cmp    %ecx,%eax
jge    1456 <main+0x336>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1408 <main+0x2e8>
lea    0xc35(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    13e2 <main+0x2c2>
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    141b <main+0x2fb>
movl   $0x1,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1433 <main+0x313>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    143c <main+0x31c>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
lea    0xbe5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    13c5 <main+0x2a5>
xor    %eax,%eax
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    0xeae(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
lea    0xea6(%rip),%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11b3 <main+0x73>
xor    %r14d,%r14d
lea    0xe89(%rip),%rbx
jmp    1197 <main+0x57>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
mov    0x4(%rsp),%eax
cmp    %eax,%r14d
jge    11b3 <main+0x73>
test   %eax,%eax
jle    1180 <main+0x40>
xor    %ebp,%ebp
nopl   (%rax)
mov    %rbx,%rdi
call   1050 <printf@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     11a0 <main+0x60>
jmp    1180 <main+0x40>
lea    0xe75(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x4(%rsp)
jle    1216 <main+0xd6>
xor    %r14d,%r14d
mov    $0x1,%r15d
lea    0xe2d(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r15d,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1050 <printf@plt>
add    $0xffffffff,%ebp
jne    11f0 <main+0xb0>
add    $0x1,%r15d
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
cmp    0x4(%rsp),%r14d
jl     11e0 <main+0xa0>
lea    0xe38(%rip),%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%r15d
test   %r15d,%r15d
jle    127f <main+0x13f>
xor    %r14d,%r14d
lea    0xdcd(%rip),%rbx
jmp    1259 <main+0x119>
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%r15d
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
cmp    0x4(%rsp),%r14d
jge    127f <main+0x13f>
test   %r15d,%r15d
jle    1240 <main+0x100>
mov    %r15d,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <printf@plt>
add    $0xffffffff,%ebp
jne    1270 <main+0x130>
jmp    1240 <main+0x100>
lea    0xdf5(%rip),%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    12e9 <main+0x1a9>
xor    %ebx,%ebx
lea    0xd6a(%rip),%r14
lea    0xd60(%rip),%r15
jmp    12c5 <main+0x185>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
cmp    %eax,%ebx
jge    12e9 <main+0x1a9>
test   %eax,%eax
jle    12b0 <main+0x170>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
cmp    %ebx,%ebp
mov    %r15,%rdi
cmovb  %r14,%rdi
call   1050 <printf@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     12d0 <main+0x190>
jmp    12b0 <main+0x170>
lea    0xdb1(%rip),%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    1359 <main+0x219>
xor    %r14d,%r14d
lea    0xcff(%rip),%r15
lea    0xcf5(%rip),%r12
mov    %eax,%ebp
jmp    1337 <main+0x1f7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
mov    0x4(%rsp),%eax
cmp    %eax,%r14d
jge    1359 <main+0x219>
add    $0xffffffff,%ebp
test   %eax,%eax
jle    1320 <main+0x1e0>
xor    %ebx,%ebx
cmp    %ebp,%ebx
mov    %r12,%rdi
cmovl  %r15,%rdi
call   1050 <printf@plt>
add    $0x1,%ebx
cmp    0x4(%rsp),%ebx
jl     1340 <main+0x200>
jmp    1320 <main+0x1e0>
lea    0xd67(%rip),%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%eax
lea    (%rax,%rax,1),%ecx
add    $0xffffffff,%ecx
test   %ecx,%ecx
jle    13e3 <main+0x2a3>
mov    $0x1,%r14d
xor    %r15d,%r15d
lea    0xc80(%rip),%rbx
mov    $0x1,%r13d
xor    %r12d,%r12d
jmp    13c1 <main+0x281>
xchg   %ax,%ax
cmp    %eax,%r13d
cmove  %r14d,%r15d
mov    %r15d,%eax
neg    %eax
sbb    %eax,%eax
or     $0x1,%eax
add    %eax,%r13d
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
mov    0x4(%rsp),%eax
lea    (%rax,%rax,1),%ecx
add    $0xffffffff,%ecx
cmp    %ecx,%r12d
jge    13e3 <main+0x2a3>
test   %r13d,%r13d
jle    1390 <main+0x250>
mov    %r13d,%ebp
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1050 <printf@plt>
add    $0xffffffff,%ebp
jne    13d0 <main+0x290>
mov    0x4(%rsp),%eax
jmp    1390 <main+0x250>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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