#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*/ factorial(double *);
int /*<<< orphan*/ printf(char *, int, double);
int main() {
  int j;
  double fact[21];
  factorial(fact);
  for (j = 0; j <= 20; ++j)
    printf("j = %3d    factorial(j) = %12.3e\n", j, fact[j]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xb0(%rbp),%rdi
call   1030 <factorial@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jg     1179 <main+0x59>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
movsd  -0xb0(%rbp,%rax,8),%xmm0
ff ff
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1145 <main+0x25>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xb0,%rsp
mov    %rsp,%rdi
call   1030 <factorial@plt>
movsd  (%rsp),%xmm0
lea    0xec4(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <printf@plt>
movsd  0x20(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
movsd  0x28(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <printf@plt>
movsd  0x30(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x6,%esi
call   1040 <printf@plt>
movsd  0x38(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x7,%esi
call   1040 <printf@plt>
movsd  0x40(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x8,%esi
call   1040 <printf@plt>
movsd  0x48(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x9,%esi
call   1040 <printf@plt>
movsd  0x50(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <printf@plt>
movsd  0x58(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0xb,%esi
call   1040 <printf@plt>
movsd  0x60(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0xc,%esi
call   1040 <printf@plt>
movsd  0x68(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0xd,%esi
call   1040 <printf@plt>
movsd  0x70(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0xe,%esi
call   1040 <printf@plt>
movsd  0x78(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0xf,%esi
call   1040 <printf@plt>
movsd  0x80(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <printf@plt>
movsd  0x88(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x11,%esi
call   1040 <printf@plt>
movsd  0x90(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x12,%esi
call   1040 <printf@plt>
movsd  0x98(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x13,%esi
call   1040 <printf@plt>
movsd  0xa0(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x14,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"j = %3d factorial(j) = %12.3e\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [21 x double]
store i32 0, i32* %1
%4 = getelementptr inbounds [21 x double], [21 x double]* %3, i64 0, i64 0
%5 = call i32 @factorial(double* %4)
store i32 0, i32* %2
br label %6
6: ; preds = %16, %0
%7 = load i32, i32* %2
%8 = icmp sle i32 %7, 20
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load i32, i32* %2
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [21 x double], [21 x double]* %3, i64 0, i64 %12
%14 = load double, double* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %10, double %14)
br label %16
16: ; preds = %9
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %6
19: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"j = %3d factorial(j) = %12.3e\0A\00"
define i32 @main() {
%1 = alloca [21 x double]
%2 = bitcast [21 x double]* %1 to i8*
%3 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 0
%4 = call i32 @factorial(double* %3)
%5 = load double, double* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 0, double %5)
%7 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 1
%8 = load double, double* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 1, double %8)
%10 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 2
%11 = load double, double* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 2, double %11)
%13 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 3
%14 = load double, double* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 3, double %14)
%16 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 4
%17 = load double, double* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 4, double %17)
%19 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 5
%20 = load double, double* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 5, double %20)
%22 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 6
%23 = load double, double* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 6, double %23)
%25 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 7
%26 = load double, double* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 7, double %26)
%28 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 8
%29 = load double, double* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 8, double %29)
%31 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 9
%32 = load double, double* %31
%33 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 9, double %32)
%34 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 10
%35 = load double, double* %34
%36 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 10, double %35)
%37 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 11
%38 = load double, double* %37
%39 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 11, double %38)
%40 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 12
%41 = load double, double* %40
%42 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 12, double %41)
%43 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 13
%44 = load double, double* %43
%45 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 13, double %44)
%46 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 14
%47 = load double, double* %46
%48 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 14, double %47)
%49 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 15
%50 = load double, double* %49
%51 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 15, double %50)
%52 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 16
%53 = load double, double* %52
%54 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 16, double %53)
%55 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 17
%56 = load double, double* %55
%57 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 17, double %56)
%58 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 18
%59 = load double, double* %58
%60 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 18, double %59)
%61 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 19
%62 = load double, double* %61
%63 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 19, double %62)
%64 = getelementptr inbounds [21 x double], [21 x double]* %1, i64 0, i64 20
%65 = load double, double* %64
%66 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 20, double %65)
ret i32 0
}