// File: /workspace/github_c_makefile_star2_O1/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 $0x48, %rsp
movl %r8d, %ebx
movl %ecx, 0x4(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdi, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movq %rdx, %rsi
callq 0xf19f
movl %ebx, %eax
movq %rbx, 0x38(%rsp)
leal 0x1(%rbx), %ecx
movl %ecx, 0x1c(%rsp)
leaq (%rax,%rax,4), %rax
leaq 0x5b7a3(%rip), %rcx     # 0x6a750
addq %rax, %rcx
movq %rcx, 0x30(%rsp)
leaq 0x5afc4(%rip), %rcx     # 0x69f80
addq %rcx, %rax
addq $-0x5, %rax
movq %rax, 0x28(%rsp)
movb $0x1, %bpl
xorl %eax, %eax
movq 0x8(%rsp), %rcx
movzbl (%rcx), %ecx
cmpl $0x52, %ecx
je 0xf15d
cmpl $0x44, %ecx
je 0xf141
cmpl $0x20, %ecx
je 0xf176
testb $0x1, %bpl
je 0xf18c
xorl %r13d, %r13d
leaq 0x5bf70(%rip), %rbp     # 0x6af74
xorl %ecx, %ecx
movq %rcx, 0x40(%rsp)
leaq 0x5bf0e(%rip), %rax     # 0x6af20
movslq (%rax,%r13,4), %r14
testq %r14, %r14
setg %bl
jle 0xf0a7
imulq $0x64, %r13, %rsi
leaq 0x5bf43(%rip), %rax     # 0x6af70
addq %rax, %rsi
movl $0x3, %edx
movq 0x10(%rsp), %rdi
callq 0x2070
testl %eax, %eax
je 0xf075
leaq -0x1(%r14), %r12
movq %rbp, %rbx
xorl %r15d, %r15d
cmpq %r15, %r12
je 0xf0a7
movl $0x3, %edx
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x2070
addq $0x4, %rbx
incq %r15
testl %eax, %eax
jne 0xf04d
cmpq %r14, %r15
setb %bl
leaq (,%r13,4), %rsi
addq %r13, %rsi
leaq 0x5c6b9(%rip), %rax     # 0x6b740
addq %rax, %rsi
movq 0x8(%rsp), %rdi
callq 0xf19f
movq 0x20(%rsp), %rax
movl $0x1, (%rax)
testb %bl, %bl
jne 0xf130
cmpq $0x13, %r13
leaq 0x1(%r13), %rax
setae %cl
addq $0x64, %rbp
movq %rax, %r13
cmpq $0x14, %rax
jne 0xf006
xorl %ebp, %ebp
cmpl $0x0, 0x38(%rsp)
je 0xf18e
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rbx
movl 0x1c(%rsp), %r14d
decl %r14d
testl %r14d, %r14d
jle 0xf18e
addq $-0x5, %rbx
leaq -0x5(%rsi), %r15
movl $0x3, %edx
movq 0x10(%rsp), %rdi
callq 0x2070
movq %r15, %rsi
testl %eax, %eax
jne 0xf0df
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0xf19f
xorl %ebp, %ebp
movq 0x20(%rsp), %rax
movl $0x1, (%rax)
movb $0x1, %al
testl %r14d, %r14d
jg 0xefcd
jmp 0xf18e
movb $0x1, %al
xorl %ebp, %ebp
testb $0x1, 0x40(%rsp)
je 0xefcd
jmp 0xf0c3
movzbl %al, %eax
andl $0x1, %eax
cmpl $0x0, 0x4(%rsp)
leal -0x2(,%rax,4), %eax
movl $0x2, %ebp
cmovnel %eax, %ebp
jmp 0xf18e
testb $0x1, %al
movl $0x3, %eax
movl $0xfffffffd, %ebp       # imm = 0xFFFFFFFD
cmovnel %eax, %ebp
cmpl $0x0, 0x4(%rsp)
cmovel %eax, %ebp
jmp 0xf18e
cmpl $0x0, 0x4(%rsp)
setne %cl
notb %al
andb %cl, %al
movzbl %al, %ebp
negl %ebp
orl $0x1, %ebp
jmp 0xf18e
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq