#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*/ free(int *);
int *get_row_direct(int, int *);
int *get_row_recursive(int, int *);
int /*<<< orphan*/ printf(char *, ...);
void print_pascal_row(int r) {
  int size;
  int *row;
  if (r % 2 == 0)
    row = get_row_recursive(r, &size);
  else
    row = get_row_direct(r, &size);
  for (int c = 0; c < size; c++) {
    printf("%d ", row[c]);
  }
  printf("\n");
  free(row);
}


x86 assembly (clang, -O0):
<print_pascal_row>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1174 <print_pascal_row+0x34>
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1060 <get_row_recursive@plt>
mov    %rax,-0x10(%rbp)
jmp    1184 <print_pascal_row+0x44>
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1040 <get_row_direct@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11be <print_pascal_row+0x7e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118b <print_pascal_row+0x4b>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_pascal_row>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rsi
test   $0x1,%dil
jne    116b <print_pascal_row+0x1b>
call   1070 <get_row_recursive@plt>
jmp    1170 <print_pascal_row+0x20>
call   1050 <get_row_direct@plt>
mov    %rax,%r15
cmpl   $0x0,0xc(%rsp)
jle    11ac <print_pascal_row+0x5c>
lea    0xe7f(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1190 <print_pascal_row+0x40>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r15,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_pascal_row(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = srem i32 %6, 2
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = call i32* @get_row_recursive(i32 %10, i32* %3)
store i32* %11, i32** %4
br label %15
12: ; preds = %1
%13 = load i32, i32* %2
%14 = call i32* @get_row_direct(i32 %13, i32* %3)
store i32* %14, i32** %4
br label %15
15: ; preds = %12, %9
store i32 0, i32* %5
br label %16
16: ; preds = %27, %15
%17 = load i32, i32* %5
%18 = load i32, i32* %3
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %30
20: ; preds = %16
%21 = load i32*, i32** %4
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
%25 = load i32, i32* %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %20
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %16
30: ; preds = %16
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%32 = load i32*, i32** %4
%33 = call i32 @free(i32* %32)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @print_pascal_row(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = and i32 %0, 1
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32* @get_row_recursive(i32 %0, i32* %2)
br label %10
8: ; preds = %1
%9 = call i32* @get_row_direct(i32 %0, i32* %2)
br label %10
10: ; preds = %8, %6
%11 = phi i32* [ %7, %6 ], [ %9, %8 ]
%12 = load i32, i32* %2
%13 = icmp sgt i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %17, %10
%15 = call i32 @putchar(i32 10)
%16 = call i32 @free(i32* %11)
ret void
17: ; preds = %10, %17
%18 = phi i64 [ %22, %17 ], [ 0, %10 ]
%19 = getelementptr inbounds i32, i32* %11, i64 %18
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = add nuw nsw i64 %18, 1
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = icmp slt i64 %22, %24
br i1 %25, label %17, label %14
}