// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/buildup.c
// Function: Get_previous_AA
int Get_previous_AA(char *pre, struct bond *bond, int res){
  // returns ichar position of character that should match *pre
  if(res<bond->atom->res){
    strcpy(pre, "C "); return(-1);
  }
  char *name=bond->atom->name, index=name[1];
  if(name[0]=='H'){
    if((index=='N')||(index=='1')||(index=='2')||(index=='3')){*pre=' ';}
    else{*pre=index;}
  }else if(index==' '){
    if(name[0]=='N'){
      strcpy(pre, "C "); return(-1);
    }else if(name[0]=='C'){
      strcpy(pre, "CA"); return(-1); // CA
    }else if(name[0]=='O'){
      strcpy(pre, "C "); return(-1); // C
    }
  }else if(index=='A'){
    strcpy(pre, "N "); return(-1);
  }else if(index=='B'){
    strcpy(pre, "CA"); return(-1);
  }else if(index=='G'){
    *pre='B';
  }else if(index=='D'){
    *pre='G';
  }else if(index=='E'){
    *pre='D';
  }else if(index=='Z'){
    *pre='E';
  }else if(index=='H'){
    *pre='Z';
  }else if((strncmp(name,"OXT",3)==0)||
	   (strncmp(name,"OT" ,2)==0)){
    strcpy(pre, "C "); return(-1);
  }else{
    printf("WARNING, unknown atom name: %s res %d chain %d\n",
	   name, bond->atom->res, bond->atom->chain);
    strcpy(pre, "  "); return(-1);
    //exit(8);
  }
  return(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x64(%rcx), %eax
jge 0x1e5de
movq -0x10(%rbp), %rdi
leaq 0x5ca63(%rip), %rsi     # 0x7b030
callq 0x1060
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1e822
movq -0x18(%rbp), %rax
movq (%rax), %rax
addq $0x18, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movb 0x1(%rax), %al
movb %al, -0x29(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x48, %eax
jne 0x1e63e
movsbl -0x29(%rbp), %eax
cmpl $0x4e, %eax
je 0x1e627
movsbl -0x29(%rbp), %eax
cmpl $0x31, %eax
je 0x1e627
movsbl -0x29(%rbp), %eax
cmpl $0x32, %eax
je 0x1e627
movsbl -0x29(%rbp), %eax
cmpl $0x33, %eax
jne 0x1e630
movq -0x10(%rbp), %rax
movb $0x20, (%rax)
jmp 0x1e639
movb -0x29(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, (%rax)
jmp 0x1e81b
movsbl -0x29(%rbp), %eax
cmpl $0x20, %eax
jne 0x1e6cc
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x4e, %eax
jne 0x1e673
movq -0x10(%rbp), %rdi
leaq 0x5c9ce(%rip), %rsi     # 0x7b030
callq 0x1060
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1e822
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x43, %eax
jne 0x1e69b
movq -0x10(%rbp), %rdi
leaq 0x57c7e(%rip), %rsi     # 0x76308
callq 0x1060
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1e822
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x4f, %eax
jne 0x1e6c3
movq -0x10(%rbp), %rdi
leaq 0x5c97e(%rip), %rsi     # 0x7b030
callq 0x1060
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1e822
jmp 0x1e6c5
jmp 0x1e6c7
jmp 0x1e819
movsbl -0x29(%rbp), %eax
cmpl $0x41, %eax
jne 0x1e6f1
movq -0x10(%rbp), %rdi
leaq 0x5c94d(%rip), %rsi     # 0x7b02d
callq 0x1060
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1e822
movsbl -0x29(%rbp), %eax
cmpl $0x42, %eax
jne 0x1e716
movq -0x10(%rbp), %rdi
leaq 0x57c03(%rip), %rsi     # 0x76308
callq 0x1060
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1e822
movsbl -0x29(%rbp), %eax
cmpl $0x47, %eax
jne 0x1e72b
movq -0x10(%rbp), %rax
movb $0x42, (%rax)
jmp 0x1e813
movsbl -0x29(%rbp), %eax
cmpl $0x44, %eax
jne 0x1e740
movq -0x10(%rbp), %rax
movb $0x47, (%rax)
jmp 0x1e811
movsbl -0x29(%rbp), %eax
cmpl $0x45, %eax
jne 0x1e755
movq -0x10(%rbp), %rax
movb $0x44, (%rax)
jmp 0x1e80f
movsbl -0x29(%rbp), %eax
cmpl $0x5a, %eax
jne 0x1e76a
movq -0x10(%rbp), %rax
movb $0x45, (%rax)
jmp 0x1e80d
movsbl -0x29(%rbp), %eax
cmpl $0x48, %eax
jne 0x1e77f
movq -0x10(%rbp), %rax
movb $0x5a, (%rax)
jmp 0x1e80b
movq -0x28(%rbp), %rdi
leaq 0x5d7c7(%rip), %rsi     # 0x7bf51
movl $0x3, %edx
callq 0x1050
cmpl $0x0, %eax
je 0x1e7b3
movq -0x28(%rbp), %rdi
leaq 0x5c892(%rip), %rsi     # 0x7b036
movl $0x2, %edx
callq 0x1050
cmpl $0x0, %eax
jne 0x1e7cc
movq -0x10(%rbp), %rdi
leaq 0x5c872(%rip), %rsi     # 0x7b030
callq 0x1060
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1e822
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl 0x64(%rax), %edx
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl 0x6c(%rax), %ecx
leaq 0x5d76a(%rip), %rdi     # 0x7bf55
movb $0x0, %al
callq 0x10d0
movq -0x10(%rbp), %rdi
leaq 0x5fd83(%rip), %rsi     # 0x7e580
callq 0x1060
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1e822
jmp 0x1e80d
jmp 0x1e80f
jmp 0x1e811
jmp 0x1e813
jmp 0x1e815
jmp 0x1e817
jmp 0x1e819
jmp 0x1e81b
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)