// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/sparse.c
// Function: column_grouping
int column_grouping(sp_mat *G, int *col_g, int *filled){
  int testcol,groupnum,fitted,neq;
  int i, *Ap, *Ai,done;

  neq = G->ncols;
  Ai = G->Ai; Ap = G->Ap;
  for(i=0;i<neq;i++)
    col_g[i]=-1;

  for(groupnum=0; groupnum<neq; groupnum++){
    //Reset filled vector:
    for (i=0; i<neq; i++){
      filled[i] = 0;
    }
    //Try to assign remaining columns to current group:
    done = _TRUE_;
    for (testcol=0; testcol<neq; testcol++){
      if (col_g[testcol]!=-1){
	continue;
      }
      done = _FALSE_;
      //Is current testcol in conflict with the groups filling vector?
      fitted = _TRUE_;
      for (i=Ap[testcol]; i<Ap[testcol+1]; i++){
	if (filled[Ai[i]] != 0){
	  fitted = _FALSE_;
	  break;
	}
      }
      if (fitted == _TRUE_){
	//Test succesfull
	col_g[testcol] = groupnum;
	for (i=Ap[testcol]; i<Ap[testcol+1]; i++){
	  filled[Ai[i]] = 1;
	}
      }
    }
    if (done == _TRUE_){
      //No columns remaining.
      //No column belongs to current groupnum.
      break;
    }
  }
  return (groupnum-1);
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq %rdx, -0x18(%rsp)
movq -0x8(%rsp), %rax
movl (%rax), %eax
movl %eax, -0x28(%rsp)
movq -0x8(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x40(%rsp)
movq -0x8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rsp)
movl $0x0, -0x2c(%rsp)
movl -0x2c(%rsp), %eax
cmpl -0x28(%rsp), %eax
jge 0xcca6
movq -0x10(%rsp), %rax
movslq -0x2c(%rsp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movl -0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rsp)
jmp 0xcc7e
movl $0x0, -0x20(%rsp)
movl -0x20(%rsp), %eax
cmpl -0x28(%rsp), %eax
jge 0xce21
movl $0x0, -0x2c(%rsp)
movl -0x2c(%rsp), %eax
cmpl -0x28(%rsp), %eax
jge 0xccec
movq -0x18(%rsp), %rax
movslq -0x2c(%rsp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rsp)
jmp 0xccc4
movl $0x1, -0x44(%rsp)
movl $0x0, -0x1c(%rsp)
movl -0x1c(%rsp), %eax
cmpl -0x28(%rsp), %eax
jge 0xce06
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
je 0xcd1f
jmp 0xcdf6
movl $0x0, -0x44(%rsp)
movl $0x1, -0x24(%rsp)
movq -0x38(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x2c(%rsp)
movl -0x2c(%rsp), %eax
movq -0x38(%rsp), %rcx
movl -0x1c(%rsp), %edx
addl $0x1, %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xcd8a
movq -0x18(%rsp), %rax
movq -0x40(%rsp), %rcx
movslq -0x2c(%rsp), %rdx
movslq (%rcx,%rdx,4), %rcx
cmpl $0x0, (%rax,%rcx,4)
je 0xcd7b
movl $0x0, -0x24(%rsp)
jmp 0xcd8a
jmp 0xcd7d
movl -0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rsp)
jmp 0xcd40
cmpl $0x1, -0x24(%rsp)
jne 0xcdf4
movl -0x20(%rsp), %edx
movq -0x10(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x38(%rsp), %rax
movslq -0x1c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x2c(%rsp)
movl -0x2c(%rsp), %eax
movq -0x38(%rsp), %rcx
movl -0x1c(%rsp), %edx
addl $0x1, %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xcdf2
movq -0x18(%rsp), %rax
movq -0x40(%rsp), %rcx
movslq -0x2c(%rsp), %rdx
movslq (%rcx,%rdx,4), %rcx
movl $0x1, (%rax,%rcx,4)
movl -0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rsp)
jmp 0xcdb3
jmp 0xcdf4
jmp 0xcdf6
movl -0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rsp)
jmp 0xccfc
cmpl $0x1, -0x44(%rsp)
jne 0xce0f
jmp 0xce21
jmp 0xce11
movl -0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rsp)
jmp 0xccae
movl -0x20(%rsp), %eax
subl $0x1, %eax
retq
nopl (%rax)