#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 */
double pow(int /*<<< orphan*/, double);
double zeta(double x) {
  double t = 1, z = 0;
  double base = 2;
  do {
    z += t;
    t = pow(base++, -x);
  } while (z + t > z);
  return z;
}


x86 assembly (clang, -O0):
<zeta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xee3(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xec6(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xead(%rip),%xmm2
movaps %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,-0x20(%rbp)
cvttsd2si %xmm0,%edi
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <pow@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
ja     113f <zeta+0x2f>
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zeta>:
sub    $0x28,%rsp
xorps  0xee5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movsd  0xee8(%rip),%xmm2
xorpd  %xmm1,%xmm1
movsd  0xee4(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
cvttsd2si %xmm2,%edi
addsd  0xec3(%rip),%xmm2
movsd  %xmm2,0x8(%rsp)
movapd 0x10(%rsp),%xmm0
call   1030 <pow@plt>
movsd  0x8(%rsp),%xmm2
movapd %xmm0,%xmm1
addsd  (%rsp),%xmm1
ucomisd (%rsp),%xmm1
movsd  (%rsp),%xmm1
ja     1140 <zeta+0x30>
movapd %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @zeta(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %2
store double 1.000000e+00, double* %3
store double 0.000000e+00, double* %4
store double 2.000000e+00, double* %5
br label %6
6: ; preds = %16, %1
%7 = load double, double* %3
%8 = load double, double* %4
%9 = fadd double %8, %7
store double %9, double* %4
%10 = load double, double* %5
%11 = fadd double %10, 1.000000e+00
store double %11, double* %5
%12 = fptosi double %10 to i32
%13 = load double, double* %2
%14 = fneg double %13
%15 = call double @pow(i32 %12, double %14)
store double %15, double* %3
br label %16
16: ; preds = %6
%17 = load double, double* %4
%18 = load double, double* %3
%19 = fadd double %17, %18
%20 = load double, double* %4
%21 = fcmp ogt double %19, %20
br i1 %21, label %6, label %22
22: ; preds = %16
%23 = load double, double* %4
ret double %23
}

LLVM IR (-O2):
define double @zeta(double %0) {
%2 = fneg double %0
br label %3
3: ; preds = %3, %1
%4 = phi double [ 1.000000e+00, %1 ], [ %10, %3 ]
%5 = phi double [ 0.000000e+00, %1 ], [ %7, %3 ]
%6 = phi double [ 2.000000e+00, %1 ], [ %8, %3 ]
%7 = fadd double %4, %5
%8 = fadd double %6, 1.000000e+00
%9 = fptosi double %6 to i32
%10 = tail call double @pow(i32 %9, double %2)
%11 = fadd double %7, %10
%12 = fcmp ogt double %11, %7
br i1 %12, label %3, label %13
13: ; preds = %3
ret double %7
}