#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 */
typedef int uint8_t;

/* Variables and functions */
int get_current_val(int, int);
int /*<<< orphan*/ printf(char *, ...);
void print_pascal_triangle(uint8_t line) {
  uint8_t i, j;
  if (line == 0) {
    return;
  }
  for (i = 0; i < line; i += 1) {
    for (j = 0; j < line - 1 - i; j += 1) {
      printf("    ");
    }
    for (j = 0; j < i + 1; j += 1) {
      printf("%4d    ", get_current_val(i, j));
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_pascal_triangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    113a <print_pascal_triangle+0x1a>
jmp    11e1 <print_pascal_triangle+0xc1>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11e1 <print_pascal_triangle+0xc1>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    1184 <print_pascal_triangle+0x64>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1154 <print_pascal_triangle+0x34>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11c5 <print_pascal_triangle+0xa5>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <get_current_val@plt>
mov    %eax,%esi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118b <print_pascal_triangle+0x6b>
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1141 <print_pascal_triangle+0x21>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_pascal_triangle>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    11c3 <print_pascal_triangle+0x93>
mov    %edi,%r14d
mov    $0x1,%ebx
lea    0xeb1(%rip),%r15
lea    0xea7(%rip),%r12
xor    %r13d,%r13d
nopl   0x0(%rax)
mov    %r13d,%eax
not    %eax
add    %r14d,%eax
test   %eax,%eax
jle    1181 <print_pascal_triangle+0x51>
mov    %r14d,%ebp
nop
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffff,%ebp
cmp    %ebp,%ebx
jne    1170 <print_pascal_triangle+0x40>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13d,%edi
mov    %ebp,%esi
call   1030 <get_current_val@plt>
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1190 <print_pascal_triangle+0x60>
add    $0x1,%r13d
mov    $0xa,%edi
call   1040 <putchar@plt>
add    $0x1,%ebx
cmp    %r14d,%r13d
jne    1160 <print_pascal_triangle+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c" \00"
@.str.1 = [8 x i8] c"%4d \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @print_pascal_triangle(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
br label %45
8: ; preds = %1
store i32 0, i32* %3
br label %9
9: ; preds = %42, %8
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %45
13: ; preds = %9
store i32 0, i32* %4
br label %14
14: ; preds = %23, %13
%15 = load i32, i32* %4
%16 = load i32, i32* %2
%17 = sub nsw i32 %16, 1
%18 = load i32, i32* %3
%19 = sub nsw i32 %17, %18
%20 = icmp slt i32 %15, %19
br i1 %20, label %21, label %26
21: ; preds = %14
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %23
23: ; preds = %21
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %14
26: ; preds = %14
store i32 0, i32* %4
br label %27
27: ; preds = %37, %26
%28 = load i32, i32* %4
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
%31 = icmp slt i32 %28, %30
br i1 %31, label %32, label %40
32: ; preds = %27
%33 = load i32, i32* %3
%34 = load i32, i32* %4
%35 = call i32 @get_current_val(i32 %33, i32 %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %32
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %27
40: ; preds = %27
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %42
42: ; preds = %40
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 1
store i32 %44, i32* %3
br label %9
45: ; preds = %7, %9
ret void
}

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