#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 */
double Determinant22(double **);
int Inverse22(double m[2][2], double i[2][2]) {
  double det;
  det = Determinant22(m);
  if (det <= 0.000001)
    return (0);
  i[0][0] = m[1][1] / det;
  i[0][1] = -m[0][1] / det;
  i[1][0] = -m[1][0] / det;
  i[1][1] = m[0][0] / det;
  return (1);
}


x86 assembly (clang, -O0):
<Inverse22>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <Determinant22@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  0xeca(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     114d <Inverse22+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    11dc <Inverse22+0xcc>
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x18(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Inverse22>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <Determinant22@plt>
xor    %eax,%eax
movsd  0xed7(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    117e <Inverse22+0x6e>
movsd  0x18(%rbx),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
movsd  0x8(%rbx),%xmm1
movapd 0xec6(%rip),%xmm2
xorpd  %xmm2,%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%r14)
movsd  0x10(%rbx),%xmm1
xorpd  %xmm2,%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%r14)
movsd  (%rbx),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%r14)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @Inverse22([2 x double]* %0, [2 x double]* %1) {
%3 = alloca i32
%4 = alloca [2 x double]*
%5 = alloca [2 x double]*
%6 = alloca double
store [2 x double]* %0, [2 x double]** %4
store [2 x double]* %1, [2 x double]** %5
%7 = load [2 x double]*, [2 x double]** %4
%8 = bitcast [2 x double]* %7 to double**
%9 = call double @Determinant22(double** %8)
store double %9, double* %6
%10 = load double, double* %6
%11 = fcmp ole double %10, 0x3EB0C6F7A0B5ED8D
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 0, i32* %3
br label %52
13: ; preds = %2
%14 = load [2 x double]*, [2 x double]** %4
%15 = getelementptr inbounds [2 x double], [2 x double]* %14, i64 1
%16 = getelementptr inbounds [2 x double], [2 x double]* %15, i64 0, i64 1
%17 = load double, double* %16
%18 = load double, double* %6
%19 = fdiv double %17, %18
%20 = load [2 x double]*, [2 x double]** %5
%21 = getelementptr inbounds [2 x double], [2 x double]* %20, i64 0
%22 = getelementptr inbounds [2 x double], [2 x double]* %21, i64 0, i64 0
store double %19, double* %22
%23 = load [2 x double]*, [2 x double]** %4
%24 = getelementptr inbounds [2 x double], [2 x double]* %23, i64 0
%25 = getelementptr inbounds [2 x double], [2 x double]* %24, i64 0, i64 1
%26 = load double, double* %25
%27 = fneg double %26
%28 = load double, double* %6
%29 = fdiv double %27, %28
%30 = load [2 x double]*, [2 x double]** %5
%31 = getelementptr inbounds [2 x double], [2 x double]* %30, i64 0
%32 = getelementptr inbounds [2 x double], [2 x double]* %31, i64 0, i64 1
store double %29, double* %32
%33 = load [2 x double]*, [2 x double]** %4
%34 = getelementptr inbounds [2 x double], [2 x double]* %33, i64 1
%35 = getelementptr inbounds [2 x double], [2 x double]* %34, i64 0, i64 0
%36 = load double, double* %35
%37 = fneg double %36
%38 = load double, double* %6
%39 = fdiv double %37, %38
%40 = load [2 x double]*, [2 x double]** %5
%41 = getelementptr inbounds [2 x double], [2 x double]* %40, i64 1
%42 = getelementptr inbounds [2 x double], [2 x double]* %41, i64 0, i64 0
store double %39, double* %42
%43 = load [2 x double]*, [2 x double]** %4
%44 = getelementptr inbounds [2 x double], [2 x double]* %43, i64 0
%45 = getelementptr inbounds [2 x double], [2 x double]* %44, i64 0, i64 0
%46 = load double, double* %45
%47 = load double, double* %6
%48 = fdiv double %46, %47
%49 = load [2 x double]*, [2 x double]** %5
%50 = getelementptr inbounds [2 x double], [2 x double]* %49, i64 1
%51 = getelementptr inbounds [2 x double], [2 x double]* %50, i64 0, i64 1
store double %48, double* %51
store i32 1, i32* %3
br label %52
52: ; preds = %13, %12
%53 = load i32, i32* %3
ret i32 %53
}

LLVM IR (-O2):
define i32 @Inverse22([2 x double]* %0, [2 x double]* nocapture writeonly %1) {
%3 = bitcast [2 x double]* %0 to double**
%4 = tail call double @Determinant22(double** %3)
%5 = fcmp ugt double %4, 0x3EB0C6F7A0B5ED8D
br i1 %5, label %6, label %25
6: ; preds = %2
%7 = getelementptr inbounds [2 x double], [2 x double]* %0, i64 1, i64 1
%8 = load double, double* %7
%9 = fdiv double %8, %4
%10 = getelementptr inbounds [2 x double], [2 x double]* %1, i64 0, i64 0
store double %9, double* %10
%11 = getelementptr inbounds [2 x double], [2 x double]* %0, i64 0, i64 1
%12 = load double, double* %11
%13 = fneg double %12
%14 = fdiv double %13, %4
%15 = getelementptr inbounds [2 x double], [2 x double]* %1, i64 0, i64 1
store double %14, double* %15
%16 = getelementptr inbounds [2 x double], [2 x double]* %0, i64 1, i64 0
%17 = load double, double* %16
%18 = fneg double %17
%19 = fdiv double %18, %4
%20 = getelementptr inbounds [2 x double], [2 x double]* %1, i64 1, i64 0
store double %19, double* %20
%21 = getelementptr inbounds [2 x double], [2 x double]* %0, i64 0, i64 0
%22 = load double, double* %21
%23 = fdiv double %22, %4
%24 = getelementptr inbounds [2 x double], [2 x double]* %1, i64 1, i64 1
store double %23, double* %24
br label %25
25: ; preds = %2, %6
%26 = phi i32 [ 1, %6 ], [ 0, %2 ]
ret i32 %26
}