// File: /workspace/github_c_makefile_star2_O2/ugobas[P]tnm/read.c
// Function: Get_amm
int Get_amm(char *amm, int *exo, char *res_type_old, int hetatm, int n_exo)
{
  /* Check amino acid type */
  Code_3_2(amm, res_type_old);
  int type=0, exo_check=0;

 find_type:
  if(amm[0] == ' '){
    // Standard amino acid residue
    if(hetatm==0 || exo_check){type=1;}
    else{type=-1;} // Standard res. and HETATM => ligand
  }else if(amm[0]=='D'){
    // deoxyribo-nucleotide
    if(hetatm==0 || exo_check){type=2;}
    else{type=-2;} // Standard nuc and HETATM => ligand
  }else if(amm[0]=='R'){
    // ribo-nucleotide
    if(hetatm==0 || exo_check){type=3;}
    else{type=-3;} // Standard nuc and HETATM => ligand
  }else if(exo_check==0){
    exo_check=1;
    // Non-standard residue
    for(int i=0; i<20; i++){
      for(int j=0; j<n_modres[i]; j++){
	if(strncmp(res_type_old, modres[i]+4*j, 3)==0){
	  Code_3_2(amm, stdres[i]); *exo=1; goto find_type;
	}
      }
    }
    if(n_exo){
      for(int i=n_exo-1; i>=0; i--){
	if(strncmp(res_type_old,res_exo[i],3)==0){
	  Code_3_2(amm, res_std[i]); *exo=1; goto find_type;
	}
      }
    }
  }
  //if(type<0)type=-type;
  return(type);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r8d, %ebx
movl %ecx, 0x8(%rsp)
movq %rdx, %r15
movq %rsi, 0x30(%rsp)
movq %rdi, %r12
movq %rdx, %rsi
callq 0xe6fb
movl %ebx, %eax
movq %rbx, 0x20(%rsp)
leal 0x1(%rbx), %ecx
movl %ecx, 0xc(%rsp)
leaq (%rax,%rax,4), %rax
leaq 0x571bc(%rip), %rcx     # 0x65750
addq %rax, %rcx
movq %rcx, 0x18(%rsp)
leaq 0x569dd(%rip), %rcx     # 0x64f80
addq %rcx, %rax
addq $-0x5, %rax
movq %rax, 0x10(%rsp)
movb $0x1, %cl
pushq $0x3
popq %rbp
xorl %eax, %eax
movq %r12, 0x28(%rsp)
movzbl (%r12), %edx
cmpl $0x52, %edx
je 0xe6a5
cmpl $0x44, %edx
je 0xe6ba
cmpl $0x20, %edx
je 0xe6d4
xorl %eax, %eax
testb $0x1, %cl
je 0xe6ec
leaq 0x57983(%rip), %r12     # 0x65f70
xorl %r14d, %r14d
cmpq $0x14, %r14
je 0xe66b
leaq 0x57923(%rip), %rax     # 0x65f20
movl (%rax,%r14,4), %r13d
testl %r13d, %r13d
movl $0x0, %eax
cmovlel %eax, %r13d
incq %r13
movq %r12, %rsi
decq %r13
je 0xe630
leaq 0x4(%rsi), %rbx
movq %r15, %rdi
movq %rbp, %rdx
callq 0x2070
movq %rbx, %rsi
testl %eax, %eax
jne 0xe613
jmp 0xe639
incq %r14
addq $0x64, %r12
jmp 0xe5f0
leaq (%r14,%r14,4), %r14
leaq 0x580fc(%rip), %rax     # 0x66740
addq %rax, %r14
movq 0x28(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0xe6fb
movq 0x30(%rsp), %rax
movl $0x1, (%rax)
movb $0x1, %al
xorl %ecx, %ecx
jmp 0xe5bb
cmpl $0x0, 0x20(%rsp)
je 0xe6ea
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %r14
movl 0xc(%rsp), %r12d
decl %r12d
testl %r12d, %r12d
jle 0xe6ea
addq $-0x5, %r14
leaq -0x5(%rsi), %rbx
movq %r15, %rdi
movq %rbp, %rdx
callq 0x2070
movq %rbx, %rsi
testl %eax, %eax
jne 0xe681
jmp 0xe647
testb $0x1, %al
pushq $0x3
popq %rcx
pushq $-0x3
popq %rax
cmovnel %ecx, %eax
cmpl $0x0, 0x8(%rsp)
cmovel %ecx, %eax
jmp 0xe6ec
movzbl %al, %eax
andl $0x1, %eax
cmpl $0x0, 0x8(%rsp)
leal -0x2(,%rax,4), %ecx
pushq $0x2
popq %rax
cmovnel %ecx, %eax
jmp 0xe6ec
cmpl $0x0, 0x8(%rsp)
setne %cl
notb %al
andb %cl, %al
movzbl %al, %eax
negl %eax
orl $0x1, %eax
jmp 0xe6ec
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq