#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 */
unsigned char atoi(char *);
int factorial(unsigned char);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  unsigned char i = 0;
  unsigned char nb_lines = 0;
  unsigned char c = 0;
  if (argc != 2) {
    printf("Usage: %s integer\n", argv[0]);
    return (1);
  }
  nb_lines = atoi(argv[1]);
  for (i = 0; i < nb_lines; i++) {
    for (c = 0; c <= (nb_lines - i - 2); c++) {
      printf("     ");
    }
    for (c = 0; c <= i; c++) {
      printf("%05lu     ", factorial(i) / (factorial(c) * factorial(i - c)));
    }
    printf("\n");
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
movb   $0x0,-0x12(%rbp)
movb   $0x0,-0x13(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     117d <main+0x4d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1264 <main+0x134>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %al,-0x12(%rbp)
movb   $0x0,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
movzbl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jge    125d <main+0x12d>
movb   $0x0,-0x13(%rbp)
movzbl -0x13(%rbp),%eax
movzbl -0x12(%rbp),%ecx
movzbl -0x11(%rbp),%edx
sub    %edx,%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jg     11d9 <main+0xa9>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x13(%rbp),%al
add    $0x1,%al
mov    %al,-0x13(%rbp)
jmp    11a5 <main+0x75>
movb   $0x0,-0x13(%rbp)
movzbl -0x13(%rbp),%eax
movzbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jg     1242 <main+0x112>
movzbl -0x11(%rbp),%edi
call   1030 <factorial@plt>
mov    %eax,-0x18(%rbp)
movzbl -0x13(%rbp),%edi
call   1030 <factorial@plt>
mov    %eax,-0x1c(%rbp)
movzbl -0x11(%rbp),%eax
movzbl -0x13(%rbp),%ecx
sub    %ecx,%eax
movzbl %al,%edi
call   1030 <factorial@plt>
mov    -0x1c(%rbp),%ecx
mov    %eax,%edx
mov    -0x18(%rbp),%eax
imul   %edx,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x13(%rbp),%al
add    $0x1,%al
mov    %al,-0x13(%rbp)
jmp    11dd <main+0xad>
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x11(%rbp),%al
add    $0x1,%al
mov    %al,-0x11(%rbp)
jmp    1191 <main+0x61>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jne    1242 <main+0x102>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
test   %al,%al
je     123e <main+0xfe>
movzbl %al,%eax
mov    %rax,0x10(%rsp)
add    $0xfffffffe,%eax
mov    %eax,0xc(%rsp)
mov    $0x1,%r14b
lea    0xe92(%rip),%r12
lea    0xe90(%rip),%r15
xor    %r13d,%r13d
nopl   0x0(%rax,%rax,1)
mov    0xc(%rsp),%ebx
sub    %r13d,%ebx
js     11b5 <main+0x75>
mov    $0x1,%bpl
nopl   0x0(%rax)
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl %bpl,%eax
lea    0x1(%rax),%ebp
cmp    %eax,%ebx
jge    11a0 <main+0x60>
xor    %ebp,%ebp
mov    %r13d,%ebx
mov    %r14b,0xb(%rsp)
nop
movzbl %r13b,%edi
call   1040 <factorial@plt>
mov    %r12,%r14
mov    %eax,%r12d
movzbl %bpl,%ebp
mov    %ebp,%edi
call   1040 <factorial@plt>
mov    %r13d,%r15d
mov    %eax,%r13d
movzbl %bl,%ebx
mov    %ebx,%edi
call   1040 <factorial@plt>
mov    %eax,%ecx
imul   %r13d,%ecx
mov    %r15d,%r13d
mov    %r12d,%eax
mov    %r14,%r12
movzbl 0xb(%rsp),%r14d
cltd
idiv   %ecx
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%bpl
add    $0xff,%bl
cmp    %bpl,%r14b
jne    11c0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13d
add    $0x1,%r14b
cmp    0x10(%rsp),%r13d
lea    0xde0(%rip),%r15
jne    1190 <main+0x50>
xor    %eax,%eax
jmp    1258 <main+0x118>
mov    (%rsi),%rsi
lea    0xdb4(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [19 x i8] c"Usage: %s integer\0A\00"
@.str.1 = [6 x i8] c" \00"
@.str.2 = [11 x i8] c"%05lu \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %44
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call zeroext i8 @atoi(i8* %9)
%11 = icmp eq i8 %10, 0
br i1 %11, label %44, label %12
12: ; preds = %7
%13 = zext i8 %10 to i32
%14 = add nsw i32 %13, -2
br label %15
15: ; preds = %12, %39
%16 = phi i32 [ 0, %12 ], [ %41, %39 ]
%17 = phi i8 [ 1, %12 ], [ %42, %39 ]
%18 = sub nsw i32 %14, %16
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %22, %15
%21 = trunc i32 %16 to i8
br label %28
22: ; preds = %15, %22
%23 = phi i8 [ %25, %22 ], [ 0, %15 ]
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%25 = add i8 %23, 1
%26 = zext i8 %25 to i32
%27 = icmp slt i32 %18, %26
br i1 %27, label %20, label %22
28: ; preds = %20, %28
%29 = phi i8 [ 0, %20 ], [ %37, %28 ]
%30 = tail call i32 @factorial(i8 zeroext %21)
%31 = tail call i32 @factorial(i8 zeroext %29)
%32 = sub i8 %21, %29
%33 = tail call i32 @factorial(i8 zeroext %32)
%34 = mul nsw i32 %33, %31
%35 = sdiv i32 %30, %34
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %35)
%37 = add nuw i8 %29, 1
%38 = icmp eq i8 %37, %17
br i1 %38, label %39, label %28
39: ; preds = %28
%40 = tail call i32 @putchar(i32 10)
%41 = add nuw nsw i32 %16, 1
%42 = add i8 %17, 1
%43 = icmp eq i32 %41, %13
br i1 %43, label %44, label %15
44: ; preds = %39, %7, %4
%45 = phi i32 [ 1, %4 ], [ 0, %7 ], [ 0, %39 ]
ret i32 %45
}