#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 abs(int);
int fact(int);
int pow(int, int);
int /*<<< orphan*/ printf(char *, int, double, int, double, double, long);
double man_serie(double x) {
  int n, k;
  double accumulator = 1, productory;
  int sign = 1;
  for (n = 1; n <= 8; n++) {
    sign = pow(-1, n + 1);
    double pot = pow((x - 1), n);
    long denominator = pow(2, n) * fact(n);
    productory = 1;
    for (k = -1; k < n - 1; k++) {
      productory = productory * abs((2 * k) + 1);
    }
    double slice = (sign * productory * pot) / denominator;
    printf("Slice %d: %lf <=> (%d * %lf * %.2lf) / %li\n", n, slice, sign,
           productory, pot, denominator);
    accumulator += slice;
  }
  return accumulator;
}


x86 assembly (clang, -O0):
<man_serie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeab(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x1,-0x24(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jg     128d <man_serie+0x14d>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    $0xffffffff,%edi
call   1060 <pow@plt>
mov    %eax,-0x24(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe6e(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
mov    -0xc(%rbp),%esi
call   1060 <pow@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0xc(%rbp),%esi
mov    $0x2,%edi
call   1060 <pow@plt>
mov    %eax,-0x44(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <fact@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
imul   %ecx,%eax
cltq
mov    %rax,-0x38(%rbp)
movsd  0xe27(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0xffffffff,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    122d <man_serie+0xed>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%edi
shl    $0x1,%edi
add    $0x1,%edi
call   1030 <abs@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11e5 <man_serie+0xa5>
cvtsi2sdl -0x24(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
cvtsi2sdq -0x38(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0xc(%rbp),%esi
movsd  -0x40(%rbp),%xmm0
mov    -0x24(%rbp),%edx
movsd  -0x20(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
mov    -0x38(%rbp),%rcx
lea    0xd9d(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x40(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1168 <man_serie+0x28>
movsd  -0x18(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<man_serie>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
addsd  0xeaa(%rip),%xmm0
cvttsd2si %xmm0,%ebx
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1060 <pow@plt>
mov    %eax,%r12d
mov    %ebx,0x14(%rsp)
mov    %ebx,%edi
mov    $0x1,%esi
call   1060 <pow@plt>
mov    %eax,%r14d
mov    $0x2,%edi
mov    $0x1,%esi
call   1060 <pow@plt>
mov    %eax,%ebx
mov    $0x1,%edi
call   1050 <fact@plt>
mov    %eax,%ebp
imul   %ebx,%ebp
mov    $0xffffffff,%edi
call   1030 <abs@plt>
movapd %xmm0,%xmm1
cvtsi2sd %r14d,%xmm2
movslq %ebp,%rcx
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
cvtsi2sd %ecx,%xmm3
divsd  %xmm3,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xe36(%rip),%rdi
mov    $0x1,%esi
mov    %r12d,%edx
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
addsd  0xe13(%rip),%xmm0
xor    %r15d,%r15d
jmp    1255 <man_serie+0x115>
nopw   0x0(%rax,%rax,1)
xorps  %xmm2,%xmm2
cvtsi2sd %r12d,%xmm2
movslq %ebx,%rcx
xorps  %xmm0,%xmm0
cvtsi2sd %r13d,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
xorps  %xmm3,%xmm3
cvtsi2sd %ecx,%xmm3
divsd  %xmm3,%xmm0
movsd  %xmm0,(%rsp)
lea    0xdde(%rip),%rdi
mov    %ebp,%esi
mov    %r13d,%edx
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
add    $0x1,%r15d
cmp    $0x7,%r15d
je     138c <man_serie+0x24c>
movsd  %xmm0,0x8(%rsp)
lea    0x2(%r15),%ebp
lea    0x3(%r15),%esi
mov    $0xffffffff,%edi
call   1060 <pow@plt>
mov    %eax,%r13d
mov    0x14(%rsp),%edi
mov    %ebp,%esi
call   1060 <pow@plt>
mov    %eax,%r12d
mov    $0x2,%edi
mov    %ebp,%esi
call   1060 <pow@plt>
mov    %eax,%r14d
mov    %ebp,%edi
call   1050 <fact@plt>
mov    %eax,%ebx
imul   %r14d,%ebx
mov    $0xffffffff,%edi
call   1030 <abs@plt>
movsd  %xmm0,(%rsp)
mov    $0x1,%edi
call   1030 <abs@plt>
movapd %xmm0,%xmm1
mulsd  (%rsp),%xmm1
test   %r15d,%r15d
je     1200 <man_serie+0xc0>
mov    $0x3,%edi
movsd  %xmm1,(%rsp)
call   1030 <abs@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
cmp    $0x1,%r15d
je     1200 <man_serie+0xc0>
mov    $0x5,%edi
movsd  %xmm1,(%rsp)
call   1030 <abs@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
cmp    $0x2,%r15d
je     1200 <man_serie+0xc0>
mov    $0x7,%edi
movsd  %xmm1,(%rsp)
call   1030 <abs@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
cmp    $0x3,%r15d
je     1200 <man_serie+0xc0>
mov    $0x9,%edi
movsd  %xmm1,(%rsp)
call   1030 <abs@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
cmp    $0x4,%r15d
je     1200 <man_serie+0xc0>
mov    $0xb,%edi
movsd  %xmm1,(%rsp)
call   1030 <abs@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
cmp    $0x5,%r15d
je     1200 <man_serie+0xc0>
mov    $0xd,%edi
movsd  %xmm1,(%rsp)
call   1030 <abs@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
jmp    1200 <man_serie+0xc0>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [44 x i8] c"Slice %d: %lf <=> (%d * %lf * %.2lf) / %li\0A\00"
define double @man_serie(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca double
%9 = alloca i64
%10 = alloca double
store double %0, double* %2
store double 1.000000e+00, double* %5
store i32 1, i32* %7
store i32 1, i32* %3
br label %11
11: ; preds = %65, %1
%12 = load i32, i32* %3
%13 = icmp sle i32 %12, 8
br i1 %13, label %14, label %68
14: ; preds = %11
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
%17 = call i32 @pow(i32 -1, i32 %16)
store i32 %17, i32* %7
%18 = load double, double* %2
%19 = fsub double %18, 1.000000e+00
%20 = fptosi double %19 to i32
%21 = load i32, i32* %3
%22 = call i32 @pow(i32 %20, i32 %21)
%23 = sitofp i32 %22 to double
store double %23, double* %8
%24 = load i32, i32* %3
%25 = call i32 @pow(i32 2, i32 %24)
%26 = load i32, i32* %3
%27 = call i32 @fact(i32 %26)
%28 = mul nsw i32 %25, %27
%29 = sext i32 %28 to i64
store i64 %29, i64* %9
store double 1.000000e+00, double* %6
store i32 -1, i32* %4
br label %30
30: ; preds = %42, %14
%31 = load i32, i32* %4
%32 = load i32, i32* %3
%33 = sub nsw i32 %32, 1
%34 = icmp slt i32 %31, %33
br i1 %34, label %35, label %45
35: ; preds = %30
%36 = load double, double* %6
%37 = load i32, i32* %4
%38 = mul nsw i32 2, %37
%39 = add nsw i32 %38, 1
%40 = call double @abs(i32 %39)
%41 = fmul double %36, %40
store double %41, double* %6
br label %42
42: ; preds = %35
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %30
45: ; preds = %30
%46 = load i32, i32* %7
%47 = sitofp i32 %46 to double
%48 = load double, double* %6
%49 = fmul double %47, %48
%50 = load double, double* %8
%51 = fmul double %49, %50
%52 = load i64, i64* %9
%53 = sitofp i64 %52 to double
%54 = fdiv double %51, %53
store double %54, double* %10
%55 = load i32, i32* %3
%56 = load double, double* %10
%57 = load i32, i32* %7
%58 = load double, double* %6
%59 = load double, double* %8
%60 = load i64, i64* %9
%61 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %55, double %56, i32 %57, double %58, double %59, i64 %60)
%62 = load double, double* %10
%63 = load double, double* %5
%64 = fadd double %63, %62
store double %64, double* %5
br label %65
65: ; preds = %45
%66 = load i32, i32* %3
%67 = add nsw i32 %66, 1
store i32 %67, i32* %3
br label %11
68: ; preds = %11
%69 = load double, double* %5
ret double %69
}

LLVM IR (-O2):
@.str = [44 x i8] c"Slice %d: %lf <=> (%d * %lf * %.2lf) / %li\0A\00"
define double @man_serie(double %0) {
%2 = fadd double %0, -1.000000e+00
%3 = fptosi double %2 to i32
%4 = tail call i32 @pow(i32 -1, i32 2)
%5 = tail call i32 @pow(i32 %3, i32 1)
%6 = tail call i32 @pow(i32 2, i32 1)
%7 = tail call i32 @fact(i32 1)
%8 = mul nsw i32 %7, %6
%9 = tail call double @abs(i32 -1)
%10 = sitofp i32 %5 to double
%11 = sext i32 %8 to i64
%12 = sitofp i32 %4 to double
%13 = fmul double %9, %12
%14 = fmul double %13, %10
%15 = sitofp i32 %8 to double
%16 = fdiv double %14, %15
%17 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 1, double %16, i32 %4, double %9, double %10, i64 %11)
%18 = fadd double %16, 1.000000e+00
br label %19
19: ; preds = %1, %56
%20 = phi i32 [ 1, %1 ], [ %67, %56 ]
%21 = phi i32 [ 2, %1 ], [ %23, %56 ]
%22 = phi double [ %18, %1 ], [ %66, %56 ]
%23 = add nuw nsw i32 %21, 1
%24 = tail call i32 @pow(i32 -1, i32 %23)
%25 = tail call i32 @pow(i32 %3, i32 %21)
%26 = tail call i32 @pow(i32 2, i32 %21)
%27 = tail call i32 @fact(i32 %21)
%28 = mul nsw i32 %27, %26
%29 = tail call double @abs(i32 -1)
%30 = tail call double @abs(i32 1)
%31 = fmul double %29, %30
%32 = icmp eq i32 %20, 1
br i1 %32, label %56, label %33
33: ; preds = %19
%34 = tail call double @abs(i32 3)
%35 = fmul double %31, %34
%36 = icmp eq i32 %20, 2
br i1 %36, label %56, label %37
37: ; preds = %33
%38 = tail call double @abs(i32 5)
%39 = fmul double %35, %38
%40 = icmp eq i32 %20, 3
br i1 %40, label %56, label %41
41: ; preds = %37
%42 = tail call double @abs(i32 7)
%43 = fmul double %39, %42
%44 = icmp eq i32 %20, 4
br i1 %44, label %56, label %45
45: ; preds = %41
%46 = tail call double @abs(i32 9)
%47 = fmul double %43, %46
%48 = icmp eq i32 %20, 5
br i1 %48, label %56, label %49
49: ; preds = %45
%50 = tail call double @abs(i32 11)
%51 = fmul double %47, %50
%52 = icmp eq i32 %20, 6
br i1 %52, label %56, label %53
53: ; preds = %49
%54 = tail call double @abs(i32 13)
%55 = fmul double %51, %54
br label %56
56: ; preds = %53, %49, %45, %41, %37, %33, %19
%57 = phi double [ %31, %19 ], [ %35, %33 ], [ %39, %37 ], [ %43, %41 ], [ %47, %45 ], [ %51, %49 ], [ %55, %53 ]
%58 = sitofp i32 %25 to double
%59 = sext i32 %28 to i64
%60 = sitofp i32 %24 to double
%61 = fmul double %57, %60
%62 = fmul double %61, %58
%63 = sitofp i32 %28 to double
%64 = fdiv double %62, %63
%65 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %21, double %64, i32 %24, double %57, double %58, i64 %59)
%66 = fadd double %22, %64
%67 = add nuw nsw i32 %20, 1
%68 = icmp eq i32 %67, 8
br i1 %68, label %69, label %19
69: ; preds = %56
ret double %66
}