// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../external/HyRec2020/hydrogen.c
// Function: solve_real_virt
void solve_real_virt(double xr[2], double xv[NVIRT], double Trr[2][2], double *Trv[2], double *Tvr[2], double *Tvv[3],
                     double sr[2], double sv[NVIRT], int *error, char error_message[SIZE_ErrorM]){

  double *Tvv_inv_Tvr[2];
  double *Tvv_inv_sv;
  double Trr_new[2][2];
  double sr_new[2];
  unsigned i, j, b;
  double det;

  unsigned NSUBDIFF;
  NSUBDIFF = NSUBLYA - NDIFF/2;     /* lowest bin of the diffusion region */

  /** Allocate memory **/
  for (i = 0; i < 2; i++) Tvv_inv_Tvr[i] = create_1D_array(NVIRT, error, error_message);
  Tvv_inv_sv = create_1D_array(NVIRT, error, error_message);

  /*** Computing Tvv^{-1}.Tvr ***/

  for (i = 0; i < 2; i++) {
    for (b = 0; b < NSUBDIFF; b++)               Tvv_inv_Tvr[i][b] = Tvr[i][b]/Tvv[0][b];
    for (b = NSUBLYA + NDIFF/2; b < NVIRT; b++)  Tvv_inv_Tvr[i][b] = Tvr[i][b]/Tvv[0][b];
    solveTXeqB(Tvv[0]+NSUBDIFF, Tvv[2]+NSUBDIFF, Tvv[1]+NSUBDIFF, Tvv_inv_Tvr[i]+NSUBDIFF, Tvr[i]+NSUBDIFF, NDIFF, error, error_message);
  }

  /*** Trr_new = Trr - Trv.Tvv^{-1}.Tvr ***/
  for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) {
    Trr_new[i][j] = Trr[i][j];
    for (b = 0; b < NVIRT; b++) Trr_new[i][j] -= Trv[i][b]*Tvv_inv_Tvr[j][b];
  }

  /*** Computing Tvv^{-1}.sv ***/
  for (b = 0; b < NSUBDIFF; b++)               Tvv_inv_sv[b] = sv[b]/Tvv[0][b];
  for (b = NSUBLYA + NDIFF/2; b < NVIRT; b++)  Tvv_inv_sv[b] = sv[b]/Tvv[0][b];
  solveTXeqB(Tvv[0]+NSUBDIFF, Tvv[2]+NSUBDIFF, Tvv[1]+NSUBDIFF, Tvv_inv_sv+NSUBDIFF, sv+NSUBDIFF, NDIFF, error, error_message);

  /*** sr_new = sr - Trv.Tvv^{-1}sv ***/
  for (i = 0; i < 2; i++) {
    sr_new[i] = sr[i];
    for (b = 0; b < NVIRT; b++) sr_new[i] -= Trv[i][b]*Tvv_inv_sv[b];
  }

  /*** Solve 2 by 2 system Trr_new.xr = sr_new ***/
  det = Trr_new[0][0] * Trr_new[1][1] - Trr_new[0][1] * Trr_new[1][0];
  xr[0] = (Trr_new[1][1] * sr_new[0] - Trr_new[0][1] * sr_new[1])/det;
  xr[1] = (Trr_new[0][0] * sr_new[1] - Trr_new[1][0] * sr_new[0])/det;

  /*** xv = Tvv^{-1}(sv - Tvr.xr) ***/
  for (b = 0; b < NVIRT; b++) xv[b] = Tvv_inv_sv[b] - Tvv_inv_Tvr[0][b]*xr[0] - Tvv_inv_Tvr[1][b]*xr[1];

  /** Free memory **/
  for (i = 0; i < 2; i++) free(Tvv_inv_Tvr[i]);
  free(Tvv_inv_sv);

}

// Assembly:
subq $0xb8, %rsp
movq 0xd8(%rsp), %rax
movq 0xd0(%rsp), %rax
movq 0xc8(%rsp), %rax
movq 0xc0(%rsp), %rax
movq %rdi, 0xb0(%rsp)
movq %rsi, 0xa8(%rsp)
movq %rdx, 0xa0(%rsp)
movq %rcx, 0x98(%rsp)
movq %r8, 0x90(%rsp)
movq %r9, 0x88(%rsp)
movl $0x64, 0x14(%rsp)
movl $0x0, 0x2c(%rsp)
cmpl $0x2, 0x2c(%rsp)
jae 0x1abbd1
movq 0xd0(%rsp), %rsi
movq 0xd8(%rsp), %rdx
movl $0x137, %edi            # imm = 0x137
callq 0x1a5690
movq %rax, %rcx
movl 0x2c(%rsp), %eax
movq %rcx, 0x70(%rsp,%rax,8)
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x1abb97
movq 0xd0(%rsp), %rsi
movq 0xd8(%rsp), %rdx
movl $0x137, %edi            # imm = 0x137
callq 0x1a5690
movq %rax, 0x68(%rsp)
movl $0x0, 0x2c(%rsp)
cmpl $0x2, 0x2c(%rsp)
jae 0x1abd67
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
cmpl 0x14(%rsp), %eax
jae 0x1abc61
movq 0x90(%rsp), %rax
movl 0x2c(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movl 0x24(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x88(%rsp), %rax
movq (%rax), %rax
movl 0x24(%rsp), %ecx
divsd (%rax,%rcx,8), %xmm0
movl 0x2c(%rsp), %eax
movq 0x70(%rsp,%rax,8), %rax
movl 0x24(%rsp), %ecx
movsd %xmm0, (%rax,%rcx,8)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x1abc0b
movl $0xb4, 0x24(%rsp)
cmpl $0x137, 0x24(%rsp)      # imm = 0x137
jae 0x1abcbf
movq 0x90(%rsp), %rax
movl 0x2c(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movl 0x24(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x88(%rsp), %rax
movq (%rax), %rax
movl 0x24(%rsp), %ecx
divsd (%rax,%rcx,8), %xmm0
movl 0x2c(%rsp), %eax
movq 0x70(%rsp,%rax,8), %rax
movl 0x24(%rsp), %ecx
movsd %xmm0, (%rax,%rcx,8)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x1abc69
movq 0x88(%rsp), %rax
movq (%rax), %rdi
movl 0x14(%rsp), %eax
shlq $0x3, %rax
addq %rax, %rdi
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rsi
movl 0x14(%rsp), %eax
shlq $0x3, %rax
addq %rax, %rsi
movq 0x88(%rsp), %rax
movq 0x8(%rax), %rdx
movl 0x14(%rsp), %eax
shlq $0x3, %rax
addq %rax, %rdx
movl 0x2c(%rsp), %eax
movq 0x70(%rsp,%rax,8), %rcx
movl 0x14(%rsp), %eax
shlq $0x3, %rax
addq %rax, %rcx
movq 0x90(%rsp), %rax
movl 0x2c(%rsp), %r8d
movq (%rax,%r8,8), %r8
movl 0x14(%rsp), %eax
shlq $0x3, %rax
addq %rax, %r8
movq 0xd0(%rsp), %r10
movq 0xd8(%rsp), %rax
movl $0x50, %r9d
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1ab8e0
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x1abbf8
movl $0x0, 0x2c(%rsp)
cmpl $0x2, 0x2c(%rsp)
jae 0x1abe74
movl $0x0, 0x28(%rsp)
cmpl $0x2, 0x28(%rsp)
jae 0x1abe62
movq 0xa0(%rsp), %rax
movl 0x2c(%rsp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x28(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movl 0x2c(%rsp), %eax
movl %eax, %ecx
leaq 0x40(%rsp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x28(%rsp), %ecx
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, 0x24(%rsp)
cmpl $0x137, 0x24(%rsp)      # imm = 0x137
jae 0x1abe50
movq 0x98(%rsp), %rax
movl 0x2c(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movl 0x24(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movl 0x28(%rsp), %eax
movq 0x70(%rsp,%rax,8), %rax
movl 0x24(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm2
movl 0x2c(%rsp), %eax
movl %eax, %ecx
leaq 0x40(%rsp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x28(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm1
movq %xmm0, %rdx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
xorq %rsi, %rdx
movq %rdx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x1abdcc
jmp 0x1abe52
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x1abd82
jmp 0x1abe64
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x1abd6f
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
cmpl 0x14(%rsp), %eax
jae 0x1abec6
movq 0xc8(%rsp), %rax
movl 0x24(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x88(%rsp), %rax
movq (%rax), %rax
movl 0x24(%rsp), %ecx
divsd (%rax,%rcx,8), %xmm0
movq 0x68(%rsp), %rax
movl 0x24(%rsp), %ecx
movsd %xmm0, (%rax,%rcx,8)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x1abe7c
movl $0xb4, 0x24(%rsp)
cmpl $0x137, 0x24(%rsp)      # imm = 0x137
jae 0x1abf18
movq 0xc8(%rsp), %rax
movl 0x24(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x88(%rsp), %rax
movq (%rax), %rax
movl 0x24(%rsp), %ecx
divsd (%rax,%rcx,8), %xmm0
movq 0x68(%rsp), %rax
movl 0x24(%rsp), %ecx
movsd %xmm0, (%rax,%rcx,8)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x1abece
movq 0x88(%rsp), %rax
movq (%rax), %rdi
movl 0x14(%rsp), %eax
shlq $0x3, %rax
addq %rax, %rdi
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rsi
movl 0x14(%rsp), %eax
shlq $0x3, %rax
addq %rax, %rsi
movq 0x88(%rsp), %rax
movq 0x8(%rax), %rdx
movl 0x14(%rsp), %eax
shlq $0x3, %rax
addq %rax, %rdx
movq 0x68(%rsp), %rcx
movl 0x14(%rsp), %eax
shlq $0x3, %rax
addq %rax, %rcx
movq 0xc8(%rsp), %r8
movl 0x14(%rsp), %eax
shlq $0x3, %rax
addq %rax, %r8
movq 0xd0(%rsp), %r10
movq 0xd8(%rsp), %rax
movl $0x50, %r9d
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1ab8e0
movl $0x0, 0x2c(%rsp)
cmpl $0x2, 0x2c(%rsp)
jae 0x1ac058
movq 0xc0(%rsp), %rax
movl 0x2c(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movl 0x2c(%rsp), %eax
movsd %xmm0, 0x30(%rsp,%rax,8)
movl $0x0, 0x24(%rsp)
cmpl $0x137, 0x24(%rsp)      # imm = 0x137
jae 0x1ac046
movq 0x98(%rsp), %rax
movl 0x2c(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movl 0x24(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x68(%rsp), %rax
movl 0x24(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm2
movl 0x2c(%rsp), %eax
movsd 0x30(%rsp,%rax,8), %xmm1
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp,%rax,8)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x1abfd9
jmp 0x1ac048
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x1abfab
movsd 0x40(%rsp), %xmm0
movsd 0x58(%rsp), %xmm2
movsd 0x48(%rsp), %xmm1
mulsd 0x50(%rsp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x58(%rsp), %xmm0
movsd 0x30(%rsp), %xmm2
movsd 0x48(%rsp), %xmm1
mulsd 0x38(%rsp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
divsd 0x18(%rsp), %xmm0
movq 0xb0(%rsp), %rax
movsd %xmm0, (%rax)
movsd 0x40(%rsp), %xmm0
movsd 0x38(%rsp), %xmm2
movsd 0x50(%rsp), %xmm1
mulsd 0x30(%rsp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
divsd 0x18(%rsp), %xmm0
movq 0xb0(%rsp), %rax
movsd %xmm0, 0x8(%rax)
movl $0x0, 0x24(%rsp)
cmpl $0x137, 0x24(%rsp)      # imm = 0x137
jae 0x1ac1e0
movq 0x68(%rsp), %rax
movl 0x24(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x70(%rsp), %rax
movl 0x24(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm1
movq 0xb0(%rsp), %rax
movsd (%rax), %xmm2
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movq 0x78(%rsp), %rax
movl 0x24(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0xb0(%rsp), %rax
movsd 0x8(%rax), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0xa8(%rsp), %rax
movl 0x24(%rsp), %ecx
movsd %xmm0, (%rax,%rcx,8)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x1ac130
movl $0x0, 0x2c(%rsp)
cmpl $0x2, 0x2c(%rsp)
jae 0x1ac20a
movl 0x2c(%rsp), %eax
movq 0x70(%rsp,%rax,8), %rdi
callq 0x8420
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x1ac1e8
movq 0x68(%rsp), %rdi
callq 0x8420
addq $0xb8, %rsp
retq
nopl (%rax)