#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*/ inverseOfMatrix(double **, double **, int);
int /*<<< orphan*/ multiplyMatrix(double **, double **, double **, int, int,
                                  int);
int /*<<< orphan*/ transpose(double **, double **, int, int);
void solveWithInverseMethod(double A[][100], double b[], double x[], int m,
                            int n) {
  double tempx[100][100];
  double tempb[100][100];
  double transp[100][100];
  double inverse[100][100];
  double result1[100][100];
  double result2[100][100];
  int i, j;
  for (i = 1; i <= m; i++)
    tempb[i][1] = b[i];
  transpose(A, transp, m, n);
  multiplyMatrix(transp, A, result1, n, m, n);
  inverseOfMatrix(result1, inverse, n);
  multiplyMatrix(transp, tempb, result2, n, m, 1);
  multiplyMatrix(inverse, result2, tempx, n, n, 1);
  for (i = 1; i <= m; i++)
    x[i] = tempx[i][1];
}


x86 assembly (clang, -O0):
<solveWithInverseMethod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x75330,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
movl   $0x1,-0x75324(%rbp)
mov    -0x75324(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     11a8 <solveWithInverseMethod+0x78>
mov    -0x10(%rbp),%rax
movslq -0x75324(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x75324(%rbp),%rcx
lea    -0x27120(%rbp),%rax
imul   $0x320,%rcx,%rcx
add    %rcx,%rax
movsd  %xmm0,0x8(%rax)
mov    -0x75324(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x75324(%rbp)
jmp    1158 <solveWithInverseMethod+0x28>
mov    -0x8(%rbp),%rdi
lea    -0x3a9a0(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1040 <transpose@plt>
lea    -0x3a9a0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
lea    -0x61aa0(%rbp),%rdx
mov    -0x20(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
call   1050 <multiplyMatrix@plt>
lea    -0x61aa0(%rbp),%rdi
lea    -0x4e220(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1030 <inverseOfMatrix@plt>
lea    -0x3a9a0(%rbp),%rdi
lea    -0x27120(%rbp),%rsi
lea    -0x75320(%rbp),%rdx
mov    -0x20(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    $0x1,%r9d
call   1050 <multiplyMatrix@plt>
lea    -0x4e220(%rbp),%rdi
lea    -0x75320(%rbp),%rsi
lea    -0x138a0(%rbp),%rdx
mov    -0x20(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    $0x1,%r9d
call   1050 <multiplyMatrix@plt>
movl   $0x1,-0x75324(%rbp)
mov    -0x75324(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     129e <solveWithInverseMethod+0x16e>
movslq -0x75324(%rbp),%rcx
lea    -0x138a0(%rbp),%rax
imul   $0x320,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x75324(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x75324(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x75324(%rbp)
jmp    124e <solveWithInverseMethod+0x11e>
add    $0x75330,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solveWithInverseMethod>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x75308,%rsp
mov    %r8d,%r13d
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %ecx,%r15d
test   %ecx,%ecx
jle    1209 <solveWithInverseMethod+0xd9>
lea    -0x1(%r15),%rdx
mov    %r15d,%eax
and    $0x3,%eax
mov    $0x1,%ecx
cmp    $0x3,%rdx
jb     11c9 <solveWithInverseMethod+0x99>
mov    %r15d,%edx
and    $0xfffffffc,%edx
lea    0xc88(%rsp),%rbp
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
movsd  0x8(%rsi,%rcx,8),%xmm0
movsd  %xmm0,-0x960(%rbp)
ff
movsd  0x10(%rsi,%rcx,8),%xmm0
movsd  %xmm0,-0x640(%rbp)
ff
movsd  0x18(%rsi,%rcx,8),%xmm0
movsd  %xmm0,-0x320(%rbp)
ff
movsd  0x20(%rsi,%rcx,8),%xmm0
movsd  %xmm0,0x0(%rbp)
add    $0x4,%rcx
add    $0xc80,%rbp
cmp    %rcx,%rdx
jne    1180 <solveWithInverseMethod+0x50>
add    $0x1,%rcx
test   %rax,%rax
je     1209 <solveWithInverseMethod+0xd9>
imul   $0x320,%rcx,%rdx
add    %rsp,%rdx
add    $0x8,%rdx
lea    (%rsi,%rcx,8),%rcx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rcx,%rsi,8),%xmm0
movsd  %xmm0,(%rdx)
add    $0x1,%rsi
add    $0x320,%rdx
cmp    %rsi,%rax
jne    11f0 <solveWithInverseMethod+0xc0>
lea    0x27100(%rsp),%rbp
mov    %rbp,%rsi
mov    %r14d,%edx
mov    %r13d,%ecx
mov    %rdi,%r12
call   1040 <transpose@plt>
lea    0x4e200(%rsp),%rdx
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %rdx,%rbp
mov    %r13d,%ecx
mov    %r14d,%r8d
mov    %r13d,%r9d
call   1050 <multiplyMatrix@plt>
lea    0x61a80(%rsp),%r12
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %r13d,%edx
call   1030 <inverseOfMatrix@plt>
mov    %rsp,%rsi
lea    0x3a980(%rsp),%rbp
lea    0x27100(%rsp),%rdi
mov    %rbp,%rdx
mov    %r13d,%ecx
mov    %r14d,%r8d
mov    $0x1,%r9d
call   1050 <multiplyMatrix@plt>
lea    0x13880(%rsp),%rdx
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %r13d,%ecx
mov    %r13d,%r8d
mov    $0x1,%r9d
call   1050 <multiplyMatrix@plt>
test   %r14d,%r14d
jle    1339 <solveWithInverseMethod+0x209>
mov    $0x1,%eax
cmp    $0x4,%r14d
jb     1309 <solveWithInverseMethod+0x1d9>
mov    %r15d,%ecx
and    $0xfffffffc,%ecx
lea    0x1(%rcx),%rax
lea    0x14508(%rsp),%rdx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nop
movsd  -0x960(%rdx),%xmm0
ff
movhps -0x640(%rdx),%xmm0
movsd  -0x320(%rdx),%xmm1
ff
movhps (%rdx),%xmm1
movups %xmm0,0x8(%rbx,%rsi,8)
movups %xmm1,0x18(%rbx,%rsi,8)
add    $0x4,%rsi
add    $0xc80,%rdx
cmp    %rsi,%rcx
jne    12d0 <solveWithInverseMethod+0x1a0>
cmp    %rcx,%r15
je     1339 <solveWithInverseMethod+0x209>
add    $0x1,%r15
imul   $0x320,%rax,%rcx
add    %rsp,%rcx
add    $0x13888,%rcx
xchg   %ax,%ax
movsd  (%rcx),%xmm0
movsd  %xmm0,(%rbx,%rax,8)
add    $0x1,%rax
add    $0x320,%rcx
cmp    %rax,%r15
jne    1320 <solveWithInverseMethod+0x1f0>
add    $0x75308,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @solveWithInverseMethod([100 x double]* %0, double* %1, double* %2, i32 %3, i32 %4) {
%6 = alloca [100 x double]*
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
%11 = alloca [100 x [100 x double]]
%12 = alloca [100 x [100 x double]]
%13 = alloca [100 x [100 x double]]
%14 = alloca [100 x [100 x double]]
%15 = alloca [100 x [100 x double]]
%16 = alloca [100 x [100 x double]]
%17 = alloca i32
%18 = alloca i32
store [100 x double]* %0, [100 x double]** %6
store double* %1, double** %7
store double* %2, double** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
store i32 1, i32* %17
br label %19
19: ; preds = %33, %5
%20 = load i32, i32* %17
%21 = load i32, i32* %9
%22 = icmp sle i32 %20, %21
br i1 %22, label %23, label %36
23: ; preds = %19
%24 = load double*, double** %7
%25 = load i32, i32* %17
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
%28 = load double, double* %27
%29 = load i32, i32* %17
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %12, i64 0, i64 %30
%32 = getelementptr inbounds [100 x double], [100 x double]* %31, i64 0, i64 1
store double %28, double* %32
br label %33
33: ; preds = %23
%34 = load i32, i32* %17
%35 = add nsw i32 %34, 1
store i32 %35, i32* %17
br label %19
36: ; preds = %19
%37 = load [100 x double]*, [100 x double]** %6
%38 = bitcast [100 x double]* %37 to double**
%39 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %13, i64 0, i64 0
%40 = bitcast [100 x double]* %39 to double**
%41 = load i32, i32* %9
%42 = load i32, i32* %10
%43 = call i32 @transpose(double** %38, double** %40, i32 %41, i32 %42)
%44 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %13, i64 0, i64 0
%45 = bitcast [100 x double]* %44 to double**
%46 = load [100 x double]*, [100 x double]** %6
%47 = bitcast [100 x double]* %46 to double**
%48 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %15, i64 0, i64 0
%49 = bitcast [100 x double]* %48 to double**
%50 = load i32, i32* %10
%51 = load i32, i32* %9
%52 = load i32, i32* %10
%53 = call i32 @multiplyMatrix(double** %45, double** %47, double** %49, i32 %50, i32 %51, i32 %52)
%54 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %15, i64 0, i64 0
%55 = bitcast [100 x double]* %54 to double**
%56 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %14, i64 0, i64 0
%57 = bitcast [100 x double]* %56 to double**
%58 = load i32, i32* %10
%59 = call i32 @inverseOfMatrix(double** %55, double** %57, i32 %58)
%60 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %13, i64 0, i64 0
%61 = bitcast [100 x double]* %60 to double**
%62 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %12, i64 0, i64 0
%63 = bitcast [100 x double]* %62 to double**
%64 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %16, i64 0, i64 0
%65 = bitcast [100 x double]* %64 to double**
%66 = load i32, i32* %10
%67 = load i32, i32* %9
%68 = call i32 @multiplyMatrix(double** %61, double** %63, double** %65, i32 %66, i32 %67, i32 1)
%69 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %14, i64 0, i64 0
%70 = bitcast [100 x double]* %69 to double**
%71 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %16, i64 0, i64 0
%72 = bitcast [100 x double]* %71 to double**
%73 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %11, i64 0, i64 0
%74 = bitcast [100 x double]* %73 to double**
%75 = load i32, i32* %10
%76 = load i32, i32* %10
%77 = call i32 @multiplyMatrix(double** %70, double** %72, double** %74, i32 %75, i32 %76, i32 1)
store i32 1, i32* %17
br label %78
78: ; preds = %92, %36
%79 = load i32, i32* %17
%80 = load i32, i32* %9
%81 = icmp sle i32 %79, %80
br i1 %81, label %82, label %95
82: ; preds = %78
%83 = load i32, i32* %17
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %11, i64 0, i64 %84
%86 = getelementptr inbounds [100 x double], [100 x double]* %85, i64 0, i64 1
%87 = load double, double* %86
%88 = load double*, double** %8
%89 = load i32, i32* %17
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds double, double* %88, i64 %90
store double %87, double* %91
br label %92
92: ; preds = %82
%93 = load i32, i32* %17
%94 = add nsw i32 %93, 1
store i32 %94, i32* %17
br label %78
95: ; preds = %78
ret void
}

LLVM IR (-O2):
define void @solveWithInverseMethod([100 x double]* %0, double* nocapture %1, double* nocapture writeonly %2, i32 %3, i32 %4) {
%6 = alloca [100 x [100 x double]]
%7 = alloca [100 x [100 x double]]
%8 = alloca [100 x [100 x double]]
%9 = alloca [100 x [100 x double]]
%10 = alloca [100 x [100 x double]]
%11 = alloca [100 x [100 x double]]
%12 = bitcast [100 x [100 x double]]* %6 to i8*
%13 = bitcast [100 x [100 x double]]* %7 to i8*
%14 = bitcast [100 x [100 x double]]* %8 to i8*
%15 = bitcast [100 x [100 x double]]* %9 to i8*
%16 = bitcast [100 x [100 x double]]* %10 to i8*
%17 = bitcast [100 x [100 x double]]* %11 to i8*
%18 = icmp slt i32 %3, 1
br i1 %18, label %61, label %19
19: ; preds = %5
%20 = add nuw i32 %3, 1
%21 = zext i32 %20 to i64
%22 = add nsw i64 %21, -1
%23 = add nsw i64 %21, -2
%24 = and i64 %22, 3
%25 = icmp ult i64 %23, 3
br i1 %25, label %49, label %26
26: ; preds = %19
%27 = and i64 %22, -4
br label %28
28: ; preds = %28, %26
%29 = phi i64 [ 1, %26 ], [ %46, %28 ]
%30 = phi i64 [ 0, %26 ], [ %47, %28 ]
%31 = getelementptr inbounds double, double* %1, i64 %29
%32 = load double, double* %31
%33 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %7, i64 0, i64 %29, i64 1
store double %32, double* %33
%34 = add nuw nsw i64 %29, 1
%35 = getelementptr inbounds double, double* %1, i64 %34
%36 = load double, double* %35
%37 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %7, i64 0, i64 %34, i64 1
store double %36, double* %37
%38 = add nuw nsw i64 %29, 2
%39 = getelementptr inbounds double, double* %1, i64 %38
%40 = load double, double* %39
%41 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %7, i64 0, i64 %38, i64 1
store double %40, double* %41
%42 = add nuw nsw i64 %29, 3
%43 = getelementptr inbounds double, double* %1, i64 %42
%44 = load double, double* %43
%45 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %7, i64 0, i64 %42, i64 1
store double %44, double* %45
%46 = add nuw nsw i64 %29, 4
%47 = add i64 %30, 4
%48 = icmp eq i64 %47, %27
br i1 %48, label %49, label %28
49: ; preds = %28, %19
%50 = phi i64 [ 1, %19 ], [ %46, %28 ]
%51 = icmp eq i64 %24, 0
br i1 %51, label %61, label %52
52: ; preds = %49, %52
%53 = phi i64 [ %58, %52 ], [ %50, %49 ]
%54 = phi i64 [ %59, %52 ], [ 0, %49 ]
%55 = getelementptr inbounds double, double* %1, i64 %53
%56 = load double, double* %55
%57 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %7, i64 0, i64 %53, i64 1
store double %56, double* %57
%58 = add nuw nsw i64 %53, 1
%59 = add i64 %54, 1
%60 = icmp eq i64 %59, %24
br i1 %60, label %61, label %52
61: ; preds = %49, %52, %5
%62 = bitcast [100 x double]* %0 to double**
%63 = bitcast [100 x [100 x double]]* %8 to double**
%64 = call i32 @transpose(double** %62, double** %63, i32 %3, i32 %4)
%65 = bitcast [100 x [100 x double]]* %10 to double**
%66 = call i32 @multiplyMatrix(double** %63, double** %62, double** %65, i32 %4, i32 %3, i32 %4)
%67 = bitcast [100 x [100 x double]]* %9 to double**
%68 = call i32 @inverseOfMatrix(double** %65, double** %67, i32 %4)
%69 = bitcast [100 x [100 x double]]* %7 to double**
%70 = bitcast [100 x [100 x double]]* %11 to double**
%71 = call i32 @multiplyMatrix(double** %63, double** %69, double** %70, i32 %4, i32 %3, i32 1)
%72 = bitcast [100 x [100 x double]]* %6 to double**
%73 = call i32 @multiplyMatrix(double** %67, double** %70, double** %72, i32 %4, i32 %4, i32 1)
br i1 %18, label %117, label %74
74: ; preds = %61
%75 = add nuw i32 %3, 1
%76 = zext i32 %75 to i64
%77 = add nsw i64 %76, -1
%78 = icmp ult i64 %77, 4
br i1 %78, label %108, label %79
79: ; preds = %74
%80 = and i64 %77, -4
%81 = or i64 %80, 1
br label %82
82: ; preds = %82, %79
%83 = phi i64 [ 0, %79 ], [ %104, %82 ]
%84 = or i64 %83, 1
%85 = or i64 %83, 2
%86 = or i64 %83, 3
%87 = add i64 %83, 4
%88 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %6, i64 0, i64 %84, i64 1
%89 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %6, i64 0, i64 %85, i64 1
%90 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %6, i64 0, i64 %86, i64 1
%91 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %6, i64 0, i64 %87, i64 1
%92 = load double, double* %88
%93 = load double, double* %89
%94 = insertelement <2 x double> poison, double %92, i64 0
%95 = insertelement <2 x double> %94, double %93, i64 1
%96 = load double, double* %90
%97 = load double, double* %91
%98 = insertelement <2 x double> poison, double %96, i64 0
%99 = insertelement <2 x double> %98, double %97, i64 1
%100 = getelementptr inbounds double, double* %2, i64 %84
%101 = bitcast double* %100 to <2 x double>*
store <2 x double> %95, <2 x double>* %101
%102 = getelementptr inbounds double, double* %100, i64 2
%103 = bitcast double* %102 to <2 x double>*
store <2 x double> %99, <2 x double>* %103
%104 = add nuw i64 %83, 4
%105 = icmp eq i64 %104, %80
br i1 %105, label %106, label %82
106: ; preds = %82
%107 = icmp eq i64 %77, %80
br i1 %107, label %117, label %108
108: ; preds = %74, %106
%109 = phi i64 [ 1, %74 ], [ %81, %106 ]
br label %110
110: ; preds = %108, %110
%111 = phi i64 [ %115, %110 ], [ %109, %108 ]
%112 = getelementptr inbounds [100 x [100 x double]], [100 x [100 x double]]* %6, i64 0, i64 %111, i64 1
%113 = load double, double* %112
%114 = getelementptr inbounds double, double* %2, i64 %111
store double %113, double* %114
%115 = add nuw nsw i64 %111, 1
%116 = icmp eq i64 %115, %76
br i1 %116, label %117, label %110
117: ; preds = %110, %106, %61
ret void
}