#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 sompx(double **, long);
double sompxy(double **, double **, long, double, double);
void resid(double **a, double **b, long stop, double lmoyA, double lmoyB) {
  double coef_b;
  double coef_a;
  long i, j;
  coef_b = sompxy(a, b, stop, lmoyA, lmoyB) / sompx(b, stop);
  coef_a = lmoyA - (coef_b * lmoyB);
  for (i = 0; i < stop; i++)
    for (j = 0; j <= i; j++)
      a[i][j] = a[i][j] - (coef_a + (coef_b * b[i][j]));
}


x86 assembly (clang, -O0):
<resid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1030 <sompxy@plt>
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <sompx@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    1257 <resid+0x137>
movq   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x40(%rbp),%rax
jg     1241 <resid+0x121>
mov    -0x8(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x38(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x48(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    11cd <resid+0xad>
jmp    1246 <resid+0x126>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    11b7 <resid+0x97>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<resid>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
movapd %xmm0,0x20(%rsp)
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
movsd  %xmm1,0x8(%rsp)
call   1030 <sompxy@plt>
movapd %xmm0,0x10(%rsp)
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <sompx@plt>
movapd 0x10(%rsp),%xmm7
movapd 0x20(%rsp),%xmm6
test   %r12,%r12
jle    1373 <resid+0x253>
divsd  %xmm0,%xmm7
movsd  0x8(%rsp),%xmm0
mulsd  %xmm7,%xmm0
subsd  %xmm0,%xmm6
movapd %xmm7,%xmm0
unpcklpd %xmm7,%xmm0
movapd %xmm6,%xmm1
unpcklpd %xmm6,%xmm1
mov    $0x1,%eax
mov    $0xfffffffffffffffd,%r10
xor    %r9d,%r9d
jmp    11b1 <resid+0x91>
xchg   %ax,%ax
add    $0x1,%rax
add    $0x1,%r10
cmp    %r12,%r9
je     1373 <resid+0x253>
mov    %r9,%r11
lea    -0x3(%r9),%r8
add    $0x1,%r9
mov    %r11,%rcx
mov    (%r15,%r11,8),%rsi
mov    (%r14,%r11,8),%rdi
sub    $0x3,%rcx
jb     11e7 <resid+0xc7>
lea    (%rdi,%r9,8),%rdx
cmp    %rdx,%rsi
jae    1270 <resid+0x150>
lea    (%rsi,%r9,8),%rdx
cmp    %rdx,%rdi
jae    1270 <resid+0x150>
xor    %edx,%edx
mov    %rdx,%rcx
test   $0x1,%al
je     1212 <resid+0xf2>
movsd  (%rsi,%rdx,8),%xmm2
movsd  (%rdi,%rdx,8),%xmm3
mulsd  %xmm7,%xmm3
addsd  %xmm6,%xmm3
subsd  %xmm3,%xmm2
movsd  %xmm2,(%rsi,%rdx,8)
mov    %rdx,%rcx
or     $0x1,%rcx
cmp    %rdx,%r11
je     11a0 <resid+0x80>
nopw   0x0(%rax,%rax,1)
movsd  (%rdi,%rcx,8),%xmm2
mulsd  %xmm7,%xmm2
addsd  %xmm6,%xmm2
movsd  (%rsi,%rcx,8),%xmm3
subsd  %xmm2,%xmm3
movsd  0x8(%rsi,%rcx,8),%xmm2
movsd  %xmm3,(%rsi,%rcx,8)
movsd  0x8(%rdi,%rcx,8),%xmm3
mulsd  %xmm7,%xmm3
addsd  %xmm6,%xmm3
subsd  %xmm3,%xmm2
movsd  %xmm2,0x8(%rsi,%rcx,8)
add    $0x2,%rcx
cmp    %rcx,%rax
jne    1220 <resid+0x100>
jmp    11a0 <resid+0x80>
nopw   0x0(%rax,%rax,1)
shr    $0x2,%r8
add    $0x1,%r8
cmp    $0x4,%rcx
jae    1285 <resid+0x165>
xor    %ebx,%ebx
jmp    131f <resid+0x1ff>
mov    %r10,%rcx
shr    $0x2,%rcx
add    $0x1,%rcx
and    $0xfffffffffffffffe,%rcx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movupd (%rdi,%rbx,8),%xmm2
movupd 0x10(%rdi,%rbx,8),%xmm3
mulpd  %xmm0,%xmm2
addpd  %xmm1,%xmm2
mulpd  %xmm0,%xmm3
addpd  %xmm1,%xmm3
movupd (%rsi,%rbx,8),%xmm4
subpd  %xmm2,%xmm4
movupd 0x10(%rsi,%rbx,8),%xmm2
subpd  %xmm3,%xmm2
movupd 0x20(%rsi,%rbx,8),%xmm3
movupd 0x30(%rsi,%rbx,8),%xmm5
movupd %xmm4,(%rsi,%rbx,8)
movupd %xmm2,0x10(%rsi,%rbx,8)
movupd 0x20(%rdi,%rbx,8),%xmm2
movupd 0x30(%rdi,%rbx,8),%xmm4
mulpd  %xmm0,%xmm2
addpd  %xmm1,%xmm2
subpd  %xmm2,%xmm3
mulpd  %xmm0,%xmm4
addpd  %xmm1,%xmm4
subpd  %xmm4,%xmm5
movupd %xmm3,0x20(%rsi,%rbx,8)
movupd %xmm5,0x30(%rsi,%rbx,8)
add    $0x8,%rbx
add    $0xfffffffffffffffe,%rcx
jne    12a0 <resid+0x180>
mov    %r9,%rdx
and    $0xfffffffffffffffc,%rdx
test   $0x1,%r8b
je     1365 <resid+0x245>
movupd (%rsi,%rbx,8),%xmm2
movupd 0x10(%rsi,%rbx,8),%xmm3
movupd (%rdi,%rbx,8),%xmm4
movupd 0x10(%rdi,%rbx,8),%xmm5
mulpd  %xmm0,%xmm4
addpd  %xmm1,%xmm4
subpd  %xmm4,%xmm2
mulpd  %xmm0,%xmm5
addpd  %xmm1,%xmm5
subpd  %xmm5,%xmm3
movupd %xmm2,(%rsi,%rbx,8)
movupd %xmm3,0x10(%rsi,%rbx,8)
cmp    %rdx,%r9
je     11a0 <resid+0x80>
jmp    11e9 <resid+0xc9>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @resid(double** %0, double** %1, i64 %2, double %3, double %4) {
%6 = alloca double**
%7 = alloca double**
%8 = alloca i64
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca i64
%14 = alloca i64
store double** %0, double*** %6
store double** %1, double*** %7
store i64 %2, i64* %8
store double %3, double* %9
store double %4, double* %10
%15 = load double**, double*** %6
%16 = load double**, double*** %7
%17 = load i64, i64* %8
%18 = load double, double* %9
%19 = load double, double* %10
%20 = call double @sompxy(double** %15, double** %16, i64 %17, double %18, double %19)
%21 = load double**, double*** %7
%22 = load i64, i64* %8
%23 = call double @sompx(double** %21, i64 %22)
%24 = fdiv double %20, %23
store double %24, double* %11
%25 = load double, double* %9
%26 = load double, double* %11
%27 = load double, double* %10
%28 = fneg double %26
%29 = call double @llvm.fmuladd.f64(double %28, double %27, double %25)
store double %29, double* %12
store i64 0, i64* %13
br label %30
30: ; preds = %68, %5
%31 = load i64, i64* %13
%32 = load i64, i64* %8
%33 = icmp slt i64 %31, %32
br i1 %33, label %34, label %71
34: ; preds = %30
store i64 0, i64* %14
br label %35
35: ; preds = %64, %34
%36 = load i64, i64* %14
%37 = load i64, i64* %13
%38 = icmp sle i64 %36, %37
br i1 %38, label %39, label %67
39: ; preds = %35
%40 = load double**, double*** %6
%41 = load i64, i64* %13
%42 = getelementptr inbounds double*, double** %40, i64 %41
%43 = load double*, double** %42
%44 = load i64, i64* %14
%45 = getelementptr inbounds double, double* %43, i64 %44
%46 = load double, double* %45
%47 = load double, double* %12
%48 = load double, double* %11
%49 = load double**, double*** %7
%50 = load i64, i64* %13
%51 = getelementptr inbounds double*, double** %49, i64 %50
%52 = load double*, double** %51
%53 = load i64, i64* %14
%54 = getelementptr inbounds double, double* %52, i64 %53
%55 = load double, double* %54
%56 = call double @llvm.fmuladd.f64(double %48, double %55, double %47)
%57 = fsub double %46, %56
%58 = load double**, double*** %6
%59 = load i64, i64* %13
%60 = getelementptr inbounds double*, double** %58, i64 %59
%61 = load double*, double** %60
%62 = load i64, i64* %14
%63 = getelementptr inbounds double, double* %61, i64 %62
store double %57, double* %63
br label %64
64: ; preds = %39
%65 = load i64, i64* %14
%66 = add nsw i64 %65, 1
store i64 %66, i64* %14
br label %35
67: ; preds = %35
br label %68
68: ; preds = %67
%69 = load i64, i64* %13
%70 = add nsw i64 %69, 1
store i64 %70, i64* %13
br label %30
71: ; preds = %30
ret void
}

LLVM IR (-O2):
define void @resid(double** %0, double** %1, i64 %2, double %3, double %4) {
%6 = tail call double @sompxy(double** %0, double** %1, i64 %2, double %3, double %4)
%7 = tail call double @sompx(double** %1, i64 %2)
%8 = fdiv double %6, %7
%9 = fneg double %8
%10 = tail call double @llvm.fmuladd.f64(double %9, double %4, double %3)
%11 = icmp sgt i64 %2, 0
br i1 %11, label %12, label %149
12: ; preds = %5
%13 = insertelement <2 x double> poison, double %8, i64 0
%14 = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> zeroinitializer
%15 = insertelement <2 x double> poison, double %10, i64 0
%16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> zeroinitializer
%17 = insertelement <2 x double> poison, double %8, i64 0
%18 = shufflevector <2 x double> %17, <2 x double> poison, <2 x i32> zeroinitializer
%19 = insertelement <2 x double> poison, double %10, i64 0
%20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
br label %21
21: ; preds = %12, %145
%22 = phi i64 [ %147, %145 ], [ 1, %12 ]
%23 = phi i64 [ %146, %145 ], [ 0, %12 ]
%24 = add nsw i64 %23, -3
%25 = lshr i64 %24, 2
%26 = add nuw nsw i64 %25, 1
%27 = add nuw i64 %23, 1
%28 = add nuw i64 %23, 1
%29 = getelementptr inbounds double*, double** %0, i64 %23
%30 = load double*, double** %29
%31 = getelementptr inbounds double*, double** %1, i64 %23
%32 = load double*, double** %31
%33 = icmp ult i64 %23, 3
br i1 %33, label %113, label %34
34: ; preds = %21
%35 = getelementptr double, double* %30, i64 %28
%36 = getelementptr double, double* %32, i64 %28
%37 = icmp ult double* %30, %36
%38 = icmp ult double* %32, %35
%39 = and i1 %37, %38
br i1 %39, label %113, label %40
40: ; preds = %34
%41 = and i64 %27, -4
%42 = and i64 %26, 1
%43 = icmp ult i64 %24, 4
br i1 %43, label %89, label %44
44: ; preds = %40
%45 = and i64 %26, 9223372036854775806
br label %46
46: ; preds = %46, %44
%47 = phi i64 [ 0, %44 ], [ %86, %46 ]
%48 = phi i64 [ 0, %44 ], [ %87, %46 ]
%49 = getelementptr inbounds double, double* %30, i64 %47
%50 = bitcast double* %49 to <2 x double>*
%51 = load <2 x double>, <2 x double>* %50
%52 = getelementptr inbounds double, double* %49, i64 2
%53 = bitcast double* %52 to <2 x double>*
%54 = load <2 x double>, <2 x double>* %53
%55 = getelementptr inbounds double, double* %32, i64 %47
%56 = bitcast double* %55 to <2 x double>*
%57 = load <2 x double>, <2 x double>* %56
%58 = getelementptr inbounds double, double* %55, i64 2
%59 = bitcast double* %58 to <2 x double>*
%60 = load <2 x double>, <2 x double>* %59
%61 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %14, <2 x double> %57, <2 x double> %16)
%62 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %18, <2 x double> %60, <2 x double> %20)
%63 = fsub <2 x double> %51, %61
%64 = fsub <2 x double> %54, %62
%65 = bitcast double* %49 to <2 x double>*
store <2 x double> %63, <2 x double>* %65
%66 = bitcast double* %52 to <2 x double>*
store <2 x double> %64, <2 x double>* %66
%67 = or i64 %47, 4
%68 = getelementptr inbounds double, double* %30, i64 %67
%69 = bitcast double* %68 to <2 x double>*
%70 = load <2 x double>, <2 x double>* %69
%71 = getelementptr inbounds double, double* %68, i64 2
%72 = bitcast double* %71 to <2 x double>*
%73 = load <2 x double>, <2 x double>* %72
%74 = getelementptr inbounds double, double* %32, i64 %67
%75 = bitcast double* %74 to <2 x double>*
%76 = load <2 x double>, <2 x double>* %75
%77 = getelementptr inbounds double, double* %74, i64 2
%78 = bitcast double* %77 to <2 x double>*
%79 = load <2 x double>, <2 x double>* %78
%80 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %14, <2 x double> %76, <2 x double> %16)
%81 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %18, <2 x double> %79, <2 x double> %20)
%82 = fsub <2 x double> %70, %80
%83 = fsub <2 x double> %73, %81
%84 = bitcast double* %68 to <2 x double>*
store <2 x double> %82, <2 x double>* %84
%85 = bitcast double* %71 to <2 x double>*
store <2 x double> %83, <2 x double>* %85
%86 = add nuw i64 %47, 8
%87 = add i64 %48, 2
%88 = icmp eq i64 %87, %45
br i1 %88, label %89, label %46
89: ; preds = %46, %40
%90 = phi i64 [ 0, %40 ], [ %86, %46 ]
%91 = icmp eq i64 %42, 0
br i1 %91, label %111, label %92
92: ; preds = %89
%93 = getelementptr inbounds double, double* %30, i64 %90
%94 = bitcast double* %93 to <2 x double>*
%95 = load <2 x double>, <2 x double>* %94
%96 = getelementptr inbounds double, double* %93, i64 2
%97 = bitcast double* %96 to <2 x double>*
%98 = load <2 x double>, <2 x double>* %97
%99 = getelementptr inbounds double, double* %32, i64 %90
%100 = bitcast double* %99 to <2 x double>*
%101 = load <2 x double>, <2 x double>* %100
%102 = getelementptr inbounds double, double* %99, i64 2
%103 = bitcast double* %102 to <2 x double>*
%104 = load <2 x double>, <2 x double>* %103
%105 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %14, <2 x double> %101, <2 x double> %16)
%106 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %18, <2 x double> %104, <2 x double> %20)
%107 = fsub <2 x double> %95, %105
%108 = fsub <2 x double> %98, %106
%109 = bitcast double* %93 to <2 x double>*
store <2 x double> %107, <2 x double>* %109
%110 = bitcast double* %96 to <2 x double>*
store <2 x double> %108, <2 x double>* %110
br label %111
111: ; preds = %89, %92
%112 = icmp eq i64 %27, %41
br i1 %112, label %145, label %113
113: ; preds = %34, %21, %111
%114 = phi i64 [ 0, %34 ], [ 0, %21 ], [ %41, %111 ]
%115 = and i64 %22, 1
%116 = icmp eq i64 %115, 0
br i1 %116, label %125, label %117
117: ; preds = %113
%118 = getelementptr inbounds double, double* %30, i64 %114
%119 = load double, double* %118
%120 = getelementptr inbounds double, double* %32, i64 %114
%121 = load double, double* %120
%122 = tail call double @llvm.fmuladd.f64(double %8, double %121, double %10)
%123 = fsub double %119, %122
store double %123, double* %118
%124 = or i64 %114, 1
br label %125
125: ; preds = %117, %113
%126 = phi i64 [ %114, %113 ], [ %124, %117 ]
%127 = icmp eq i64 %23, %114
br i1 %127, label %145, label %128
128: ; preds = %125, %128
%129 = phi i64 [ %143, %128 ], [ %126, %125 ]
%130 = getelementptr inbounds double, double* %30, i64 %129
%131 = load double, double* %130
%132 = getelementptr inbounds double, double* %32, i64 %129
%133 = load double, double* %132
%134 = tail call double @llvm.fmuladd.f64(double %8, double %133, double %10)
%135 = fsub double %131, %134
store double %135, double* %130
%136 = add nuw nsw i64 %129, 1
%137 = getelementptr inbounds double, double* %30, i64 %136
%138 = load double, double* %137
%139 = getelementptr inbounds double, double* %32, i64 %136
%140 = load double, double* %139
%141 = tail call double @llvm.fmuladd.f64(double %8, double %140, double %10)
%142 = fsub double %138, %141
store double %142, double* %137
%143 = add nuw nsw i64 %129, 2
%144 = icmp eq i64 %143, %22
br i1 %144, label %145, label %128
145: ; preds = %125, %128, %111
%146 = add nuw nsw i64 %23, 1
%147 = add nuw i64 %22, 1
%148 = icmp eq i64 %146, %2
br i1 %148, label %149, label %21
149: ; preds = %145, %5
ret void
}