#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 */
struct aComplex {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ LU_back_substitution(struct aComplex **, int, int *,
                                        struct aComplex *);
int LU_decompose(struct aComplex **, int, double *, int *, double *);
int invert_matrix(struct aComplex **a, int n, double *dwork, int *indx,
                  struct aComplex *col) {
  int pb;
  pb = LU_decompose(a, n, dwork, indx, (double *)NULL);
  if (pb == 0) {
    LU_back_substitution(a, n, indx, col);
  }
  return pb;
}


x86 assembly (clang, -O0):
<invert_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <LU_decompose@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    1175 <invert_matrix+0x55>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1030 <LU_back_substitution@plt>
mov    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<invert_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8,%r14
mov    %rcx,%r15
mov    %esi,%r12d
mov    %rdi,%rbx
xor    %r8d,%r8d
call   1040 <LU_decompose@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    1153 <invert_matrix+0x33>
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <LU_back_substitution@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.aComplex = type { i32 }
define i32 @invert_matrix(%struct.aComplex** %0, i32 %1, double* %2, i32* %3, %struct.aComplex* %4) {
%6 = alloca %struct.aComplex**
%7 = alloca i32
%8 = alloca double*
%9 = alloca i32*
%10 = alloca %struct.aComplex*
%11 = alloca i32
store %struct.aComplex** %0, %struct.aComplex*** %6
store i32 %1, i32* %7
store double* %2, double** %8
store i32* %3, i32** %9
store %struct.aComplex* %4, %struct.aComplex** %10
%12 = load %struct.aComplex**, %struct.aComplex*** %6
%13 = load i32, i32* %7
%14 = load double*, double** %8
%15 = load i32*, i32** %9
%16 = call i32 @LU_decompose(%struct.aComplex** %12, i32 %13, double* %14, i32* %15, double* null)
store i32 %16, i32* %11
%17 = load i32, i32* %11
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %5
%20 = load %struct.aComplex**, %struct.aComplex*** %6
%21 = load i32, i32* %7
%22 = load i32*, i32** %9
%23 = load %struct.aComplex*, %struct.aComplex** %10
%24 = call i32 @LU_back_substitution(%struct.aComplex** %20, i32 %21, i32* %22, %struct.aComplex* %23)
br label %25
25: ; preds = %19, %5
%26 = load i32, i32* %11
ret i32 %26
}

LLVM IR (-O2):
%struct.aComplex = type { i32 }
define i32 @invert_matrix(%struct.aComplex** %0, i32 %1, double* %2, i32* %3, %struct.aComplex* %4) {
%6 = tail call i32 @LU_decompose(%struct.aComplex** %0, i32 %1, double* %2, i32* %3, double* null)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @LU_back_substitution(%struct.aComplex** %0, i32 %1, i32* %3, %struct.aComplex* %4)
br label %10
10: ; preds = %8, %5
ret i32 %6
}