#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  int n1 = 0;
  char linea[180];
  printf("Intruduce un numero entero: ");
  fgets(linea, 180, stdin);
  sscanf(linea, "%d", &n1);
  for (int i = 0; i < n1; i++) {
    for (int a = i; a >= 0; a--) {
      printf(" ");
    }
    for (int a = 0; a <= i; a++) {
      printf("*");
    }
    printf("\n");
  }
  printf("Pulsa Cuanquier tecla para terminar: ");
  fgets(linea, 180, stdin);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
lea    -0xd0(%rbp),%rdi
mov    0x2e7e(%rip),%rax
mov    (%rax),%edx
mov    $0xb4,%esi
call   1040 <fgets@plt>
lea    -0xd0(%rbp),%rdi
lea    0xe99(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1050 <sscanf@plt>
movl   $0x0,-0xd4(%rbp)
mov    -0xd4(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    123b <main+0x10b>
mov    -0xd4(%rbp),%eax
mov    %eax,-0xd8(%rbp)
cmpl   $0x0,-0xd8(%rbp)
jl     11df <main+0xaf>
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
mov    -0xd8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xd8(%rbp)
jmp    11b2 <main+0x82>
movl   $0x0,-0xdc(%rbp)
mov    -0xdc(%rbp),%eax
cmp    -0xd4(%rbp),%eax
jg     121b <main+0xeb>
lea    0xe1e(%rip),%rdi
call   1030 <printf@plt>
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xdc(%rbp)
jmp    11e9 <main+0xb9>
lea    0xe00(%rip),%rdi
call   1030 <printf@plt>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1197 <main+0x67>
lea    0xde2(%rip),%rdi
call   1030 <printf@plt>
lea    -0xd0(%rbp),%rdi
mov    0x2d93(%rip),%rax
mov    (%rax),%edx
mov    $0xb4,%esi
call   1040 <fgets@plt>
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xc8,%rsp
movl   $0x0,0xc(%rsp)
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e80(%rip),%r14
mov    (%r14),%edx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xb4,%esi
call   1050 <fgets@plt>
lea    0xe99(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
call   1060 <sscanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11f7 <main+0xb7>
xor    %r15d,%r15d
mov    $0x1,%ebx
mov    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jg     11b0 <main+0x70>
mov    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11d0 <main+0x90>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
add    $0x1,%ebx
cmp    0xc(%rsp),%r15d
jl     11a0 <main+0x60>
lea    0xe22(%rip),%rdi
call   1040 <printf@plt>
mov    (%r14),%edx
lea    0x10(%rsp),%rdi
mov    $0xb4,%esi
call   1050 <fgets@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Intruduce un numero entero: \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [2 x i8] c"*\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [38 x i8] c"Pulsa Cuanquier tecla para terminar: \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [180 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%11 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [180 x i8], [180 x i8]* %7, i64 0, i64 0
%13 = load i32, i32* @stdin
%14 = call i32 @fgets(i8* %12, i32 180, i32 %13)
%15 = getelementptr inbounds [180 x i8], [180 x i8]* %7, i64 0, i64 0
%16 = call i32 @sscanf(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
store i32 0, i32* %8
br label %17
17: ; preds = %43, %2
%18 = load i32, i32* %8
%19 = load i32, i32* %6
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %46
21: ; preds = %17
%22 = load i32, i32* %8
store i32 %22, i32* %9
br label %23
23: ; preds = %28, %21
%24 = load i32, i32* %9
%25 = icmp sge i32 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %26
%29 = load i32, i32* %9
%30 = add nsw i32 %29, -1
store i32 %30, i32* %9
br label %23
31: ; preds = %23
store i32 0, i32* %10
br label %32
32: ; preds = %38, %31
%33 = load i32, i32* %10
%34 = load i32, i32* %8
%35 = icmp sle i32 %33, %34
br i1 %35, label %36, label %41
36: ; preds = %32
%37 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %38
38: ; preds = %36
%39 = load i32, i32* %10
%40 = add nsw i32 %39, 1
store i32 %40, i32* %10
br label %32
41: ; preds = %32
%42 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %43
43: ; preds = %41
%44 = load i32, i32* %8
%45 = add nsw i32 %44, 1
store i32 %45, i32* %8
br label %17
46: ; preds = %17
%47 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
%48 = getelementptr inbounds [180 x i8], [180 x i8]* %7, i64 0, i64 0
%49 = load i32, i32* @stdin
%50 = call i32 @fgets(i8* %48, i32 180, i32 %49)
%51 = load i32, i32* %3
ret i32 %51
}

LLVM IR (-O2):
@.str = [29 x i8] c"Intruduce un numero entero: \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@.str.5 = [38 x i8] c"Pulsa Cuanquier tecla para terminar: \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [180 x i8]
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = getelementptr inbounds [180 x i8], [180 x i8]* %4, i64 0, i64 0
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %6, i32 180, i32 %8)
%10 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %2, %25
%14 = phi i32 [ %30, %25 ], [ 1, %2 ]
%15 = phi i32 [ %27, %25 ], [ 0, %2 ]
br label %20
16: ; preds = %25, %2
%17 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
%18 = load i32, i32* @stdin
%19 = call i32 @fgets(i8* %6, i32 180, i32 %18)
ret i32 0
20: ; preds = %13, %20
%21 = phi i32 [ %23, %20 ], [ %15, %13 ]
%22 = call i32 @putchar(i32 32)
%23 = add nsw i32 %21, -1
%24 = icmp sgt i32 %21, 0
br i1 %24, label %20, label %31
25: ; preds = %31
%26 = call i32 @putchar(i32 10)
%27 = add nuw nsw i32 %15, 1
%28 = load i32, i32* %3
%29 = icmp slt i32 %27, %28
%30 = add nuw i32 %14, 1
br i1 %29, label %13, label %16
31: ; preds = %20, %31
%32 = phi i32 [ %34, %31 ], [ 0, %20 ]
%33 = call i32 @putchar(i32 42)
%34 = add nuw nsw i32 %32, 1
%35 = icmp eq i32 %34, %14
br i1 %35, label %25, label %31
}