#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*/ initarray(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, i, j;
  printf("Introduzca numeros \n");
  scanf("%d", &n);
  if (!(n > 0 && n <= 20))
    return 0;
  int buffer[n + 1];
  initarray(buffer, n);
  buffer[n] = 1;
  for (i = n; i >= 0; i--) {
    int k;
    for (j = 0; j < i; j++)
      printf(" ");
    for (j = i; j < n; j++) {
      k = buffer[j] + buffer[j + 1];
      printf("%d ", k);
      buffer[j] = k;
    }
    printf("1\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    1171 <main+0x41>
cmpl   $0x14,-0x8(%rbp)
jle    117d <main+0x4d>
movl   $0x0,-0x4(%rbp)
jmp    1280 <main+0x150>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x30(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%esi
call   1040 <initarray@plt>
mov    -0x30(%rbp),%rax
movslq -0x8(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1272 <main+0x142>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11fd <main+0xcd>
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11d5 <main+0xa5>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1256 <main+0x126>
mov    -0x30(%rbp),%rcx
movslq -0x10(%rbp),%rax
mov    (%rcx,%rax,4),%eax
mov    -0x10(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
add    (%rcx,%rdx,4),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%edx
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1203 <main+0xd3>
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    11c4 <main+0x94>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe9f(%rip),%rdi
call   1040 <puts@plt>
lea    0xe8c(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x2c(%rbp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x13,%ecx
ja     11c1 <main+0x71>
mov    %rsp,-0x38(%rbp)
mov    %rsp,%r12
lea    0x13(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    -0x2c(%rbp),%esi
mov    %r12,%rdi
call   1060 <initarray@plt>
movslq -0x2c(%rbp),%r14
movl   $0x1,(%r12,%r14,4)
test   %r14,%r14
jns    11fe <main+0xae>
mov    -0x38(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xe34(%rip),%rdi
call   1040 <puts@plt>
mov    -0x40(%rbp),%rcx
mov    %rcx,%rax
add    $0xffffffffffffffff,%rax
test   %ecx,%ecx
mov    %rax,%r14
jle    11bd <main+0x6d>
mov    %r14d,%ebx
test   %r14d,%r14d
jle    121f <main+0xcf>
cs nopw 0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1210 <main+0xc0>
mov    %r14,%r13
mov    %r14,-0x40(%rbp)
cmp    %r14d,-0x2c(%rbp)
lea    0xdd2(%rip),%r15
jle    11e0 <main+0x90>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%r13),%r14
mov    0x4(%r12,%r13,4),%ebx
add    (%r12,%r13,4),%ebx
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,(%r12,%r13,4)
movslq -0x2c(%rbp),%rax
mov    %r14,%r13
cmp    %rax,%r14
jl     1240 <main+0xf0>
jmp    11e0 <main+0x90>

LLVM IR (-O0):
@.str = [21 x i8] c"Introduzca numeros \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [4 x i8] c"%d \00"
@.str.4 = [3 x i8] c"1\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = load i32, i32* %2
%14 = icmp sle i32 %13, 20
br i1 %14, label %16, label %15
15: ; preds = %12, %0
store i32 0, i32* %1
br label %74
16: ; preds = %12
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
%19 = zext i32 %18 to i64
%20 = call i8* @llvm.stacksave()
store i8* %20, i8** %5
%21 = alloca i32, i64 %19
store i64 %19, i64* %6
%22 = load i32, i32* %2
%23 = call i32 @initarray(i32* %21, i32 %22)
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %21, i64 %25
store i32 1, i32* %26
%27 = load i32, i32* %2
store i32 %27, i32* %3
br label %28
28: ; preds = %69, %16
%29 = load i32, i32* %3
%30 = icmp sge i32 %29, 0
br i1 %30, label %31, label %72
31: ; preds = %28
store i32 0, i32* %4
br label %32
32: ; preds = %38, %31
%33 = load i32, i32* %4
%34 = load i32, i32* %3
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %41
36: ; preds = %32
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %38
38: ; preds = %36
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %32
41: ; preds = %32
%42 = load i32, i32* %3
store i32 %42, i32* %4
br label %43
43: ; preds = %64, %41
%44 = load i32, i32* %4
%45 = load i32, i32* %2
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %67
47: ; preds = %43
%48 = load i32, i32* %4
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i32, i32* %21, i64 %49
%51 = load i32, i32* %50
%52 = load i32, i32* %4
%53 = add nsw i32 %52, 1
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i32, i32* %21, i64 %54
%56 = load i32, i32* %55
%57 = add nsw i32 %51, %56
store i32 %57, i32* %7
%58 = load i32, i32* %7
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %58)
%60 = load i32, i32* %7
%61 = load i32, i32* %4
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32, i32* %21, i64 %62
store i32 %60, i32* %63
br label %64
64: ; preds = %47
%65 = load i32, i32* %4
%66 = add nsw i32 %65, 1
store i32 %66, i32* %4
br label %43
67: ; preds = %43
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %69
69: ; preds = %67
%70 = load i32, i32* %3
%71 = add nsw i32 %70, -1
store i32 %71, i32* %3
br label %28
72: ; preds = %28
store i32 0, i32* %1
%73 = load i8*, i8** %5
br label %74
74: ; preds = %72, %15
%75 = load i32, i32* %1
ret i32 %75
}

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