#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 *, double);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  int n, i, counter = 2;
  double soma = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    if ((i % 2) == 0) {
      soma -= 1.0 / (double)(i);
    } else {
      soma += 1.0 / (double)(i);
    }
  }
  printf("%.4lf\n", soma);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x2,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
lea    0xebc(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11ce <main+0xae>
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11a0 <main+0x80>
cvtsi2sdl -0x18(%rbp),%xmm0
movsd  0xe77(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11bb <main+0x9b>
cvtsi2sdl -0x18(%rbp),%xmm1
movsd  0xe53(%rip),%xmm0
divsd  %xmm1,%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11c0 <main+0xa0>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115c <main+0x3c>
movsd  -0x28(%rbp),%xmm0
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
test   %ecx,%ecx
jle    114a <main+0x2a>
cmp    $0x1,%ecx
jne    1150 <main+0x30>
mov    $0x1,%eax
xorpd  %xmm0,%xmm0
jmp    11a0 <main+0x80>
xorpd  %xmm0,%xmm0
jmp    11c8 <main+0xa8>
mov    %ecx,%edx
and    $0xfffffffe,%edx
mov    $0x1,%eax
xorpd  %xmm0,%xmm0
movsd  0xe9a(%rip),%xmm1
movsd  0xe9a(%rip),%xmm2
xchg   %ax,%ax
xorps  %xmm3,%xmm3
cvtsi2sd %eax,%xmm3
movapd %xmm1,%xmm4
divsd  %xmm3,%xmm4
addsd  %xmm0,%xmm4
lea    0x1(%rax),%esi
xorps  %xmm3,%xmm3
cvtsi2sd %esi,%xmm3
movapd %xmm2,%xmm0
divsd  %xmm3,%xmm0
addsd  %xmm4,%xmm0
add    $0x2,%eax
cmp    %edx,%esi
jne    1170 <main+0x50>
test   $0x1,%cl
je     11c8 <main+0xa8>
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
movsd  0xe4c(%rip),%xmm1
divsd  %xmm2,%xmm1
test   $0x1,%al
jne    11c4 <main+0xa4>
xorpd  0xe4c(%rip),%xmm1
addsd  %xmm1,%xmm0
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%.4lf\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 1
br i1 %7, label %40, label %8
8: ; preds = %2
%9 = and i32 %6, 1
%10 = icmp eq i32 %6, 1
br i1 %10, label %27, label %11
11: ; preds = %8
%12 = and i32 %6, -2
br label %13
13: ; preds = %13, %11
%14 = phi double [ 0.000000e+00, %11 ], [ %23, %13 ]
%15 = phi i32 [ 1, %11 ], [ %24, %13 ]
%16 = phi i32 [ 0, %11 ], [ %25, %13 ]
%17 = sitofp i32 %15 to double
%18 = fdiv double 1.000000e+00, %17
%19 = fadd double %14, %18
%20 = add nuw i32 %15, 1
%21 = sitofp i32 %20 to double
%22 = fdiv double -1.000000e+00, %21
%23 = fadd double %19, %22
%24 = add nuw i32 %15, 2
%25 = add i32 %16, 2
%26 = icmp eq i32 %25, %12
br i1 %26, label %27, label %13
27: ; preds = %13, %8
%28 = phi double [ undef, %8 ], [ %23, %13 ]
%29 = phi double [ 0.000000e+00, %8 ], [ %23, %13 ]
%30 = phi i32 [ 1, %8 ], [ %24, %13 ]
%31 = icmp eq i32 %9, 0
br i1 %31, label %40, label %32
32: ; preds = %27
%33 = and i32 %30, 1
%34 = icmp eq i32 %33, 0
%35 = sitofp i32 %30 to double
%36 = fdiv double 1.000000e+00, %35
%37 = fneg double %36
%38 = select i1 %34, double %37, double %36
%39 = fadd double %29, %38
br label %40
40: ; preds = %32, %27, %2
%41 = phi double [ 0.000000e+00, %2 ], [ %28, %27 ], [ %39, %32 ]
%42 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %41)
ret i32 0
}