#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ housev(double *, double *, double *, int);
int /*<<< orphan*/ qrevec(double *, double *, double *, int);
int /*<<< orphan*/ trnm(double *, int);
void eigen(double *a, double *ev, int n) {
  double *dp;
  dp = (double *)calloc(n, sizeof(double));
  housev(a, ev, dp, n);
  qrevec(ev, a, dp, n);
  trnm(a, n);
  free(dp);
}


x86 assembly (clang, -O0):
<eigen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1070 <housev@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1040 <qrevec@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <trnm@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eigen>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,%r12
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
mov    %ebx,%ecx
call   1070 <housev@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %ebx,%ecx
call   1040 <qrevec@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   1050 <trnm@plt>
mov    %r12,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @eigen(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca double*
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = call i64 @calloc(i32 %8, i32 8)
%10 = inttoptr i64 %9 to double*
store double* %10, double** %7
%11 = load double*, double** %4
%12 = load double*, double** %5
%13 = load double*, double** %7
%14 = load i32, i32* %6
%15 = call i32 @housev(double* %11, double* %12, double* %13, i32 %14)
%16 = load double*, double** %5
%17 = load double*, double** %4
%18 = load double*, double** %7
%19 = load i32, i32* %6
%20 = call i32 @qrevec(double* %16, double* %17, double* %18, i32 %19)
%21 = load double*, double** %4
%22 = load i32, i32* %6
%23 = call i32 @trnm(double* %21, i32 %22)
%24 = load double*, double** %7
%25 = call i32 @free(double* %24)
ret void
}

LLVM IR (-O2):
define void @eigen(double* %0, double* %1, i32 %2) {
%4 = tail call i64 @calloc(i32 %2, i32 8)
%5 = inttoptr i64 %4 to double*
%6 = tail call i32 @housev(double* %0, double* %1, double* %5, i32 %2)
%7 = tail call i32 @qrevec(double* %1, double* %0, double* %5, i32 %2)
%8 = tail call i32 @trnm(double* %0, i32 %2)
%9 = tail call i32 @free(double* %5)
ret void
}