// File: /workspace/github_c_makefile_star2_O0/radforddc[P]icpc_siggen/fields.c
// Function: efield_exists
static int efield_exists(cyl_pt pt, MJD_Siggen_Setup *setup){
  cyl_int_pt ipt;
  char ptstr[MAX_LINE];
  int  i, j, ir, iz;
  sprintf(ptstr, "(r,z) = (%.1f,%.1f)", pt.r, pt.z);
  if (outside_detector_cyl(pt, setup)){
    TELL_CHATTY("point %s is outside crystal\n", ptstr);
    return 0;
  }
  ipt.r = (pt.r - setup->rmin)/setup->rstep;  // CHECKED: no need for lrintf
  ipt.phi = 0;
  ipt.z = (pt.z - setup->zmin)/setup->zstep;  // CHECKED: no need for lrintf

  if (ipt.r < 0 || ipt.r + 1 >= setup->rlen ||
      ipt.z < 0 || ipt.z + 1 >= setup->zlen){
    TELL_CHATTY("point %s is outside wp table\n", ptstr);
    return 0;
  }
  for (i = 0; i < 2 ; i++){
    ir = ipt.r + i;
    for (j = 0; j < 2; j++){
      iz = ipt.z + j;
      if (setup->efld[ir][iz].r == 0.0 && setup->efld[ir][iz].z == 0.0) {
	TELL_CHATTY("point %s has no efield\n", ptstr);
	return 0;
      }
    }
  }
  TELL_CHATTY("point %s is in crystal\n", ptstr);
  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movlpd %xmm0, -0x20(%rbp)
movss %xmm1, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x8(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
movq %rdi, -0x28(%rbp)
movss -0x10(%rbp), %xmm0
movss -0x8(%rbp), %xmm1
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
leaq 0x4d0b(%rip), %rsi      # 0xd65b
leaq -0x240(%rbp), %rdi
movb $0x2, %al
callq 0x2160
movq -0x28(%rbp), %rdi
movl -0x8(%rbp), %eax
movl %eax, -0x258(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x260(%rbp)
movsd -0x260(%rbp), %xmm0
movss -0x258(%rbp), %xmm1
callq 0x4dc0
cmpl $0x0, %eax
je 0x89ba
movq -0x28(%rbp), %rax
cmpl $0x2, (%rax)
jl 0x89ae
leaq -0x240(%rbp), %rsi
leaq 0x4cc8(%rip), %rdi      # 0xd66f
movb $0x0, %al
callq 0x2530
movl $0x0, -0x4(%rbp)
jmp 0x8b96
movss -0x10(%rbp), %xmm0
movq -0x28(%rbp), %rax
subss 0x3b0(%rax), %xmm0
movq -0x28(%rbp), %rax
divss 0x3b8(%rax), %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x34(%rbp)
movl $0x0, -0x30(%rbp)
movss -0x8(%rbp), %xmm0
movq -0x28(%rbp), %rax
subss 0x3bc(%rax), %xmm0
movq -0x28(%rbp), %rax
divss 0x3c4(%rax), %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x34(%rbp)
jl 0x8a39
movl -0x34(%rbp), %eax
addl $0x1, %eax
movq -0x28(%rbp), %rcx
cmpl 0x3c8(%rcx), %eax
jge 0x8a39
cmpl $0x0, -0x2c(%rbp)
jl 0x8a39
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movq -0x28(%rbp), %rcx
cmpl 0x3cc(%rcx), %eax
jl 0x8a63
movq -0x28(%rbp), %rax
cmpl $0x2, (%rax)
jl 0x8a57
leaq -0x240(%rbp), %rsi
leaq 0x4c3c(%rip), %rdi      # 0xd68c
movb $0x0, %al
callq 0x2530
movl $0x0, -0x4(%rbp)
jmp 0x8b96
movl $0x0, -0x244(%rbp)
cmpl $0x2, -0x244(%rbp)
jge 0x8b71
movl -0x34(%rbp), %eax
addl -0x244(%rbp), %eax
movl %eax, -0x24c(%rbp)
movl $0x0, -0x248(%rbp)
cmpl $0x2, -0x248(%rbp)
jge 0x8b5b
movl -0x2c(%rbp), %eax
addl -0x248(%rbp), %eax
movl %eax, -0x250(%rbp)
movq -0x28(%rbp), %rax
movq 0x1470(%rax), %rax
movslq -0x24c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x250(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x8b45
jp 0x8b45
movq -0x28(%rbp), %rax
movq 0x1470(%rax), %rax
movslq -0x24c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x250(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x8(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x8b45
jp 0x8b45
movq -0x28(%rbp), %rax
cmpl $0x2, (%rax)
jl 0x8b3c
leaq -0x240(%rbp), %rsi
leaq 0x4b75(%rip), %rdi      # 0xd6aa
movb $0x0, %al
callq 0x2530
movl $0x0, -0x4(%rbp)
jmp 0x8b96
jmp 0x8b47
movl -0x248(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x248(%rbp)
jmp 0x8a93
jmp 0x8b5d
movl -0x244(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x244(%rbp)
jmp 0x8a6d
movq -0x28(%rbp), %rax
cmpl $0x2, (%rax)
jl 0x8b8f
leaq -0x240(%rbp), %rsi
leaq 0x4b3a(%rip), %rdi      # 0xd6c2
movb $0x0, %al
callq 0x2530
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)