// File: /workspace/github_c_makefile_star2_O0/josch[P]stride/place_h.c
// Function: PlaceHydrogens
int PlaceHydrogens(CHAIN *Chain)
{

  int Res, i, N, C, CA, H, PlacedCnt=0;
  float Length_N_C, Length_N_CA, Length_N_H;
  RESIDUE *r, *rr;
  
  for( Res=1; Res<Chain->NRes; Res++ ) {
    
    r  = Chain->Rsd[Res];
    rr = Chain->Rsd[Res-1];

      if( !strcmp(r->ResType,"PRO") ) continue;

      /* Replace deiterium atoms by hydrogens */
      if( FindAtom(Chain,Res,"D",&H) ) 
	strcmp(r->AtomType[H],"H");

      if( !FindAtom(Chain,Res,"H",&H)  && FindAtom(Chain,Res,"N",&N)   &&
	   FindAtom(Chain,Res-1,"C",&C) && FindAtom(Chain,Res,"CA",&CA) ) {

	H = r->NAtom;
	
	Length_N_C   = Dist(r->Coord[N],rr->Coord[C]);
	Length_N_CA  = Dist(r->Coord[N],r->Coord[CA]);
	
	for( i=0; i<3; i++ )
	  r->Coord[H][i] = r->Coord[N][i] - 
	      ( (rr->Coord[C][i] -  r->Coord[N][i])/Length_N_C +
	        (r->Coord[CA][i]  -  r->Coord[N][i])/Length_N_CA );

	Length_N_H = Dist(r->Coord[N],r->Coord[H]);

	for( i=0; i<3; i++ )
	  r->Coord[H][i] = r->Coord[N][i] + 
	    DIST_N_H*(r->Coord[H][i]-r->Coord[N][i])/Length_N_H;

	strcpy(r->AtomType[H],"H");
	r->NAtom++;
	PlacedCnt++;
      }
    }
  return(PlacedCnt);
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movl $0x0, 0x24(%rsp)
movl $0x1, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
movq 0x40(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x6d4e
movq 0x40(%rsp), %rax
movq 0x68(%rax), %rax
movslq 0x3c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
movq 0x40(%rsp), %rax
movq 0x68(%rax), %rax
movl 0x3c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
addq $0xa, %rdi
leaq 0x24edf(%rip), %rsi     # 0x2b89c
callq 0x2130
cmpl $0x0, %eax
jne 0x69cc
jmp 0x6d3e
movq 0x40(%rsp), %rdi
movl 0x3c(%rsp), %esi
leaq 0x25457(%rip), %rdx     # 0x2be33
leaq 0x28(%rsp), %rcx
callq 0x6140
cmpl $0x0, %eax
je 0x69eb
movq 0x40(%rsp), %rdi
movl 0x3c(%rsp), %esi
leaq 0x25fcd(%rip), %rdx     # 0x2c9c8
leaq 0x28(%rsp), %rcx
callq 0x6140
cmpl $0x0, %eax
jne 0x6d3c
movq 0x40(%rsp), %rdi
movl 0x3c(%rsp), %esi
leaq 0x24e5c(%rip), %rdx     # 0x2b87a
leaq 0x34(%rsp), %rcx
callq 0x6140
cmpl $0x0, %eax
je 0x6d3c
movq 0x40(%rsp), %rdi
movl 0x3c(%rsp), %esi
subl $0x1, %esi
leaq 0x25a4a(%rip), %rdx     # 0x2c48e
leaq 0x30(%rsp), %rcx
callq 0x6140
cmpl $0x0, %eax
je 0x6d3c
movq 0x40(%rsp), %rdi
movl 0x3c(%rsp), %esi
leaq 0x261d9(%rip), %rdx     # 0x2cc40
leaq 0x2c(%rsp), %rcx
callq 0x6140
cmpl $0x0, %eax
je 0x6d3c
movq 0x10(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x28(%rsp)
movq 0x10(%rsp), %rdi
addq $0x188, %rdi            # imm = 0x188
movslq 0x34(%rsp), %rax
imulq $0xc, %rax, %rax
addq %rax, %rdi
movq 0x8(%rsp), %rsi
addq $0x188, %rsi            # imm = 0x188
movslq 0x30(%rsp), %rax
imulq $0xc, %rax, %rax
addq %rax, %rsi
callq 0x4a30
movss %xmm0, 0x20(%rsp)
movq 0x10(%rsp), %rdi
addq $0x188, %rdi            # imm = 0x188
movslq 0x34(%rsp), %rax
imulq $0xc, %rax, %rax
addq %rax, %rdi
movq 0x10(%rsp), %rsi
addq $0x188, %rsi            # imm = 0x188
movslq 0x2c(%rsp), %rax
imulq $0xc, %rax, %rax
addq %rax, %rsi
callq 0x4a30
movss %xmm0, 0x1c(%rsp)
movl $0x0, 0x38(%rsp)
cmpl $0x3, 0x38(%rsp)
jge 0x6bf8
movq 0x10(%rsp), %rax
addq $0x188, %rax            # imm = 0x188
movslq 0x34(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq 0x38(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movq 0x8(%rsp), %rax
addq $0x188, %rax            # imm = 0x188
movslq 0x30(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq 0x38(%rsp), %rcx
movss (%rax,%rcx,4), %xmm1
movq 0x10(%rsp), %rax
addq $0x188, %rax            # imm = 0x188
movslq 0x34(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq 0x38(%rsp), %rcx
subss (%rax,%rcx,4), %xmm1
divss 0x20(%rsp), %xmm1
movq 0x10(%rsp), %rax
addq $0x188, %rax            # imm = 0x188
movslq 0x2c(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq 0x38(%rsp), %rcx
movss (%rax,%rcx,4), %xmm2
movq 0x10(%rsp), %rax
addq $0x188, %rax            # imm = 0x188
movslq 0x34(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq 0x38(%rsp), %rcx
subss (%rax,%rcx,4), %xmm2
divss 0x1c(%rsp), %xmm2
addss %xmm2, %xmm1
subss %xmm1, %xmm0
movq 0x10(%rsp), %rax
addq $0x188, %rax            # imm = 0x188
movslq 0x28(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq 0x38(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38(%rsp)
jmp 0x6b03
movq 0x10(%rsp), %rdi
addq $0x188, %rdi            # imm = 0x188
movslq 0x34(%rsp), %rax
imulq $0xc, %rax, %rax
addq %rax, %rdi
movq 0x10(%rsp), %rsi
addq $0x188, %rsi            # imm = 0x188
movslq 0x28(%rsp), %rax
imulq $0xc, %rax, %rax
addq %rax, %rsi
callq 0x4a30
movss %xmm0, 0x18(%rsp)
movl $0x0, 0x38(%rsp)
cmpl $0x3, 0x38(%rsp)
jge 0x6d04
movq 0x10(%rsp), %rax
addq $0x188, %rax            # imm = 0x188
movslq 0x34(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq 0x38(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movq 0x10(%rsp), %rax
addq $0x188, %rax            # imm = 0x188
movslq 0x28(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq 0x38(%rsp), %rcx
movss (%rax,%rcx,4), %xmm1
movq 0x10(%rsp), %rax
addq $0x188, %rax            # imm = 0x188
movslq 0x34(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq 0x38(%rsp), %rcx
subss (%rax,%rcx,4), %xmm1
cvtss2sd %xmm1, %xmm2
movsd 0x24b3f(%rip), %xmm1    # 0x2b7f8
mulsd %xmm2, %xmm1
movss 0x18(%rsp), %xmm2
cvtss2sd %xmm2, %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x10(%rsp), %rax
addq $0x188, %rax            # imm = 0x188
movslq 0x28(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq 0x38(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38(%rsp)
jmp 0x6c3b
movq 0x10(%rsp), %rdi
addq $0x10, %rdi
movslq 0x28(%rsp), %rax
imulq $0x5, %rax, %rax
addq %rax, %rdi
leaq 0x25ca8(%rip), %rsi     # 0x2c9c8
callq 0x2060
movq 0x10(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x6d3e
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x6969
movl 0x24(%rsp), %eax
addq $0x48, %rsp
retq
nopw (%rax,%rax)