// File: hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::_det(Matrix)
double Matrix::_det( Matrix in ){  
  uint rows = in._m;
  uint cols = in._n;
  if( rows == 2 ){
    return in._data[0][0]*in._data[1][1] - in._data[1][0]*in._data[0][1];
  }
  if( rows == 1 ){
    return in._data[0][0];
  }
  double sum = 0.0;
  int sign = 1;
  for( uint iter = 0; iter < in._m; iter++ ){
    Matrix out( rows - 1, cols - 1 );
    for( uint i = 1; i < in._m; i++ ){
      for( uint j = 0; j < in._n; j++ ){
	if( j != iter ){
	  out << in._data[i][j];
	}
      }
    }
    sum = sum + in._data[0][iter] * sign * _det( out );
    sign = sign * -1;
  }
  return sum;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rsi, -0xd8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xd0(%rbp)
movl 0x18(%rsi), %eax
movl %eax, -0x1c(%rbp)
movl 0x1c(%rsi), %eax
movl %eax, -0x20(%rbp)
cmpl $0x2, -0x1c(%rbp)
jne 0x5308
movq -0xd8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5ba0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x6360
movq -0xd8(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0xe8(%rbp)
movl $0x1, %esi
callq 0x5ba0
movq %rax, %rdi
movl $0x1, %esi
callq 0x6360
movq -0xd8(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0xe0(%rbp)
movl $0x1, %esi
callq 0x5ba0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x6360
movq -0xd8(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0xf0(%rbp)
xorl %eax, %eax
movl %eax, %esi
callq 0x5ba0
movq %rax, %rdi
movl $0x1, %esi
callq 0x6360
movsd -0xf0(%rbp), %xmm1
movsd -0xe8(%rbp), %xmm0
movsd -0xe0(%rbp), %xmm2
mulsd (%rax), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x54f7
cmpl $0x1, -0x1c(%rbp)
jne 0x5338
movq -0xd8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5ba0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x6360
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x54f7
xorps %xmm0, %xmm0
movsd %xmm0, -0x28(%rbp)
movl $0x1, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movq -0xd8(%rbp), %rcx
movl -0x30(%rbp), %eax
cmpl 0x18(%rcx), %eax
jae 0x54ed
movl -0x1c(%rbp), %esi
subl $0x1, %esi
movl -0x20(%rbp), %edx
subl $0x1, %edx
leaq -0x70(%rbp), %rdi
callq 0x2990
movl $0x1, -0x74(%rbp)
movq -0xd8(%rbp), %rcx
movl -0x74(%rbp), %eax
cmpl 0x18(%rcx), %eax
jae 0x540a
movl $0x0, -0x78(%rbp)
movq -0xd8(%rbp), %rcx
movl -0x78(%rbp), %eax
cmpl 0x1c(%rcx), %eax
jae 0x53fa
movl -0x78(%rbp), %eax
cmpl -0x30(%rbp), %eax
je 0x53ed
movq -0xd8(%rbp), %rdi
movl -0x74(%rbp), %eax
movl %eax, %esi
callq 0x5ba0
movq %rax, %rdi
movl -0x78(%rbp), %eax
movl %eax, %esi
callq 0x6360
movsd (%rax), %xmm0
leaq -0x70(%rbp), %rdi
callq 0x2da0
jmp 0x53d7
jmp 0x53ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x54e2
jmp 0x53ef
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x5393
jmp 0x53fc
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x537d
movq -0xd8(%rbp), %rdi
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x100(%rbp)
xorl %eax, %eax
movl %eax, %esi
callq 0x5ba0
movq %rax, %rdi
movl -0x30(%rbp), %eax
movl %eax, %esi
callq 0x6360
movsd (%rax), %xmm0
cvtsi2sdl -0x2c(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0xf8(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2be0
jmp 0x545b
movq -0xd0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x51f0
movsd %xmm0, -0x108(%rbp)
jmp 0x5478
movsd -0x100(%rbp), %xmm1
movsd -0x108(%rbp), %xmm2
movsd -0xf8(%rbp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x2c30
imull $-0x1, -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x2c30
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x534e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x2c30
leaq -0x70(%rbp), %rdi
callq 0x2c30
jmp 0x5505
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x80(%rbp), %rdi
callq 0x22a0
nop