#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*/ exit(int);
int /*<<< orphan*/ mtranspose(double *, int, int, double *);
int /*<<< orphan*/ printf(char *);
int svd(double *, int, int, double *, double *, double *);
int svd_transpose(double *A, int M, int N, double *U, double *V, double *q) {
  int ret;
  if (M >= N) {
    printf("M>=N. Use svd routine.\n");
    exit(-1);
  }
  mtranspose(A, M, N, V);
  ret = svd(V, N, M, V, U, q);
  return ret;
}


x86 assembly (clang, -O0):
<svd_transpose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     1180 <svd_transpose+0x40>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   1040 <mtranspose@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x28(%rbp),%r9
call   1050 <svd@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<svd_transpose>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    %edx,%esi
jge    117e <svd_transpose+0x3e>
mov    %r9,%r14
mov    %r8,%r12
mov    %rcx,%r15
mov    %edx,%ebx
mov    %esi,%ebp
mov    %r8,%rcx
call   1040 <mtranspose@plt>
mov    %r12,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r12,%rcx
mov    %r15,%r8
mov    %r14,%r9
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <svd@plt>
lea    0xe7b(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"M>=N. Use svd routine.\0A\00"
define i32 @svd_transpose(double* %0, i32 %1, i32 %2, double* %3, double* %4, double* %5) {
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
store double* %0, double** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store double* %3, double** %10
store double* %4, double** %11
store double* %5, double** %12
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = icmp sge i32 %14, %15
br i1 %16, label %17, label %20
17: ; preds = %6
%18 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @exit(i32 -1)
unreachable
20: ; preds = %6
%21 = load double*, double** %7
%22 = load i32, i32* %8
%23 = load i32, i32* %9
%24 = load double*, double** %11
%25 = call i32 @mtranspose(double* %21, i32 %22, i32 %23, double* %24)
%26 = load double*, double** %11
%27 = load i32, i32* %9
%28 = load i32, i32* %8
%29 = load double*, double** %11
%30 = load double*, double** %10
%31 = load double*, double** %12
%32 = call i32 @svd(double* %26, i32 %27, i32 %28, double* %29, double* %30, double* %31)
store i32 %32, i32* %13
%33 = load i32, i32* %13
ret i32 %33
}

LLVM IR (-O2):
@str = [23 x i8] c"M>=N. Use svd routine.\00"
define i32 @svd_transpose(double* %0, i32 %1, i32 %2, double* %3, double* %4, double* %5) {
%7 = icmp slt i32 %1, %2
br i1 %7, label %11, label %8
8: ; preds = %6
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 -1)
unreachable
11: ; preds = %6
%12 = tail call i32 @mtranspose(double* %0, i32 %1, i32 %2, double* %4)
%13 = tail call i32 @svd(double* %4, i32 %2, i32 %1, double* %4, double* %3, double* %5)
ret i32 %13
}