// File: /workspace/github_c_makefile_star2_O3/radforddc[P]icpc_siggen/icpc_fieldgen_opt.c
// Function: do_relax
int do_relax(MJD_Siggen_Setup *setup, int ev_calc) {
  int    old = 1, new = 0, iter, r, z;
  float  grid = setup->xtal_grid;
  int    L  = lrint(setup->xtal_length/grid)+2;
  int    R  = lrint(setup->xtal_radius/grid)+2;
  double eps_sum, v_sum, dif, sum_dif=0, max_dif;
  double ***v = setup->v, **eps_dr = setup->eps_dr, **eps_dz = setup->eps_dz;
  double ***dr = setup->dr, ***dz = setup->dz;
  double *s1 = setup->s1, *s2 = setup->s2;
  double e_over_E = 11.310; // e/epsilon; for 1 mm2, charge units 1e10 e/cm3, espilon = 16*epsilon0


  if (ev_calc) {
    // for field calculation, save impurity value along passivated surface
    for (r = 1; r < R; r++)
      setup->impurity[0][r] = setup->impurity[1][r];
  } else {
    // for WP calculation, clear all impurity values
    for (z = 0; z < L; z++) {
      for (r = 1; r < R; r++) {
        setup->impurity[z][r] = 0;
      }
    }
  }

  for (iter = 0; iter < setup->max_iterations; iter++) {

    /* the following definition of the factor for over-relaxation improves convergence
           time by a factor ~ 70-120 for a 2kg ICPC detector, grid = 0.1 mm
         OR_fact increases with increasing volxel count (L*R)
               and with increasing iteration number
         0.997 is maximum asymptote for very large pixel count and iteration number */
    double OR_fact;
    if (ev_calc)  OR_fact = (1.991 - 1500.0/(L*R));
    else          OR_fact = (1.992 - 1500.0/(L*R));
    if (OR_fact < 1.4) OR_fact = 1.4;
    // if (iter == 0) printf("OR_fact = %f\n", OR_fact);
    if (iter < 1) OR_fact = 1.0;

    old = new;
    new = 1 - new;
    sum_dif = 0;
    max_dif = 0;

    if (setup->vacuum_gap > 0) {   // modify impurity value along passivated surface
      for (r = 1; r < R; r++)      //   due to surface charge induced by capacitance
        setup->impurity[1][r] = setup->impurity[0][r] -
          v[old][1][r] * 5.52e-4 * e_over_E * grid / setup->vacuum_gap;
    }

    /* start from z=1 and r=1 so that (z,r)=0 can be
       used for reflection symmetry around r=0 or z=0 */
    for (z = 1; z < L; z++) {
      /* manage r=0 reflection symmetry */
      setup->v[old][z][0] = setup->v[new][z][0] = setup->v[old][z][2];

      for (r = 1; r < R; r++) {
        if (setup->point_type[z][r] < INSIDE) continue;   // HV or point contact

        if (setup->point_type[z][r] < DITCH) {       // normal bulk or passivated surface, no complications
          v_sum = (v[old][z+1][r] + v[old][z][r+1]*s1[r] +
                   v[new][z-1][r] + v[new][z][r-1]*s2[r]);
          if (r > 1) eps_sum = 4;
          else       eps_sum = 2 + s1[r] + s2[r];
        } else if (setup->point_type[z][r] == CONTACT_EDGE) {  // adjacent to the contact
          v_sum = (v[old][z+1][r]*dz[1][z][r] + v[old][z][r+1]*dr[1][z][r] +
                   v[new][z-1][r]*dz[0][z][r] + v[new][z][r-1]*dr[0][z][r]);
          eps_sum = dz[1][z][r] + dr[1][z][r] + dz[0][z][r] + dr[0][z][r];
        } else if (setup->point_type[z][r] >= DITCH) {  // in or adjacent to the ditch
          v_sum = (v[old][z+1][r]*eps_dz[z  ][r] + v[old][z][r+1]*eps_dr[z][r  ]*s1[r] +
                   v[new][z-1][r]*eps_dz[z-1][r] + v[new][z][r-1]*eps_dr[z][r-1]*s2[r]);
          eps_sum = (eps_dz[z][r]   + eps_dr[z][r]  *s1[r] +
                     eps_dz[z-1][r] + eps_dr[z][r-1]*s2[r]);
        }

        // calculate the interpolated mean potential and the effect of the space charge

        if ((ev_calc || (setup->vacuum_gap > 0 && z == 1)) &&
            setup->point_type[z][r] < CONTACT_EDGE && r > 1 && z > 1) {   // normal bulk, no complications
          v[new][z][r] = (1.0-OR_fact)*v[old][z][r] + OR_fact * (v_sum / eps_sum + setup->impurity[z][r]);
        } else if (ev_calc || (setup->vacuum_gap > 0 && z == 1)) {
          v[new][z][r] = v_sum / eps_sum + setup->impurity[z][r];
        } else if (setup->point_type[z][r] < CONTACT_EDGE && r > 1 && z > 1) {   // normal bulk, no complications
          v[new][z][r] = (1.0-OR_fact)*v[old][z][r] + OR_fact * v_sum / eps_sum;
        } else {                          // over-relaxation at the edges seems to make things worse
          v[new][z][r] = v_sum / eps_sum;
        }

        // calculate difference from last iteration, for convergence check
        dif = fabs(v[old][z][r] - v[new][z][r]);
        sum_dif += dif;
        if (max_dif < dif) max_dif = dif;
      }
    }

    // report results for some iterations
    if (iter < 10 || (iter < 600 && iter%100 == 0) || iter%1000 == 0) {
      if (0 && ev_calc) {
        printf("%5d %d %d %.10f %.10f\n", iter, old, new, max_dif, sum_dif/(L-2)/(R-2));
      } else {
        printf("%5d %d %d %.10f %.10f ; %.10f %.10f\n",
               iter, old, new, max_dif, sum_dif/(L-2)/(R-2),
               v[new][L/2][R/2], v[new][L/3][R/3]);
      }
    }
    // check for convergence
    if ( ev_calc && max_dif < 0.00000008) break;
    if ( ev_calc && max_dif < 0.0008) break;  // comment out if you want convergence at the numerical error level
    if (!ev_calc && max_dif < 0.0000000001) break;
    if (!ev_calc && max_dif < 0.000001) break;  // comment out if you want convergence at the numerical error level

    /* every 100 iterations, check that detector is really depleted*/
    if (ev_calc && iter > 190 && iter%100 == 0) {
      for (z = 1; z < L; z++) {
        setup->v[old][z][0] = setup->v[old][z][2];
        for (r = 1; r < R; r++) {
          if (setup->point_type[z][r] < INSIDE) continue;   // HV or point contact
          if (v[new][z][r] < 0 ||
              (v[new][z][r] < v[new][z][r] &&
               v[new][z][r] < v[new][z][r] &&
               v[new][z][r] < v[new][z][r] &&
               v[new][z][r] < v[new][z][r])) {
            printf("Detector may not be fully depleted. Switching to ev_relax_undep()\n");
            ev_relax_undep(setup);
            return 0;
          }
        }
      }

    }
  }

  printf(">> %d %.16f\n\n", iter, sum_dif);
  if (setup->vacuum_gap > 0) {   // restore impurity value along passivated surface
    for (r = 1; r < R; r++)
      setup->impurity[1][r] = setup->impurity[0][r];
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movss 0x4(%rdi), %xmm0
movss 0x54(%rdi), %xmm1
movss %xmm1, 0x30(%rsp)
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x1100
movq %rax, 0x20(%rsp)
leal 0x2(%rax), %r14d
movss 0x8(%rbx), %xmm0
divss 0x30(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x1100
movq %rax, %r8
addl $0x2, %eax
movl %eax, 0x8(%rsp)
movq 0x3f8(%rbx), %rax
movq %rax, 0xa8(%rsp)
movq 0x400(%rbx), %rax
movq %rax, 0xa0(%rsp)
movq 0x418(%rbx), %rax
movq %rax, 0x58(%rsp)
movq 0x420(%rbx), %rax
movq %rax, 0x50(%rsp)
testl %ebp, %ebp
movq %r8, 0x18(%rsp)
je 0x650a
cmpl $0x7ffffffd, %r8d       # imm = 0x7FFFFFFD
ja 0x6559
movq 0x408(%rbx), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
movl 0x8(%rsp), %edx
movl $0x1, %esi
movsd (%rcx,%rsi,8), %xmm0
movsd %xmm0, (%rax,%rsi,8)
incq %rsi
cmpq %rsi, %rdx
jne 0x64f6
jmp 0x6559
testl %r14d, %r14d
jle 0x6559
leaq 0x8(,%r8,8), %rax
movabsq $0x7fffffff8, %r15      # imm = 0x7FFFFFFF8
andq %rax, %r15
movl %r14d, %r12d
xorl %r13d, %r13d
cmpl $0x7ffffffd, %r8d       # imm = 0x7FFFFFFD
ja 0x6551
movq 0x408(%rbx), %rax
movq (%rax,%r13,8), %rdi
addq $0x8, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x1110
movq 0x18(%rsp), %r8
incq %r13
cmpq %r13, %r12
jne 0x652a
cmpl $0x0, 0x78(%rbx)
jle 0x6cb3
xorl %eax, %eax
testl %ebp, %ebp
setne %al
movl 0x8(%rsp), %esi
movl %esi, %ecx
imull %r14d, %ecx
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
movsd 0x2b75(%rip), %xmm0     # 0x90f8
divsd %xmm1, %xmm0
cvtss2sd 0x30(%rsp), %xmm11
xorps %xmm1, %xmm1
cvtsi2sdl 0x20(%rsp), %xmm1
movsd %xmm1, 0x90(%rsp)
xorps %xmm1, %xmm1
cvtsi2sd %r8d, %xmm1
movsd %xmm1, 0x88(%rsp)
movl %r14d, %ecx
shrl $0x1f, %ecx
addl %r14d, %ecx
sarl %ecx
movslq %ecx, %rcx
movq %rcx, 0x80(%rsp)
movl %esi, %ecx
shrl $0x1f, %ecx
addl %esi, %ecx
sarl %ecx
movslq %ecx, %rcx
movq %rcx, 0x78(%rsp)
movslq %r14d, %rcx
imulq $0x55555556, %rcx, %rcx # imm = 0x55555556
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
addl %edx, %ecx
movslq %ecx, %rcx
movq %rcx, 0x70(%rsp)
movslq %esi, %rcx
imulq $0x55555556, %rcx, %rcx # imm = 0x55555556
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
addl %edx, %ecx
leaq 0x2bcb(%rip), %rdx      # 0x91e0
addsd (%rdx,%rax,8), %xmm0
movslq %ecx, %rax
movq %rax, 0x68(%rsp)
movsd 0x2ad6(%rip), %xmm1     # 0x9100
maxsd %xmm0, %xmm1
movsd %xmm1, 0x60(%rsp)
movl %esi, %r15d
movl %r14d, %eax
movq %rax, 0x48(%rsp)
xorl %eax, %eax
movsd 0x2a87(%rip), %xmm4     # 0x90d0
movsd 0x2a57(%rip), %xmm5     # 0x90a8
movsd 0x2a7e(%rip), %xmm14    # 0x90d8
movsd 0x2a7d(%rip), %xmm15    # 0x90e0
movapd 0x2b54(%rip), %xmm9     # 0x91c0
xorl %esi, %esi
movsd %xmm11, 0x98(%rsp)
movl %eax, %edi
movsd 0x29d5(%rip), %xmm13    # 0x9058
testl %esi, %esi
je 0x668e
movsd 0x60(%rsp), %xmm13
movl %esi, 0x14(%rsp)
movss 0x50(%rbx), %xmm1
ucomiss 0x2a9a(%rip), %xmm1     # 0x9138
jbe 0x66f9
cmpl $0x7ffffffd, %r8d       # imm = 0x7FFFFFFD
ja 0x66f9
movq 0x408(%rbx), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
movl %edi, %edx
movq 0x3e0(%rbx,%rdx,8), %rdx
movq 0x8(%rdx), %rdx
xorps %xmm2, %xmm2
cvtss2sd %xmm1, %xmm2
movl $0x1, %esi
movsd (%rdx,%rsi,8), %xmm3
mulsd %xmm4, %xmm3
mulsd %xmm5, %xmm3
mulsd %xmm11, %xmm3
divsd %xmm2, %xmm3
addsd (%rax,%rsi,8), %xmm3
movsd %xmm3, (%rcx,%rsi,8)
incq %rsi
cmpq %rsi, %r15
jne 0x66d1
movl $0x1, %eax
movl %edi, 0xc(%rsp)
subl %edi, %eax
xorpd %xmm12, %xmm12
movl %eax, 0x10(%rsp)
movl %eax, %eax
movq %rax, 0x28(%rsp)
xorpd %xmm0, %xmm0
cmpl $0x7ffffffd, 0x20(%rsp) # imm = 0x7FFFFFFD
ja 0x6a6c
movl 0xc(%rsp), %eax
movq 0x3e0(%rbx,%rax,8), %rax
movq 0x28(%rsp), %rcx
movq 0x3e0(%rbx,%rcx,8), %rcx
movsd 0x2911(%rip), %xmm2     # 0x9058
subsd %xmm13, %xmm2
movl $0x1, %edx
movq (%rax,%rdx,8), %rsi
movsd 0x10(%rsi), %xmm3
movq (%rcx,%rdx,8), %rdi
movsd %xmm3, (%rdi)
movsd %xmm3, (%rsi)
cmpl $0x7ffffffd, %r8d       # imm = 0x7FFFFFFD
ja 0x6a59
ucomiss 0x29be(%rip), %xmm1     # 0x9138
seta %r10b
movq 0x430(%rbx), %r8
movq (%r8,%rdx,8), %r8
cmpq $0x1, %rdx
sete %r9b
andb %r10b, %r9b
movb %r9b, 0x30(%rsp)
movl $0x1, %r10d
movb (%r8,%r10), %r12b
cmpb $0x2, %r12b
jl 0x6a45
cmpb $0x4, %r12b
ja 0x6816
movq (%rax,%rdx,8), %r11
movq 0x8(%rax,%rdx,8), %r14
movq 0x58(%rsp), %r9
movsd (%r9,%r10,8), %xmm3
movsd 0x8(%r11,%r10,8), %xmm6
mulsd %xmm3, %xmm6
addsd (%r14,%r10,8), %xmm6
movq -0x8(%rcx,%rdx,8), %r13
movq (%rcx,%rdx,8), %r14
addsd (%r13,%r10,8), %xmm6
movq 0x50(%rsp), %r9
movsd (%r9,%r10,8), %xmm5
movsd -0x8(%r14,%r10,8), %xmm4
mulsd %xmm5, %xmm4
addsd %xmm6, %xmm4
cmpq $0x1, %r10
jbe 0x68ca
movapd %xmm14, %xmm3
jmp 0x69a4
movl %ebp, %r9d
cmpb $0x7, %r12b
jne 0x68d8
movq (%rax,%rdx,8), %r11
movq 0x8(%rax,%rdx,8), %r14
movq 0x1468(%rbx), %r13
movq (%r13,%rdx,8), %r13
movsd (%r13,%r10,8), %xmm3
movq 0x1450(%rbx), %r13
movq 0x1458(%rbx), %rbp
movq (%rbp,%rdx,8), %rbp
movsd (%rbp,%r10,8), %xmm5
movsd 0x8(%r11,%r10,8), %xmm4
mulsd %xmm5, %xmm4
movsd (%r14,%r10,8), %xmm6
mulsd %xmm3, %xmm6
addsd %xmm4, %xmm6
movq 0x1460(%rbx), %r14
movq (%r14,%rdx,8), %r14
movsd (%r14,%r10,8), %xmm7
movq -0x8(%rcx,%rdx,8), %rbp
movq (%rcx,%rdx,8), %r14
movsd (%rbp,%r10,8), %xmm8
mulsd %xmm7, %xmm8
addsd %xmm6, %xmm8
movq (%r13,%rdx,8), %r13
movsd (%r13,%r10,8), %xmm6
movsd -0x8(%r14,%r10,8), %xmm4
mulsd %xmm6, %xmm4
addsd %xmm8, %xmm4
addsd %xmm5, %xmm3
addsd %xmm7, %xmm3
addsd %xmm6, %xmm3
jmp 0x69a1
addsd %xmm15, %xmm3
addsd %xmm5, %xmm3
jmp 0x69a4
movq (%rax,%rdx,8), %r11
movq 0x8(%rax,%rdx,8), %r14
movq 0xa0(%rsp), %rbp
movq -0x8(%rbp,%rdx,8), %r13
movq (%rbp,%rdx,8), %rbp
movsd (%rbp,%r10,8), %xmm6
movq 0xa8(%rsp), %rbp
movq (%rbp,%rdx,8), %rbp
movsd -0x8(%rbp,%r10,8), %xmm3
movsd (%rbp,%r10,8), %xmm5
movsd 0x8(%r11,%r10,8), %xmm4
mulsd %xmm5, %xmm4
movq 0x58(%rsp), %rbp
movsd (%rbp,%r10,8), %xmm7
mulsd %xmm7, %xmm4
movsd (%r14,%r10,8), %xmm8
mulsd %xmm6, %xmm8
addsd %xmm4, %xmm8
movsd (%r13,%r10,8), %xmm9
movq -0x8(%rcx,%rdx,8), %r13
movq (%rcx,%rdx,8), %r14
movsd (%r13,%r10,8), %xmm10
mulsd %xmm9, %xmm10
addsd %xmm8, %xmm10
movsd -0x8(%r14,%r10,8), %xmm4
mulsd %xmm3, %xmm4
movq 0x50(%rsp), %r13
movsd (%r13,%r10,8), %xmm8
mulsd %xmm8, %xmm4
addsd %xmm10, %xmm4
mulsd %xmm7, %xmm5
addsd %xmm6, %xmm5
addsd %xmm9, %xmm5
movapd 0x2828(%rip), %xmm9     # 0x91c0
mulsd %xmm8, %xmm3
addsd %xmm5, %xmm3
movl %r9d, %ebp
testl %ebp, %ebp
je 0x69d7
movq 0x408(%rbx), %r13
cmpq $0x2, %rdx
jb 0x69e5
cmpq $0x2, %r10
jb 0x69e5
cmpb $0x6, %r12b
ja 0x69e5
divsd %xmm3, %xmm4
movq (%r13,%rdx,8), %r12
addsd (%r12,%r10,8), %xmm4
mulsd %xmm13, %xmm4
jmp 0x6a11
cmpb $0x0, 0x30(%rsp)
je 0x69f6
movq 0x408(%rbx), %r13
divsd %xmm3, %xmm4
movq (%r13,%rdx,8), %r11
addsd (%r11,%r10,8), %xmm4
jmp 0x6a1f
cmpq $0x2, %rdx
jb 0x6a53
cmpq $0x2, %r10
jb 0x6a53
cmpb $0x6, %r12b
ja 0x6a53
mulsd %xmm13, %xmm4
divsd %xmm3, %xmm4
movsd (%r11,%r10,8), %xmm3
mulsd %xmm2, %xmm3
addsd %xmm3, %xmm4
movsd %xmm4, (%r14,%r10,8)
movsd (%rsi,%r10,8), %xmm3
subsd (%rdi,%r10,8), %xmm3
andpd %xmm9, %xmm3
addsd %xmm3, %xmm12
ucomisd %xmm0, %xmm3
jbe 0x6a45
movapd %xmm3, %xmm0
incq %r10
cmpq %r10, %r15
jne 0x679f
jmp 0x6a59
divsd %xmm3, %xmm4
jmp 0x6a1f
incq %rdx
cmpq 0x48(%rsp), %rdx
movq 0x18(%rsp), %r8
jne 0x6751
movl 0x14(%rsp), %esi
cmpl $0xa, %esi
jae 0x6b22
movapd %xmm12, %xmm1
divsd 0x90(%rsp), %xmm1
divsd 0x88(%rsp), %xmm1
movq 0x28(%rsp), %rax
movq 0x3e0(%rbx,%rax,8), %rax
movq 0x80(%rsp), %rcx
movq (%rax,%rcx,8), %rcx
movq 0x78(%rsp), %rdx
movsd (%rcx,%rdx,8), %xmm2
movq 0x70(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm3
leaq 0x3292(%rip), %rdi      # 0x9d5f
movl 0xc(%rsp), %edx
movl 0x10(%rsp), %ecx
movb $0x4, %al
movapd %xmm12, 0x30(%rsp)
movapd %xmm0, 0xb0(%rsp)
callq 0x10f0
movapd 0xb0(%rsp), %xmm0
movapd 0x30(%rsp), %xmm12
movapd 0x26bb(%rip), %xmm9     # 0x91c0
movsd 0x25d2(%rip), %xmm15    # 0x90e0
movsd 0x25c1(%rip), %xmm14    # 0x90d8
movl 0x14(%rsp), %esi
movq 0x18(%rsp), %r8
jmp 0x6b5a
cmpl $0x258, %esi            # imm = 0x258
setb %al
imull $0xc28f5c29, %esi, %ecx # imm = 0xC28F5C29
rorl $0x2, %ecx
cmpl $0x28f5c29, %ecx        # imm = 0x28F5C29
setb %cl
imull $0x26e978d5, %esi, %edx # imm = 0x26E978D5
rorl $0x3, %edx
cmpl $0x418938, %edx         # imm = 0x418938
jb 0x6a79
andb %cl, %al
jne 0x6a79
testl %ebp, %ebp
movq 0x28(%rsp), %r10
je 0x6b95
movapd %xmm0, %xmm3
movsd 0x2599(%rip), %xmm1     # 0x9108
cmpltpd %xmm1, %xmm3
movapd %xmm0, %xmm1
movsd 0x2570(%rip), %xmm2     # 0x90f0
cmpltpd %xmm2, %xmm1
orpd %xmm3, %xmm1
movd %xmm1, %eax
testb $0x1, %al
jne 0x6cba
testl %ebp, %ebp
movsd 0x98(%rsp), %xmm11
movsd 0x2527(%rip), %xmm4     # 0x90d0
movsd 0x24f7(%rip), %xmm5     # 0x90a8
jne 0x6be1
movapd %xmm0, %xmm2
movsd 0x2551(%rip), %xmm1     # 0x9110
cmpltpd %xmm1, %xmm2
movsd 0x251c(%rip), %xmm1     # 0x90e8
cmpltpd %xmm1, %xmm0
orpd %xmm2, %xmm0
movd %xmm0, %eax
testb $0x1, %al
jne 0x6cba
testl %ebp, %ebp
xorps %xmm1, %xmm1
je 0x6c7d
cmpl $0xbf, %esi
jb 0x6c7d
movl %esi, %eax
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
shrq $0x25, %rax
imull $0x64, %eax, %eax
movl %esi, %ecx
subl %eax, %ecx
jne 0x6c7d
cmpl $0x7ffffffd, 0x20(%rsp) # imm = 0x7FFFFFFD
ja 0x6c7d
movl 0xc(%rsp), %eax
movq 0x3e0(%rbx,%rax,8), %rax
movl $0x1, %ecx
movq (%rax,%rcx,8), %rdx
movsd 0x10(%rdx), %xmm0
movsd %xmm0, (%rdx)
cmpl $0x7ffffffd, %r8d       # imm = 0x7FFFFFFD
ja 0x6c73
movq 0x430(%rbx), %rdx
movq (%rdx,%rcx,8), %rdx
movl $0x1, %r9d
cmpb $0x2, (%rdx,%r9)
jl 0x6c6b
movq 0x3e0(%rbx,%r10,8), %rdi
movq (%rdi,%rcx,8), %rdi
ucomisd (%rdi,%r9,8), %xmm1
ja 0x6c8e
incq %r9
cmpq %r9, %r15
jne 0x6c50
incq %rcx
cmpq 0x48(%rsp), %rcx
jne 0x6c29
incl %esi
cmpl 0x78(%rbx), %esi
movl 0x10(%rsp), %eax
jl 0x6678
jmp 0x6cba
leaq 0x34f8(%rip), %rdi      # 0xa18d
callq 0x1070
movq %rbx, %rdi
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5a8a
xorpd %xmm12, %xmm12
xorl %esi, %esi
leaq 0x3090(%rip), %rdi      # 0x9d51
movapd %xmm12, %xmm0
movb $0x1, %al
callq 0x10f0
movss 0x50(%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x6d0e
cmpl $0x7ffffffd, 0x18(%rsp) # imm = 0x7FFFFFFD
ja 0x6d0e
movq 0x408(%rbx), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
movl 0x8(%rsp), %edx
movl $0x1, %esi
movsd (%rax,%rsi,8), %xmm0
movsd %xmm0, (%rcx,%rsi,8)
incq %rsi
cmpq %rsi, %rdx
jne 0x6cfc
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq