#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 fact(int);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
void main() {
  int i, j;
  for (i = 0; i < 10; i++) {
    for (j = 0; j <= i; j++)
      printf("%d\t", fact(i) / fact(j) / fact(i - j));
    printf("\n");
  }
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    11c7 <main+0x97>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11ab <main+0x7b>
mov    -0x4(%rbp),%edi
call   1050 <fact@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <fact@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
call   1050 <fact@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1150 <main+0x20>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113f <main+0xf>
mov    $0x0,%al
call   1040 <getchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xeb1(%rip),%r14
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15d,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15d,%edi
call   1060 <fact@plt>
mov    %eax,%r12d
mov    %ebx,%edi
call   1060 <fact@plt>
mov    %eax,%ecx
mov    %r12d,%eax
cltd
idiv   %ecx
mov    %eax,%r12d
mov    %ebp,%edi
call   1060 <fact@plt>
mov    %eax,%ecx
mov    %r12d,%eax
cltd
idiv   %ecx
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
add    $0xffffffff,%ebp
jb     1170 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
cmp    $0xa,%r15d
jne    1160 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <getchar@plt>

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

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