#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 INT16_MAX;
double fabs(double);
double log(int);
int /*<<< orphan*/ printf(char *, int, double, double, double, double);
int main() {
  int n = 0;
  int max = INT16_MAX;
  double hn1 = 0;
  double hn2 = 0;
  double gamma1 = 0;
  double gamma2 = 0;
  for (n = 1; n <= max; n++) {
    hn1 += 1.0 / n;
    hn2 += 1.0 / (max - n + 1);
    gamma1 = hn1 - log(n);
    gamma2 = hn2 - log(n);
    printf("%5d %.10e %.10e %.10e %.10e\n", n, gamma1, gamma2,
           fabs(gamma1 - 0.57721566490153286),
           fabs(gamma2 - 0.57721566490153286));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    0x2ea3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1258 <main+0x138>
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xe96(%rip),%xmm0
divsd  %xmm1,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe73(%rip),%xmm0
divsd  %xmm1,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%esi
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  0xdfd(%rip),%xmm3
subsd  %xmm3,%xmm2
movaps 0xde2(%rip),%xmm3
pand   %xmm3,%xmm2
movsd  -0x30(%rbp),%xmm3
movsd  0xde1(%rip),%xmm4
subsd  %xmm4,%xmm3
movaps 0xdc6(%rip),%xmm4
pand   %xmm4,%xmm3
lea    0xddb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1169 <main+0x49>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    0x2eaf(%rip),%rax
mov    (%rax),%ebp
test   %ebp,%ebp
jle    120a <main+0xea>
mov    %ebp,%r15d
neg    %r15d
xorpd  %xmm0,%xmm0
movapd %xmm0,(%rsp)
mov    $0x1,%ebx
lea    0xed2(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
movd   %ebx,%xmm0
movd   %ebp,%xmm1
punpckldq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm0
movapd 0xe88(%rip),%xmm1
divpd  %xmm0,%xmm1
movapd (%rsp),%xmm0
addpd  %xmm1,%xmm0
movapd %xmm0,(%rsp)
mov    %ebx,%edi
call   1040 <log@plt>
movapd (%rsp),%xmm1
unpckhpd %xmm1,%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
mov    %ebx,%edi
call   1040 <log@plt>
movapd (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd 0x10(%rsp),%xmm5
movapd %xmm5,%xmm2
movsd  0xe5a(%rip),%xmm0
addsd  %xmm0,%xmm2
movapd 0xe3e(%rip),%xmm4
andpd  %xmm4,%xmm2
movapd %xmm1,%xmm3
addsd  %xmm0,%xmm3
andpd  %xmm4,%xmm3
mov    %r14,%rdi
mov    %ebx,%esi
movapd %xmm5,%xmm0
call   1030 <printf@plt>
lea    (%r15,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
add    $0xffffffff,%ebp
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@INT16_MAX = global i32 0
@.str = [29 x i8] c"%5d %.10e %.10e %.10e %.10e\0A\00"
define i32 @main() {
%1 = load i32, i32* @INT16_MAX
%2 = icmp slt i32 %1, 1
br i1 %2, label %27, label %3
3: ; preds = %0
%4 = add nuw i32 %1, 1
br label %5
5: ; preds = %3, %5
%6 = phi i32 [ 1, %3 ], [ %25, %5 ]
%7 = phi <2 x double> [ zeroinitializer, %3 ], [ %13, %5 ]
%8 = sub i32 %4, %6
%9 = insertelement <2 x i32> poison, i32 %8, i64 0
%10 = insertelement <2 x i32> %9, i32 %6, i64 1
%11 = sitofp <2 x i32> %10 to <2 x double>
%12 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %11
%13 = fadd <2 x double> %7, %12
%14 = tail call double @log(i32 %6)
%15 = extractelement <2 x double> %13, i64 1
%16 = fsub double %15, %14
%17 = tail call double @log(i32 %6)
%18 = extractelement <2 x double> %13, i64 0
%19 = fsub double %18, %17
%20 = fadd double %16, 0xBFE2788CFC6FB619
%21 = tail call double @llvm.fabs.f64(double %20)
%22 = fadd double %19, 0xBFE2788CFC6FB619
%23 = tail call double @llvm.fabs.f64(double %22)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %6, double %16, double %19, double %21, double %23)
%25 = add nuw i32 %6, 1
%26 = icmp eq i32 %6, %1
br i1 %26, label %27, label %5
27: ; preds = %5, %0
ret i32 0
}