// File: /workspace/github_c_makefile_star2_O0/radforddc[P]icpc_siggen/fields.c
// Function: field_setup
int field_setup(MJD_Siggen_Setup *setup){

  setup->rmin  = 0;
  setup->rmax  = setup->xtal_radius;
  setup->rstep = setup->xtal_grid;
  setup->zmin  = 0;
  setup->zmax  = setup->xtal_length;
  setup->zstep = setup->xtal_grid;
  if (setup->xtal_temp < MIN_TEMP) setup->xtal_temp = MIN_TEMP;
  if (setup->xtal_temp > MAX_TEMP) setup->xtal_temp = MAX_TEMP;

  TELL_NORMAL("rmin: %.2f rmax: %.2f, rstep: %.2f\n"
	      "zmin: %.2f zmax: %.2f, zstep: %.2f\n"
	      "Detector temperature is set to %.1f K\n",
	      setup->rmin, setup->rmax, setup->rstep,
	      setup->zmin, setup->zmax, setup->zstep,
	      setup->xtal_temp);

  setup->v_lookup_len = 0;
  if (setup_velo(setup) != 0){
    error("Failed to read drift velocity data from file: %s\n", 
	  setup->drift_name);
    return -1;
  }
  if (setup_efield(setup) != 0){
    error("Failed to read electric field data from file: %s\n", 
	  setup->field_name);
    return -1;
  }
  if (setup_wp(setup) != 0){
    error("Failed to read weighting potential from file %s\n",
	  setup->wp_name);
    return -1;
  }

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x3b0(%rax)
movq -0x10(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x3b4(%rax)
movq -0x10(%rbp), %rax
movss 0x54(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x3b8(%rax)
movq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x3bc(%rax)
movq -0x10(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x3c0(%rax)
movq -0x10(%rbp), %rax
movss 0x54(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x3c4(%rax)
movq -0x10(%rbp), %rax
movss 0x388(%rax), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x808a(%rip), %xmm0     # 0xd490
ucomisd %xmm1, %xmm0
jbe 0x5420
movq -0x10(%rbp), %rax
movss 0x80f0(%rip), %xmm0     # 0xd508
movss %xmm0, 0x388(%rax)
movq -0x10(%rbp), %rax
movss 0x388(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x8060(%rip), %xmm1     # 0xd498
ucomisd %xmm1, %xmm0
jbe 0x5452
movq -0x10(%rbp), %rax
movss 0x80c2(%rip), %xmm0     # 0xd50c
movss %xmm0, 0x388(%rax)
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
jl 0x54d9
movq -0x10(%rbp), %rax
movss 0x3b0(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x10(%rbp), %rax
movss 0x3b4(%rax), %xmm1
cvtss2sd %xmm1, %xmm1
movq -0x10(%rbp), %rax
movss 0x3b8(%rax), %xmm2
cvtss2sd %xmm2, %xmm2
movq -0x10(%rbp), %rax
movss 0x3bc(%rax), %xmm3
cvtss2sd %xmm3, %xmm3
movq -0x10(%rbp), %rax
movss 0x3c0(%rax), %xmm4
cvtss2sd %xmm4, %xmm4
movq -0x10(%rbp), %rax
movss 0x3c4(%rax), %xmm5
cvtss2sd %xmm5, %xmm5
movq -0x10(%rbp), %rax
movss 0x388(%rax), %xmm6
cvtss2sd %xmm6, %xmm6
leaq 0x8052(%rip), %rdi      # 0xd524
movb $0x7, %al
callq 0x2530
movq -0x10(%rbp), %rax
movl $0x0, 0x3d0(%rax)
movq -0x10(%rbp), %rdi
callq 0x5590
cmpl $0x0, %eax
je 0x5517
movq -0x10(%rbp), %rsi
addq $0x88, %rsi
leaq 0x808a(%rip), %rdi      # 0xd591
movb $0x0, %al
callq 0x25d0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x557e
movq -0x10(%rbp), %rdi
callq 0x6980
cmpl $0x0, %eax
je 0x5547
movq -0x10(%rbp), %rsi
addq $0x188, %rsi            # imm = 0x188
leaq 0x808c(%rip), %rdi      # 0xd5c3
movb $0x0, %al
callq 0x25d0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x557e
movq -0x10(%rbp), %rdi
callq 0x70e0
cmpl $0x0, %eax
je 0x5577
movq -0x10(%rbp), %rsi
addq $0x288, %rsi            # imm = 0x288
leaq 0x808e(%rip), %rdi      # 0xd5f5
movb $0x0, %al
callq 0x25d0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x557e
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)