#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 gamma(double);
int log(double);
int w(double);
double gamma_der(double x) {
  double t, suma = 0.0;
  long i;
  t = x + 50;
  for (i = 0; i <= 50; i++)
    suma += 1.0 / (x + i);
  return (gamma(x) * (log(t) + 1 / (2 * t) + w(t) - suma));
}


x86 assembly (clang, -O0):
<gamma_der>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeb3(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x32,-0x20(%rbp)
jg     11a0 <gamma_der+0x70>
movsd  -0x8(%rbp),%xmm1
cvtsi2sdq -0x20(%rbp),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe87(%rip),%xmm0
divsd  %xmm1,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    115f <gamma_der+0x2f>
movsd  -0x8(%rbp),%xmm0
call   1030 <gamma@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <log@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe47(%rip),%xmm2
mulsd  -0x10(%rbp),%xmm2
movsd  0xe32(%rip),%xmm1
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <w@plt>
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
cvtsi2sd %eax,%xmm2
addsd  %xmm2,%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gamma_der>:
sub    $0x28,%rsp
xorpd  %xmm5,%xmm5
xor    %eax,%eax
movsd  0xebe(%rip),%xmm4
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm4,%xmm2
divsd  %xmm1,%xmm2
lea    0x1(%rax),%rcx
xorps  %xmm1,%xmm1
cvtsi2sd %rcx,%xmm1
addsd  %xmm5,%xmm2
addsd  %xmm0,%xmm1
movapd %xmm4,%xmm3
divsd  %xmm1,%xmm3
addsd  %xmm2,%xmm3
lea    0x2(%rax),%rcx
xorps  %xmm1,%xmm1
cvtsi2sd %rcx,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm4,%xmm5
divsd  %xmm1,%xmm5
addsd  %xmm3,%xmm5
add    $0x3,%rax
cmp    $0x33,%rax
jne    1150 <gamma_der+0x20>
movsd  0xe56(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  %xmm5,0x20(%rsp)
call   1030 <gamma@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <log@plt>
xorps  %xmm3,%xmm3
cvtsi2sd %eax,%xmm3
movsd  0x8(%rsp),%xmm0
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe04(%rip),%xmm2
divsd  %xmm1,%xmm2
addsd  %xmm3,%xmm2
movsd  %xmm2,0x10(%rsp)
call   1040 <w@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0x10(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
mulsd  0x18(%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @gamma_der(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i64
store double %0, double* %2
store double 0.000000e+00, double* %4
%6 = load double, double* %2
%7 = fadd double %6, 5.000000e+01
store double %7, double* %3
store i64 0, i64* %5
br label %8
8: ; preds = %19, %1
%9 = load i64, i64* %5
%10 = icmp sle i64 %9, 50
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = load double, double* %2
%13 = load i64, i64* %5
%14 = sitofp i64 %13 to double
%15 = fadd double %12, %14
%16 = fdiv double 1.000000e+00, %15
%17 = load double, double* %4
%18 = fadd double %17, %16
store double %18, double* %4
br label %19
19: ; preds = %11
%20 = load i64, i64* %5
%21 = add nsw i64 %20, 1
store i64 %21, i64* %5
br label %8
22: ; preds = %8
%23 = load double, double* %2
%24 = call i32 @gamma(double %23)
%25 = sitofp i32 %24 to double
%26 = load double, double* %3
%27 = call i32 @log(double %26)
%28 = sitofp i32 %27 to double
%29 = load double, double* %3
%30 = fmul double 2.000000e+00, %29
%31 = fdiv double 1.000000e+00, %30
%32 = fadd double %28, %31
%33 = load double, double* %3
%34 = call i32 @w(double %33)
%35 = sitofp i32 %34 to double
%36 = fadd double %32, %35
%37 = load double, double* %4
%38 = fsub double %36, %37
%39 = fmul double %25, %38
ret double %39
}

LLVM IR (-O2):
define double @gamma_der(double %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %19, %2 ]
%4 = phi double [ 0.000000e+00, %1 ], [ %18, %2 ]
%5 = sitofp i64 %3 to double
%6 = fadd double %5, %0
%7 = fdiv double 1.000000e+00, %6
%8 = fadd double %4, %7
%9 = add nuw nsw i64 %3, 1
%10 = sitofp i64 %9 to double
%11 = fadd double %10, %0
%12 = fdiv double 1.000000e+00, %11
%13 = fadd double %8, %12
%14 = add nuw nsw i64 %3, 2
%15 = sitofp i64 %14 to double
%16 = fadd double %15, %0
%17 = fdiv double 1.000000e+00, %16
%18 = fadd double %13, %17
%19 = add nuw nsw i64 %3, 3
%20 = icmp eq i64 %19, 51
br i1 %20, label %21, label %2
21: ; preds = %2
%22 = fadd double %0, 5.000000e+01
%23 = tail call i32 @gamma(double %0)
%24 = sitofp i32 %23 to double
%25 = tail call i32 @log(double %22)
%26 = sitofp i32 %25 to double
%27 = fmul double %22, 2.000000e+00
%28 = fdiv double 1.000000e+00, %27
%29 = fadd double %28, %26
%30 = tail call i32 @w(double %22)
%31 = sitofp i32 %30 to double
%32 = fadd double %29, %31
%33 = fsub double %32, %18
%34 = fmul double %33, %24
ret double %34
}