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


x86 assembly (clang, -O0):
<gklt_2d_collapsed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x20,-0x1c(%rbp)
jge    123c <gklt_2d_collapsed+0x10c>
movl   $0x0,-0x20(%rbp)
cmpl   $0x20,-0x20(%rbp)
jge    1229 <gklt_2d_collapsed+0xf9>
movl   $0x0,-0x24(%rbp)
cmpl   $0x20,-0x24(%rbp)
jge    1216 <gklt_2d_collapsed+0xe6>
movl   $0x0,-0x28(%rbp)
cmpl   $0x20,-0x28(%rbp)
jge    1203 <gklt_2d_collapsed+0xd3>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x1c(%rbp),%edi
sub    -0x24(%rbp),%edi
call   1030 <abs@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
shl    $0x8,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%edi
sub    -0x28(%rbp),%edi
call   1030 <abs@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
movsd  (%rax,%rcx,8),%xmm0
movslq -0x1c(%rbp),%rcx
lea    0x2e81(%rip),%rax
shl    $0x12,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
shl    $0xd,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rcx
shl    $0x8,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    117e <gklt_2d_collapsed+0x4e>
jmp    1208 <gklt_2d_collapsed+0xd8>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    116d <gklt_2d_collapsed+0x3d>
jmp    121b <gklt_2d_collapsed+0xeb>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    115c <gklt_2d_collapsed+0x2c>
jmp    122e <gklt_2d_collapsed+0xfe>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114b <gklt_2d_collapsed+0x1b>
mov    -0x18(%rbp),%rdx
lea    0x802e09(%rip),%rdi
lea    0x2e02(%rip),%rsi
call   1050 <flap_4d@plt>
mov    -0x8(%rbp),%rdi
lea    0x802df2(%rip),%rsi
mov    $0x100,%edx
call   1040 <symeigen@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gklt_2d_collapsed>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdx,0x18(%rsp)
mov    %rsi,%r12
mov    %rdi,0x20(%rsp)
lea    0x2f06(%rip),%r15
xor    %ecx,%ecx
mov    %rcx,0x10(%rsp)
nopl   0x0(%rax)
movl   $0xffffffff,0xc(%rsp)
ff
mov    %r15,0x28(%rsp)
xor    %eax,%eax
nop
mov    %rax,0x30(%rsp)
mov    %r15,0x38(%rsp)
xor    %ecx,%ecx
nopl   0x0(%rax)
mov    0x10(%rsp),%rax
mov    %eax,%r13d
mov    %rcx,0x40(%rsp)
sub    %ecx,%r13d
mov    0xc(%rsp),%eax
mov    %eax,%ebx
xor    %r14d,%r14d
nopl   0x0(%rax)
mov    %r13d,%edi
call   1030 <abs@plt>
mov    %rax,%rbp
lea    0x1(%rbx),%edi
call   1030 <abs@plt>
shl    $0x8,%rbp
add    %r12,%rbp
movsd  0x0(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0x8(%r15,%r14,8)
mov    %r13d,%edi
call   1030 <abs@plt>
mov    %rax,%rbp
mov    %ebx,%edi
call   1030 <abs@plt>
shl    $0x8,%rbp
add    %r12,%rbp
movsd  0x0(%rbp,%rax,8),%xmm0
movsd  %xmm0,(%r15,%r14,8)
add    $0x2,%r14
add    $0xfffffffe,%ebx
cmp    $0x20,%r14
jne    11a0 <gklt_2d_collapsed+0x70>
mov    0x40(%rsp),%rcx
add    $0x1,%rcx
add    $0x100,%r15
cmp    $0x20,%rcx
jne    1180 <gklt_2d_collapsed+0x50>
mov    0x30(%rsp),%rax
add    $0x1,%rax
addl   $0x1,0xc(%rsp)
mov    0x38(%rsp),%r15
add    $0x2000,%r15
cmp    $0x20,%rax
jne    1170 <gklt_2d_collapsed+0x40>
mov    0x10(%rsp),%rdx
add    $0x1,%rdx
mov    0x28(%rsp),%r15
add    $0x40000,%r15
mov    %rdx,%rcx
mov    %rdx,0x10(%rsp)
cmp    $0x20,%rdx
jne    1160 <gklt_2d_collapsed+0x30>
lea    0x802deb(%rip),%rbx
lea    0x2de4(%rip),%rsi
mov    %rbx,%rdi
mov    0x18(%rsp),%rdx
call   1050 <flap_4d@plt>
mov    0x20(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x100,%edx
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <symeigen@plt>

LLVM IR (-O0):
@gklt_2d_collapsed.workA = internal global [32 x [32 x [32 x [32 x double]]]] zeroinitializer
@gklt_2d_collapsed.workB = internal global [256 x [256 x double]] zeroinitializer
define void @gklt_2d_collapsed([256 x double]* %0, [32 x double]* %1, i32* %2) {
%4 = alloca [256 x double]*
%5 = alloca [32 x double]*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store [256 x double]* %0, [256 x double]** %4
store [32 x double]* %1, [32 x double]** %5
store i32* %2, i32** %6
store i32 0, i32* %7
br label %11
11: ; preds = %63, %3
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 32
br i1 %13, label %14, label %66
14: ; preds = %11
store i32 0, i32* %8
br label %15
15: ; preds = %59, %14
%16 = load i32, i32* %8
%17 = icmp slt i32 %16, 32
br i1 %17, label %18, label %62
18: ; preds = %15
store i32 0, i32* %9
br label %19
19: ; preds = %55, %18
%20 = load i32, i32* %9
%21 = icmp slt i32 %20, 32
br i1 %21, label %22, label %58
22: ; preds = %19
store i32 0, i32* %10
br label %23
23: ; preds = %51, %22
%24 = load i32, i32* %10
%25 = icmp slt i32 %24, 32
br i1 %25, label %26, label %54
26: ; preds = %23
%27 = load [32 x double]*, [32 x double]** %5
%28 = load i32, i32* %7
%29 = load i32, i32* %9
%30 = sub nsw i32 %28, %29
%31 = call i64 @abs(i32 %30)
%32 = getelementptr inbounds [32 x double], [32 x double]* %27, i64 %31
%33 = load i32, i32* %8
%34 = load i32, i32* %10
%35 = sub nsw i32 %33, %34
%36 = call i64 @abs(i32 %35)
%37 = getelementptr inbounds [32 x double], [32 x double]* %32, i64 0, i64 %36
%38 = load double, double* %37
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [32 x [32 x [32 x [32 x double]]]], [32 x [32 x [32 x [32 x double]]]]* @gklt_2d_collapsed.workA, i64 0, i64 %40
%42 = load i32, i32* %8
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [32 x [32 x [32 x double]]], [32 x [32 x [32 x double]]]* %41, i64 0, i64 %43
%45 = load i32, i32* %9
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [32 x [32 x double]], [32 x [32 x double]]* %44, i64 0, i64 %46
%48 = load i32, i32* %10
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [32 x double], [32 x double]* %47, i64 0, i64 %49
store double %38, double* %50
br label %51
51: ; preds = %26
%52 = load i32, i32* %10
%53 = add nsw i32 %52, 1
store i32 %53, i32* %10
br label %23
54: ; preds = %23
br label %55
55: ; preds = %54
%56 = load i32, i32* %9
%57 = add nsw i32 %56, 1
store i32 %57, i32* %9
br label %19
58: ; preds = %19
br label %59
59: ; preds = %58
%60 = load i32, i32* %8
%61 = add nsw i32 %60, 1
store i32 %61, i32* %8
br label %15
62: ; preds = %15
br label %63
63: ; preds = %62
%64 = load i32, i32* %7
%65 = add nsw i32 %64, 1
store i32 %65, i32* %7
br label %11
66: ; preds = %11
%67 = load i32*, i32** %6
%68 = call i32 @flap_4d(double** bitcast ([256 x [256 x double]]* @gklt_2d_collapsed.workB to double**), double**** bitcast ([32 x [32 x [32 x [32 x double]]]]* @gklt_2d_collapsed.workA to double****), i32* %67)
%69 = load [256 x double]*, [256 x double]** %4
%70 = getelementptr inbounds [256 x double], [256 x double]* %69, i64 0
%71 = getelementptr inbounds [256 x double], [256 x double]* %70, i64 0, i64 0
%72 = call i32 @symeigen(double* %71, double* getelementptr inbounds ([256 x [256 x double]], [256 x [256 x double]]* @gklt_2d_collapsed.workB, i64 0, i64 0, i64 0), i32 256)
ret void
}

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