#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 DBL_MAX;
double absmax(double *, double *, int, int);
scalar_t__ calloc(int, int);
double dc_diffmax(double *, double *, double *, int, int, int);
scalar_t__ diverged(double *, int);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ update_x_k(double *, double *, double *, int, int, int,
                              double *, double *, double *, double, int,
                              double *);
int dc_solve(double *A, double *b, double *w, int m, int n, int neq,
             double *tol, int *maxiter, double *x) {
  int niter = 0;
  double *awa = (double *)calloc(m, sizeof(double));
  double *xw = (double *)calloc(n, sizeof(double));
  double *alpha = (double *)calloc(m, sizeof(double));
  double *wa = (double *)calloc(n, sizeof(double));
  double *conv = (double *)calloc(m, sizeof(double));
  if (awa == NULL || xw == NULL || alpha == NULL || conv == NULL ||
      wa == NULL) {
    free(awa);
    free(xw);
    free(alpha);
    free(conv);
    free(wa);
    return 1;
  }
  double diff = DBL_MAX;
  int exit_status = 0;
  for (int k = 0; k < n; ++k) {
    xw[k] = 1 / w[k];
  }
  for (int k = 0; k < m; k++) {
    awa[k] = 0;
    for (int j = 0; j < n; j++) {
      awa[k] += A[k + j * m] * xw[j] * A[k + j * m];
    }
  }
  while (diff > *tol && niter < *maxiter) {
    for (int k = 0; k < m; k++)
      update_x_k(A, b, x, neq, m, n, xw, wa, alpha, awa[k], k, conv);
    ++niter;
    if (diverged(x, n) || diverged(alpha, m)) {
      exit_status = 2;
      break;
    }
    diff = absmax(conv, awa, neq, m);
  }
  if (exit_status != 2 && niter == *maxiter && diff > *tol) {
    exit_status = 3;
  }
  *tol = dc_diffmax(A, b, x, neq, m, n);
  *maxiter = niter;
  free(wa);
  free(awa);
  free(xw);
  free(alpha);
  free(conv);
  return exit_status;
}


x86 assembly (clang, -O0):
<dc_solve>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0xa0,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %ecx,-0x34(%rbp)
mov    %r8d,-0x38(%rbp)
mov    %r9d,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x34(%rbp),%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x34(%rbp),%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x38(%rbp),%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x34(%rbp),%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     1224 <dc_solve+0xc4>
cmpq   $0x0,-0x50(%rbp)
je     1224 <dc_solve+0xc4>
cmpq   $0x0,-0x58(%rbp)
je     1224 <dc_solve+0xc4>
cmpq   $0x0,-0x68(%rbp)
je     1224 <dc_solve+0xc4>
cmpq   $0x0,-0x60(%rbp)
jne    125d <dc_solve+0xfd>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x14(%rbp)
jmp    1524 <dc_solve+0x3c4>
mov    0x2d7c(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    12b7 <dc_solve+0x157>
mov    -0x30(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  0xd69(%rip),%xmm0
divsd  (%rax,%rcx,8),%xmm0
mov    -0x50(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    127b <dc_solve+0x11b>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1365 <dc_solve+0x205>
mov    -0x48(%rbp),%rax
movslq -0x7c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    1352 <dc_solve+0x1f2>
mov    -0x20(%rbp),%rax
mov    -0x7c(%rbp),%ecx
mov    -0x80(%rbp),%edx
imul   -0x34(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x50(%rbp),%rax
movslq -0x80(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x7c(%rbp),%ecx
mov    -0x80(%rbp),%edx
imul   -0x34(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x48(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    12e1 <dc_solve+0x181>
jmp    1357 <dc_solve+0x1f7>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    12be <dc_solve+0x15e>
jmp    136a <dc_solve+0x20a>
movsd  -0x70(%rbp),%xmm0
mov    0x10(%rbp),%rcx
xor    %eax,%eax
ucomisd (%rcx),%xmm0
mov    %al,-0x85(%rbp)
jbe    1397 <dc_solve+0x237>
mov    -0x40(%rbp),%eax
mov    0x18(%rbp),%rcx
cmp    (%rcx),%eax
setl   %al
mov    %al,-0x85(%rbp)
mov    -0x85(%rbp),%al
test   $0x1,%al
jne    13aa <dc_solve+0x24a>
jmp    1491 <dc_solve+0x331>
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1433 <dc_solve+0x2d3>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    0x20(%rbp),%rdx
mov    -0x3c(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    -0x38(%rbp),%r9d
mov    -0x50(%rbp),%r14
mov    -0x60(%rbp),%rbx
mov    -0x58(%rbp),%r11
mov    -0x48(%rbp),%rax
movslq -0x84(%rbp),%r10
movsd  (%rax,%r10,8),%xmm0
mov    -0x84(%rbp),%r10d
mov    -0x68(%rbp),%rax
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1060 <update_x_k@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    13b4 <dc_solve+0x254>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    0x20(%rbp),%rdi
mov    -0x38(%rbp),%esi
call   1080 <diverged@plt>
cmp    $0x0,%rax
jne    1468 <dc_solve+0x308>
mov    -0x58(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1080 <diverged@plt>
cmp    $0x0,%rax
je     1474 <dc_solve+0x314>
movl   $0x2,-0x74(%rbp)
jmp    1491 <dc_solve+0x331>
mov    -0x68(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x3c(%rbp),%edx
mov    -0x34(%rbp),%ecx
call   1040 <absmax@plt>
movsd  %xmm0,-0x70(%rbp)
jmp    136a <dc_solve+0x20a>
cmpl   $0x2,-0x74(%rbp)
je     14c4 <dc_solve+0x364>
mov    -0x40(%rbp),%eax
mov    0x18(%rbp),%rcx
cmp    (%rcx),%eax
jne    14c4 <dc_solve+0x364>
movsd  -0x70(%rbp),%xmm0
mov    0x10(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    14c4 <dc_solve+0x364>
movl   $0x3,-0x74(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    0x20(%rbp),%rdx
mov    -0x3c(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    -0x38(%rbp),%r9d
call   1070 <dc_diffmax@plt>
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x74(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<dc_solve>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r9d,0x10(%rsp)
mov    %r8d,%r15d
mov    %ecx,%ebp
mov    %rdx,%rbx
mov    %rsi,0x48(%rsp)
mov    %rdi,0x28(%rsp)
mov    %ecx,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,%r14
mov    %r15d,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,%r12
mov    %ebp,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,0x20(%rsp)
mov    %r15d,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,%r13
mov    %ebp,0x14(%rsp)
mov    %ebp,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,%rbp
test   %r14,%r14
je     12ae <dc_solve+0x14e>
test   %r12,%r12
je     12ae <dc_solve+0x14e>
cmpq   $0x0,0x20(%rsp)
je     12ae <dc_solve+0x14e>
movl   $0x1,0xc(%rsp)
test   %rbp,%rbp
je     1621 <dc_solve+0x4c1>
test   %r13,%r13
je     1621 <dc_solve+0x4c1>
mov    %r13,%r11
mov    0x2dc6(%rip),%rax
movsd  (%rax),%xmm0
mov    %r15d,%r8d
test   %r15d,%r15d
mov    0x28(%rsp),%rdi
jle    1346 <dc_solve+0x1e6>
cmp    $0x1,%r15d
je     1247 <dc_solve+0xe7>
lea    (%rbx,%r8,8),%rax
cmp    %rax,%r12
jae    12bb <dc_solve+0x15b>
lea    (%r12,%r8,8),%rax
cmp    %rbx,%rax
jbe    12bb <dc_solve+0x15b>
xor    %ecx,%ecx
mov    %rcx,%rax
not    %rax
test   $0x1,%r8b
je     126c <dc_solve+0x10c>
movsd  0xdb3(%rip),%xmm1
divsd  (%rbx,%rcx,8),%xmm1
movsd  %xmm1,(%r12,%rcx,8)
or     $0x1,%rcx
add    %r8,%rax
je     1346 <dc_solve+0x1e6>
movsd  0xd93(%rip),%xmm1
nopl   (%rax)
movapd %xmm1,%xmm2
divsd  (%rbx,%rcx,8),%xmm2
movsd  %xmm2,(%r12,%rcx,8)
movapd %xmm1,%xmm2
divsd  0x8(%rbx,%rcx,8),%xmm2
movsd  %xmm2,0x8(%r12,%rcx,8)
add    $0x2,%rcx
cmp    %rcx,%r8
jne    1280 <dc_solve+0x120>
jmp    1346 <dc_solve+0x1e6>
movl   $0x1,0xc(%rsp)
jmp    1621 <dc_solve+0x4c1>
mov    %r8d,%ecx
and    $0xfffffffe,%ecx
lea    -0x2(%rcx),%rdx
mov    %rdx,%rax
shr    %rax
add    $0x1,%rax
test   %rdx,%rdx
je     16ce <dc_solve+0x56e>
mov    %rax,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %edx,%edx
movapd 0xd17(%rip),%xmm1
nopl   0x0(%rax)
movupd (%rbx,%rdx,8),%xmm2
movapd %xmm1,%xmm3
divpd  %xmm2,%xmm3
movupd %xmm3,(%r12,%rdx,8)
movupd 0x10(%rbx,%rdx,8),%xmm2
movapd %xmm1,%xmm3
divpd  %xmm2,%xmm3
movupd %xmm3,0x10(%r12,%rdx,8)
add    $0x4,%rdx
add    $0xfffffffffffffffe,%rsi
jne    12f0 <dc_solve+0x190>
test   $0x1,%al
je     133d <dc_solve+0x1dd>
movupd (%rbx,%rdx,8),%xmm1
movapd 0xccd(%rip),%xmm2
divpd  %xmm1,%xmm2
movupd %xmm2,(%r12,%rdx,8)
cmp    %r8,%rcx
jne    1249 <dc_solve+0xe9>
mov    %rbp,%r10
mov    0x14(%rsp),%eax
mov    %eax,%ebx
test   %eax,%eax
jle    142e <dc_solve+0x2ce>
mov    %r8d,%r9d
and    $0xfffffffe,%r9d
mov    %rbx,%rdx
shl    $0x4,%rdx
xor    %esi,%esi
mov    %rdi,%r13
jmp    1381 <dc_solve+0x221>
nopl   0x0(%rax)
add    $0x1,%rsi
add    $0x8,%r13
cmp    %rbx,%rsi
je     142e <dc_solve+0x2ce>
movq   $0x0,(%r14,%rsi,8)
test   %r15d,%r15d
jle    1370 <dc_solve+0x210>
xorpd  %xmm1,%xmm1
cmp    $0x1,%r15d
jne    13a0 <dc_solve+0x240>
xor    %ecx,%ecx
jmp    13f8 <dc_solve+0x298>
nopl   0x0(%rax)
mov    %r13,%rbp
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0x0(%rbp),%xmm2
movsd  (%r12,%rcx,8),%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm1,%xmm3
movsd  %xmm3,(%r14,%rsi,8)
movsd  0x0(%rbp,%rbx,8),%xmm2
movsd  0x8(%r12,%rcx,8),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm3,%xmm1
movsd  %xmm1,(%r14,%rsi,8)
add    $0x2,%rcx
add    %rdx,%rbp
cmp    %rcx,%r9
jne    13b0 <dc_solve+0x250>
test   $0x1,%r8b
je     1370 <dc_solve+0x210>
mov    %rcx,%rax
imul   %rbx,%rax
add    %rsi,%rax
movsd  (%rdi,%rax,8),%xmm2
movsd  (%r12,%rcx,8),%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm1,%xmm3
movsd  %xmm3,(%r14,%rsi,8)
jmp    1370 <dc_solve+0x210>
mov    %r12,0x30(%rsp)
mov    %r11,0x40(%rsp)
mov    0xb0(%rsp),%rdx
mov    0xa8(%rsp),%rcx
mov    0xa0(%rsp),%rax
movsd  (%rax),%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
mov    %r15d,0x3c(%rsp)
jbe    15af <dc_solve+0x44f>
mov    %rbx,0x50(%rsp)
cmpl   $0x0,(%rcx)
mov    0x14(%rsp),%ebp
mov    %r10,%r15
jle    15b2 <dc_solve+0x452>
xor    %eax,%eax
mov    %r15,0x60(%rsp)
mov    %r14,0x58(%rsp)
mov    0x40(%rsp),%rbx
mov    0x10(%rsp),%r12d
mov    %rax,0x18(%rsp)
test   %ebp,%ebp
mov    0x20(%rsp),%r10
mov    0x3c(%rsp),%r13d
mov    0x30(%rsp),%r11
mov    0x50(%rsp),%rax
jle    1518 <dc_solve+0x3b8>
xor    %ebp,%ebp
nop
movsd  (%r14,%rbp,8),%xmm0
sub    $0x8,%rsp
mov    0x30(%rsp),%rdi
mov    0x50(%rsp),%rsi
mov    0xb8(%rsp),%rdx
mov    %r12d,%ecx
mov    %rax,%r14
mov    %r14d,%r8d
mov    %r13d,%r9d
push   %r15
push   %rbp
push   %r10
push   %rbx
push   %r11
mov    %r10,%r15
call   1060 <update_x_k@plt>
mov    %r14,%rax
mov    0x60(%rsp),%r11
mov    0x88(%rsp),%r14
mov    %r15,%r10
mov    0x90(%rsp),%r15
mov    0xe0(%rsp),%rdx
add    $0x30,%rsp
add    $0x1,%rbp
cmp    %rbp,%rax
jne    14b0 <dc_solve+0x350>
mov    0x18(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x18(%rsp)
mov    %rdx,%rdi
mov    %r13d,%esi
call   1080 <diverged@plt>
movl   $0x2,0xc(%rsp)
test   %rax,%rax
jne    165e <dc_solve+0x4fe>
mov    0x20(%rsp),%rdi
mov    0x14(%rsp),%ebp
mov    %ebp,%esi
call   1080 <diverged@plt>
test   %rax,%rax
mov    0x40(%rsp),%r13
mov    0x30(%rsp),%rax
jne    1689 <dc_solve+0x529>
mov    %r15,%rdi
mov    %r14,%rsi
mov    0x10(%rsp),%edx
mov    %ebp,%ecx
call   1040 <absmax@plt>
mov    0xa0(%rsp),%rax
movsd  (%rax),%xmm1
ucomisd %xmm1,%xmm0
jbe    16af <dc_solve+0x54f>
mov    0xa8(%rsp),%rcx
mov    0x18(%rsp),%rax
cmp    (%rcx),%eax
mov    0x28(%rsp),%rdi
mov    0xb0(%rsp),%rdx
jl     1490 <dc_solve+0x330>
jmp    15b2 <dc_solve+0x452>
mov    %r10,%r15
mov    %rax,0x18(%rsp)
mov    %r15,%rbp
cmp    (%rcx),%eax
sete   %al
ucomisd %xmm1,%xmm0
mov    %rcx,%r15
seta   %cl
and    %al,%cl
movzbl %cl,%eax
lea    (%rax,%rax,2),%eax
mov    %eax,0xc(%rsp)
mov    0x40(%rsp),%r13
mov    0x10(%rsp),%ecx
mov    0x48(%rsp),%rsi
mov    0x30(%rsp),%rax
mov    %rbp,%rbx
mov    0x20(%rsp),%rbp
mov    %rax,0x20(%rsp)
mov    %r14,%r12
mov    0x14(%rsp),%r8d
mov    0x3c(%rsp),%r9d
call   1070 <dc_diffmax@plt>
mov    0xa0(%rsp),%rax
movsd  %xmm0,(%rax)
mov    0x18(%rsp),%rax
mov    %eax,(%r15)
mov    %r13,%r14
mov    %rbx,%r13
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    0xc(%rsp),%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x40(%rsp),%r13
mov    %r15,%rbp
mov    0x10(%rsp),%ecx
mov    0x48(%rsp),%rsi
mov    0x28(%rsp),%rdi
mov    0xa8(%rsp),%r15
mov    0xb0(%rsp),%rdx
jmp    15e3 <dc_solve+0x483>
mov    %r15,%rbp
mov    0x10(%rsp),%ecx
mov    0x48(%rsp),%rsi
mov    0x28(%rsp),%rdi
mov    0xa8(%rsp),%r15
mov    0xb0(%rsp),%rdx
jmp    15e8 <dc_solve+0x488>
mov    0x28(%rsp),%rdi
mov    0xa8(%rsp),%rcx
mov    0xb0(%rsp),%rdx
mov    0x18(%rsp),%rax
jmp    15b2 <dc_solve+0x452>
xor    %edx,%edx
test   $0x1,%al
jne    1326 <dc_solve+0x1c6>
jmp    133d <dc_solve+0x1dd>

LLVM IR (-O0):
@DBL_MAX = global double 0.000000e+00
define i32 @dc_solve(double* %0, double* %1, double* %2, i32 %3, i32 %4, i32 %5, double* %6, i32* %7, double* %8) {
%10 = alloca i32
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca double*
%18 = alloca i32*
%19 = alloca double*
%20 = alloca i32
%21 = alloca double*
%22 = alloca double*
%23 = alloca double*
%24 = alloca double*
%25 = alloca double*
%26 = alloca double
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
store double* %0, double** %11
store double* %1, double** %12
store double* %2, double** %13
store i32 %3, i32* %14
store i32 %4, i32* %15
store i32 %5, i32* %16
store double* %6, double** %17
store i32* %7, i32** %18
store double* %8, double** %19
store i32 0, i32* %20
%32 = load i32, i32* %14
%33 = call i64 @calloc(i32 %32, i32 8)
%34 = inttoptr i64 %33 to double*
store double* %34, double** %21
%35 = load i32, i32* %15
%36 = call i64 @calloc(i32 %35, i32 8)
%37 = inttoptr i64 %36 to double*
store double* %37, double** %22
%38 = load i32, i32* %14
%39 = call i64 @calloc(i32 %38, i32 8)
%40 = inttoptr i64 %39 to double*
store double* %40, double** %23
%41 = load i32, i32* %15
%42 = call i64 @calloc(i32 %41, i32 8)
%43 = inttoptr i64 %42 to double*
store double* %43, double** %24
%44 = load i32, i32* %14
%45 = call i64 @calloc(i32 %44, i32 8)
%46 = inttoptr i64 %45 to double*
store double* %46, double** %25
%47 = load double*, double** %21
%48 = icmp eq double* %47, null
br i1 %48, label %61, label %49
49: ; preds = %9
%50 = load double*, double** %22
%51 = icmp eq double* %50, null
br i1 %51, label %61, label %52
52: ; preds = %49
%53 = load double*, double** %23
%54 = icmp eq double* %53, null
br i1 %54, label %61, label %55
55: ; preds = %52
%56 = load double*, double** %25
%57 = icmp eq double* %56, null
br i1 %57, label %61, label %58
58: ; preds = %55
%59 = load double*, double** %24
%60 = icmp eq double* %59, null
br i1 %60, label %61, label %72
61: ; preds = %58, %55, %52, %49, %9
%62 = load double*, double** %21
%63 = call i32 @free(double* %62)
%64 = load double*, double** %22
%65 = call i32 @free(double* %64)
%66 = load double*, double** %23
%67 = call i32 @free(double* %66)
%68 = load double*, double** %25
%69 = call i32 @free(double* %68)
%70 = load double*, double** %24
%71 = call i32 @free(double* %70)
store i32 1, i32* %10
br label %238
72: ; preds = %58
%73 = load double, double* @DBL_MAX
store double %73, double* %26
store i32 0, i32* %27
store i32 0, i32* %28
br label %74
74: ; preds = %89, %72
%75 = load i32, i32* %28
%76 = load i32, i32* %15
%77 = icmp slt i32 %75, %76
br i1 %77, label %78, label %92
78: ; preds = %74
%79 = load double*, double** %13
%80 = load i32, i32* %28
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds double, double* %79, i64 %81
%83 = load double, double* %82
%84 = fdiv double 1.000000e+00, %83
%85 = load double*, double** %22
%86 = load i32, i32* %28
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds double, double* %85, i64 %87
store double %84, double* %88
br label %89
89: ; preds = %78
%90 = load i32, i32* %28
%91 = add nsw i32 %90, 1
store i32 %91, i32* %28
br label %74
92: ; preds = %74
store i32 0, i32* %29
br label %93
93: ; preds = %141, %92
%94 = load i32, i32* %29
%95 = load i32, i32* %14
%96 = icmp slt i32 %94, %95
br i1 %96, label %97, label %144
97: ; preds = %93
%98 = load double*, double** %21
%99 = load i32, i32* %29
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds double, double* %98, i64 %100
store double 0.000000e+00, double* %101
store i32 0, i32* %30
br label %102
102: ; preds = %137, %97
%103 = load i32, i32* %30
%104 = load i32, i32* %15
%105 = icmp slt i32 %103, %104
br i1 %105, label %106, label %140
106: ; preds = %102
%107 = load double*, double** %11
%108 = load i32, i32* %29
%109 = load i32, i32* %30
%110 = load i32, i32* %14
%111 = mul nsw i32 %109, %110
%112 = add nsw i32 %108, %111
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %107, i64 %113
%115 = load double, double* %114
%116 = load double*, double** %22
%117 = load i32, i32* %30
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds double, double* %116, i64 %118
%120 = load double, double* %119
%121 = fmul double %115, %120
%122 = load double*, double** %11
%123 = load i32, i32* %29
%124 = load i32, i32* %30
%125 = load i32, i32* %14
%126 = mul nsw i32 %124, %125
%127 = add nsw i32 %123, %126
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds double, double* %122, i64 %128
%130 = load double, double* %129
%131 = load double*, double** %21
%132 = load i32, i32* %29
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds double, double* %131, i64 %133
%135 = load double, double* %134
%136 = call double @llvm.fmuladd.f64(double %121, double %130, double %135)
store double %136, double* %134
br label %137
137: ; preds = %106
%138 = load i32, i32* %30
%139 = add nsw i32 %138, 1
store i32 %139, i32* %30
br label %102
140: ; preds = %102
br label %141
141: ; preds = %140
%142 = load i32, i32* %29
%143 = add nsw i32 %142, 1
store i32 %143, i32* %29
br label %93
144: ; preds = %93
br label %145
145: ; preds = %196, %144
%146 = load double, double* %26
%147 = load double*, double** %17
%148 = load double, double* %147
%149 = fcmp ogt double %146, %148
br i1 %149, label %150, label %155
150: ; preds = %145
%151 = load i32, i32* %20
%152 = load i32*, i32** %18
%153 = load i32, i32* %152
%154 = icmp slt i32 %151, %153
br label %155
155: ; preds = %150, %145
%156 = phi i1 [ false, %145 ], [ %154, %150 ]
br i1 %156, label %157, label %202
157: ; preds = %155
store i32 0, i32* %31
br label %158
158: ; preds = %180, %157
%159 = load i32, i32* %31
%160 = load i32, i32* %14
%161 = icmp slt i32 %159, %160
br i1 %161, label %162, label %183
162: ; preds = %158
%163 = load double*, double** %11
%164 = load double*, double** %12
%165 = load double*, double** %19
%166 = load i32, i32* %16
%167 = load i32, i32* %14
%168 = load i32, i32* %15
%169 = load double*, double** %22
%170 = load double*, double** %24
%171 = load double*, double** %23
%172 = load double*, double** %21
%173 = load i32, i32* %31
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double, double* %172, i64 %174
%176 = load double, double* %175
%177 = load i32, i32* %31
%178 = load double*, double** %25
%179 = call i32 @update_x_k(double* %163, double* %164, double* %165, i32 %166, i32 %167, i32 %168, double* %169, double* %170, double* %171, double %176, i32 %177, double* %178)
br label %180
180: ; preds = %162
%181 = load i32, i32* %31
%182 = add nsw i32 %181, 1
store i32 %182, i32* %31
br label %158
183: ; preds = %158
%184 = load i32, i32* %20
%185 = add nsw i32 %184, 1
store i32 %185, i32* %20
%186 = load double*, double** %19
%187 = load i32, i32* %15
%188 = call i64 @diverged(double* %186, i32 %187)
%189 = icmp ne i64 %188, 0
br i1 %189, label %195, label %190
190: ; preds = %183
%191 = load double*, double** %23
%192 = load i32, i32* %14
%193 = call i64 @diverged(double* %191, i32 %192)
%194 = icmp ne i64 %193, 0
br i1 %194, label %195, label %196
195: ; preds = %190, %183
store i32 2, i32* %27
br label %202
196: ; preds = %190
%197 = load double*, double** %25
%198 = load double*, double** %21
%199 = load i32, i32* %16
%200 = load i32, i32* %14
%201 = call double @absmax(double* %197, double* %198, i32 %199, i32 %200)
store double %201, double* %26
br label %145
202: ; preds = %195, %155
%203 = load i32, i32* %27
%204 = icmp ne i32 %203, 2
br i1 %204, label %205, label %216
205: ; preds = %202
%206 = load i32, i32* %20
%207 = load i32*, i32** %18
%208 = load i32, i32* %207
%209 = icmp eq i32 %206, %208
br i1 %209, label %210, label %216
210: ; preds = %205
%211 = load double, double* %26
%212 = load double*, double** %17
%213 = load double, double* %212
%214 = fcmp ogt double %211, %213
br i1 %214, label %215, label %216
215: ; preds = %210
store i32 3, i32* %27
br label %216
216: ; preds = %215, %210, %205, %202
%217 = load double*, double** %11
%218 = load double*, double** %12
%219 = load double*, double** %19
%220 = load i32, i32* %16
%221 = load i32, i32* %14
%222 = load i32, i32* %15
%223 = call double @dc_diffmax(double* %217, double* %218, double* %219, i32 %220, i32 %221, i32 %222)
%224 = load double*, double** %17
store double %223, double* %224
%225 = load i32, i32* %20
%226 = load i32*, i32** %18
store i32 %225, i32* %226
%227 = load double*, double** %24
%228 = call i32 @free(double* %227)
%229 = load double*, double** %21
%230 = call i32 @free(double* %229)
%231 = load double*, double** %22
%232 = call i32 @free(double* %231)
%233 = load double*, double** %23
%234 = call i32 @free(double* %233)
%235 = load double*, double** %25
%236 = call i32 @free(double* %235)
%237 = load i32, i32* %27
store i32 %237, i32* %10
br label %238
238: ; preds = %216, %61
%239 = load i32, i32* %10
ret i32 %239
}

LLVM IR (-O2):
@DBL_MAX = global double 0.000000e+00
define i32 @dc_solve(double* %0, double* %1, double* nocapture %2, i32 %3, i32 %4, i32 %5, double* nocapture %6, i32* nocapture %7, double* %8) {
%10 = tail call i64 @calloc(i32 %3, i32 8)
%11 = inttoptr i64 %10 to double*
%12 = tail call i64 @calloc(i32 %4, i32 8)
%13 = inttoptr i64 %12 to double*
%14 = inttoptr i64 %12 to i8*
%15 = tail call i64 @calloc(i32 %3, i32 8)
%16 = inttoptr i64 %15 to double*
%17 = tail call i64 @calloc(i32 %4, i32 8)
%18 = inttoptr i64 %17 to double*
%19 = tail call i64 @calloc(i32 %3, i32 8)
%20 = inttoptr i64 %19 to double*
%21 = icmp eq i64 %10, 0
%22 = icmp eq i64 %12, 0
%23 = select i1 %21, i1 true, i1 %22
%24 = icmp eq i64 %15, 0
%25 = select i1 %23, i1 true, i1 %24
%26 = icmp eq i64 %19, 0
%27 = select i1 %25, i1 true, i1 %26
%28 = icmp eq i64 %17, 0
%29 = select i1 %27, i1 true, i1 %28
br i1 %29, label %208, label %30
30: ; preds = %9
%31 = load double, double* @DBL_MAX
%32 = icmp sgt i32 %4, 0
br i1 %32, label %33, label %98
33: ; preds = %30
%34 = zext i32 %4 to i64
%35 = icmp eq i32 %4, 1
br i1 %35, label %83, label %36
36: ; preds = %33
%37 = getelementptr double, double* %13, i64 %34
%38 = getelementptr double, double* %2, i64 %34
%39 = bitcast double* %38 to i8*
%40 = icmp ult i8* %14, %39
%41 = icmp ugt double* %37, %2
%42 = and i1 %40, %41
br i1 %42, label %83, label %43
43: ; preds = %36
%44 = and i64 %34, 4294967294
%45 = add nsw i64 %44, -2
%46 = lshr exact i64 %45, 1
%47 = add nuw i64 %46, 1
%48 = and i64 %47, 1
%49 = icmp eq i64 %45, 0
br i1 %49, label %71, label %50
50: ; preds = %43
%51 = and i64 %47, -2
br label %52
52: ; preds = %52, %50
%53 = phi i64 [ 0, %50 ], [ %68, %52 ]
%54 = phi i64 [ 0, %50 ], [ %69, %52 ]
%55 = getelementptr inbounds double, double* %2, i64 %53
%56 = bitcast double* %55 to <2 x double>*
%57 = load <2 x double>, <2 x double>* %56
%58 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %57
%59 = getelementptr inbounds double, double* %13, i64 %53
%60 = bitcast double* %59 to <2 x double>*
store <2 x double> %58, <2 x double>* %60
%61 = or i64 %53, 2
%62 = getelementptr inbounds double, double* %2, i64 %61
%63 = bitcast double* %62 to <2 x double>*
%64 = load <2 x double>, <2 x double>* %63
%65 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %64
%66 = getelementptr inbounds double, double* %13, i64 %61
%67 = bitcast double* %66 to <2 x double>*
store <2 x double> %65, <2 x double>* %67
%68 = add nuw i64 %53, 4
%69 = add nuw i64 %54, 2
%70 = icmp eq i64 %69, %51
br i1 %70, label %71, label %52
71: ; preds = %52, %43
%72 = phi i64 [ 0, %43 ], [ %68, %52 ]
%73 = icmp eq i64 %48, 0
br i1 %73, label %81, label %74
74: ; preds = %71
%75 = getelementptr inbounds double, double* %2, i64 %72
%76 = bitcast double* %75 to <2 x double>*
%77 = load <2 x double>, <2 x double>* %76
%78 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %77
%79 = getelementptr inbounds double, double* %13, i64 %72
%80 = bitcast double* %79 to <2 x double>*
store <2 x double> %78, <2 x double>* %80
br label %81
81: ; preds = %71, %74
%82 = icmp eq i64 %44, %34
br i1 %82, label %98, label %83
83: ; preds = %36, %33, %81
%84 = phi i64 [ 0, %36 ], [ 0, %33 ], [ %44, %81 ]
%85 = xor i64 %84, -1
%86 = and i64 %34, 1
%87 = icmp eq i64 %86, 0
br i1 %87, label %94, label %88
88: ; preds = %83
%89 = getelementptr inbounds double, double* %2, i64 %84
%90 = load double, double* %89
%91 = fdiv double 1.000000e+00, %90
%92 = getelementptr inbounds double, double* %13, i64 %84
store double %91, double* %92
%93 = or i64 %84, 1
br label %94
94: ; preds = %88, %83
%95 = phi i64 [ %84, %83 ], [ %93, %88 ]
%96 = sub nsw i64 0, %34
%97 = icmp eq i64 %85, %96
br i1 %97, label %98, label %108
98: ; preds = %94, %108, %81, %30
%99 = icmp sgt i32 %3, 0
br i1 %99, label %100, label %121
100: ; preds = %98
%101 = zext i32 %3 to i64
%102 = zext i32 %3 to i64
%103 = zext i32 %4 to i64
%104 = and i64 %103, 1
%105 = icmp eq i32 %4, 1
%106 = and i64 %103, 4294967294
%107 = icmp eq i64 %104, 0
br label %128
108: ; preds = %94, %108
%109 = phi i64 [ %119, %108 ], [ %95, %94 ]
%110 = getelementptr inbounds double, double* %2, i64 %109
%111 = load double, double* %110
%112 = fdiv double 1.000000e+00, %111
%113 = getelementptr inbounds double, double* %13, i64 %109
store double %112, double* %113
%114 = add nuw nsw i64 %109, 1
%115 = getelementptr inbounds double, double* %2, i64 %114
%116 = load double, double* %115
%117 = fdiv double 1.000000e+00, %116
%118 = getelementptr inbounds double, double* %13, i64 %114
store double %117, double* %118
%119 = add nuw nsw i64 %109, 2
%120 = icmp eq i64 %119, %34
br i1 %120, label %98, label %108
121: ; preds = %144, %98
%122 = load double, double* %6
%123 = fcmp ogt double %31, %122
br i1 %123, label %124, label %195
124: ; preds = %121
%125 = zext i32 %3 to i64
%126 = load i32, i32* %7
%127 = icmp sgt i32 %126, 0
br i1 %127, label %174, label %195
128: ; preds = %100, %144
%129 = phi i64 [ 0, %100 ], [ %145, %144 ]
%130 = getelementptr inbounds double, double* %11, i64 %129
store double 0.000000e+00, double* %130
br i1 %32, label %131, label %144
131: ; preds = %128
br i1 %105, label %132, label %147
132: ; preds = %147, %131
%133 = phi double [ 0.000000e+00, %131 ], [ %167, %147 ]
%134 = phi i64 [ 0, %131 ], [ %168, %147 ]
br i1 %107, label %144, label %135
135: ; preds = %132
%136 = mul nsw i64 %134, %101
%137 = add nuw nsw i64 %136, %129
%138 = getelementptr inbounds double, double* %0, i64 %137
%139 = load double, double* %138
%140 = getelementptr inbounds double, double* %13, i64 %134
%141 = load double, double* %140
%142 = fmul double %139, %141
%143 = tail call double @llvm.fmuladd.f64(double %142, double %139, double %133)
store double %143, double* %130
br label %144
144: ; preds = %135, %132, %128
%145 = add nuw nsw i64 %129, 1
%146 = icmp eq i64 %145, %102
br i1 %146, label %121, label %128
147: ; preds = %131, %147
%148 = phi double [ %167, %147 ], [ 0.000000e+00, %131 ]
%149 = phi i64 [ %168, %147 ], [ 0, %131 ]
%150 = phi i64 [ %169, %147 ], [ 0, %131 ]
%151 = mul nsw i64 %149, %101
%152 = add nuw nsw i64 %151, %129
%153 = getelementptr inbounds double, double* %0, i64 %152
%154 = load double, double* %153
%155 = getelementptr inbounds double, double* %13, i64 %149
%156 = load double, double* %155
%157 = fmul double %154, %156
%158 = tail call double @llvm.fmuladd.f64(double %157, double %154, double %148)
store double %158, double* %130
%159 = or i64 %149, 1
%160 = mul nsw i64 %159, %101
%161 = add nuw nsw i64 %160, %129
%162 = getelementptr inbounds double, double* %0, i64 %161
%163 = load double, double* %162
%164 = getelementptr inbounds double, double* %13, i64 %159
%165 = load double, double* %164
%166 = fmul double %163, %165
%167 = tail call double @llvm.fmuladd.f64(double %166, double %163, double %158)
store double %167, double* %130
%168 = add nuw nsw i64 %149, 2
%169 = add i64 %150, 2
%170 = icmp eq i64 %169, %106
br i1 %170, label %132, label %147
171: ; preds = %191
%172 = load i32, i32* %7
%173 = icmp slt i32 %177, %172
br i1 %173, label %174, label %195
174: ; preds = %124, %171
%175 = phi i32 [ %177, %171 ], [ 0, %124 ]
br i1 %99, label %180, label %176
176: ; preds = %180, %174
%177 = add nuw nsw i32 %175, 1
%178 = tail call i64 @diverged(double* %8, i32 %4)
%179 = icmp eq i64 %178, 0
br i1 %179, label %188, label %204
180: ; preds = %174, %180
%181 = phi i64 [ %186, %180 ], [ 0, %174 ]
%182 = getelementptr inbounds double, double* %11, i64 %181
%183 = load double, double* %182
%184 = trunc i64 %181 to i32
%185 = tail call i32 @update_x_k(double* %0, double* %1, double* %8, i32 %5, i32 %3, i32 %4, double* %13, double* %18, double* %16, double %183, i32 %184, double* %20)
%186 = add nuw nsw i64 %181, 1
%187 = icmp eq i64 %186, %125
br i1 %187, label %176, label %180
188: ; preds = %176
%189 = tail call i64 @diverged(double* %16, i32 %3)
%190 = icmp eq i64 %189, 0
br i1 %190, label %191, label %204
191: ; preds = %188
%192 = tail call double @absmax(double* %20, double* %11, i32 %5, i32 %3)
%193 = load double, double* %6
%194 = fcmp ogt double %192, %193
br i1 %194, label %171, label %195
195: ; preds = %171, %191, %124, %121
%196 = phi double [ %122, %121 ], [ %122, %124 ], [ %193, %191 ], [ %193, %171 ]
%197 = phi i32 [ 0, %121 ], [ 0, %124 ], [ %177, %191 ], [ %177, %171 ]
%198 = phi double [ %31, %121 ], [ %31, %124 ], [ %192, %191 ], [ %192, %171 ]
%199 = load i32, i32* %7
%200 = icmp eq i32 %197, %199
%201 = fcmp ogt double %198, %196
%202 = select i1 %200, i1 %201, i1 false
%203 = select i1 %202, i32 3, i32 0
br label %204
204: ; preds = %176, %188, %195
%205 = phi i32 [ %197, %195 ], [ %177, %188 ], [ %177, %176 ]
%206 = phi i32 [ %203, %195 ], [ 2, %188 ], [ 2, %176 ]
%207 = tail call double @dc_diffmax(double* %0, double* %1, double* %8, i32 %5, i32 %3, i32 %4)
store double %207, double* %6
store i32 %205, i32* %7
br label %208
208: ; preds = %9, %204
%209 = phi double* [ %18, %204 ], [ %11, %9 ]
%210 = phi double* [ %11, %204 ], [ %13, %9 ]
%211 = phi double* [ %13, %204 ], [ %16, %9 ]
%212 = phi double* [ %16, %204 ], [ %20, %9 ]
%213 = phi double* [ %20, %204 ], [ %18, %9 ]
%214 = phi i32 [ %206, %204 ], [ 1, %9 ]
%215 = tail call i32 @free(double* %209)
%216 = tail call i32 @free(double* %210)
%217 = tail call i32 @free(double* %211)
%218 = tail call i32 @free(double* %212)
%219 = tail call i32 @free(double* %213)
ret i32 %214
}