#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*/ dlaswp_3l(int, double *, int, int /*<<< orphan*/, int,
                             int *);
int /*<<< orphan*/ dtrsm_l_l_n_u_3l(int, int, double *, int, double *, int);
int /*<<< orphan*/ dtrsm_l_u_n_n_3l(int, int, double *, int, double *, int);
void dgetrs_3l(int n, int nrhs, double *A, int lda, int *ipiv, double *B,
               int ldb) {
  if (n == 0 || nrhs == 0)
    return;
  dlaswp_3l(nrhs, B, ldb, 0, n, ipiv);
  dtrsm_l_l_n_u_3l(n, nrhs, A, lda, B, ldb);
  dtrsm_l_u_n_n_3l(n, nrhs, A, lda, B, ldb);
  return;
}


x86 assembly (clang, -O0):
<dgetrs_3l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1164 <dgetrs_3l+0x34>
cmpl   $0x0,-0x8(%rbp)
jne    1169 <dgetrs_3l+0x39>
jmp    11b6 <dgetrs_3l+0x86>
mov    -0x8(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    0x10(%rbp),%edx
mov    -0x4(%rbp),%r8d
mov    -0x20(%rbp),%r9
xor    %ecx,%ecx
call   1040 <dlaswp_3l@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    0x10(%rbp),%r9d
call   1050 <dtrsm_l_l_n_u_3l@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    0x10(%rbp),%r9d
call   1030 <dtrsm_l_u_n_n_3l@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dgetrs_3l>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
je     11a2 <dgetrs_3l+0x72>
mov    %esi,%ebp
test   %esi,%esi
je     11a2 <dgetrs_3l+0x72>
mov    %r9,%r12
mov    %r8,%r9
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %edi,%ebx
mov    0x40(%rsp),%r13d
mov    %ebp,%edi
mov    %r12,%rsi
mov    %r13d,%edx
xor    %ecx,%ecx
mov    %ebx,%r8d
call   1040 <dlaswp_3l@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r15,%rdx
mov    %r14d,%ecx
mov    %r12,%r8
mov    %r13d,%r9d
call   1050 <dtrsm_l_l_n_u_3l@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r15,%rdx
mov    %r14d,%ecx
mov    %r12,%r8
mov    %r13d,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <dtrsm_l_u_n_n_3l@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @dgetrs_3l(i32 %0, i32 %1, double* %2, i32 %3, i32* %4, double* %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32*
%13 = alloca double*
%14 = alloca i32
store i32 %0, i32* %8
store i32 %1, i32* %9
store double* %2, double** %10
store i32 %3, i32* %11
store i32* %4, i32** %12
store double* %5, double** %13
store i32 %6, i32* %14
%15 = load i32, i32* %8
%16 = icmp eq i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %7
%18 = load i32, i32* %9
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %17, %7
br label %42
21: ; preds = %17
%22 = load i32, i32* %9
%23 = load double*, double** %13
%24 = load i32, i32* %14
%25 = load i32, i32* %8
%26 = load i32*, i32** %12
%27 = call i32 @dlaswp_3l(i32 %22, double* %23, i32 %24, i32 0, i32 %25, i32* %26)
%28 = load i32, i32* %8
%29 = load i32, i32* %9
%30 = load double*, double** %10
%31 = load i32, i32* %11
%32 = load double*, double** %13
%33 = load i32, i32* %14
%34 = call i32 @dtrsm_l_l_n_u_3l(i32 %28, i32 %29, double* %30, i32 %31, double* %32, i32 %33)
%35 = load i32, i32* %8
%36 = load i32, i32* %9
%37 = load double*, double** %10
%38 = load i32, i32* %11
%39 = load double*, double** %13
%40 = load i32, i32* %14
%41 = call i32 @dtrsm_l_u_n_n_3l(i32 %35, i32 %36, double* %37, i32 %38, double* %39, i32 %40)
br label %42
42: ; preds = %21, %20
ret void
}

LLVM IR (-O2):
define void @dgetrs_3l(i32 %0, i32 %1, double* %2, i32 %3, i32* %4, double* %5, i32 %6) {
%8 = icmp eq i32 %0, 0
%9 = icmp eq i32 %1, 0
%10 = or i1 %8, %9
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = tail call i32 @dlaswp_3l(i32 %1, double* %5, i32 %6, i32 0, i32 %0, i32* %4)
%13 = tail call i32 @dtrsm_l_l_n_u_3l(i32 %0, i32 %1, double* %2, i32 %3, double* %5, i32 %6)
%14 = tail call i32 @dtrsm_l_u_n_n_3l(i32 %0, i32 %1, double* %2, i32 %3, double* %5, i32 %6)
br label %15
15: ; preds = %7, %11
ret void
}