#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*/ inv_matrix_det_inc(float *, float *, int *, int, int);
float inv_matrix_det(float *p, int *n) {
  float d[10][10], sum = 0;
  int i, j, m;
  m = *n;
  if (*n == 2)
    return (*p * *(p + 11) - *(p + 1) * *(p + 10));
  for (i = 0, j = 0; j < m; j++) {
    *n = m;
    inv_matrix_det_inc(p, &d[0][0], n, i, j);
    sum = sum + *(p + 10 * i + j) * ((int)(i + j) & 1 ? -1 : 1) *
                    inv_matrix_det(&d[0][0], n);
  }
  return (sum);
}


x86 assembly (clang, -O0):
<inv_matrix_det>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1b4(%rbp)
ff
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c0(%rbp)
mov    -0x18(%rbp),%rax
cmpl   $0x2,(%rax)
jne    1199 <inv_matrix_det+0x79>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  0x2c(%rax),%xmm2
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulss  0x28(%rax),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    12a0 <inv_matrix_det+0x180>
movl   $0x0,-0x1b8(%rbp)
movl   $0x0,-0x1bc(%rbp)
mov    -0x1bc(%rbp),%eax
cmp    -0x1c0(%rbp),%eax
jge    1293 <inv_matrix_det+0x173>
mov    -0x1c0(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
lea    -0x1b0(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1b8(%rbp),%ecx
mov    -0x1bc(%rbp),%r8d
call   1040 <inv_matrix_det_inc@plt>
movss  -0x1b4(%rbp),%xmm0
ff
movss  %xmm0,-0x1c8(%rbp)
ff
mov    -0x10(%rbp),%rax
imul   $0xa,-0x1b8(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x1bc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x1b8(%rbp),%edx
add    -0x1bc(%rbp),%edx
and    $0x1,%edx
mov    $0x1,%eax
mov    $0xffffffff,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x1c4(%rbp)
ff
lea    -0x1b0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <inv_matrix_det@plt>
movss  -0x1c8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movss  -0x1c4(%rbp),%xmm0
ff
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1b4(%rbp)
ff
mov    -0x1bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1bc(%rbp)
jmp    11ad <inv_matrix_det+0x8d>
movss  -0x1b4(%rbp),%xmm0
ff
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inv_matrix_det>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a0,%rsp
mov    %rdi,%r14
mov    (%rsi),%r13d
cmp    $0x2,%r13
jne    115c <inv_matrix_det+0x3c>
movss  0x28(%r14),%xmm1
mulss  0x4(%r14),%xmm1
movss  (%r14),%xmm0
mulss  0x2c(%r14),%xmm0
subss  %xmm1,%xmm0
jmp    11e0 <inv_matrix_det+0xc0>
test   %r13d,%r13d
jle    11dd <inv_matrix_det+0xbd>
mov    %rsi,%r15
xorps  %xmm0,%xmm0
xor    %ebx,%ebx
lea    0x10(%rsp),%r12
xchg   %ax,%ax
movss  %xmm0,0x8(%rsp)
mov    %r13d,(%r15)
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
xor    %ecx,%ecx
mov    %ebx,%r8d
call   1040 <inv_matrix_det_inc@plt>
mov    %ebx,%eax
and    $0x1,%eax
neg    %eax
sbb    %eax,%eax
or     $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  (%r14,%rbx,4),%xmm0
movss  %xmm0,0xc(%rsp)
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <inv_matrix_det@plt>
mulss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x8(%rsp)
movss  0x8(%rsp),%xmm0
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1170 <inv_matrix_det+0x50>
jmp    11e0 <inv_matrix_det+0xc0>
xorps  %xmm0,%xmm0
add    $0x1a0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define float @inv_matrix_det(float* %0, i32* %1) {
%3 = alloca float
%4 = alloca float*
%5 = alloca i32*
%6 = alloca [10 x [10 x float]]
%7 = alloca float
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store float* %0, float** %4
store i32* %1, i32** %5
store float 0.000000e+00, float* %7
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
store i32 %12, i32* %10
%13 = load i32*, i32** %5
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %31
16: ; preds = %2
%17 = load float*, float** %4
%18 = load float, float* %17
%19 = load float*, float** %4
%20 = getelementptr inbounds float, float* %19, i64 11
%21 = load float, float* %20
%22 = load float*, float** %4
%23 = getelementptr inbounds float, float* %22, i64 1
%24 = load float, float* %23
%25 = load float*, float** %4
%26 = getelementptr inbounds float, float* %25, i64 10
%27 = load float, float* %26
%28 = fmul float %24, %27
%29 = fneg float %28
%30 = call float @llvm.fmuladd.f32(float %18, float %21, float %29)
store float %30, float* %3
br label %75
31: ; preds = %2
store i32 0, i32* %8
store i32 0, i32* %9
br label %32
32: ; preds = %70, %31
%33 = load i32, i32* %9
%34 = load i32, i32* %10
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %73
36: ; preds = %32
%37 = load i32, i32* %10
%38 = load i32*, i32** %5
store i32 %37, i32* %38
%39 = load float*, float** %4
%40 = getelementptr inbounds [10 x [10 x float]], [10 x [10 x float]]* %6, i64 0, i64 0
%41 = getelementptr inbounds [10 x float], [10 x float]* %40, i64 0, i64 0
%42 = load i32*, i32** %5
%43 = load i32, i32* %8
%44 = load i32, i32* %9
%45 = call i32 @inv_matrix_det_inc(float* %39, float* %41, i32* %42, i32 %43, i32 %44)
%46 = load float, float* %7
%47 = load float*, float** %4
%48 = load i32, i32* %8
%49 = mul nsw i32 10, %48
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds float, float* %47, i64 %50
%52 = load i32, i32* %9
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds float, float* %51, i64 %53
%55 = load float, float* %54
%56 = load i32, i32* %8
%57 = load i32, i32* %9
%58 = add nsw i32 %56, %57
%59 = and i32 %58, 1
%60 = icmp ne i32 %59, 0
%61 = zext i1 %60 to i64
%62 = select i1 %60, i32 -1, i32 1
%63 = sitofp i32 %62 to float
%64 = fmul float %55, %63
%65 = getelementptr inbounds [10 x [10 x float]], [10 x [10 x float]]* %6, i64 0, i64 0
%66 = getelementptr inbounds [10 x float], [10 x float]* %65, i64 0, i64 0
%67 = load i32*, i32** %5
%68 = call float @inv_matrix_det(float* %66, i32* %67)
%69 = call float @llvm.fmuladd.f32(float %64, float %68, float %46)
store float %69, float* %7
br label %70
70: ; preds = %36
%71 = load i32, i32* %9
%72 = add nsw i32 %71, 1
store i32 %72, i32* %9
br label %32
73: ; preds = %32
%74 = load float, float* %7
store float %74, float* %3
br label %75
75: ; preds = %73, %16
%76 = load float, float* %3
ret float %76
}

LLVM IR (-O2):
define float @inv_matrix_det(float* %0, i32* %1) {
%3 = alloca [10 x [10 x float]]
%4 = bitcast [10 x [10 x float]]* %3 to i8*
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 2
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = icmp sgt i32 %5, 0
br i1 %8, label %9, label %39
9: ; preds = %7
%10 = getelementptr inbounds [10 x [10 x float]], [10 x [10 x float]]* %3, i64 0, i64 0, i64 0
%11 = zext i32 %5 to i64
br label %23
12: ; preds = %2
%13 = load float, float* %0
%14 = getelementptr inbounds float, float* %0, i64 11
%15 = load float, float* %14
%16 = getelementptr inbounds float, float* %0, i64 1
%17 = load float, float* %16
%18 = getelementptr inbounds float, float* %0, i64 10
%19 = load float, float* %18
%20 = fneg float %17
%21 = fmul float %19, %20
%22 = tail call float @llvm.fmuladd.f32(float %13, float %15, float %21)
br label %39
23: ; preds = %9, %23
%24 = phi i64 [ 0, %9 ], [ %37, %23 ]
%25 = phi float [ 0.000000e+00, %9 ], [ %36, %23 ]
store i32 %5, i32* %1
%26 = trunc i64 %24 to i32
%27 = call i32 @inv_matrix_det_inc(float* %0, float* %10, i32* %1, i32 0, i32 %26)
%28 = getelementptr inbounds float, float* %0, i64 %24
%29 = load float, float* %28
%30 = and i32 %26, 1
%31 = icmp eq i32 %30, 0
%32 = select i1 %31, i32 1, i32 -1
%33 = sitofp i32 %32 to float
%34 = fmul float %29, %33
%35 = call float @inv_matrix_det(float* %10, i32* %1)
%36 = call float @llvm.fmuladd.f32(float %34, float %35, float %25)
%37 = add nuw nsw i64 %24, 1
%38 = icmp eq i64 %37, %11
br i1 %38, label %39, label %23
39: ; preds = %23, %7, %12
%40 = phi float [ %22, %12 ], [ 0.000000e+00, %7 ], [ %36, %23 ]
ret float %40
}