#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*/ eig1(double **, long, double *, double *);
int /*<<< orphan*/ eig2(double *, double *, long, double **);
int /*<<< orphan*/ esort(double *, double **, long, long);
scalar_t__ realloc(double *, long);
void eigen(double **c, long m, long nq) {
  static double *d = NULL, *e = NULL;
  d = (double *)realloc(d, m * sizeof(double));
  e = (double *)realloc(e, m * sizeof(double));
  eig1(c, m, d, e);
  eig2(d, e, m, c);
  esort(d, c, m, nq);
}


x86 assembly (clang, -O0):
<eigen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2eed(%rip),%rdi
mov    -0x10(%rbp),%rsi
shl    $0x3,%rsi
call   1050 <realloc@plt>
mov    %rax,0x2ed9(%rip)
mov    0x2eda(%rip),%rdi
mov    -0x10(%rbp),%rsi
shl    $0x3,%rsi
call   1050 <realloc@plt>
mov    %rax,0x2ec6(%rip)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2eaf(%rip),%rdx
mov    0x2eb0(%rip),%rcx
call   1040 <eig1@plt>
mov    0x2e9c(%rip),%rdi
mov    0x2e9d(%rip),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
call   1060 <eig2@plt>
mov    0x2e81(%rip),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1030 <esort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eigen>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%r15
mov    0x2ef0(%rip),%rdi
lea    0x0(,%rsi,8),%rbx
mov    %rbx,%rsi
call   1050 <realloc@plt>
mov    %rax,0x2ed9(%rip)
mov    0x2eda(%rip),%rdi
mov    %rbx,%rsi
call   1050 <realloc@plt>
mov    %rax,0x2ecb(%rip)
mov    0x2ebc(%rip),%rdx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rax,%rcx
call   1040 <eig1@plt>
mov    0x2ea7(%rip),%rdi
mov    0x2ea8(%rip),%rsi
mov    %r12,%rdx
mov    %r15,%rcx
call   1060 <eig2@plt>
mov    0x2e8e(%rip),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <esort@plt>

LLVM IR (-O0):
@eigen.d = internal global double* null
@eigen.e = internal global double* null
define void @eigen(double** %0, i64 %1, i64 %2) {
%4 = alloca double**
%5 = alloca i64
%6 = alloca i64
store double** %0, double*** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load double*, double** @eigen.d
%8 = load i64, i64* %5
%9 = mul i64 %8, 8
%10 = call i64 @realloc(double* %7, i64 %9)
%11 = inttoptr i64 %10 to double*
store double* %11, double** @eigen.d
%12 = load double*, double** @eigen.e
%13 = load i64, i64* %5
%14 = mul i64 %13, 8
%15 = call i64 @realloc(double* %12, i64 %14)
%16 = inttoptr i64 %15 to double*
store double* %16, double** @eigen.e
%17 = load double**, double*** %4
%18 = load i64, i64* %5
%19 = load double*, double** @eigen.d
%20 = load double*, double** @eigen.e
%21 = call i32 @eig1(double** %17, i64 %18, double* %19, double* %20)
%22 = load double*, double** @eigen.d
%23 = load double*, double** @eigen.e
%24 = load i64, i64* %5
%25 = load double**, double*** %4
%26 = call i32 @eig2(double* %22, double* %23, i64 %24, double** %25)
%27 = load double*, double** @eigen.d
%28 = load double**, double*** %4
%29 = load i64, i64* %5
%30 = load i64, i64* %6
%31 = call i32 @esort(double* %27, double** %28, i64 %29, i64 %30)
ret void
}

LLVM IR (-O2):
@eigen.d = internal unnamed_addr global double* null
@eigen.e = internal unnamed_addr global double* null
define void @eigen(double** %0, i64 %1, i64 %2) {
%4 = load double*, double** @eigen.d
%5 = shl i64 %1, 3
%6 = tail call i64 @realloc(double* %4, i64 %5)
%7 = inttoptr i64 %6 to double*
store double* %7, double** @eigen.d
%8 = load double*, double** @eigen.e
%9 = tail call i64 @realloc(double* %8, i64 %5)
%10 = inttoptr i64 %9 to double*
store double* %10, double** @eigen.e
%11 = load double*, double** @eigen.d
%12 = tail call i32 @eig1(double** %0, i64 %1, double* %11, double* %10)
%13 = load double*, double** @eigen.d
%14 = load double*, double** @eigen.e
%15 = tail call i32 @eig2(double* %13, double* %14, i64 %1, double** %0)
%16 = load double*, double** @eigen.d
%17 = tail call i32 @esort(double* %16, double** %0, i64 %1, i64 %2)
ret void
}