#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*/ aitken_(double *, double *, int *);
int /*<<< orphan*/ leibniz(double *, int const);
int /*<<< orphan*/ printseq_(double *, int *);
int main() {
  const int len = 13;
  double seq1[len];
  double seq2[len];
  int n, i, j;
  int farg;
  leibniz(seq1, len);
  n = len / 2;
  if (len % 2 == 0)
    n--;
  for (i = 0; i < n; i++) {
    farg = len - 2 * i;
    printseq_(seq1, &farg);
    aitken_(seq1, seq2, &farg);
    for (j = 0; j < len - 2 * (i + 1); j++)
      seq1[j] = seq2[j];
  }
  if (len % 2 == 0) {
    farg = 2;
    printseq_(seq1, &farg);
  } else {
    farg = 1;
    printseq_(seq1, &farg);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xd,-0x8(%rbp)
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
mov    $0xd,%esi
call   1040 <leibniz@plt>
movl   $0x6,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    120f <main+0xdf>
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
mov    $0xd,%eax
sub    %ecx,%eax
mov    %eax,-0x20(%rbp)
lea    -0x90(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <printseq_@plt>
lea    -0x90(%rbp),%rdi
lea    -0x100(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1030 <aitken_@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%edx
add    $0x1,%edx
shl    $0x1,%edx
mov    $0xd,%ecx
sub    %edx,%ecx
cmp    %ecx,%eax
jge    11fc <main+0xcc>
movslq -0x1c(%rbp),%rax
movsd  -0x100(%rbp,%rax,8),%xmm0
ff ff
movslq -0x1c(%rbp),%rax
movsd  %xmm0,-0x90(%rbp,%rax,8)
ff ff
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b9 <main+0x89>
jmp    1201 <main+0xd1>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116f <main+0x3f>
movl   $0x1,-0x20(%rbp)
lea    -0x90(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <printseq_@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xf0,%rsp
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xd,%esi
call   1040 <leibniz@plt>
movl   $0xd,0xc(%rsp)
lea    0xc(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <printseq_@plt>
lea    0x10(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <aitken_@plt>
movaps 0x10(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movaps 0x30(%rsp),%xmm2
movaps 0x40(%rsp),%xmm3
movaps %xmm0,0x80(%rsp)
movaps %xmm1,0x90(%rsp)
movaps %xmm2,0xa0(%rsp)
movaps %xmm3,0xb0(%rsp)
movaps 0x50(%rsp),%xmm0
movaps %xmm0,0xc0(%rsp)
mov    0x60(%rsp),%rax
mov    %rax,0xd0(%rsp)
movl   $0xb,0xc(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <printseq_@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <aitken_@plt>
movaps 0x10(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movaps 0x30(%rsp),%xmm2
movaps 0x40(%rsp),%xmm3
movaps %xmm0,0x80(%rsp)
movaps %xmm1,0x90(%rsp)
movaps %xmm2,0xa0(%rsp)
movaps %xmm3,0xb0(%rsp)
mov    0x50(%rsp),%rax
mov    %rax,0xc0(%rsp)
movl   $0x9,0xc(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <printseq_@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <aitken_@plt>
movaps 0x10(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movaps 0x30(%rsp),%xmm2
movaps %xmm0,0x80(%rsp)
movaps %xmm1,0x90(%rsp)
movaps %xmm2,0xa0(%rsp)
mov    0x40(%rsp),%rax
mov    %rax,0xb0(%rsp)
movl   $0x7,0xc(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <printseq_@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <aitken_@plt>
movaps 0x10(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movaps %xmm0,0x80(%rsp)
movaps %xmm1,0x90(%rsp)
mov    0x30(%rsp),%rax
mov    %rax,0xa0(%rsp)
movl   $0x5,0xc(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <printseq_@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <aitken_@plt>
movaps 0x10(%rsp),%xmm0
movaps %xmm0,0x80(%rsp)
mov    0x20(%rsp),%rax
mov    %rax,0x90(%rsp)
movl   $0x3,0xc(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <printseq_@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <aitken_@plt>
mov    0x10(%rsp),%rax
mov    %rax,0x80(%rsp)
movl   $0x1,0xc(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <printseq_@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 13, i32* %2
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %3
%9 = alloca double, i64 13
%10 = alloca double, i64 13
%11 = call i32 @leibniz(double* %9, i32 13)
store i32 6, i32* %4
store i32 0, i32* %5
br label %12
12: ; preds = %41, %0
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %44
16: ; preds = %12
%17 = load i32, i32* %5
%18 = mul nsw i32 2, %17
%19 = sub nsw i32 13, %18
store i32 %19, i32* %7
%20 = call i32 @printseq_(double* %9, i32* %7)
%21 = call i32 @aitken_(double* %9, double* %10, i32* %7)
store i32 0, i32* %6
br label %22
22: ; preds = %37, %16
%23 = load i32, i32* %6
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
%26 = mul nsw i32 2, %25
%27 = sub nsw i32 13, %26
%28 = icmp slt i32 %23, %27
br i1 %28, label %29, label %40
29: ; preds = %22
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %10, i64 %31
%33 = load double, double* %32
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %9, i64 %35
store double %33, double* %36
br label %37
37: ; preds = %29
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
br label %22
40: ; preds = %22
br label %41
41: ; preds = %40
%42 = load i32, i32* %5
%43 = add nsw i32 %42, 1
store i32 %43, i32* %5
br label %12
44: ; preds = %12
store i32 1, i32* %7
%45 = call i32 @printseq_(double* %9, i32* %7)
%46 = load i8*, i8** %3
%47 = load i32, i32* %1
ret i32 %47
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x double]
%3 = bitcast [13 x double]* %2 to i8*
%4 = alloca [13 x double]
%5 = bitcast [13 x double]* %4 to i8*
%6 = getelementptr inbounds [13 x double], [13 x double]* %4, i64 0, i64 0
%7 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 0
%8 = bitcast i32* %1 to i8*
%9 = call i32 @leibniz(double* %7, i32 13)
store i32 13, i32* %1
%10 = call i32 @printseq_(double* %7, i32* %1)
%11 = call i32 @aitken_(double* %7, double* %6, i32* %1)
store i32 11, i32* %1
%12 = call i32 @printseq_(double* %7, i32* %1)
%13 = call i32 @aitken_(double* %7, double* %6, i32* %1)
store i32 9, i32* %1
%14 = call i32 @printseq_(double* %7, i32* %1)
%15 = call i32 @aitken_(double* %7, double* %6, i32* %1)
store i32 7, i32* %1
%16 = call i32 @printseq_(double* %7, i32* %1)
%17 = call i32 @aitken_(double* %7, double* %6, i32* %1)
store i32 5, i32* %1
%18 = call i32 @printseq_(double* %7, i32* %1)
%19 = call i32 @aitken_(double* %7, double* %6, i32* %1)
store i32 3, i32* %1
%20 = call i32 @printseq_(double* %7, i32* %1)
%21 = call i32 @aitken_(double* %7, double* %6, i32* %1)
%22 = bitcast [13 x double]* %4 to i64*
%23 = bitcast [13 x double]* %2 to i64*
%24 = load i64, i64* %22
store i64 %24, i64* %23
store i32 1, i32* %1
%25 = call i32 @printseq_(double* %7, i32* %1)
ret i32 0
}