// File: /workspace/github_c_makefile_star2_O3/asford[P]tmalign/./basic_fun.h
// Function: read_ligand(char*, double**, char*, int*)
int read_ligand(char *filename, double **a, char *seq, int *resno)
{
    int i=0;
    char cstr[100];    
    string line, str;    
    string atom ("HETATM "); 
    string finish ("END"); 
    
    
    ifstream fin (filename);
    if (fin.is_open())
    {
        while ( fin.good() )
        {
            getline(fin, line);
            if(line.compare(0, atom.length(), atom)==0)
            {
                strcpy(cstr, (line.substr(12, 4)).c_str()); 
                   
                if(!strstr(cstr, "H"))
                {
                    if( line.compare(16, 1, " ")==0 ||\
                        line.compare(16, 1, "A")==0 )
                    {                                  
                        get_xyz(line, &a[i][0], &a[i][1], &a[i][2], &seq[i], &resno[i]);
                        i++;
                    }
                }                  
            }
            else if(line.compare(0, finish.length(), finish)==0) 
            {
                break;
            }          
        }
        fin.close();
    }
    else
    {
		char message[5000];
		sprintf(message, "Can not open file: %s\n", filename);
        PrintErrorAndQuit(message);     
    } 
    seq[i]='\0';   
    
    return i;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x16b8, %rsp           # imm = 0x16B8
movq %rcx, 0x90(%rsp)
movq %rdx, (%rsp)
movq %rsi, 0x88(%rsp)
movq %rdi, %rbx
leaq 0x78(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0xa8(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x17ed4c(%rip), %rsi    # 0x58423c
leaq 0x17ed4c(%rip), %rdx    # 0x584243
leaq 0x48(%rsp), %rdi
callq 0x40c558
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x17ed33(%rip), %rsi    # 0x584244
leaq 0x17ed2f(%rip), %rdx    # 0x584247
leaq 0x28(%rsp), %rdi
callq 0x40c558
leaq 0xb8(%rsp), %rdi
movq %rbx, %rsi
movl $0x8, %edx
callq 0x452e40
leaq 0x130(%rsp), %rdi
callq 0x40d530
testb %al, %al
je 0x4057c6
movq 0xb8(%rsp), %rax
movq -0x18(%rax), %rax
xorl %r14d, %r14d
cmpl $0x0, 0xd8(%rsp,%rax)
jne 0x405713
leaq (%rsp,%rax), %rdi
addq $0xb8, %rdi
xorl %r14d, %r14d
leaq 0xb8(%rsp), %r13
leaq 0x68(%rsp), %rbp
leaq 0x48(%rsp), %r15
leaq 0x2c0(%rsp), %r12
movl $0xa, %esi
callq 0x4571d0
movsbl %al, %edx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x40e900
movq 0x50(%rsp), %rdx
movq %rbp, %rdi
xorl %esi, %esi
movq %r15, %rcx
callq 0x47ea40
testl %eax, %eax
je 0x4055e0
movq 0x30(%rsp), %rdx
movq %rbp, %rdi
xorl %esi, %esi
leaq 0x28(%rsp), %rcx
callq 0x47ea40
testl %eax, %eax
jne 0x4056f2
jmp 0x405713
movl $0xc, %edx
movl $0x4, %ecx
leaq 0x330(%rsp), %rdi
movq %rbp, %rsi
callq 0x47f260
movq 0x330(%rsp), %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x401080
leaq 0x340(%rsp), %rax
cmpq %rax, %rbx
je 0x40562d
movq 0x340(%rsp), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x40c5f0
movq %r12, %rdi
movl $0x48, %esi
callq 0x4010b0
testq %rax, %rax
jne 0x4056f2
movl $0x10, %esi
movl $0x1, %edx
movq %rbp, %rdi
leaq 0x17fa90(%rip), %rcx    # 0x5850e7
callq 0x47ec00
testl %eax, %eax
je 0x40567d
movl $0x10, %esi
movl $0x1, %edx
movq %rbp, %rdi
leaq 0x17f671(%rip), %rcx    # 0x584ce5
callq 0x47ec00
testl %eax, %eax
jne 0x4056f2
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x40c4c2
movslq %r14d, %rax
movq 0x88(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
leaq 0x8(%rsi), %rdx
leaq 0x10(%rsi), %rcx
movq (%rsp), %rdi
leaq (%rdi,%rax), %r8
movq 0x90(%rsp), %rdi
leaq (%rdi,%rax,4), %r9
leaq 0x8(%rsp), %rdi
callq 0x40499a
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4056ef
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40c5f0
incl %r14d
movq 0xb8(%rsp), %rax
movq -0x18(%rax), %rax
leaq (%rsp,%rax), %rdi
addq $0xb8, %rdi
cmpl $0x0, 0x20(%rdi)
je 0x405591
leaq 0xb8(%rsp), %rdi
callq 0x4533f0
movslq %r14d, %rax
movq (%rsp), %rcx
movb $0x0, (%rcx,%rax)
leaq 0xb8(%rsp), %rdi
callq 0x4537a0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x405754
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40c5f0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x405770
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x40c5f0
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x405795
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x40c5f0
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x4057b1
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x40c5f0
movl %r14d, %eax
addq $0x16b8, %rsp           # imm = 0x16B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17ea58(%rip), %rsi    # 0x584225
leaq 0x330(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x4d9b80
movq %r14, %rdi
callq 0x404708
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x405823
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40c5f0
jmp 0x405823
jmp 0x405820
jmp 0x405820
movq %rax, %rbx
jmp 0x405830
movq %rax, %rbx
jmp 0x40584c
movq %rax, %rbx
jmp 0x405868
jmp 0x405820
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x4537a0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x40584c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40c5f0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x405868
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x40c5f0
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x40588d
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x40c5f0
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x4058a9
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x40c5f0
movq %rbx, %rdi
callq 0x4b2d40