#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 /*<<< orphan*/ system(char *);
int main() {
  printf("Digite o tamanho:");
  int tam;
  scanf("%d", &tam);
  for (int i = 0; i < tam; i++) {
    for (int k = tam; k > i; k--) {
      printf("#");
    }
    printf("\n");
  }
  for (int x = 0; x < tam; x++) {
    for (int z = 0; z <= x; z++) {
      printf("#");
    }
    printf("\n");
  }
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
lea    0xec0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b4 <main+0x84>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    119a <main+0x6a>
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1174 <main+0x44>
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1162 <main+0x32>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    120e <main+0xde>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11f4 <main+0xc4>
lea    0xe34(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ce <main+0x9e>
lea    0xe1c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11bb <main+0x8b>
lea    0xe04(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%ebp
test   %ebp,%ebp
jle    11f7 <main+0xb7>
xor    %ebx,%ebx
jmp    118d <main+0x4d>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    %ebx,%ebp
jg     1180 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%ebp
cmp    %ebp,%ebx
jl     118d <main+0x4d>
test   %ebp,%ebp
jle    11f7 <main+0xb7>
xor    %r14d,%r14d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11d0 <main+0x90>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
add    $0x1,%ebx
cmp    0xc(%rsp),%r14d
jl     11c0 <main+0x80>
lea    0xe17(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Digite o tamanho:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"#\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [6 x i8] c"pause\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 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %9
9: ; preds = %26, %0
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %29
13: ; preds = %9
%14 = load i32, i32* %2
store i32 %14, i32* %4
br label %15
15: ; preds = %21, %13
%16 = load i32, i32* %4
%17 = load i32, i32* %3
%18 = icmp sgt i32 %16, %17
br i1 %18, label %19, label %24
19: ; preds = %15
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19
%22 = load i32, i32* %4
%23 = add nsw i32 %22, -1
store i32 %23, i32* %4
br label %15
24: ; preds = %15
%25 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %24
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %9
29: ; preds = %9
store i32 0, i32* %5
br label %30
30: ; preds = %46, %29
%31 = load i32, i32* %5
%32 = load i32, i32* %2
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %49
34: ; preds = %30
store i32 0, i32* %6
br label %35
35: ; preds = %41, %34
%36 = load i32, i32* %6
%37 = load i32, i32* %5
%38 = icmp sle i32 %36, %37
br i1 %38, label %39, label %44
39: ; preds = %35
%40 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %41
41: ; preds = %39
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 1
store i32 %43, i32* %6
br label %35
44: ; preds = %35
%45 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %46
46: ; preds = %44
%47 = load i32, i32* %5
%48 = add nsw i32 %47, 1
store i32 %48, i32* %5
br label %30
49: ; preds = %30
%50 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

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