#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int n, k;
  float P;
  printf("N=");
  scanf("%d", &n);
  P = 1.0;
  for (k = 1; k <= n; k++)
    P *= (1 / (float)k + ((float)k + 1) / ((float)k + 2));
  printf("%f\n", P);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  0xeab(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11c0 <main+0xa0>
cvtsi2ssl -0xc(%rbp),%xmm1
movss  0xe86(%rip),%xmm0
divss  %xmm1,%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
movss  0xe75(%rip),%xmm2
addss  %xmm2,%xmm1
cvtsi2ssl -0xc(%rbp),%xmm2
movss  0xe68(%rip),%xmm3
addss  %xmm3,%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1161 <main+0x41>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe3e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11b7 <main+0x97>
neg    %eax
mov    $0x1,%ecx
movss  0xeb1(%rip),%xmm0
movss  0xead(%rip),%xmm1
movaps 0xeaa(%rip),%xmm2
movaps %xmm0,%xmm3
nopl   0x0(%rax)
xorps  %xmm4,%xmm4
cvtsi2ss %ecx,%xmm4
movaps %xmm4,%xmm5
addss  %xmm0,%xmm5
movaps %xmm2,%xmm6
unpcklps %xmm5,%xmm6
movaps %xmm4,%xmm5
addss  %xmm1,%xmm5
unpcklps %xmm5,%xmm4
divps  %xmm4,%xmm6
movaps %xmm6,%xmm4
shufps $0x55,%xmm6,%xmm4
addss  %xmm6,%xmm4
mulss  %xmm4,%xmm3
lea    (%rax,%rcx,1),%edx
add    $0x1,%edx
add    $0x1,%ecx
cmp    $0x1,%edx
jne    1170 <main+0x50>
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
jmp    11bf <main+0x9f>
movsd  0xe41(%rip),%xmm0
lea    0xe60(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"N=\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store float 1.000000e+00, float* %4
store i32 1, i32* %3
br label %7
7: ; preds = %25, %0
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %28
11: ; preds = %7
%12 = load i32, i32* %3
%13 = sitofp i32 %12 to float
%14 = fdiv float 1.000000e+00, %13
%15 = load i32, i32* %3
%16 = sitofp i32 %15 to float
%17 = fadd float %16, 1.000000e+00
%18 = load i32, i32* %3
%19 = sitofp i32 %18 to float
%20 = fadd float %19, 2.000000e+00
%21 = fdiv float %17, %20
%22 = fadd float %14, %21
%23 = load float, float* %4
%24 = fmul float %23, %22
store float %24, float* %4
br label %25
25: ; preds = %11
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %7
28: ; preds = %7
%29 = load float, float* %4
%30 = fpext float %29 to double
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"N=\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 1
br i1 %6, label %25, label %7
7: ; preds = %0, %7
%8 = phi float [ %20, %7 ], [ 1.000000e+00, %0 ]
%9 = phi i32 [ %21, %7 ], [ 1, %0 ]
%10 = sitofp i32 %9 to float
%11 = fadd float %10, 1.000000e+00
%12 = fadd float %10, 2.000000e+00
%13 = insertelement <2 x float> <float 1.000000e+00, float poison>, float %11, i64 1
%14 = insertelement <2 x float> poison, float %10, i64 0
%15 = insertelement <2 x float> %14, float %12, i64 1
%16 = fdiv <2 x float> %13, %15
%17 = shufflevector <2 x float> %16, <2 x float> poison, <2 x i32> <i32 1, i32 undef>
%18 = fadd <2 x float> %16, %17
%19 = extractelement <2 x float> %18, i64 0
%20 = fmul float %8, %19
%21 = add nuw i32 %9, 1
%22 = icmp eq i32 %9, %5
br i1 %22, label %23, label %7
23: ; preds = %7
%24 = fpext float %20 to double
br label %25
25: ; preds = %23, %0
%26 = phi double [ 1.000000e+00, %0 ], [ %24, %23 ]
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %26)
ret i32 0
}