#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int height = 0;
  do {
    printf("Altura: ");
    scanf("%d", &height);
  } while (height < 4);
  int leftSize = height - 2;
  for (int i = 0; i < height - 1; ++i) {
    for (int j = 0; j < leftSize - i; ++j) {
      printf(" ");
    }
    for (int j = 0; j < 1 + 2 * i; ++j) {
      printf("*");
    }
    puts("");
  }
  for (int i = 0; i < leftSize; ++i) {
    printf(" ");
  }
  puts("*");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x4,-0x8(%rbp)
jl     1146 <main+0x16>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    120e <main+0xde>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    -0x10(%rbp),%ecx
cmp    %ecx,%eax
jge    11bf <main+0x8f>
lea    0xe5b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1194 <main+0x64>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11f4 <main+0xc4>
lea    0xe2b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11c6 <main+0x96>
lea    0xe0d(%rip),%rdi
call   1030 <puts@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117c <main+0x4c>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    123b <main+0x10b>
lea    0xddf(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1215 <main+0xe5>
lea    0xdca(%rip),%rdi
call   1030 <puts@plt>
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
movl   $0x0,0x4(%rsp)
lea    0xea6(%rip),%r14
lea    0xea8(%rip),%r15
lea    0x4(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%r13d
cmp    $0x4,%r13d
jl     1170 <main+0x30>
lea    -0x2(%r13),%r14d
xor    %r12d,%r12d
mov    $0x1,%r15d
mov    %r14d,%ebx
xchg   %ax,%ax
mov    %r15d,%ebp
cmp    %r12d,%r14d
jle    11d0 <main+0x90>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    11b0 <main+0x70>
mov    %r15d,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11d0 <main+0x90>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
add    $0xffffffff,%ebx
add    $0x2,%r15d
cmp    %eax,%r12d
jl     11a0 <main+0x60>
cmp    $0x3,%r13d
jl     1220 <main+0xe0>
cs nopw 0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%r14d
jne    1210 <main+0xd0>
lea    0xde5(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Altura: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [2 x i8] c"*\00"
@.str.4 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %8
8: ; preds = %11, %0
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %11
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 4
br i1 %13, label %8, label %14
14: ; preds = %11
%15 = load i32, i32* %2
%16 = sub nsw i32 %15, 2
store i32 %16, i32* %3
store i32 0, i32* %4
br label %17
17: ; preds = %48, %14
%18 = load i32, i32* %4
%19 = load i32, i32* %2
%20 = sub nsw i32 %19, 1
%21 = icmp slt i32 %18, %20
br i1 %21, label %22, label %51
22: ; preds = %17
store i32 0, i32* %5
br label %23
23: ; preds = %31, %22
%24 = load i32, i32* %5
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = sub nsw i32 %25, %26
%28 = icmp slt i32 %24, %27
br i1 %28, label %29, label %34
29: ; preds = %23
%30 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %29
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %23
34: ; preds = %23
store i32 0, i32* %6
br label %35
35: ; preds = %43, %34
%36 = load i32, i32* %6
%37 = load i32, i32* %4
%38 = mul nsw i32 2, %37
%39 = add nsw i32 1, %38
%40 = icmp slt i32 %36, %39
br i1 %40, label %41, label %46
41: ; preds = %35
%42 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %43
43: ; preds = %41
%44 = load i32, i32* %6
%45 = add nsw i32 %44, 1
store i32 %45, i32* %6
br label %35
46: ; preds = %35
%47 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
br label %48
48: ; preds = %46
%49 = load i32, i32* %4
%50 = add nsw i32 %49, 1
store i32 %50, i32* %4
br label %17
51: ; preds = %17
store i32 0, i32* %7
br label %52
52: ; preds = %58, %51
%53 = load i32, i32* %7
%54 = load i32, i32* %3
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %61
56: ; preds = %52
%57 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %58
58: ; preds = %56
%59 = load i32, i32* %7
%60 = add nsw i32 %59, 1
store i32 %60, i32* %7
br label %52
61: ; preds = %52
%62 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"Altura: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [2 x i8] c"*\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %3, %0
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 4
br i1 %7, label %3, label %8
8: ; preds = %3
%9 = add nsw i32 %6, -2
br label %10
10: ; preds = %8, %23
%11 = phi i32 [ 1, %8 ], [ %30, %23 ]
%12 = phi i32 [ %9, %8 ], [ %29, %23 ]
%13 = phi i32 [ 0, %8 ], [ %25, %23 ]
%14 = icmp sgt i32 %9, %13
br i1 %14, label %18, label %15
15: ; preds = %18, %10
br label %31
16: ; preds = %23
%17 = icmp sgt i32 %6, 2
br i1 %17, label %38, label %36
18: ; preds = %10, %18
%19 = phi i32 [ %21, %18 ], [ 0, %10 ]
%20 = call i32 @putchar(i32 32)
%21 = add nuw nsw i32 %19, 1
%22 = icmp eq i32 %21, %12
br i1 %22, label %15, label %18
23: ; preds = %31
%24 = call i32 @putchar(i32 10)
%25 = add nuw nsw i32 %13, 1
%26 = load i32, i32* %1
%27 = add nsw i32 %26, -1
%28 = icmp slt i32 %25, %27
%29 = add i32 %12, -1
%30 = add nuw i32 %11, 2
br i1 %28, label %10, label %16
31: ; preds = %15, %31
%32 = phi i32 [ %34, %31 ], [ 0, %15 ]
%33 = call i32 @putchar(i32 42)
%34 = add nuw i32 %32, 1
%35 = icmp eq i32 %34, %11
br i1 %35, label %23, label %31
36: ; preds = %38, %16
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
38: ; preds = %16, %38
%39 = phi i32 [ %41, %38 ], [ 0, %16 ]
%40 = call i32 @putchar(i32 32)
%41 = add nuw nsw i32 %39, 1
%42 = icmp eq i32 %41, %9
br i1 %42, label %36, label %38
}