#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*/ getch();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int numero, linhas, colunas;
  printf(
      "Ola, me chamo Desenhador, eu gosto de desenhar!\nHoje eu quero desenhar "
      "um triangulo, me ajuda?\nDigite um numero NATURAL entre 2 e 10\ne eu "
      "desenharei um triangulo especial para voce!\nBrinca comigo!!!\n\n");
  scanf("%d", &numero);
  while ((numero < 2) || (numero > 10)) {
    printf("Ei, eu te disse que o numero tem que ser NATUAL\ne entre DOIS (2) "
           "e DEZ (10)\ne nao vale trapacear!\nDigite um numero valido desta "
           "vez, por favor!\n");
    scanf("%d", &numero);
  }
  for (linhas = 1; linhas <= numero; linhas++) {
    for (colunas = 1; colunas <= linhas; colunas++) {
      printf("*");
    }
    printf("\n");
  }
  getch();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xf77(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x2,-0x8(%rbp)
mov    %al,-0x11(%rbp)
jl     1174 <main+0x44>
cmpl   $0xa,-0x8(%rbp)
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1184 <main+0x54>
jmp    11a5 <main+0x75>
lea    0xf41(%rip),%rdi
call   1030 <printf@plt>
lea    0xf32(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    115b <main+0x2b>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11ff <main+0xcf>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11e5 <main+0xb5>
lea    0xf8b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11bf <main+0x8f>
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ac <main+0x7c>
mov    $0x0,%al
call   1050 <getch@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xeb5(%rip),%rdi
call   1040 <puts@plt>
lea    0xea6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xfffffff5,%eax
cmp    $0xfffffff6,%eax
ja     11af <main+0x6f>
lea    0xf54(%rip),%r14
lea    0xe82(%rip),%r15
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xfffffff5,%eax
cmp    $0xfffffff7,%eax
jb     1190 <main+0x50>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11d0 <main+0x90>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
cmp    0x4(%rsp),%ebx
mov    %eax,%ebx
jl     11c0 <main+0x80>
xor    %eax,%eax
call   1060 <getch@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [201 x i8] c"Ola, me chamo Desenhador, eu gosto de desenhar!\0AHoje eu quero desenhar um triangulo, me ajuda?\0ADigite um numero NATURAL entre 2 e 10\0Ae eu desenharei um triangulo especial para voce!\0ABrinca comigo!!!\0A\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [145 x i8] c"Ei, eu te disse que o numero tem que ser NATUAL\0Ae entre DOIS (2) e DEZ (10)\0Ae nao vale trapacear!\0ADigite um numero valido desta vez, por favor!\0A\00"
@.str.3 = [2 x i8] c"*\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([201 x i8], [201 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 2
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 10
br label %13
13: ; preds = %10, %7
%14 = phi i1 [ true, %7 ], [ %12, %10 ]
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = call i32 @printf(i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %7
18: ; preds = %13
store i32 1, i32* %3
br label %19
19: ; preds = %35, %18
%20 = load i32, i32* %3
%21 = load i32, i32* %2
%22 = icmp sle i32 %20, %21
br i1 %22, label %23, label %38
23: ; preds = %19
store i32 1, i32* %4
br label %24
24: ; preds = %30, %23
%25 = load i32, i32* %4
%26 = load i32, i32* %3
%27 = icmp sle i32 %25, %26
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %30
30: ; preds = %28
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %24
33: ; preds = %24
%34 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %35
35: ; preds = %33
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %19
38: ; preds = %19
%39 = call i32 (...) @getch()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [200 x i8] c"Ola, me chamo Desenhador, eu gosto de desenhar!\0AHoje eu quero desenhar um triangulo, me ajuda?\0ADigite um numero NATURAL entre 2 e 10\0Ae eu desenharei um triangulo especial para voce!\0ABrinca comigo!!!\0A\00"
@str.5 = [144 x i8] c"Ei, eu te disse que o numero tem que ser NATUAL\0Ae entre DOIS (2) e DEZ (10)\0Ae nao vale trapacear!\0ADigite um numero valido desta vez, por favor!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([200 x i8], [200 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = add i32 %5, -11
%7 = icmp ult i32 %6, -9
br i1 %7, label %8, label %14
8: ; preds = %0, %8
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([144 x i8], [144 x i8]* @str.5, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = add i32 %11, -11
%13 = icmp ult i32 %12, -9
br i1 %13, label %8, label %14
14: ; preds = %8, %0
br label %15
15: ; preds = %14, %23
%16 = phi i32 [ %28, %23 ], [ 2, %14 ]
%17 = phi i32 [ %25, %23 ], [ 1, %14 ]
br label %18
18: ; preds = %15, %18
%19 = phi i32 [ 1, %15 ], [ %21, %18 ]
%20 = call i32 @putchar(i32 42)
%21 = add nuw i32 %19, 1
%22 = icmp eq i32 %21, %16
br i1 %22, label %23, label %18
23: ; preds = %18
%24 = call i32 @putchar(i32 10)
%25 = add nuw nsw i32 %17, 1
%26 = load i32, i32* %1
%27 = icmp slt i32 %17, %26
%28 = add nuw i32 %16, 1
br i1 %27, label %15, label %29
29: ; preds = %23
%30 = call i32 (...) @getch()
ret i32 0
}