#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 */
size_t abs(int);
int /*<<< orphan*/ flap_2d(double **, double **, int const *);
int /*<<< orphan*/ symeigen(double *, double *, int);
void gklt_1d_collapsed(double klt[(1 << (4))][(1 << (4))],
                       double cov[((1 << (4)) * 2)], const int *_f) {
  static double workA[((1 << (4)) * 2)][((1 << (4)) * 2)];
  static double workB[(1 << (4))][(1 << (4))];
  int i, j;
  for (i = 0; i < ((1 << (4)) * 2); i++)
    for (j = 0; j < ((1 << (4)) * 2); j++)
      workA[i][j] = cov[abs(i - j)];
  flap_2d(workB, workA, _f);
  symeigen(&klt[0][0], &workB[0][0], (1 << (4)));
}


x86 assembly (clang, -O0):
<gklt_1d_collapsed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x20,-0x1c(%rbp)
jge    11c1 <gklt_1d_collapsed+0x91>
movl   $0x0,-0x20(%rbp)
cmpl   $0x20,-0x20(%rbp)
jge    11ae <gklt_1d_collapsed+0x7e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%edi
sub    -0x20(%rbp),%edi
call   1030 <abs@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
movsd  (%rax,%rcx,8),%xmm0
movslq -0x1c(%rbp),%rcx
lea    0x2ec0(%rip),%rax
shl    $0x8,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    115c <gklt_1d_collapsed+0x2c>
jmp    11b3 <gklt_1d_collapsed+0x83>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114b <gklt_1d_collapsed+0x1b>
mov    -0x18(%rbp),%rdx
lea    0x4e84(%rip),%rdi
lea    0x2e7d(%rip),%rsi
call   1050 <flap_2d@plt>
mov    -0x8(%rbp),%rdi
lea    0x4e6d(%rip),%rsi
mov    $0x10,%edx
call   1040 <symeigen@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gklt_1d_collapsed>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,0x8(%rsp)
mov    %rsi,%r12
mov    %rdi,0x10(%rsp)
mov    $0xffffffff,%r13d
lea    0x2f00(%rip),%rbp
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
mov    %r13d,%ebx
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
lea    0x1(%rbx),%edi
call   1030 <abs@plt>
movsd  (%r12,%rax,8),%xmm0
movsd  %xmm0,-0x8(%rbp,%r15,8)
mov    %ebx,%edi
call   1030 <abs@plt>
movsd  (%r12,%rax,8),%xmm0
movsd  %xmm0,0x0(%rbp,%r15,8)
add    $0x2,%r15
add    $0xfffffffe,%ebx
cmp    $0x20,%r15
jne    1170 <gklt_1d_collapsed+0x40>
add    $0x1,%r14
add    $0x1,%r13d
add    $0x100,%rbp
cmp    $0x20,%r14
jne    1160 <gklt_1d_collapsed+0x30>
lea    0x4e8e(%rip),%rbx
lea    0x2e87(%rip),%rsi
mov    %rbx,%rdi
mov    0x8(%rsp),%rdx
call   1050 <flap_2d@plt>
mov    0x10(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x10,%edx
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <symeigen@plt>

LLVM IR (-O0):
@gklt_1d_collapsed.workA = internal global [32 x [32 x double]] zeroinitializer
@gklt_1d_collapsed.workB = internal global [16 x [16 x double]] zeroinitializer
define void @gklt_1d_collapsed([16 x double]* %0, double* %1, i32* %2) {
%4 = alloca [16 x double]*
%5 = alloca double*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store [16 x double]* %0, [16 x double]** %4
store double* %1, double** %5
store i32* %2, i32** %6
store i32 0, i32* %7
br label %9
9: ; preds = %34, %3
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 32
br i1 %11, label %12, label %37
12: ; preds = %9
store i32 0, i32* %8
br label %13
13: ; preds = %30, %12
%14 = load i32, i32* %8
%15 = icmp slt i32 %14, 32
br i1 %15, label %16, label %33
16: ; preds = %13
%17 = load double*, double** %5
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = sub nsw i32 %18, %19
%21 = call i64 @abs(i32 %20)
%22 = getelementptr inbounds double, double* %17, i64 %21
%23 = load double, double* %22
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [32 x [32 x double]], [32 x [32 x double]]* @gklt_1d_collapsed.workA, i64 0, i64 %25
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [32 x double], [32 x double]* %26, i64 0, i64 %28
store double %23, double* %29
br label %30
30: ; preds = %16
%31 = load i32, i32* %8
%32 = add nsw i32 %31, 1
store i32 %32, i32* %8
br label %13
33: ; preds = %13
br label %34
34: ; preds = %33
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %9
37: ; preds = %9
%38 = load i32*, i32** %6
%39 = call i32 @flap_2d(double** bitcast ([16 x [16 x double]]* @gklt_1d_collapsed.workB to double**), double** bitcast ([32 x [32 x double]]* @gklt_1d_collapsed.workA to double**), i32* %38)
%40 = load [16 x double]*, [16 x double]** %4
%41 = getelementptr inbounds [16 x double], [16 x double]* %40, i64 0
%42 = getelementptr inbounds [16 x double], [16 x double]* %41, i64 0, i64 0
%43 = call i32 @symeigen(double* %42, double* getelementptr inbounds ([16 x [16 x double]], [16 x [16 x double]]* @gklt_1d_collapsed.workB, i64 0, i64 0, i64 0), i32 16)
ret void
}

LLVM IR (-O2):
@gklt_1d_collapsed.workA = internal global [32 x [32 x double]] zeroinitializer
@gklt_1d_collapsed.workB = internal global [16 x [16 x double]] zeroinitializer
define void @gklt_1d_collapsed([16 x double]* %0, double* nocapture %1, i32* %2) {
br label %4
4: ; preds = %3, %23
%5 = phi i64 [ 0, %3 ], [ %24, %23 ]
br label %6
6: ; preds = %6, %4
%7 = phi i64 [ 0, %4 ], [ %21, %6 ]
%8 = sub nsw i64 %5, %7
%9 = trunc i64 %8 to i32
%10 = tail call i64 @abs(i32 %9)
%11 = getelementptr inbounds double, double* %1, i64 %10
%12 = load double, double* %11
%13 = getelementptr inbounds [32 x [32 x double]], [32 x [32 x double]]* @gklt_1d_collapsed.workA, i64 0, i64 %5, i64 %7
store double %12, double* %13
%14 = or i64 %7, 1
%15 = sub nsw i64 %5, %14
%16 = trunc i64 %15 to i32
%17 = tail call i64 @abs(i32 %16)
%18 = getelementptr inbounds double, double* %1, i64 %17
%19 = load double, double* %18
%20 = getelementptr inbounds [32 x [32 x double]], [32 x [32 x double]]* @gklt_1d_collapsed.workA, i64 0, i64 %5, i64 %14
store double %19, double* %20
%21 = add nuw nsw i64 %7, 2
%22 = icmp eq i64 %21, 32
br i1 %22, label %23, label %6
23: ; preds = %6
%24 = add nuw nsw i64 %5, 1
%25 = icmp eq i64 %24, 32
br i1 %25, label %26, label %4
26: ; preds = %23
%27 = tail call i32 @flap_2d(double** bitcast ([16 x [16 x double]]* @gklt_1d_collapsed.workB to double**), double** bitcast ([32 x [32 x double]]* @gklt_1d_collapsed.workA to double**), i32* %2)
%28 = getelementptr inbounds [16 x double], [16 x double]* %0, i64 0, i64 0
%29 = tail call i32 @symeigen(double* %28, double* getelementptr inbounds ([16 x [16 x double]], [16 x [16 x double]]* @gklt_1d_collapsed.workB, i64 0, i64 0, i64 0), i32 16)
ret void
}