#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 *, ...);
void shu(int index, int array[index + 2]) {
  if (index == 1) {
    array[0] = 0;
    array[1] = 1;
    array[2] = 0;
    printf("%10d\n", 1);
  } else {
    int newArray[index + 1];
    shu(index - 1, newArray);
    array[0] = 0;
    array[index + 1] = 0;
    for (int i = 0; i < index; i++) {
      array[i + 1] = newArray[i] + newArray[i + 1];
      printf("%10d ", array[i + 1]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<shu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1171 <shu+0x51>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,0x4(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,0x8(%rax)
lea    0xea0(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123f <shu+0x11f>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x30(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1040 <shu@plt>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movl   $0x0,(%rax,%rcx,4)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    122a <shu+0x10a>
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
add    (%rax,%rcx,4),%edx
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11cb <shu+0xab>
lea    0xdd3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shu>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
cmp    $0x1,%edi
jne    117c <shu+0x4c>
movabs $0x100000000,%rax
mov    %rax,(%r14)
movl   $0x0,0x8(%r14)
lea    0xe9e(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>
mov    %edi,%r15d
mov    %rsp,-0x30(%rbp)
lea    0x1(%r15),%eax
mov    %rsp,%r13
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
lea    -0x1(%r15),%edi
mov    %r13,%rsi
call   1050 <shu@plt>
movl   $0x0,(%r14)
movslq %r15d,%rax
movl   $0x0,0x4(%r14,%rax,4)
test   %r15d,%r15d
jle    11fa <shu+0xca>
mov    %r15d,%ebx
mov    0x0(%r13),%esi
xor    %eax,%eax
nopl   0x0(%rax)
lea    0x1(%rax),%r12
mov    0x4(%r13,%rax,4),%r15d
add    %r15d,%esi
mov    %esi,0x4(%r14,%rax,4)
lea    0xe1e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15d,%esi
mov    %r12,%rax
cmp    %r12,%rbx
jne    11d0 <shu+0xa0>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x30(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%10d\0A\00"
@.str.1 = [6 x i8] c"%10d \00"
define void @shu(i32 %0, i32* nocapture writeonly %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
store i32 0, i32* %1
%5 = getelementptr inbounds i32, i32* %1, i64 1
store i32 1, i32* %5
%6 = getelementptr inbounds i32, i32* %1, i64 2
store i32 0, i32* %6
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1)
br label %32
8: ; preds = %2
%9 = add nsw i32 %0, 1
%10 = zext i32 %9 to i64
%11 = tail call i8* @llvm.stacksave()
%12 = alloca i32, i64 %10
%13 = add nsw i32 %0, -1
store i32 0, i32* %1
%14 = sext i32 %9 to i64
%15 = getelementptr inbounds i32, i32* %1, i64 %14
store i32 0, i32* %15
%16 = icmp sgt i32 %0, 0
br i1 %16, label %17, label %20
17: ; preds = %8
%18 = zext i32 %0 to i64
%19 = load i32, i32* %12
br label %22
20: ; preds = %22, %8
%21 = tail call i32 @putchar(i32 10)
tail call void @llvm.stackrestore(i8* %11)
br label %32
22: ; preds = %17, %22
%23 = phi i32 [ %19, %17 ], [ %27, %22 ]
%24 = phi i64 [ 0, %17 ], [ %25, %22 ]
%25 = add nuw nsw i64 %24, 1
%26 = getelementptr inbounds i32, i32* %12, i64 %25
%27 = load i32, i32* %26
%28 = add nsw i32 %27, %23
%29 = getelementptr inbounds i32, i32* %1, i64 %25
store i32 %28, i32* %29
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%31 = icmp eq i64 %25, %18
br i1 %31, label %20, label %22
32: ; preds = %20, %4
ret void
}