// File: dlcgold[P]sparsematrix-unimib/./sparsematrix.h
// Function: int evaluate<float, positive>(sparse_matrix<float> const&, positive)
int evaluate(const sparse_matrix<T> &smatrix, P pred) {

  typename sparse_matrix<T>::const_iterator i, ie;
  int count = 0;
  if(smatrix.get_size() == 0) return count;
  i = smatrix.begin();
  ie = smatrix.end();
	
  while(i!=ie) {
    if(pred(i->v)) {
      count++;
    }
    ++i;
  }
  // calcolo le celle di default
  // se pred(default) = true sommo quel numero al mio count
  int totalDefault = (smatrix.get_size_row() * smatrix.get_size_column())
    - smatrix.get_size();
  if(pred(smatrix.get_default_value()))
    count += totalDefault;
  return count;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x6460
leaq -0x20(%rbp), %rdi
callq 0x6460
jmp 0x3f23
movl $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6480
movl %eax, -0x58(%rbp)
jmp 0x3f38
movl -0x58(%rbp), %eax
cmpl $0x0, %eax
jne 0x3f74
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0x34(%rbp)
jmp 0x40e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x4110
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x4107
movq -0x10(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x64a0
jmp 0x3f83
leaq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x64d0
jmp 0x3f92
leaq -0x40(%rbp), %rdi
callq 0x64f0
movq -0x10(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x6500
jmp 0x3faa
leaq -0x20(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x64d0
jmp 0x3fb9
leaq -0x48(%rbp), %rdi
callq 0x64f0
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x6530
movb %al, -0x59(%rbp)
jmp 0x3fd4
movb -0x59(%rbp), %al
testb $0x1, %al
jne 0x3fe0
jmp 0x406a
leaq -0x18(%rbp), %rdi
callq 0x6580
movq %rax, -0x68(%rbp)
jmp 0x3fef
movq -0x68(%rbp), %rax
cvttss2si (%rax), %esi
leaq -0x5(%rbp), %rdi
callq 0x6560
movb %al, -0x69(%rbp)
jmp 0x4005
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x400e
jmp 0x404d
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x404d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x64f0
jmp 0x4107
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x64f0
jmp 0x4107
leaq -0x50(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x65a0
jmp 0x405c
leaq -0x50(%rbp), %rdi
callq 0x64f0
jmp 0x3fc2
movq -0x10(%rbp), %rdi
callq 0x37b0
movl %eax, -0x78(%rbp)
movq -0x10(%rbp), %rdi
callq 0x37d0
movl %eax, %ecx
movl -0x78(%rbp), %eax
imull %ecx, %eax
movl %eax, -0x74(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6480
movl %eax, -0x70(%rbp)
jmp 0x4098
movl -0x70(%rbp), %ecx
movl -0x74(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x54(%rbp)
movq -0x10(%rbp), %rdi
callq 0x65e0
movss %xmm0, -0x7c(%rbp)
jmp 0x40b3
movss -0x7c(%rbp), %xmm0
cvttss2si %xmm0, %esi
leaq -0x5(%rbp), %rdi
callq 0x6560
movb %al, -0x7d(%rbp)
jmp 0x40ca
movb -0x7d(%rbp), %al
testb $0x1, %al
jne 0x40d3
jmp 0x40dc
movl -0x54(%rbp), %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0x34(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x64f0
leaq -0x18(%rbp), %rdi
callq 0x64f0
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
leaq -0x20(%rbp), %rdi
callq 0x64f0
leaq -0x18(%rbp), %rdi
callq 0x64f0
movq -0x28(%rbp), %rdi
callq 0x2120
nopw %cs:(%rax,%rax)
nopl (%rax)