// File: /workspace/github_c_makefile_star2_O0/josch[P]stride/phipsi.c
// Function: DiscrPhiPsi
void DiscrPhiPsi(CHAIN **Chain, int NChain, COMMAND *Cmd)
{

  register int i, Res, Cn;
  RESIDUE *r;

  for( Cn=0; Cn<NChain; Cn++ ) {
    
    for( Res=0; Res<Chain[Cn]->NRes; Res++ ) {
      
      r = Chain[Cn]->Rsd[Res];
      
      r->Prop->PhiZn = ERR;
      r->Prop->PsiZn = ERR;
      
      if( Res != 0 ) {
	for( i=0; i<Cmd->NPixel; i++ )
	  if( r->Prop->Phi  >  MINPHIPSI+(float)(i)*Cmd->PhiPsiStep && 
	      r->Prop->Phi <=  MINPHIPSI+(float)(i+1)*Cmd->PhiPsiStep ) {
	    r->Prop->PhiZn = i;
	    break;
	  }
      }
      
      if( Res != Chain[Cn]->NRes-1 ) {
	for( i=0; i<Cmd->NPixel; i++ )
	  if( r->Prop->Psi  >  MINPHIPSI+(float)(i)*Cmd->PhiPsiStep && 
	      r->Prop->Psi <=  MINPHIPSI+(float)(i+1)*Cmd->PhiPsiStep ) {
	    r->Prop->PsiZn = i;
	    break;
	  }
      }
      
    }
    
    for(Res=0; Res<Chain[Cn]->NRes; Res++ )  {
      r = Chain[Cn]->Rsd[Res];
      if( Res != 0 && r->Prop->PsiZn == ERR )
	r->Prop->PsiZn = Chain[Cn]->Rsd[Res-1]->Prop->PsiZn;
      if( Res != Chain[Cn]->NRes-1 && r->Prop->PhiZn == ERR )
	r->Prop->PhiZn = Chain[Cn]->Rsd[Res+1]->Prop->PhiZn;
    }

  }
}

// Assembly:
movq %rdi, -0x8(%rsp)
movl %esi, -0xc(%rsp)
movq %rdx, -0x18(%rsp)
movl $0x0, -0x24(%rsp)
movl -0x24(%rsp), %eax
cmpl -0xc(%rsp), %eax
jge 0xc072
movl $0x0, -0x20(%rsp)
movl -0x20(%rsp), %eax
movq -0x8(%rsp), %rcx
movslq -0x24(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
cmpl (%rcx), %eax
jge 0xbf54
movq -0x8(%rsp), %rax
movslq -0x24(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movslq -0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rsp)
movq -0x30(%rsp), %rax
movq 0x768(%rax), %rax
movl $0xffffffff, 0xc(%rax)  # imm = 0xFFFFFFFF
movq -0x30(%rsp), %rax
movq 0x768(%rax), %rax
movl $0xffffffff, 0x10(%rax) # imm = 0xFFFFFFFF
cmpl $0x0, -0x20(%rsp)
je 0xbe5c
movl $0x0, -0x1c(%rsp)
movl -0x1c(%rsp), %eax
movq -0x18(%rsp), %rcx
cmpl 0x1cf4(%rcx), %eax
jge 0xbe5a
movq -0x30(%rsp), %rax
movq 0x768(%rax), %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
cvtsi2ssl -0x1c(%rsp), %xmm1
movq -0x18(%rsp), %rax
mulss 0x1d08(%rax), %xmm1
cvtss2sd %xmm1, %xmm2
movsd 0x1fed9(%rip), %xmm1    # 0x2bcc0
addsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xbe48
movq -0x30(%rsp), %rax
movq 0x768(%rax), %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm1
movl -0x1c(%rsp), %eax
addl $0x1, %eax
cvtsi2ss %eax, %xmm0
movq -0x18(%rsp), %rax
mulss 0x1d08(%rax), %xmm0
cvtss2sd %xmm0, %xmm2
movsd 0x1fe97(%rip), %xmm0    # 0x2bcc0
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jb 0xbe48
movl -0x1c(%rsp), %ecx
movq -0x30(%rsp), %rax
movq 0x768(%rax), %rax
movl %ecx, 0xc(%rax)
jmp 0xbe5a
jmp 0xbe4a
movl -0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rsp)
jmp 0xbd9f
jmp 0xbe5c
movl -0x20(%rsp), %eax
movq -0x8(%rsp), %rcx
movslq -0x24(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movl (%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
je 0xbf42
movl $0x0, -0x1c(%rsp)
movl -0x1c(%rsp), %eax
movq -0x18(%rsp), %rcx
cmpl 0x1cf4(%rcx), %eax
jge 0xbf40
movq -0x30(%rsp), %rax
movq 0x768(%rax), %rax
movss 0x4(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
cvtsi2ssl -0x1c(%rsp), %xmm1
movq -0x18(%rsp), %rax
mulss 0x1d08(%rax), %xmm1
cvtss2sd %xmm1, %xmm2
movsd 0x1fdf4(%rip), %xmm1    # 0x2bcc0
addsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xbf2e
movq -0x30(%rsp), %rax
movq 0x768(%rax), %rax
movss 0x4(%rax), %xmm0
cvtss2sd %xmm0, %xmm1
movl -0x1c(%rsp), %eax
addl $0x1, %eax
cvtsi2ss %eax, %xmm0
movq -0x18(%rsp), %rax
mulss 0x1d08(%rax), %xmm0
cvtss2sd %xmm0, %xmm2
movsd 0x1fdb1(%rip), %xmm0    # 0x2bcc0
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jb 0xbf2e
movl -0x1c(%rsp), %ecx
movq -0x30(%rsp), %rax
movq 0x768(%rax), %rax
movl %ecx, 0x10(%rax)
jmp 0xbf40
jmp 0xbf30
movl -0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rsp)
jmp 0xbe83
jmp 0xbf42
jmp 0xbf44
movl -0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rsp)
jmp 0xbd2c
movl $0x0, -0x20(%rsp)
movl -0x20(%rsp), %eax
movq -0x8(%rsp), %rcx
movslq -0x24(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
cmpl (%rcx), %eax
jge 0xc060
movq -0x8(%rsp), %rax
movslq -0x24(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movslq -0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rsp)
cmpl $0x0, -0x20(%rsp)
je 0xbfe8
movq -0x30(%rsp), %rax
movq 0x768(%rax), %rax
cmpl $-0x1, 0x10(%rax)
jne 0xbfe8
movq -0x8(%rsp), %rax
movslq -0x24(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movl -0x20(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq 0x768(%rax), %rax
movl 0x10(%rax), %ecx
movq -0x30(%rsp), %rax
movq 0x768(%rax), %rax
movl %ecx, 0x10(%rax)
movl -0x20(%rsp), %eax
movq -0x8(%rsp), %rcx
movslq -0x24(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movl (%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
je 0xc04e
movq -0x30(%rsp), %rax
movq 0x768(%rax), %rax
cmpl $-0x1, 0xc(%rax)
jne 0xc04e
movq -0x8(%rsp), %rax
movslq -0x24(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movl -0x20(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq 0x768(%rax), %rax
movl 0xc(%rax), %ecx
movq -0x30(%rsp), %rax
movq 0x768(%rax), %rax
movl %ecx, 0xc(%rax)
jmp 0xc050
movl -0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rsp)
jmp 0xbf5c
jmp 0xc062
movl -0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rsp)
jmp 0xbd16
retq
nopw %cs:(%rax,%rax)
nopl (%rax)