#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 pascal(int, int);
int /*<<< orphan*/ printf(char *, ...);
void dreieck(int n) {
  int rows, cols;
  for (rows = 1; rows <= n; rows++) {
    for (cols = 1; cols <= n - rows + 1; cols++) {
      printf(" %2d", pascal(rows, cols));
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<dreieck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     119e <dreieck+0x7e>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     1182 <dreieck+0x62>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <pascal@plt>
mov    %eax,%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1145 <dreieck+0x25>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <dreieck+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dreieck>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    11ba <dreieck+0x8a>
mov    %edi,%r14d
lea    0x1(%r14),%r13d
mov    %edi,%ebp
neg    %ebp
mov    $0x1,%r12d
lea    0xea9(%rip),%r15
jmp    117a <dreieck+0x4a>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r12),%eax
add    $0x1,%ebp
cmp    %r14d,%r12d
mov    %eax,%r12d
je     11ba <dreieck+0x8a>
mov    %r13d,%eax
sub    %r12d,%eax
test   %eax,%eax
jle    1160 <dreieck+0x30>
mov    $0x1,%ebx
nopl   0x0(%rax)
mov    %r12d,%edi
mov    %ebx,%esi
call   1050 <pascal@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1190 <dreieck+0x60>
jmp    1160 <dreieck+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" %2d\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @dreieck(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
br label %5
5: ; preds = %27, %1
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = icmp sle i32 %6, %7
br i1 %8, label %9, label %30
9: ; preds = %5
store i32 1, i32* %4
br label %10
10: ; preds = %22, %9
%11 = load i32, i32* %4
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = sub nsw i32 %12, %13
%15 = add nsw i32 %14, 1
%16 = icmp sle i32 %11, %15
br i1 %16, label %17, label %25
17: ; preds = %10
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = call i32 @pascal(i32 %18, i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %17
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %10
25: ; preds = %10
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %25
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %5
30: ; preds = %5
ret void
}

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