#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 */
scalar_t__ ceil(double);
int /*<<< orphan*/ printf(char *, long);
int problem015() {
  int i = 0;
  int k = 0;
  double product = 1;
  for (i = 21, k = 20; i < 41; i++, k--) {
    product *= ((double)i / k);
  }
  printf("%ld\n", (long)ceil(product));
  return 0;
}


x86 assembly (clang, -O0):
<problem015>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movsd  0xec2(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x15,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
cmpl   $0x29,-0x4(%rbp)
jge    118a <problem015+0x6a>
cvtsi2sdl -0x4(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1151 <problem015+0x31>
movsd  -0x10(%rbp),%xmm0
call   1030 <ceil@plt>
mov    %rax,%rsi
lea    0xe6a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<problem015>:
push   %rax
movdqa 0xed7(%rip),%xmm1
movsd  0xeef(%rip),%xmm0
movdqa 0xed7(%rip),%xmm2
nopl   0x0(%rax)
cvtdq2pd %xmm1,%xmm3
movapd %xmm3,%xmm4
unpckhpd %xmm3,%xmm4
divsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm0
paddd  %xmm2,%xmm1
movd   %xmm1,%eax
cmp    $0x29,%eax
jne    1140 <problem015+0x20>
call   1030 <ceil@plt>
lea    0xebb(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%ld\0A\00"
define i32 @problem015() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
store i32 0, i32* %1
store i32 0, i32* %2
store double 1.000000e+00, double* %3
store i32 21, i32* %1
store i32 20, i32* %2
br label %4
4: ; preds = %15, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 41
br i1 %6, label %7, label %20
7: ; preds = %4
%8 = load i32, i32* %1
%9 = sitofp i32 %8 to double
%10 = load i32, i32* %2
%11 = sitofp i32 %10 to double
%12 = fdiv double %9, %11
%13 = load double, double* %3
%14 = fmul double %13, %12
store double %14, double* %3
br label %15
15: ; preds = %7
%16 = load i32, i32* %1
%17 = add nsw i32 %16, 1
store i32 %17, i32* %1
%18 = load i32, i32* %2
%19 = add nsw i32 %18, -1
store i32 %19, i32* %2
br label %4
20: ; preds = %4
%21 = load double, double* %3
%22 = call i64 @ceil(double %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%ld\0A\00"
define i32 @problem015() {
br label %1
1: ; preds = %0, %1
%2 = phi double [ 1.000000e+00, %0 ], [ %8, %1 ]
%3 = phi <2 x i32> [ <i32 21, i32 20>, %0 ], [ %9, %1 ]
%4 = sitofp <2 x i32> %3 to <2 x double>
%5 = extractelement <2 x double> %4, i64 0
%6 = extractelement <2 x double> %4, i64 1
%7 = fdiv double %5, %6
%8 = fmul double %2, %7
%9 = add nsw <2 x i32> %3, <i32 1, i32 -1>
%10 = extractelement <2 x i32> %9, i64 0
%11 = icmp eq i32 %10, 41
br i1 %11, label %12, label %1
12: ; preds = %1
%13 = tail call i64 @ceil(double %8)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %13)
ret i32 0
}