// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/contacts.c
// Function: Get_contact_list
void Get_contact_list(int **nc1, int ***clist1, int ***cnum1, int Nres,
		      atom *atoms, struct interaction *Int_list, int N_int)
{
  int **clist=(int **)malloc(Nres*sizeof(int *));
  int **cnum=(int **)malloc(Nres*sizeof(int *));
  int *nc=(int *)malloc(Nres*sizeof(int));
  *nc1=nc; *clist1=clist; *cnum1=cnum;
  int ia, ja, n;

  for(ia=0; ia<Nres; ia++)nc[ia]=0;
  for(n=0; n<N_int; n++){
    ia=(atoms+Int_list[n].i1)->res;
    ja=(atoms+Int_list[n].i2)->res;
    if((ia>=Nres)||(ja>=Nres))continue;
    nc[ia]++; nc[ja]++;
  }

  int Ncmax=0;
  for(ia=0; ia<Nres; ia++){
    if(nc[ia]>Ncmax)Ncmax=nc[ia];
    clist[ia]=malloc((nc[ia]+1)*sizeof(int));
    cnum[ia]=malloc((nc[ia]+1)*sizeof(int));
    nc[ia]=0;
  }
  printf("Max number contact per residue: %d\n", Ncmax);

  for(n=0; n<N_int; n++){
    ia=(atoms+Int_list[n].i1)->res;
    ja=(atoms+Int_list[n].i2)->res;
    if((ia>=Nres)||(ja>=Nres))continue;
    clist[ia][nc[ia]]=ja; cnum[ia][nc[ia]]=n; nc[ia]++;
    clist[ja][nc[ja]]=ia; cnum[ja][nc[ja]]=n; nc[ja]++;
  }    
  for(ia=0; ia<Nres; ia++){
    clist[ia][nc[ia]]=-1;
    cnum[ia][nc[ia]]=-1;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movslq -0x1c(%rbp), %rdi
shlq $0x3, %rdi
callq 0x1180
movq %rax, -0x38(%rbp)
movslq -0x1c(%rbp), %rdi
shlq $0x3, %rdi
callq 0x1180
movq %rax, -0x40(%rbp)
movslq -0x1c(%rbp), %rdi
shlq $0x2, %rdi
callq 0x1180
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x2c02f
movq -0x48(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x2c00d
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl 0x10(%rbp), %eax
jge 0x2c0d1
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movslq -0x54(%rbp), %rdx
imulq $0xc8, %rdx, %rdx
addq %rdx, %rcx
movslq (%rcx), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x64(%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movslq -0x54(%rbp), %rdx
imulq $0xc8, %rdx, %rdx
addq %rdx, %rcx
movslq 0x4(%rcx), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x64(%rax), %eax
movl %eax, -0x50(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x2c09f
movl -0x50(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x2c0a1
jmp 0x2c0c3
movq -0x48(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0x48(%rbp), %rax
movslq -0x50(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x2c036
movl $0x0, -0x58(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x2c178
movq -0x48(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x58(%rbp), %eax
jle 0x2c109
movq -0x48(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x58(%rbp)
movq -0x48(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x2, %rdi
callq 0x1180
movq %rax, %rdx
movq -0x38(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x48(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x2, %rdi
callq 0x1180
movq %rax, %rdx
movq -0x40(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x48(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x2c0df
movl -0x58(%rbp), %esi
leaq 0x514d7(%rip), %rdi     # 0x7d659
movb $0x0, %al
callq 0x10d0
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl 0x10(%rbp), %eax
jge 0x2c2a6
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movslq -0x54(%rbp), %rdx
imulq $0xc8, %rdx, %rdx
addq %rdx, %rcx
movslq (%rcx), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x64(%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movslq -0x54(%rbp), %rdx
imulq $0xc8, %rdx, %rdx
addq %rdx, %rcx
movslq 0x4(%rcx), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x64(%rax), %eax
movl %eax, -0x50(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x2c1f9
movl -0x50(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x2c1fe
jmp 0x2c298
movl -0x50(%rbp), %edx
movq -0x38(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x48(%rbp), %rcx
movslq -0x4c(%rbp), %rsi
movslq (%rcx,%rsi,4), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x54(%rbp), %edx
movq -0x40(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x48(%rbp), %rcx
movslq -0x4c(%rbp), %rsi
movslq (%rcx,%rsi,4), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x48(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x4c(%rbp), %edx
movq -0x38(%rbp), %rax
movslq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x48(%rbp), %rcx
movslq -0x50(%rbp), %rsi
movslq (%rcx,%rsi,4), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x54(%rbp), %edx
movq -0x40(%rbp), %rax
movslq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x48(%rbp), %rcx
movslq -0x50(%rbp), %rsi
movslq (%rcx,%rsi,4), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x48(%rbp), %rax
movslq -0x50(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x2c190
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x2c2fe
movq -0x38(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x48(%rbp), %rcx
movslq -0x4c(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movq -0x40(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x48(%rbp), %rcx
movslq -0x4c(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x2c2ad
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop