#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*/ clapack_ssyev(char, char, int, float *, int, float *,
                                 float *, int, int *);
int /*<<< orphan*/ free(float *);
scalar_t__ malloc(int);
void clapack_ssyev_simple(char jobz, char uplo, int n, float *a, int lda,
                          float *w, int *info) {
  float fwork;
  clapack_ssyev(jobz, uplo, n, a, lda, w, &fwork, -1, info);
  int lwork = fwork + 1;
  float *work = (float *)malloc(sizeof(float) * lwork);
  clapack_ssyev(jobz, uplo, n, a, lda, w, work, lwork, info);
  free(work);
}


x86 assembly (clang, -O0):
<clapack_ssyev_simple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %sil,%al
mov    %dil,%sil
mov    0x10(%rbp),%rdi
mov    %sil,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    %edx,-0x8(%rbp)
mov    %rcx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x1(%rbp),%dil
mov    -0x2(%rbp),%sil
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    -0x20(%rbp),%r9
mov    0x10(%rbp),%rax
lea    -0x24(%rbp),%r10
movsbl %dil,%edi
movsbl %sil,%esi
mov    %r10,(%rsp)
movl   $0xffffffff,0x8(%rsp)
ff
mov    %rax,0x10(%rsp)
call   1040 <clapack_ssyev@plt>
movss  0xe63(%rip),%xmm0
addss  -0x24(%rbp),%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x28(%rbp)
movslq -0x28(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x1(%rbp),%dil
mov    -0x2(%rbp),%sil
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    -0x20(%rbp),%r9
mov    -0x30(%rbp),%r11
mov    -0x28(%rbp),%r10d
mov    0x10(%rbp),%rax
movsbl %dil,%edi
movsbl %sil,%esi
mov    %r11,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <clapack_ssyev@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clapack_ssyev_simple>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %r8d,0x8(%rsp)
mov    %rcx,%r12
mov    %edx,%r13d
mov    %esi,%ebx
mov    %edi,%ebp
sub    $0x8,%rsp
lea    0x14(%rsp),%r10
push   0x58(%rsp)
push   $0xffffffffffffffff
push   %r10
call   1040 <clapack_ssyev@plt>
add    $0x20,%rsp
movss  0xc(%rsp),%xmm0
addss  0xe86(%rip),%xmm0
cvttss2si %xmm0,%r15d
lea    0x0(,%r15,4),%edi
call   1050 <malloc@plt>
mov    %rax,%r14
sub    $0x8,%rsp
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r13d,%edx
mov    %r12,%rcx
mov    0x10(%rsp),%r8d
mov    0x18(%rsp),%r9
push   0x58(%rsp)
push   %r15
push   %rax
call   1040 <clapack_ssyev@plt>
add    $0x20,%rsp
mov    %r14,%rdi
call   1030 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @clapack_ssyev_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 float*
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
%18 = load i8, i8* %8
%19 = load i8, i8* %9
%20 = load i32, i32* %10
%21 = load float*, float** %11
%22 = load i32, i32* %12
%23 = load float*, float** %13
%24 = load i32*, i32** %14
%25 = call i32 @clapack_ssyev(i8 signext %18, i8 signext %19, i32 %20, float* %21, i32 %22, float* %23, float* %15, i32 -1, i32* %24)
%26 = load float, float* %15
%27 = fadd float %26, 1.000000e+00
%28 = fptosi float %27 to i32
store i32 %28, i32* %16
%29 = load i32, i32* %16
%30 = sext i32 %29 to i64
%31 = mul i64 4, %30
%32 = trunc i64 %31 to i32
%33 = call i64 @malloc(i32 %32)
%34 = inttoptr i64 %33 to float*
store float* %34, float** %17
%35 = load i8, i8* %8
%36 = load i8, i8* %9
%37 = load i32, i32* %10
%38 = load float*, float** %11
%39 = load i32, i32* %12
%40 = load float*, float** %13
%41 = load float*, float** %17
%42 = load i32, i32* %16
%43 = load i32*, i32** %14
%44 = call i32 @clapack_ssyev(i8 signext %35, i8 signext %36, i32 %37, float* %38, i32 %39, float* %40, float* %41, i32 %42, i32* %43)
%45 = load float*, float** %17
%46 = call i32 @free(float* %45)
ret void
}

LLVM IR (-O2):
define void @clapack_ssyev_simple(i8 signext %0, i8 signext %1, i32 %2, float* %3, i32 %4, float* %5, i32* %6) {
%8 = alloca float
%9 = bitcast float* %8 to i8*
%10 = call i32 @clapack_ssyev(i8 signext %0, i8 signext %1, i32 %2, float* %3, i32 %4, float* %5, float* %8, i32 -1, i32* %6)
%11 = load float, float* %8
%12 = fadd float %11, 1.000000e+00
%13 = fptosi float %12 to i32
%14 = shl i32 %13, 2
%15 = call i64 @malloc(i32 %14)
%16 = inttoptr i64 %15 to float*
%17 = call i32 @clapack_ssyev(i8 signext %0, i8 signext %1, i32 %2, float* %3, i32 %4, float* %5, float* %16, i32 %13, i32* %6)
%18 = call i32 @free(float* %16)
ret void
}