#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*/ dgetrs_(char *, int *, int *, double *, int *, int *,
                           double *, int *, int *);
int lusolve(int N, double *A, double *B) {
  char trans = 'N';
  int info;
  int lda = N;
  int ldb = N;
  int NRHS = 1;
  int ipiv[N];
  dgetrs_(&trans, &N, &NRHS, A, &lda, ipiv, B, &ldb, &info);
  return info;
}


x86 assembly (clang, -O0):
<lusolve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movb   $0x4e,-0x19(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%r9
sub    %rcx,%r9
mov    %r9,%rsp
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r11
lea    -0x19(%rbp),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
lea    -0x24(%rbp),%r8
lea    -0x28(%rbp),%r10
lea    -0x20(%rbp),%rax
sub    $0x20,%rsp
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <dgetrs_@plt>
add    $0x20,%rsp
mov    -0x20(%rbp),%eax
mov    -0x38(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lusolve>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rax
mov    %rsi,%rcx
mov    %rsp,%rbx
mov    %edi,-0x20(%rbp)
movb   $0x4e,-0x9(%rbp)
mov    %edi,-0x18(%rbp)
mov    %edi,-0x14(%rbp)
movl   $0x1,-0x10(%rbp)
mov    %edi,%edx
mov    %rsp,%r9
lea    0xf(,%rdx,4),%rdx
and    $0xfffffffffffffff0,%rdx
sub    %rdx,%r9
mov    %r9,%rsp
sub    $0x8,%rsp
lea    -0x1c(%rbp),%r10
lea    -0x14(%rbp),%r11
lea    -0x9(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%r8
push   %r10
push   %r11
push   %rax
call   1030 <dgetrs_@plt>
add    $0x20,%rsp
mov    -0x1c(%rbp),%eax
mov    %rbx,%rsp
lea    -0x8(%rbp),%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @lusolve(i32 %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca i8
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i64
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
store i8 78, i8* %7
%14 = load i32, i32* %4
store i32 %14, i32* %9
%15 = load i32, i32* %4
store i32 %15, i32* %10
store i32 1, i32* %11
%16 = load i32, i32* %4
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %12
%19 = alloca i32, i64 %17
store i64 %17, i64* %13
%20 = load double*, double** %5
%21 = load double*, double** %6
%22 = call i32 @dgetrs_(i8* %7, i32* %4, i32* %11, double* %20, i32* %9, i32* %19, double* %21, i32* %10, i32* %8)
%23 = load i32, i32* %8
%24 = load i8*, i8** %12
ret i32 %23
}

LLVM IR (-O2):
define i32 @lusolve(i32 %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i8 78, i8* %5
%10 = bitcast i32* %6 to i8*
%11 = bitcast i32* %7 to i8*
store i32 %0, i32* %7
%12 = bitcast i32* %8 to i8*
store i32 %0, i32* %8
%13 = bitcast i32* %9 to i8*
store i32 1, i32* %9
%14 = zext i32 %0 to i64
%15 = tail call i8* @llvm.stacksave()
%16 = alloca i32, i64 %14
%17 = call i32 @dgetrs_(i8* %5, i32* %4, i32* %9, double* %1, i32* %7, i32* %16, double* %2, i32* %8, i32* %6)
%18 = load i32, i32* %6
ret i32 %18
}