#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ dsyeig(char *, char *, char *, int *, double *, int *,
                          double *, double *, int *, int *, int *, double *,
                          double *, int *);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ init_symmetric_matrix(double *, int, int);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  int n = 100;
  int lda = n;
  int ldz = n;
  int nz = n;
  double *A, *W, *Z;
  double vl, vu;
  int il, iu;
  int m;
  A = (double *)malloc((size_t)n * n * sizeof(double));
  assert(A != NULL);
  W = (double *)malloc((size_t)n * sizeof(double));
  assert(W != NULL);
  Z = (double *)malloc((size_t)n * nz * sizeof(double));
  assert(Z != NULL);
  init_symmetric_matrix(A, n, lda);
  dsyeig("Vectors", "All", "Low", &n, A, &lda, &vl, &vu, &il, &iu, &m, W, Z,
         &ldz);
  printf("Successfully computed eigenpairs!\n");
  free(A);
  free(W);
  free(Z);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
movl   $0x0,-0x2c(%rbp)
mov    %edi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
movl   $0x64,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x48(%rbp)
movslq -0x3c(%rbp),%rdi
movslq -0x3c(%rbp),%rax
imul   %rax,%rdi
shl    $0x3,%rdi
call   1080 <malloc@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
movslq -0x3c(%rbp),%rdi
shl    $0x3,%rdi
call   1080 <malloc@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
movslq -0x3c(%rbp),%rdi
movslq -0x48(%rbp),%rax
imul   %rax,%rdi
shl    $0x3,%rdi
call   1080 <malloc@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x50(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x40(%rbp),%edx
call   1060 <init_symmetric_matrix@plt>
mov    -0x50(%rbp),%r8
mov    -0x58(%rbp),%r11
mov    -0x60(%rbp),%r10
lea    0xdca(%rip),%rdi
lea    0xdcb(%rip),%rsi
lea    0xdc8(%rip),%rdx
lea    -0x3c(%rbp),%rcx
lea    -0x40(%rbp),%r9
lea    -0x68(%rbp),%r13
lea    -0x70(%rbp),%r12
lea    -0x74(%rbp),%r15
lea    -0x78(%rbp),%r14
lea    -0x7c(%rbp),%rbx
lea    -0x44(%rbp),%rax
mov    %r13,(%rsp)
mov    %r12,0x8(%rsp)
mov    %r15,0x10(%rsp)
mov    %r14,0x18(%rsp)
mov    %rbx,0x20(%rsp)
mov    %r11,0x28(%rsp)
mov    %r10,0x30(%rsp)
mov    %rax,0x38(%rsp)
call   1040 <dsyeig@plt>
lea    0xd79(%rip),%rdi
call   1050 <printf@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movl   $0x64,0x8(%rsp)
movl   $0x64,0x4(%rsp)
movl   $0x64,(%rsp)
mov    $0x13880,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1070 <assert@plt>
mov    $0x320,%edi
call   1080 <malloc@plt>
mov    %rax,%r14
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1070 <assert@plt>
mov    $0x13880,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
mov    $0x64,%edx
call   1060 <init_symmetric_matrix@plt>
mov    %rsp,%rax
lea    0xc(%rsp),%r10
lea    0x10(%rsp),%r11
lea    0x14(%rsp),%r12
lea    0x18(%rsp),%r13
lea    0x20(%rsp),%rbp
lea    0xdf5(%rip),%rdi
lea    0xdf6(%rip),%rsi
lea    0xdf3(%rip),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r9
mov    %rbx,%r8
push   %rax
push   %r15
push   %r14
push   %r10
push   %r11
push   %r12
push   %r13
push   %rbp
call   1040 <dsyeig@plt>
add    $0x40,%rsp
lea    0xdcc(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Vectors\00"
@.str.1 = [4 x i8] c"All\00"
@.str.2 = [4 x i8] c"Low\00"
@.str.3 = [35 x i8] c"Successfully computed eigenpairs!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double
%14 = alloca double
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 100, i32* %6
%18 = load i32, i32* %6
store i32 %18, i32* %7
%19 = load i32, i32* %6
store i32 %19, i32* %8
%20 = load i32, i32* %6
store i32 %20, i32* %9
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = mul i64 %22, %24
%26 = mul i64 %25, 8
%27 = call i64 @malloc(i64 %26)
%28 = inttoptr i64 %27 to double*
store double* %28, double** %10
%29 = load double*, double** %10
%30 = icmp ne double* %29, null
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = mul i64 %34, 8
%36 = call i64 @malloc(i64 %35)
%37 = inttoptr i64 %36 to double*
store double* %37, double** %11
%38 = load double*, double** %11
%39 = icmp ne double* %38, null
%40 = zext i1 %39 to i32
%41 = call i32 @assert(i32 %40)
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = load i32, i32* %9
%45 = sext i32 %44 to i64
%46 = mul i64 %43, %45
%47 = mul i64 %46, 8
%48 = call i64 @malloc(i64 %47)
%49 = inttoptr i64 %48 to double*
store double* %49, double** %12
%50 = load double*, double** %12
%51 = icmp ne double* %50, null
%52 = zext i1 %51 to i32
%53 = call i32 @assert(i32 %52)
%54 = load double*, double** %10
%55 = load i32, i32* %6
%56 = load i32, i32* %7
%57 = call i32 @init_symmetric_matrix(double* %54, i32 %55, i32 %56)
%58 = load double*, double** %10
%59 = load double*, double** %11
%60 = load double*, double** %12
%61 = call i32 @dsyeig(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %6, double* %58, i32* %7, double* %13, double* %14, i32* %15, i32* %16, i32* %17, double* %59, double* %60, i32* %8)
%62 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%63 = load double*, double** %10
%64 = call i32 @free(double* %63)
%65 = load double*, double** %11
%66 = call i32 @free(double* %65)
%67 = load double*, double** %12
%68 = call i32 @free(double* %67)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"Vectors\00"
@.str.1 = [4 x i8] c"All\00"
@.str.2 = [4 x i8] c"Low\00"
@str = [34 x i8] c"Successfully computed eigenpairs!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = bitcast i32* %3 to i8*
store i32 100, i32* %3
%12 = bitcast i32* %4 to i8*
store i32 100, i32* %4
%13 = bitcast i32* %5 to i8*
store i32 100, i32* %5
%14 = bitcast double* %6 to i8*
%15 = bitcast double* %7 to i8*
%16 = bitcast i32* %8 to i8*
%17 = bitcast i32* %9 to i8*
%18 = bitcast i32* %10 to i8*
%19 = tail call i64 @malloc(i64 80000)
%20 = inttoptr i64 %19 to double*
%21 = icmp ne i64 %19, 0
%22 = zext i1 %21 to i32
%23 = tail call i32 @assert(i32 %22)
%24 = tail call i64 @malloc(i64 800)
%25 = inttoptr i64 %24 to double*
%26 = icmp ne i64 %24, 0
%27 = zext i1 %26 to i32
%28 = tail call i32 @assert(i32 %27)
%29 = tail call i64 @malloc(i64 80000)
%30 = inttoptr i64 %29 to double*
%31 = icmp ne i64 %29, 0
%32 = zext i1 %31 to i32
%33 = tail call i32 @assert(i32 %32)
%34 = tail call i32 @init_symmetric_matrix(double* %20, i32 100, i32 100)
%35 = call i32 @dsyeig(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %3, double* %20, i32* %4, double* %6, double* %7, i32* %8, i32* %9, i32* %10, double* %25, double* %30, i32* %5)
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%37 = call i32 @free(double* %20)
%38 = call i32 @free(double* %25)
%39 = call i32 @free(double* %30)
ret i32 0
}