void clapack_ssyevd_simple(char jobz, char uplo, int n, float *a, int lda,
                           float *w, int *info) {
  float fwork;
  int liwork, lwork;
  clapack_ssyevd(jobz, uplo, n, a, lda, w, &fwork, -1, &liwork, -1, info);
  lwork = fwork + 1;
  float *work = (float *)malloc(sizeof(float) * lwork);
  int *iwork = (int *)malloc(sizeof(int) * liwork);
  clapack_ssyevd(jobz, uplo, n, a, lda, w, work, lwork, iwork, liwork, info);
  free(work);
  free(iwork);
}


x86 assembly (clang, -O0):
<clapack_ssyevd_simple>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %sil,%al
mov    %dil,%sil
mov    0x10(%rbp),%rdi
mov    %sil,-0x11(%rbp)
mov    %al,-0x12(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
movsbl -0x11(%rbp),%edi
movsbl -0x12(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x30(%rbp),%r9
mov    0x10(%rbp),%rax
lea    -0x34(%rbp),%r11
lea    -0x38(%rbp),%r10
mov    %r11,(%rsp)
movl   $0xffffffff,0x8(%rsp)
ff
mov    %r10,0x10(%rsp)
movl   $0xffffffff,0x18(%rsp)
ff
mov    %rax,0x20(%rsp)
mov    $0x0,%al
call   1040 <clapack_ssyevd@plt>
movss  0xe55(%rip),%xmm0
addss  -0x34(%rbp),%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x3c(%rbp)
movslq -0x3c(%rbp),%rdi
shl    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x48(%rbp)
movslq -0x38(%rbp),%rdi
shl    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x50(%rbp)
movsbl -0x11(%rbp),%edi
movsbl -0x12(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x30(%rbp),%r9
mov    -0x48(%rbp),%r14
mov    -0x3c(%rbp),%ebx
mov    -0x50(%rbp),%r11
mov    -0x38(%rbp),%r10d
mov    0x10(%rbp),%rax
mov    %r14,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %rax,0x20(%rsp)
mov    $0x0,%al
call   1040 <clapack_ssyevd@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<clapack_ssyevd_simple>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,0x20(%rsp)
mov    %r8d,0xc(%rsp)
mov    %rcx,0x18(%rsp)
mov    %edx,0x8(%rsp)
mov    %esi,%ebx
mov    %edi,%ebp
sub    $0x8,%rsp
lea    0x18(%rsp),%r10
lea    0x1c(%rsp),%r11
xor    %eax,%eax
push   0x68(%rsp)
push   $0xffffffffffffffff
push   %r10
push   $0xffffffffffffffff
push   %r11
call   1040 <clapack_ssyevd@plt>
add    $0x30,%rsp
movss  0x14(%rsp),%xmm0
addss  0xe78(%rip),%xmm0
cvttss2si %xmm0,%eax
movslq %eax,%r12
lea    0x0(,%r12,4),%rdi
call   1050 <malloc@plt>
mov    %rax,%r14
movslq 0x10(%rsp),%r13
mov    %r13,%rdi
shl    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,%r15
sub    $0x8,%rsp
mov    %ebp,%edi
mov    %ebx,%esi
mov    0x10(%rsp),%edx
mov    0x20(%rsp),%rcx
mov    0x14(%rsp),%r8d
mov    0x28(%rsp),%r9
xor    %eax,%eax
push   0x68(%rsp)
push   %r13
push   %r15
push   %r12
push   %r14
call   1040 <clapack_ssyevd@plt>
add    $0x30,%rsp
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @clapack_ssyevd_simple(i8 signext %0, i8 signext %1, i32 %2, float* %3, i32 %4, float* %5, i32* %6) {
%8 = alloca i8
%9 = alloca i8
%10 = alloca i32
%11 = alloca float*
%12 = alloca i32
%13 = alloca float*
%14 = alloca i32*
%15 = alloca float
%16 = alloca i32
%17 = alloca i32
%18 = alloca float*
%19 = alloca i32*
store i8 %0, i8* %8
store i8 %1, i8* %9
store i32 %2, i32* %10
store float* %3, float** %11
store i32 %4, i32* %12
store float* %5, float** %13
store i32* %6, i32** %14
%20 = load i8, i8* %8
%21 = sext i8 %20 to i32
%22 = load i8, i8* %9
%23 = sext i8 %22 to i32
%24 = load i32, i32* %10
%25 = load float*, float** %11
%26 = load i32, i32* %12
%27 = load float*, float** %13
%28 = load i32*, i32** %14
%29 = call i32 (i32, i32, i32, float*, i32, float*, float*, i32, i32*, i32, i32*, ...) bitcast (i32 (...)* @clapack_ssyevd to i32 (i32, i32, i32, float*, i32, float*, float*, i32, i32*, i32, i32*, ...)*)(i32 %21, i32 %23, i32 %24, float* %25, i32 %26, float* %27, float* %15, i32 -1, i32* %16, i32 -1, i32* %28)
%30 = load float, float* %15
%31 = fadd float %30, 1.000000e+00
%32 = fptosi float %31 to i32
store i32 %32, i32* %17
%33 = load i32, i32* %17
%34 = sext i32 %33 to i64
%35 = mul i64 4, %34
%36 = call i8* @malloc(i64 %35)
%37 = bitcast i8* %36 to float*
store float* %37, float** %18
%38 = load i32, i32* %16
%39 = sext i32 %38 to i64
%40 = mul i64 4, %39
%41 = call i8* @malloc(i64 %40)
%42 = bitcast i8* %41 to i32*
store i32* %42, i32** %19
%43 = load i8, i8* %8
%44 = sext i8 %43 to i32
%45 = load i8, i8* %9
%46 = sext i8 %45 to i32
%47 = load i32, i32* %10
%48 = load float*, float** %11
%49 = load i32, i32* %12
%50 = load float*, float** %13
%51 = load float*, float** %18
%52 = load i32, i32* %17
%53 = load i32*, i32** %19
%54 = load i32, i32* %16
%55 = load i32*, i32** %14
%56 = call i32 (i32, i32, i32, float*, i32, float*, float*, i32, i32*, i32, i32*, ...) bitcast (i32 (...)* @clapack_ssyevd to i32 (i32, i32, i32, float*, i32, float*, float*, i32, i32*, i32, i32*, ...)*)(i32 %44, i32 %46, i32 %47, float* %48, i32 %49, float* %50, float* %51, i32 %52, i32* %53, i32 %54, i32* %55)
%57 = load float*, float** %18
%58 = bitcast float* %57 to i8*
%59 = load i32*, i32** %19
%60 = bitcast i32* %59 to i8*
ret void
}

LLVM IR (-O2):
define void @clapack_ssyevd_simple(i8 signext %0, i8 signext %1, i32 %2, float* %3, i32 %4, float* %5, i32* %6) {
%8 = alloca float
%9 = alloca i32
%10 = bitcast float* %8 to i8*
%11 = bitcast i32* %9 to i8*
%12 = sext i8 %0 to i32
%13 = sext i8 %1 to i32
%14 = call i32 (i32, i32, i32, float*, i32, float*, float*, i32, i32*, i32, i32*, ...) bitcast (i32 (...)* @clapack_ssyevd to i32 (i32, i32, i32, float*, i32, float*, float*, i32, i32*, i32, i32*, ...)*)(i32 %12, i32 %13, i32 %2, float* %3, i32 %4, float* %5, float* %8, i32 -1, i32* %9, i32 -1, i32* %6)
%15 = load float, float* %8
%16 = fadd float %15, 1.000000e+00
%17 = fptosi float %16 to i32
%18 = sext i32 %17 to i64
%19 = shl nsw i64 %18, 2
%20 = call i8* @malloc(i64 %19)
%21 = bitcast i8* %20 to float*
%22 = load i32, i32* %9
%23 = sext i32 %22 to i64
%24 = shl nsw i64 %23, 2
%25 = call i8* @malloc(i64 %24)
%26 = bitcast i8* %25 to i32*
%27 = call i32 (i32, i32, i32, float*, i32, float*, float*, i32, i32*, i32, i32*, ...) bitcast (i32 (...)* @clapack_ssyevd to i32 (i32, i32, i32, float*, i32, float*, float*, i32, i32*, i32, i32*, ...)*)(i32 %12, i32 %13, i32 %2, float* %3, i32 %4, float* %5, float* %21, i32 %17, i32* %26, i32 %22, i32* %6)
ret void
}