// File: /workspace/github_c_makefile_star2_O0/radforddc[P]icpc_siggen/fields.c
// Function: setup_velo
static int setup_velo(MJD_Siggen_Setup *setup){
  int vlook_sz = setup->v_lookup_len;
  struct velocity_lookup *v_lookup;

  char  line[MAX_LINE], *c;
  FILE  *fp;
  int   i, v_lookup_len;
  struct velocity_lookup *tmp, v, v0;
  float sumb_e, sumc_e, sumb_h, sumc_h;

  double be=1.3e7, bh=1.2e7, thetae=200.0, thetah=200.0;  // parameters for temperature correction
  double pwre=-1.680, pwrh=-2.398, mue=5.66e7, muh=1.63e9; //     adopted for Ge   DCR Feb 2015
  double mu_0_1, mu_0_2, v_s_1, v_s_2, E_c_1, E_c_2, e, f;

  if (vlook_sz == 0) {
    vlook_sz = 10;
    if ((v_lookup = (struct velocity_lookup *)
	 malloc(vlook_sz*sizeof(*v_lookup))) == NULL) {
      error("malloc failed in setup_velo\n");
      return -1;
    }
  } else {
    v_lookup = setup->v_lookup;
  }

  if ((fp = fopen(setup->drift_name, "r")) == NULL){
    error("failed to open velocity lookup table file: '%s'\n", setup->drift_name);
    return -1;
  }
  line[0] = '#';
  c = line;
  while ((line[0] == '#' || line[0] == '\0') && c != NULL) c = fgets(line, MAX_LINE, fp);
  if (c == NULL) {
    error("Failed to read velocity lookup table from file: %s\n", setup->drift_name);
    fclose(fp);
    return -1;
  }
  TELL_CHATTY("Drift velocity table:\n"
	      "  e          e100    e110    e111    h100    h110    h111\n");   
  for (v_lookup_len = 0; ;v_lookup_len++){
    if (v_lookup_len == vlook_sz - 1){
      vlook_sz += 10;
      if ((tmp = (struct velocity_lookup *)
	   realloc(v_lookup, vlook_sz*sizeof(*v_lookup))) == NULL){
	error("realloc failed in setup_velo\n");
	fclose(fp);
	return -1;
      }
      v_lookup = tmp;
    }
    if (sscanf(line, "%f %f %f %f %f %f %f", 
	       &v_lookup[v_lookup_len].e,
	       &v_lookup[v_lookup_len].e100,
	       &v_lookup[v_lookup_len].e110,
	       &v_lookup[v_lookup_len].e111,
	       &v_lookup[v_lookup_len].h100,
	       &v_lookup[v_lookup_len].h110,
	       &v_lookup[v_lookup_len].h111) != 7){
      break; //assume EOF
    }	   
    //v_lookup[v_lookup_len].e *= 100; /*V/m*/
    tmp = &v_lookup[v_lookup_len];
    TELL_CHATTY("%10.3f%8.3f%8.3f%8.3f%8.3f%8.3f%8.3f\n",
		tmp->e, tmp->e100, tmp->e110, tmp->e111, tmp->h100, tmp->h110,tmp->h111);
    line[0] = '#';
    while ((line[0] == '#' || line[0] == '\0' ||
	    line[0] == '\n' || line[0] == '\r') && c != NULL) c = fgets(line, MAX_LINE, fp);
    if (c == NULL) break;
    if (line[0] == 'e' || line[0] == 'h') break; /* no more velocities data;
						    now reading temp correction data */
  }

  /* check for and decode temperature correction parameters */
  while (line[0] == 'e' || line[0] == 'h') {
    if (line[0] == 'e' &&
	sscanf(line+2, "%lf %lf %lf %lf", 
	       &mue, &pwre, &be, &thetae) != 4) break;//asume EOF
    if (line[0] == 'h' &&
	sscanf(line+2, "%lf %lf %lf %lf", 
	       &muh, &pwrh, &bh, &thetah) != 4) break;//asume EOF
    if (line[0] == 'e')
      TELL_CHATTY("electrons: mu_0 = %.2e x T^%.4f  B = %.2e  Theta = %.0f\n",
		  mue, pwre, be, thetae);
    if (line[0] == 'h')
      TELL_CHATTY("    holes: mu_0 = %.2e x T^%.4f  B = %.2e  Theta = %.0f\n",
		  muh, pwrh, bh, thetah);

    line[0] = '#';
    while ((line[0] == '#' || line[0] == '\0') && c != NULL) c = fgets(line, MAX_LINE, fp);
    if (c == NULL) break;
  }

  if (v_lookup_len == 0){
    error("Failed to read velocity lookup table from file: %s\n", setup->drift_name);
    return -1;
  }  
  v_lookup_len++;
  if (vlook_sz != v_lookup_len){
    if ((tmp = (struct velocity_lookup *) 
	 realloc(v_lookup, v_lookup_len*sizeof(*v_lookup))) == NULL){
      error("realloc failed in setup_velo. This should not happen\n");
      fclose(fp);
      return -1;
    }
    v_lookup = tmp;
    vlook_sz = v_lookup_len;
  }
  TELL_NORMAL("Drift velocity table has %d rows of data\n", v_lookup_len);
  fclose(fp);

  /*
    apply temperature dependence to mobilities;
    see drift_velocities.doc and tempdep.c
    The drift velocity reduces at higher temperature due to the increasing of
    scattering with the lattice vibration. We used a model by M. Ali Omar and
    L. Reggiani (Solid-State Electronics Vol. 30, No. 12 (1987) 1351) to
    calculate the temperature dependence.
  */
  /* electrons */
  TELL_NORMAL("Adjusting mobilities for temperature, from %.1f to %.1f\n", REF_TEMP, setup->xtal_temp);
  TELL_CHATTY("Index  field  vel_factor\n");
  mu_0_1 = mue * pow(REF_TEMP, pwre);
  v_s_1 = be * sqrt(tanh(0.5 * thetae / REF_TEMP));
  E_c_1 = v_s_1 / mu_0_1;
  mu_0_2 = mue * pow(setup->xtal_temp, pwre);
  v_s_2 = be * sqrt(tanh(0.5 * thetae / setup->xtal_temp));
  E_c_2 = v_s_2 / mu_0_2;
  for (i = 0; i < vlook_sz; i++){
    e = v_lookup[i].e;
    if (e < 1) continue;
    f = (v_s_2 * (e/E_c_2) / sqrt(1.0 + (e/E_c_2) * (e/E_c_2))) /
        (v_s_1 * (e/E_c_1) / sqrt(1.0 + (e/E_c_1) * (e/E_c_1)));
    v_lookup[i].e100 *= f;
    v_lookup[i].e110 *= f;
    v_lookup[i].e111 *= f;
    TELL_CHATTY("%2d %5.0f %f\n", i, e, f);
  }

  /* holes */
  mu_0_1 = muh * pow(REF_TEMP, pwrh);
  v_s_1 = bh * sqrt(tanh(0.5 * thetah / REF_TEMP));
  E_c_1 = v_s_1 / mu_0_1;
  mu_0_2 = muh * pow(setup->xtal_temp, pwrh);
  v_s_2 = bh * sqrt(tanh(0.5 * thetah / setup->xtal_temp));
  E_c_2 = v_s_2 / mu_0_2;
  for (i = 0; i < vlook_sz; i++){
    e = v_lookup[i].e;
    if (e < 1) continue;
    f = (v_s_2 * (e/E_c_2) / sqrt(1.0 + (e/E_c_2) * (e/E_c_2))) /
        (v_s_1 * (e/E_c_1) / sqrt(1.0 + (e/E_c_1) * (e/E_c_1)));
    v_lookup[i].h100 *= f;
    v_lookup[i].h110 *= f;
    v_lookup[i].h111 *= f;
    TELL_CHATTY("%2d %5.0f %f\n", i, e, f);
  }
  /* end of temperature correction */

  for (i = 0; i < vlook_sz; i++){
    v = v_lookup[i];
    v_lookup[i].ea =  0.5 * v.e100 -  4 * v.e110 +  4.5 * v.e111;
    v_lookup[i].eb = -2.5 * v.e100 + 16 * v.e110 - 13.5 * v.e111;
    v_lookup[i].ec =  3.0 * v.e100 - 12 * v.e110 +  9.0 * v.e111;
    v_lookup[i].ha =  0.5 * v.h100 -  4 * v.h110 +  4.5 * v.h111;
    v_lookup[i].hb = -2.5 * v.h100 + 16 * v.h110 - 13.5 * v.h111;
    v_lookup[i].hc =  3.0 * v.h100 - 12 * v.h110 +  9.0 * v.h111;
  }
  v_lookup[0].ebp = v_lookup[0].ecp = v_lookup[0].hbp = v_lookup[0].hcp = 0.0;
  sumb_e = sumc_e = sumb_h = sumc_h = 0.0;
  for (i = 1; i < vlook_sz; i++){
    v0 = v_lookup[i-1];
    v = v_lookup[i];
    sumb_e += (v.e - v0.e)*(v0.eb+v.eb)/2;
    sumc_e += (v.e - v0.e)*(v0.ec+v.ec)/2;
    sumb_h += (v.e - v0.e)*(v0.hb+v.hb)/2;
    sumc_h += (v.e - v0.e)*(v0.hc+v.hc)/2;
    v_lookup[i].ebp = sumb_e/v.e;
    v_lookup[i].ecp = sumc_e/v.e;
    v_lookup[i].hbp = sumb_h/v.e;
    v_lookup[i].hcp = sumc_h/v.e;
  }

  setup->v_lookup = v_lookup;
  setup->v_lookup_len = v_lookup_len;

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x400, %rsp            # imm = 0x400
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x3d0(%rax), %eax
movl %eax, -0x14(%rbp)
movsd 0x7f1c(%rip), %xmm0     # 0xd4d0
movsd %xmm0, -0x2f0(%rbp)
movsd 0x7f04(%rip), %xmm0     # 0xd4c8
movsd %xmm0, -0x2f8(%rbp)
movsd 0x7eec(%rip), %xmm0     # 0xd4c0
movsd %xmm0, -0x300(%rbp)
movsd 0x7edc(%rip), %xmm0     # 0xd4c0
movsd %xmm0, -0x308(%rbp)
movsd 0x7ec4(%rip), %xmm0     # 0xd4b8
movsd %xmm0, -0x310(%rbp)
movsd 0x7eac(%rip), %xmm0     # 0xd4b0
movsd %xmm0, -0x318(%rbp)
movsd 0x7e94(%rip), %xmm0     # 0xd4a8
movsd %xmm0, -0x320(%rbp)
movsd 0x7e7c(%rip), %xmm0     # 0xd4a0
movsd %xmm0, -0x328(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x566c
movl $0xa, -0x14(%rbp)
movslq -0x14(%rbp), %rax
imulq $0x4c, %rax, %rdi
callq 0x20b0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x566a
leaq 0x8083(%rip), %rdi      # 0xd6da
movb $0x0, %al
callq 0x25d0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6967
jmp 0x567b
movq -0x10(%rbp), %rax
movq 0x3d8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
addq $0x88, %rdi
leaq 0x8e78(%rip), %rsi      # 0xe505
callq 0x20c0
movq %rax, -0x230(%rbp)
cmpq $0x0, %rax
jne 0x56c4
movq -0x10(%rbp), %rsi
addq $0x88, %rsi
leaq 0x8046(%rip), %rdi      # 0xd6f7
movb $0x0, %al
callq 0x25d0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6967
movb $0x23, -0x220(%rbp)
leaq -0x220(%rbp), %rax
movq %rax, -0x228(%rbp)
movsbl -0x220(%rbp), %eax
cmpl $0x23, %eax
je 0x56f9
movsbl -0x220(%rbp), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x369(%rbp)
jne 0x570a
cmpq $0x0, -0x228(%rbp)
setne %al
movb %al, -0x369(%rbp)
movb -0x369(%rbp), %al
testb $0x1, %al
jne 0x5716
jmp 0x5737
leaq -0x220(%rbp), %rdi
movq -0x230(%rbp), %rdx
movl $0x200, %esi            # imm = 0x200
callq 0x20e0
movq %rax, -0x228(%rbp)
jmp 0x56d9
cmpq $0x0, -0x228(%rbp)
jne 0x5772
movq -0x10(%rbp), %rsi
addq $0x88, %rsi
leaq 0x7fd5(%rip), %rdi      # 0xd728
movb $0x0, %al
callq 0x25d0
movq -0x230(%rbp), %rdi
callq 0x21e0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6967
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jl 0x5789
leaq 0x7fda(%rip), %rdi      # 0xd75c
movb $0x0, %al
callq 0x2530
movl $0x0, -0x238(%rbp)
movl -0x238(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x57fb
movl -0x14(%rbp), %eax
addl $0xa, %eax
movl %eax, -0x14(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x14(%rbp), %rax
imulq $0x4c, %rax, %rsi
callq 0x2210
movq %rax, -0x240(%rbp)
cmpq $0x0, %rax
jne 0x57f0
leaq 0x7fdc(%rip), %rdi      # 0xd7ad
movb $0x0, %al
callq 0x25d0
movq -0x230(%rbp), %rdi
callq 0x21e0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6967
movq -0x240(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq -0x220(%rbp), %rdi
movq -0x20(%rbp), %rdx
movslq -0x238(%rbp), %rax
imulq $0x4c, %rax, %rax
addq %rax, %rdx
movq -0x20(%rbp), %rcx
movslq -0x238(%rbp), %rax
imulq $0x4c, %rax, %rax
addq %rax, %rcx
addq $0x4, %rcx
movq -0x20(%rbp), %r8
movslq -0x238(%rbp), %rax
imulq $0x4c, %rax, %rax
addq %rax, %r8
addq $0x8, %r8
movq -0x20(%rbp), %r9
movslq -0x238(%rbp), %rax
imulq $0x4c, %rax, %rax
addq %rax, %r9
addq $0xc, %r9
movq -0x20(%rbp), %r11
movslq -0x238(%rbp), %rax
imulq $0x4c, %rax, %rax
addq %rax, %r11
addq $0x10, %r11
movq -0x20(%rbp), %r10
movslq -0x238(%rbp), %rax
imulq $0x4c, %rax, %rax
addq %rax, %r10
addq $0x14, %r10
movq -0x20(%rbp), %rax
movslq -0x238(%rbp), %rsi
imulq $0x4c, %rsi, %rsi
addq %rsi, %rax
addq $0x18, %rax
leaq 0x7f2c(%rip), %rsi      # 0xd7cb
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x0, %al
callq 0x2090
cmpl $0x7, %eax
je 0x58be
jmp 0x5a16
movq -0x20(%rbp), %rax
movslq -0x238(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x240(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jl 0x595d
movq -0x240(%rbp), %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x240(%rbp), %rax
movss 0x4(%rax), %xmm1
cvtss2sd %xmm1, %xmm1
movq -0x240(%rbp), %rax
movss 0x8(%rax), %xmm2
cvtss2sd %xmm2, %xmm2
movq -0x240(%rbp), %rax
movss 0xc(%rax), %xmm3
cvtss2sd %xmm3, %xmm3
movq -0x240(%rbp), %rax
movss 0x10(%rax), %xmm4
cvtss2sd %xmm4, %xmm4
movq -0x240(%rbp), %rax
movss 0x14(%rax), %xmm5
cvtss2sd %xmm5, %xmm5
movq -0x240(%rbp), %rax
movss 0x18(%rax), %xmm6
cvtss2sd %xmm6, %xmm6
leaq 0x7e8a(%rip), %rdi      # 0xd7e0
movb $0x7, %al
callq 0x2530
movb $0x23, -0x220(%rbp)
movsbl -0x220(%rbp), %eax
cmpl $0x23, %eax
je 0x599c
movsbl -0x220(%rbp), %eax
cmpl $0x0, %eax
je 0x599c
movsbl -0x220(%rbp), %eax
cmpl $0xa, %eax
je 0x599c
movsbl -0x220(%rbp), %ecx
xorl %eax, %eax
cmpl $0xd, %ecx
movb %al, -0x36a(%rbp)
jne 0x59ad
cmpq $0x0, -0x228(%rbp)
setne %al
movb %al, -0x36a(%rbp)
movb -0x36a(%rbp), %al
testb $0x1, %al
jne 0x59b9
jmp 0x59da
leaq -0x220(%rbp), %rdi
movq -0x230(%rbp), %rdx
movl $0x200, %esi            # imm = 0x200
callq 0x20e0
movq %rax, -0x228(%rbp)
jmp 0x5964
cmpq $0x0, -0x228(%rbp)
jne 0x59e6
jmp 0x5a16
movsbl -0x220(%rbp), %eax
cmpl $0x65, %eax
je 0x59fe
movsbl -0x220(%rbp), %eax
cmpl $0x68, %eax
jne 0x5a00
jmp 0x5a16
jmp 0x5a02
movl -0x238(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x238(%rbp)
jmp 0x5793
jmp 0x5a18
movsbl -0x220(%rbp), %ecx
movb $0x1, %al
cmpl $0x65, %ecx
movb %al, -0x36b(%rbp)
je 0x5a3f
movsbl -0x220(%rbp), %eax
cmpl $0x68, %eax
sete %al
movb %al, -0x36b(%rbp)
movb -0x36b(%rbp), %al
testb $0x1, %al
jne 0x5a4e
jmp 0x5be4
movsbl -0x220(%rbp), %eax
cmpl $0x65, %eax
jne 0x5a99
leaq -0x220(%rbp), %rdi
addq $0x2, %rdi
leaq 0x7d9a(%rip), %rsi      # 0xd806
leaq -0x320(%rbp), %rdx
leaq -0x310(%rbp), %rcx
leaq -0x2f0(%rbp), %r8
leaq -0x300(%rbp), %r9
movb $0x0, %al
callq 0x2090
cmpl $0x4, %eax
je 0x5a99
jmp 0x5be4
movsbl -0x220(%rbp), %eax
cmpl $0x68, %eax
jne 0x5ae4
leaq -0x220(%rbp), %rdi
addq $0x2, %rdi
leaq 0x7d4f(%rip), %rsi      # 0xd806
leaq -0x328(%rbp), %rdx
leaq -0x318(%rbp), %rcx
leaq -0x2f8(%rbp), %r8
leaq -0x308(%rbp), %r9
movb $0x0, %al
callq 0x2090
cmpl $0x4, %eax
je 0x5ae4
jmp 0x5be4
movsbl -0x220(%rbp), %eax
cmpl $0x65, %eax
jne 0x5b29
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jl 0x5b27
movsd -0x320(%rbp), %xmm0
movsd -0x310(%rbp), %xmm1
movsd -0x2f0(%rbp), %xmm2
movsd -0x300(%rbp), %xmm3
leaq 0x7cf6(%rip), %rdi      # 0xd816
movb $0x4, %al
callq 0x2530
jmp 0x5b29
movsbl -0x220(%rbp), %eax
cmpl $0x68, %eax
jne 0x5b6e
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jl 0x5b6c
movsd -0x328(%rbp), %xmm0
movsd -0x318(%rbp), %xmm1
movsd -0x2f8(%rbp), %xmm2
movsd -0x308(%rbp), %xmm3
leaq 0x7cea(%rip), %rdi      # 0xd84f
movb $0x4, %al
callq 0x2530
jmp 0x5b6e
movb $0x23, -0x220(%rbp)
movsbl -0x220(%rbp), %eax
cmpl $0x23, %eax
je 0x5b95
movsbl -0x220(%rbp), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x36c(%rbp)
jne 0x5ba6
cmpq $0x0, -0x228(%rbp)
setne %al
movb %al, -0x36c(%rbp)
movb -0x36c(%rbp), %al
testb $0x1, %al
jne 0x5bb2
jmp 0x5bd3
leaq -0x220(%rbp), %rdi
movq -0x230(%rbp), %rdx
movl $0x200, %esi            # imm = 0x200
callq 0x20e0
movq %rax, -0x228(%rbp)
jmp 0x5b75
cmpq $0x0, -0x228(%rbp)
jne 0x5bdf
jmp 0x5be4
jmp 0x5a18
cmpl $0x0, -0x238(%rbp)
jne 0x5c12
movq -0x10(%rbp), %rsi
addq $0x88, %rsi
leaq 0x7b29(%rip), %rdi      # 0xd728
movb $0x0, %al
callq 0x25d0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6967
movl -0x238(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x238(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x238(%rbp), %eax
je 0x5c87
movq -0x20(%rbp), %rdi
movslq -0x238(%rbp), %rax
imulq $0x4c, %rax, %rsi
callq 0x2210
movq %rax, -0x240(%rbp)
cmpq $0x0, %rax
jne 0x5c73
leaq 0x7c34(%rip), %rdi      # 0xd888
movb $0x0, %al
callq 0x25d0
movq -0x230(%rbp), %rdi
callq 0x21e0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6967
movq -0x240(%rbp), %rax
movq %rax, -0x20(%rbp)
movl -0x238(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
jl 0x5ca4
movl -0x238(%rbp), %esi
leaq 0x7c21(%rip), %rdi      # 0xd8be
movb $0x0, %al
callq 0x2530
movq -0x230(%rbp), %rdi
callq 0x21e0
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
jl 0x5cdf
movq -0x10(%rbp), %rax
movss 0x388(%rax), %xmm0
cvtss2sd %xmm0, %xmm1
leaq 0x7c18(%rip), %rdi      # 0xd8e8
movsd 0x7800(%rip), %xmm0     # 0xd4d8
movb $0x2, %al
callq 0x2530
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jl 0x5cf6
leaq 0x7c32(%rip), %rdi      # 0xd921
movb $0x0, %al
callq 0x2530
movsd -0x320(%rbp), %xmm0
movsd %xmm0, -0x390(%rbp)
movsd -0x310(%rbp), %xmm1
movsd 0x77c2(%rip), %xmm0     # 0xd4d8
callq 0x2240
movaps %xmm0, %xmm1
movsd -0x390(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x330(%rbp)
movsd -0x2f0(%rbp), %xmm0
movsd %xmm0, -0x388(%rbp)
movsd 0x7796(%rip), %xmm0     # 0xd4e0
mulsd -0x300(%rbp), %xmm0
movsd 0x777e(%rip), %xmm1     # 0xd4d8
divsd %xmm1, %xmm0
callq 0x2040
callq 0x2250
movaps %xmm0, %xmm1
movsd -0x388(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x340(%rbp)
movsd -0x340(%rbp), %xmm0
divsd -0x330(%rbp), %xmm0
movsd %xmm0, -0x350(%rbp)
movsd -0x320(%rbp), %xmm0
movsd %xmm0, -0x380(%rbp)
movq -0x10(%rbp), %rax
movss 0x388(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd -0x310(%rbp), %xmm1
callq 0x2240
movaps %xmm0, %xmm1
movsd -0x380(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x338(%rbp)
movsd -0x2f0(%rbp), %xmm0
movsd %xmm0, -0x378(%rbp)
movsd 0x76ed(%rip), %xmm0     # 0xd4e0
mulsd -0x300(%rbp), %xmm0
movq -0x10(%rbp), %rax
movss 0x388(%rax), %xmm1
cvtss2sd %xmm1, %xmm1
divsd %xmm1, %xmm0
callq 0x2040
callq 0x2250
movaps %xmm0, %xmm1
movsd -0x378(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x348(%rbp)
movsd -0x348(%rbp), %xmm0
divsd -0x338(%rbp), %xmm0
movsd %xmm0, -0x358(%rbp)
movl $0x0, -0x234(%rbp)
movl -0x234(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x6059
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x360(%rbp)
movsd 0x7205(%rip), %xmm0     # 0xd090
ucomisd -0x360(%rbp), %xmm0
jbe 0x5e9a
jmp 0x6045
movsd -0x348(%rbp), %xmm0
movsd -0x360(%rbp), %xmm1
divsd -0x358(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x3a8(%rbp)
movsd -0x360(%rbp), %xmm0
divsd -0x358(%rbp), %xmm0
movsd -0x360(%rbp), %xmm1
divsd -0x358(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x71a6(%rip), %xmm1     # 0xd090
addsd %xmm1, %xmm0
callq 0x2250
movaps %xmm0, %xmm1
movsd -0x3a8(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x398(%rbp)
movsd -0x340(%rbp), %xmm0
movsd -0x360(%rbp), %xmm1
divsd -0x350(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x3a0(%rbp)
movsd -0x360(%rbp), %xmm0
divsd -0x350(%rbp), %xmm0
movsd -0x360(%rbp), %xmm1
divsd -0x350(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x7136(%rip), %xmm1     # 0xd090
addsd %xmm1, %xmm0
callq 0x2250
movsd -0x3a0(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x398(%rbp), %xmm0
divsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x368(%rbp)
movsd -0x368(%rbp), %xmm1
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss 0x4(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x4(%rax)
movsd -0x368(%rbp), %xmm1
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss 0x8(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8(%rax)
movsd -0x368(%rbp), %xmm1
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss 0xc(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xc(%rax)
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jl 0x6043
movl -0x234(%rbp), %esi
movsd -0x360(%rbp), %xmm0
movsd -0x368(%rbp), %xmm1
leaq 0x78ff(%rip), %rdi      # 0xd93b
movb $0x2, %al
callq 0x2530
jmp 0x6045
movl -0x234(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x234(%rbp)
jmp 0x5e52
movsd -0x328(%rbp), %xmm0
movsd %xmm0, -0x3c8(%rbp)
movsd -0x318(%rbp), %xmm1
movsd 0x745f(%rip), %xmm0     # 0xd4d8
callq 0x2240
movaps %xmm0, %xmm1
movsd -0x3c8(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x330(%rbp)
movsd -0x2f8(%rbp), %xmm0
movsd %xmm0, -0x3c0(%rbp)
movsd 0x7433(%rip), %xmm0     # 0xd4e0
mulsd -0x308(%rbp), %xmm0
movsd 0x741b(%rip), %xmm1     # 0xd4d8
divsd %xmm1, %xmm0
callq 0x2040
callq 0x2250
movaps %xmm0, %xmm1
movsd -0x3c0(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x340(%rbp)
movsd -0x340(%rbp), %xmm0
divsd -0x330(%rbp), %xmm0
movsd %xmm0, -0x350(%rbp)
movsd -0x328(%rbp), %xmm0
movsd %xmm0, -0x3b8(%rbp)
movq -0x10(%rbp), %rax
movss 0x388(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd -0x318(%rbp), %xmm1
callq 0x2240
movaps %xmm0, %xmm1
movsd -0x3b8(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x338(%rbp)
movsd -0x2f8(%rbp), %xmm0
movsd %xmm0, -0x3b0(%rbp)
movsd 0x738a(%rip), %xmm0     # 0xd4e0
mulsd -0x308(%rbp), %xmm0
movq -0x10(%rbp), %rax
movss 0x388(%rax), %xmm1
cvtss2sd %xmm1, %xmm1
divsd %xmm1, %xmm0
callq 0x2040
callq 0x2250
movaps %xmm0, %xmm1
movsd -0x3b0(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x348(%rbp)
movsd -0x348(%rbp), %xmm0
divsd -0x338(%rbp), %xmm0
movsd %xmm0, -0x358(%rbp)
movl $0x0, -0x234(%rbp)
movl -0x234(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x63bc
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x360(%rbp)
movsd 0x6ea2(%rip), %xmm0     # 0xd090
ucomisd -0x360(%rbp), %xmm0
jbe 0x61fd
jmp 0x63a8
movsd -0x348(%rbp), %xmm0
movsd -0x360(%rbp), %xmm1
divsd -0x358(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x3e0(%rbp)
movsd -0x360(%rbp), %xmm0
divsd -0x358(%rbp), %xmm0
movsd -0x360(%rbp), %xmm1
divsd -0x358(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x6e43(%rip), %xmm1     # 0xd090
addsd %xmm1, %xmm0
callq 0x2250
movaps %xmm0, %xmm1
movsd -0x3e0(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x3d0(%rbp)
movsd -0x340(%rbp), %xmm0
movsd -0x360(%rbp), %xmm1
divsd -0x350(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x3d8(%rbp)
movsd -0x360(%rbp), %xmm0
divsd -0x350(%rbp), %xmm0
movsd -0x360(%rbp), %xmm1
divsd -0x350(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x6dd3(%rip), %xmm1     # 0xd090
addsd %xmm1, %xmm0
callq 0x2250
movsd -0x3d8(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x3d0(%rbp), %xmm0
divsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x368(%rbp)
movsd -0x368(%rbp), %xmm1
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss 0x10(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10(%rax)
movsd -0x368(%rbp), %xmm1
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss 0x14(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x14(%rax)
movsd -0x368(%rbp), %xmm1
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss 0x18(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x18(%rax)
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jl 0x63a6
movl -0x234(%rbp), %esi
movsd -0x360(%rbp), %xmm0
movsd -0x368(%rbp), %xmm1
leaq 0x759c(%rip), %rdi      # 0xd93b
movb $0x2, %al
callq 0x2530
jmp 0x63a8
movl -0x234(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x234(%rbp)
jmp 0x61b5
movl $0x0, -0x234(%rbp)
movl -0x234(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x66d2
movq -0x20(%rbp), %rsi
movslq -0x234(%rbp), %rax
imulq $0x4c, %rax, %rax
addq %rax, %rsi
leaq -0x28c(%rbp), %rdi
movl $0x4c, %edx
callq 0x2260
movss -0x288(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movss 0x7110(%rip), %xmm0     # 0xd51c
mulss -0x284(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x70a9(%rip), %xmm2     # 0xd4e0
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movss -0x280(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x70ad(%rip), %xmm2     # 0xd500
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x1c(%rax)
movss -0x288(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movss 0x708e(%rip), %xmm0     # 0xd518
mulss -0x284(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x705a(%rip), %xmm2     # 0xd4f8
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movss -0x280(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x7036(%rip), %xmm2     # 0xd4f0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x20(%rax)
movss -0x288(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movss 0x7023(%rip), %xmm0     # 0xd514
mulss -0x284(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x6b3c(%rip), %xmm2     # 0xd058
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movss -0x280(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x6fb0(%rip), %xmm2     # 0xd4e8
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x24(%rax)
movss -0x27c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movss 0x6fad(%rip), %xmm0     # 0xd51c
mulss -0x278(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x6f46(%rip), %xmm2     # 0xd4e0
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movss -0x274(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x6f4a(%rip), %xmm2     # 0xd500
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x30(%rax)
movss -0x27c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movss 0x6f2b(%rip), %xmm0     # 0xd518
mulss -0x278(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x6ef7(%rip), %xmm2     # 0xd4f8
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movss -0x274(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x6ed3(%rip), %xmm2     # 0xd4f0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x34(%rax)
movss -0x27c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movss 0x6ec0(%rip), %xmm0     # 0xd514
mulss -0x278(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x69d9(%rip), %xmm2     # 0xd058
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movss -0x274(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x6e4d(%rip), %xmm2     # 0xd4e8
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x38(%rax)
movl -0x234(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x234(%rbp)
jmp 0x63c6
movq -0x20(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x40(%rax)
movq -0x20(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x3c(%rax)
movq -0x20(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x2c(%rax)
movq -0x20(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x28(%rax)
xorps %xmm0, %xmm0
movss %xmm0, -0x2e8(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x2e4(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x2e0(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x2dc(%rbp)
movl $0x1, -0x234(%rbp)
movl -0x234(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x6941
movq -0x20(%rbp), %rsi
movl -0x234(%rbp), %eax
subl $0x1, %eax
cltq
imulq $0x4c, %rax, %rax
addq %rax, %rsi
leaq -0x2d8(%rbp), %rdi
movl $0x4c, %edx
callq 0x2260
movq -0x20(%rbp), %rsi
movslq -0x234(%rbp), %rax
imulq $0x4c, %rax, %rax
addq %rax, %rsi
leaq -0x28c(%rbp), %rdi
movl $0x4c, %edx
callq 0x2260
movss -0x28c(%rbp), %xmm0
subss -0x2d8(%rbp), %xmm0
movss -0x2b8(%rbp), %xmm1
addss -0x26c(%rbp), %xmm1
mulss %xmm1, %xmm0
movss 0x6d53(%rip), %xmm1     # 0xd510
divss %xmm1, %xmm0
addss -0x2dc(%rbp), %xmm0
movss %xmm0, -0x2dc(%rbp)
movss -0x28c(%rbp), %xmm0
subss -0x2d8(%rbp), %xmm0
movss -0x2b4(%rbp), %xmm1
addss -0x268(%rbp), %xmm1
mulss %xmm1, %xmm0
movss 0x6d13(%rip), %xmm1     # 0xd510
divss %xmm1, %xmm0
addss -0x2e0(%rbp), %xmm0
movss %xmm0, -0x2e0(%rbp)
movss -0x28c(%rbp), %xmm0
subss -0x2d8(%rbp), %xmm0
movss -0x2a4(%rbp), %xmm1
addss -0x258(%rbp), %xmm1
mulss %xmm1, %xmm0
movss 0x6cd3(%rip), %xmm1     # 0xd510
divss %xmm1, %xmm0
addss -0x2e4(%rbp), %xmm0
movss %xmm0, -0x2e4(%rbp)
movss -0x28c(%rbp), %xmm0
subss -0x2d8(%rbp), %xmm0
movss -0x2a0(%rbp), %xmm1
addss -0x254(%rbp), %xmm1
mulss %xmm1, %xmm0
movss 0x6c93(%rip), %xmm1     # 0xd510
divss %xmm1, %xmm0
addss -0x2e8(%rbp), %xmm0
movss %xmm0, -0x2e8(%rbp)
movss -0x2dc(%rbp), %xmm0
divss -0x28c(%rbp), %xmm0
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x28(%rax)
movss -0x2e0(%rbp), %xmm0
divss -0x28c(%rbp), %xmm0
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x2c(%rax)
movss -0x2e4(%rbp), %xmm0
divss -0x28c(%rbp), %xmm0
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x3c(%rax)
movss -0x2e8(%rbp), %xmm0
divss -0x28c(%rbp), %xmm0
movq -0x20(%rbp), %rax
movslq -0x234(%rbp), %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x40(%rax)
movl -0x234(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x234(%rbp)
jmp 0x6738
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x3d8(%rax)
movl -0x238(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x3d0(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x400, %rsp            # imm = 0x400
popq %rbp
retq
nopw %cs:(%rax,%rax)