#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 */
float fatorial(int);
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, n;
  float serie = 0.0, x = 0.0;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) {
    x = (x * 2.0) + 1.0;
    if (i % 2 != 0)
      serie += fatorial(i) / x;
    else
      serie -= fatorial(i) / x;
  }
  printf("%.2lf\n", serie);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xeb2(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11f5 <main+0xc5>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  %xmm0,%xmm0
movsd  0xe79(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11c4 <main+0x94>
mov    -0x8(%rbp),%edi
call   1040 <fatorial@plt>
divss  -0x14(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11e2 <main+0xb2>
mov    -0x8(%rbp),%edi
call   1040 <fatorial@plt>
movaps %xmm0,%xmm1
divss  -0x14(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11e7 <main+0xb7>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1166 <main+0x36>
movss  -0x10(%rbp),%xmm0
lea    0xe0a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xee4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11b8 <main+0x88>
xorps  %xmm2,%xmm2
xor    %ebx,%ebx
xorps  %xmm0,%xmm0
jmp    1173 <main+0x43>
nopw   0x0(%rax,%rax,1)
movss  0xc(%rsp),%xmm1
addss  %xmm0,%xmm1
movaps %xmm1,%xmm0
cmp    0x4(%rsp),%ebx
jge    11bb <main+0x8b>
movss  %xmm0,0xc(%rsp)
add    $0x1,%ebx
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
addsd  %xmm0,%xmm0
addsd  0xe71(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1040 <fatorial@plt>
movss  0x8(%rsp),%xmm2
divss  %xmm2,%xmm0
test   $0x1,%bl
jne    1160 <main+0x30>
xorps  0xe5a(%rip),%xmm0
jmp    1160 <main+0x30>
xorps  %xmm0,%xmm0
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%.2lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 1
br i1 %5, label %23, label %6
6: ; preds = %0, %6
%7 = phi float [ %12, %6 ], [ 0.000000e+00, %0 ]
%8 = phi float [ %19, %6 ], [ 0.000000e+00, %0 ]
%9 = phi i32 [ %20, %6 ], [ 1, %0 ]
%10 = fpext float %7 to double
%11 = call double @llvm.fmuladd.f64(double %10, double 2.000000e+00, double 1.000000e+00)
%12 = fptrunc double %11 to float
%13 = and i32 %9, 1
%14 = icmp eq i32 %13, 0
%15 = call float @fatorial(i32 %9)
%16 = fdiv float %15, %12
%17 = fneg float %16
%18 = select i1 %14, float %17, float %16
%19 = fadd float %8, %18
%20 = add nuw nsw i32 %9, 1
%21 = load i32, i32* %1
%22 = icmp slt i32 %9, %21
br i1 %22, label %6, label %23
23: ; preds = %6, %0
%24 = phi float [ 0.000000e+00, %0 ], [ %19, %6 ]
%25 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), float %24)
ret i32 0
}