#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 i, n;
  double sum = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++)
    sum += 1.0 / i;
  printf("%.3lf\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xeca(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1183 <main+0x63>
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xe99(%rip),%xmm0
divsd  %xmm1,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114e <main+0x2e>
movsd  -0x18(%rbp),%xmm0
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    1151 <main+0x31>
cmp    $0x1,%eax
jne    1157 <main+0x37>
movsd  0xeb9(%rip),%xmm1
xorpd  %xmm0,%xmm0
test   $0x1,%al
jne    11ab <main+0x8b>
jmp    11bb <main+0x9b>
xorpd  %xmm0,%xmm0
jmp    11bb <main+0x9b>
mov    %eax,%ecx
and    $0xfffffffe,%ecx
mov    $0x1,%edx
xorpd  %xmm0,%xmm0
movsd  0xe93(%rip),%xmm1
nopl   (%rax)
xorps  %xmm2,%xmm2
cvtsi2sd %edx,%xmm2
movapd %xmm1,%xmm3
divsd  %xmm2,%xmm3
addsd  %xmm0,%xmm3
lea    0x1(%rdx),%esi
xorps  %xmm2,%xmm2
cvtsi2sd %esi,%xmm2
movapd %xmm1,%xmm0
divsd  %xmm2,%xmm0
addsd  %xmm3,%xmm0
add    $0x2,%edx
cmp    %ecx,%esi
jne    1170 <main+0x50>
xorps  %xmm1,%xmm1
cvtsi2sd %edx,%xmm1
test   $0x1,%al
je     11bb <main+0x9b>
movsd  0xe4d(%rip),%xmm2
divsd  %xmm1,%xmm2
addsd  %xmm2,%xmm0
lea    0xe49(%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"%.3lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %4
%5 = 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 %6
6: ; preds = %16, %0
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %19
10: ; preds = %6
%11 = load i32, i32* %2
%12 = sitofp i32 %11 to double
%13 = fdiv double 1.000000e+00, %12
%14 = load double, double* %4
%15 = fadd double %14, %13
store double %15, double* %4
br label %16
16: ; preds = %10
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %6
19: ; preds = %6
%20 = load double, double* %4
%21 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%.3lf\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 %35, label %6
6: ; preds = %0
%7 = and i32 %4, 1
%8 = icmp eq i32 %4, 1
br i1 %8, label %27, label %9
9: ; preds = %6
%10 = and i32 %4, -2
br label %11
11: ; preds = %11, %9
%12 = phi double [ 0.000000e+00, %9 ], [ %21, %11 ]
%13 = phi i32 [ 1, %9 ], [ %22, %11 ]
%14 = phi i32 [ 0, %9 ], [ %23, %11 ]
%15 = sitofp i32 %13 to double
%16 = fdiv double 1.000000e+00, %15
%17 = fadd double %12, %16
%18 = add nuw i32 %13, 1
%19 = sitofp i32 %18 to double
%20 = fdiv double 1.000000e+00, %19
%21 = fadd double %17, %20
%22 = add nuw i32 %13, 2
%23 = add i32 %14, 2
%24 = icmp eq i32 %23, %10
br i1 %24, label %25, label %11
25: ; preds = %11
%26 = sitofp i32 %22 to double
br label %27
27: ; preds = %25, %6
%28 = phi double [ undef, %6 ], [ %21, %25 ]
%29 = phi double [ 0.000000e+00, %6 ], [ %21, %25 ]
%30 = phi double [ 1.000000e+00, %6 ], [ %26, %25 ]
%31 = icmp eq i32 %7, 0
br i1 %31, label %35, label %32
32: ; preds = %27
%33 = fdiv double 1.000000e+00, %30
%34 = fadd double %29, %33
br label %35
35: ; preds = %32, %27, %0
%36 = phi double [ 0.000000e+00, %0 ], [ %28, %27 ], [ %34, %32 ]
%37 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %36)
ret i32 0
}