#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*/ LA_svd_(int *, int *, int *, int *, double *, double *,
                           double *, double *, int *);
int /*<<< orphan*/ free(double *);
double *malloc(int);
int main() {
  int nu = 3, nv = 3, m = 10, n = 3, info = 0;
  double *x = malloc(m * n * sizeof(double));
  double *s = malloc(n * sizeof(double));
  double *u = malloc(m * n * sizeof(double));
  double *vt = malloc(n * n * sizeof(double));
  LA_svd_(&nu, &nv, &m, &n, x, s, u, vt, &info);
  free(x);
  free(s);
  free(u);
  free(vt);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
movl   $0xa,-0x10(%rbp)
movl   $0x3,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    -0x30(%rbp),%r11
mov    -0x38(%rbp),%r10
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <LA_svd_@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x3,0x14(%rsp)
movl   $0x3,0x10(%rsp)
movl   $0xa,0xc(%rsp)
movl   $0x3,0x8(%rsp)
movl   $0x0,0x4(%rsp)
mov    $0xf0,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    $0x18,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
mov    $0xf0,%edi
call   1050 <malloc@plt>
mov    %rax,%r12
mov    $0x48,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
sub    $0x8,%rsp
lea    0xc(%rsp),%rax
lea    0x1c(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
mov    %r14,%r8
mov    %r15,%r9
push   %rax
push   %rbx
push   %r12
call   1040 <LA_svd_@plt>
add    $0x20,%rsp
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
store i32 0, i32* %1
store i32 3, i32* %2
store i32 3, i32* %3
store i32 10, i32* %4
store i32 3, i32* %5
store i32 0, i32* %6
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = mul nsw i32 %11, %12
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 8
%16 = trunc i64 %15 to i32
%17 = call double* @malloc(i32 %16)
store double* %17, double** %7
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = mul i64 %19, 8
%21 = trunc i64 %20 to i32
%22 = call double* @malloc(i32 %21)
store double* %22, double** %8
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = mul nsw i32 %23, %24
%26 = sext i32 %25 to i64
%27 = mul i64 %26, 8
%28 = trunc i64 %27 to i32
%29 = call double* @malloc(i32 %28)
store double* %29, double** %9
%30 = load i32, i32* %5
%31 = load i32, i32* %5
%32 = mul nsw i32 %30, %31
%33 = sext i32 %32 to i64
%34 = mul i64 %33, 8
%35 = trunc i64 %34 to i32
%36 = call double* @malloc(i32 %35)
store double* %36, double** %10
%37 = load double*, double** %7
%38 = load double*, double** %8
%39 = load double*, double** %9
%40 = load double*, double** %10
%41 = call i32 @LA_svd_(i32* %2, i32* %3, i32* %4, i32* %5, double* %37, double* %38, double* %39, double* %40, i32* %6)
%42 = load double*, double** %7
%43 = call i32 @free(double* %42)
%44 = load double*, double** %8
%45 = call i32 @free(double* %44)
%46 = load double*, double** %9
%47 = call i32 @free(double* %46)
%48 = load double*, double** %10
%49 = call i32 @free(double* %48)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %1 to i8*
store i32 3, i32* %1
%7 = bitcast i32* %2 to i8*
store i32 3, i32* %2
%8 = bitcast i32* %3 to i8*
store i32 10, i32* %3
%9 = bitcast i32* %4 to i8*
store i32 3, i32* %4
%10 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%11 = tail call double* @malloc(i32 240)
%12 = tail call double* @malloc(i32 24)
%13 = tail call double* @malloc(i32 240)
%14 = tail call double* @malloc(i32 72)
%15 = call i32 @LA_svd_(i32* %1, i32* %2, i32* %3, i32* %4, double* %11, double* %12, double* %13, double* %14, i32* %5)
%16 = call i32 @free(double* %11)
%17 = call i32 @free(double* %12)
%18 = call i32 @free(double* %13)
%19 = call i32 @free(double* %14)
ret i32 0
}