// File: dlcgold[P]sparsematrix-unimib/main.cpp
// Function: test_fondamentali()
void test_fondamentali(){
  std::cout << "test matrice float 3x3 (valore default 0)\n";
  smatrixf floatNM(0, 3, 3);
  for(int i = 0; i < floatNM.get_size_row(); i++){
    for(int j = 0; j < floatNM.get_size_column(); j++){
      if(i != j){
        if(j != 0 ){
	  floatNM.add((float)(i + j + 7) / (-1 * j * 3), i, j);
	}else{
	  floatNM.add(i + (j * (-1)), i, j);
	}
      }
    }
  }
  assert(floatNM.get_size_row() == 3);
  assert(floatNM.get_size_column() == 3);
  assert(floatNM.get_size_row() == 3);
  assert(floatNM.get_size_column() == 3);
  std::cout << "\ntest stampa matrice float con accesso mediante operator()\n";
  printdef(floatNM, floatNM.get_size_row(), floatNM.get_size_column());
  
  positive pos;
  int count = evaluate(floatNM, pos);
  std::cout << "\ntest evaluate (numero positivi) matrice float \n";
  assert(count == 2);
  std::cout << count << " = " << 2 << "\n";
  std::cout << "\ntest stampa matrice float con accesso mediante iteratore\n";
  smatrixf::iterator i, ie;
  for(i = floatNM.begin(), ie = floatNM.end(); i != ie; i++){
    std::cout << i->v << std::endl;
  }
  i = floatNM.begin();
  
  std::cout << "\n\n" << (*i).v << "\n";
  std::cout << "\ntest cast da matrice float a matrice di interi\n";
  smatrixi interaNM(floatNM);
  std::cout << "\ntest stampa matrice intera con accesso mediante operator()\n";
  printdef(interaNM, interaNM.get_size_row(), interaNM.get_size_column());
  
  count = evaluate(interaNM, pos);
  std::cout << "\ntest evaluate (numero positivi) matrice intera \n";
  assert(count == 2);
  std::cout << count << " = " << 2 << "\n";
  std::cout << "\ntest stampa matrice intera con accesso mediante iteratore\n";
  smatrixi::iterator iu, ieu;
  for(iu = interaNM.begin(), ieu = interaNM.end(); iu != ieu; iu++){
    std::cout << iu->v << std::endl;
  }
  std::cout << "\ntest assegnamento\n";
  smatrixf floatNM2 = floatNM;
  printdef(floatNM2, floatNM2.get_size_row(), floatNM2.get_size_column());
  std::cout << "\ntest assegnamento con iteratore\n";

  smatrixf::iterator testBegin;
  testBegin = floatNM.begin();
  std::cout << testBegin->v << "\n";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq 0x9d46(%rip), %rdi      # 0xbfd8
leaq 0x5d6b(%rip), %rsi      # 0x8004
callq 0x20b0
leaq -0x20(%rbp), %rdi
xorps %xmm0, %xmm0
movl $0x3, %edx
movl %edx, %esi
callq 0x3730
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x168(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x37b0
movl %eax, -0x164(%rbp)
jmp 0x22d2
movl -0x168(%rbp), %eax
movl -0x164(%rbp), %ecx
cmpl %ecx, %eax
jge 0x23bf
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x170(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x37d0
movl %eax, -0x16c(%rbp)
jmp 0x2307
movl -0x170(%rbp), %eax
movl -0x16c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x23af
movl -0x24(%rbp), %eax
cmpl -0x38(%rbp), %eax
je 0x239f
cmpl $0x0, -0x38(%rbp)
je 0x2375
movl -0x24(%rbp), %edx
movl -0x38(%rbp), %ecx
movl %ecx, %eax
movl %edx, %ecx
leal 0x7(%rcx,%rax), %ecx
cvtsi2ss %ecx, %xmm0
leal (%rax,%rax,2), %eax
negl %eax
cvtsi2ss %eax, %xmm1
divss %xmm1, %xmm0
movss %xmm0, -0x3c(%rbp)
movl -0x24(%rbp), %edx
movl -0x38(%rbp), %ecx
leaq -0x20(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x37f0
jmp 0x2362
jmp 0x239d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2d53
movl -0x24(%rbp), %eax
movl -0x38(%rbp), %ecx
subl %ecx, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x40(%rbp)
movl -0x24(%rbp), %edx
movl -0x38(%rbp), %ecx
leaq -0x20(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x37f0
jmp 0x239b
jmp 0x239d
jmp 0x239f
jmp 0x23a1
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x22ed
jmp 0x23b1
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x22b8
leaq -0x20(%rbp), %rdi
callq 0x37b0
movl %eax, -0x174(%rbp)
jmp 0x23d0
movl -0x174(%rbp), %eax
cmpl $0x3, %eax
jne 0x23dd
jmp 0x23fc
leaq 0x5c4b(%rip), %rdi      # 0x802f
leaq 0x5c60(%rip), %rsi      # 0x804b
movl $0x34, %edx
leaq 0x5c5d(%rip), %rcx      # 0x8054
callq 0x2070
leaq -0x20(%rbp), %rdi
callq 0x37d0
movl %eax, -0x178(%rbp)
jmp 0x240d
movl -0x178(%rbp), %eax
cmpl $0x3, %eax
jne 0x241a
jmp 0x2439
leaq 0x5c4c(%rip), %rdi      # 0x806d
leaq 0x5c23(%rip), %rsi      # 0x804b
movl $0x35, %edx
leaq 0x5c20(%rip), %rcx      # 0x8054
callq 0x2070
leaq -0x20(%rbp), %rdi
callq 0x37b0
movl %eax, -0x17c(%rbp)
jmp 0x244a
movl -0x17c(%rbp), %eax
cmpl $0x3, %eax
jne 0x2457
jmp 0x2476
leaq 0x5bd1(%rip), %rdi      # 0x802f
leaq 0x5be6(%rip), %rsi      # 0x804b
movl $0x36, %edx
leaq 0x5be3(%rip), %rcx      # 0x8054
callq 0x2070
leaq -0x20(%rbp), %rdi
callq 0x37d0
movl %eax, -0x180(%rbp)
jmp 0x2487
movl -0x180(%rbp), %eax
cmpl $0x3, %eax
jne 0x2494
jmp 0x24b3
leaq 0x5bd2(%rip), %rdi      # 0x806d
leaq 0x5ba9(%rip), %rsi      # 0x804b
movl $0x37, %edx
leaq 0x5ba6(%rip), %rcx      # 0x8054
callq 0x2070
movq 0x9b1e(%rip), %rdi      # 0xbfd8
leaq 0x5bcb(%rip), %rsi      # 0x808c
callq 0x20b0
jmp 0x24c8
leaq -0x60(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x3db0
jmp 0x24d7
leaq -0x20(%rbp), %rdi
callq 0x37b0
movl %eax, -0x184(%rbp)
jmp 0x24e8
leaq -0x20(%rbp), %rdi
callq 0x37d0
movl %eax, -0x188(%rbp)
jmp 0x24f9
movl -0x188(%rbp), %edx
movl -0x184(%rbp), %esi
leaq -0x60(%rbp), %rdi
callq 0x3cd0
jmp 0x2510
leaq -0x60(%rbp), %rdi
callq 0x3ed0
leaq -0x20(%rbp), %rdi
callq 0x3f00
movl %eax, -0x18c(%rbp)
jmp 0x252a
movl -0x18c(%rbp), %eax
movl %eax, -0x68(%rbp)
movq 0x9a9e(%rip), %rdi      # 0xbfd8
leaq 0x5b87(%rip), %rsi      # 0x80c8
callq 0x20b0
jmp 0x2548
cmpl $0x2, -0x68(%rbp)
jne 0x2550
jmp 0x2589
leaq 0x5ba2(%rip), %rdi      # 0x80f9
leaq 0x5aed(%rip), %rsi      # 0x804b
movl $0x3e, %edx
leaq 0x5aea(%rip), %rcx      # 0x8054
callq 0x2070
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x3ed0
jmp 0x2d53
movl -0x68(%rbp), %esi
movq 0x9a45(%rip), %rdi      # 0xbfd8
callq 0x2110
movq %rax, -0x198(%rbp)
jmp 0x25a1
movq -0x198(%rbp), %rdi
leaq 0x5b55(%rip), %rsi      # 0x8104
callq 0x20b0
movq %rax, -0x1a0(%rbp)
jmp 0x25bd
movq -0x1a0(%rbp), %rdi
movl $0x2, %esi
callq 0x2110
movq %rax, -0x1a8(%rbp)
jmp 0x25d7
movq -0x1a8(%rbp), %rdi
leaq 0x5b5f(%rip), %rsi      # 0x8144
callq 0x20b0
jmp 0x25ec
movq 0x99e5(%rip), %rdi      # 0xbfd8
leaq 0x5b0e(%rip), %rsi      # 0x8108
callq 0x20b0
jmp 0x2601
leaq -0x78(%rbp), %rdi
callq 0x4130
jmp 0x260c
leaq -0x80(%rbp), %rdi
callq 0x4130
jmp 0x2617
leaq -0x88(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x4150
jmp 0x2629
leaq -0x78(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x4180
jmp 0x263b
leaq -0x90(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x41a0
jmp 0x264d
leaq -0x80(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x4180
jmp 0x265f
leaq -0x90(%rbp), %rdi
callq 0x41d0
leaq -0x88(%rbp), %rdi
callq 0x41d0
leaq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x41e0
movb %al, -0x1a9(%rbp)
jmp 0x268c
movb -0x1a9(%rbp), %al
testb $0x1, %al
jne 0x269b
jmp 0x2762
leaq -0x78(%rbp), %rdi
callq 0x4210
movq %rax, -0x1b8(%rbp)
jmp 0x26ad
movq -0x1b8(%rbp), %rax
movss (%rax), %xmm0
movq 0x9919(%rip), %rdi      # 0xbfd8
callq 0x2080
movq %rax, -0x1c0(%rbp)
jmp 0x26cd
movq -0x1c0(%rbp), %rdi
movq 0x98e5(%rip), %rsi      # 0xbfc0
callq 0x20d0
jmp 0x26e2
jmp 0x26e4
leaq -0x98(%rbp), %rdi
leaq -0x78(%rbp), %rsi
xorl %edx, %edx
callq 0x4230
jmp 0x26f8
leaq -0x98(%rbp), %rdi
callq 0x41d0
jmp 0x2677
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2d4a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2d41
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2751
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x41d0
leaq -0x88(%rbp), %rdi
callq 0x41d0
jmp 0x2d41
leaq -0xa0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x4150
jmp 0x2774
leaq -0x78(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x4180
jmp 0x2786
leaq -0xa0(%rbp), %rdi
callq 0x41d0
movq 0x983f(%rip), %rdi      # 0xbfd8
leaq 0x59a3(%rip), %rsi      # 0x8143
callq 0x20b0
movq %rax, -0x1c8(%rbp)
jmp 0x27ae
leaq -0x78(%rbp), %rdi
callq 0x4290
movq %rax, -0x1d0(%rbp)
jmp 0x27c0
movq -0x1c8(%rbp), %rdi
movq -0x1d0(%rbp), %rax
movss (%rax), %xmm0
callq 0x2080
movq %rax, -0x1d8(%rbp)
jmp 0x27e0
movq -0x1d8(%rbp), %rdi
leaq 0x5956(%rip), %rsi      # 0x8144
callq 0x20b0
jmp 0x27f5
movq 0x97dc(%rip), %rdi      # 0xbfd8
leaq 0x5943(%rip), %rsi      # 0x8146
callq 0x20b0
jmp 0x280a
leaq -0xc0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x42b0
jmp 0x281c
movq 0x97b5(%rip), %rdi      # 0xbfd8
leaq 0x594d(%rip), %rsi      # 0x8177
callq 0x20b0
jmp 0x2831
leaq -0xe0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x45b0
jmp 0x2846
leaq -0xc0(%rbp), %rdi
callq 0x46c0
movl %eax, -0x1dc(%rbp)
jmp 0x285a
leaq -0xc0(%rbp), %rdi
callq 0x46e0
movl %eax, -0x1e0(%rbp)
jmp 0x286e
movl -0x1e0(%rbp), %edx
movl -0x1dc(%rbp), %esi
leaq -0xe0(%rbp), %rdi
callq 0x44d0
jmp 0x2888
leaq -0xe0(%rbp), %rdi
callq 0x4700
leaq -0xc0(%rbp), %rdi
callq 0x4730
movl %eax, -0x1e4(%rbp)
jmp 0x28a8
movl -0x1e4(%rbp), %eax
movl %eax, -0x68(%rbp)
movq 0x9720(%rip), %rdi      # 0xbfd8
leaq 0x58f5(%rip), %rsi      # 0x81b4
callq 0x20b0
jmp 0x28c6
cmpl $0x2, -0x68(%rbp)
jne 0x28ce
jmp 0x2938
leaq 0x5824(%rip), %rdi      # 0x80f9
leaq 0x576f(%rip), %rsi      # 0x804b
movl $0x4f, %edx
leaq 0x576c(%rip), %rcx      # 0x8054
callq 0x2070
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x41d0
jmp 0x2d41
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2d35
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x4700
jmp 0x2d35
movl -0x68(%rbp), %esi
movq 0x9696(%rip), %rdi      # 0xbfd8
callq 0x2110
movq %rax, -0x1f0(%rbp)
jmp 0x2950
movq -0x1f0(%rbp), %rdi
leaq 0x57a6(%rip), %rsi      # 0x8104
callq 0x20b0
movq %rax, -0x1f8(%rbp)
jmp 0x296c
movq -0x1f8(%rbp), %rdi
movl $0x2, %esi
callq 0x2110
movq %rax, -0x200(%rbp)
jmp 0x2986
movq -0x200(%rbp), %rdi
leaq 0x57b0(%rip), %rsi      # 0x8144
callq 0x20b0
jmp 0x299b
movq 0x9636(%rip), %rdi      # 0xbfd8
leaq 0x583d(%rip), %rsi      # 0x81e6
callq 0x20b0
jmp 0x29b0
leaq -0xf0(%rbp), %rdi
callq 0x4940
jmp 0x29be
leaq -0xf8(%rbp), %rdi
callq 0x4940
jmp 0x29cc
leaq -0x100(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x4960
jmp 0x29e1
leaq -0xf0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x4990
jmp 0x29f6
leaq -0x108(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x49b0
jmp 0x2a0b
leaq -0xf8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x4990
jmp 0x2a20
leaq -0x108(%rbp), %rdi
callq 0x49e0
leaq -0x100(%rbp), %rdi
callq 0x49e0
leaq -0xf0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x49f0
movb %al, -0x201(%rbp)
jmp 0x2a53
movb -0x201(%rbp), %al
testb $0x1, %al
jne 0x2a62
jmp 0x2b2d
leaq -0xf0(%rbp), %rdi
callq 0x4a20
movq %rax, -0x210(%rbp)
jmp 0x2a77
movq -0x210(%rbp), %rax
movl (%rax), %esi
movq 0x9551(%rip), %rdi      # 0xbfd8
callq 0x2110
movq %rax, -0x218(%rbp)
jmp 0x2a95
movq -0x218(%rbp), %rdi
movq 0x951d(%rip), %rsi      # 0xbfc0
callq 0x20d0
jmp 0x2aaa
jmp 0x2aac
leaq -0x110(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
xorl %edx, %edx
callq 0x4a40
jmp 0x2ac3
leaq -0x110(%rbp), %rdi
callq 0x49e0
jmp 0x2a38
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2d29
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2d1d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2b1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x49e0
leaq -0x100(%rbp), %rdi
callq 0x49e0
jmp 0x2d1d
movq 0x94a4(%rip), %rdi      # 0xbfd8
leaq 0x56e7(%rip), %rsi      # 0x8222
callq 0x20b0
jmp 0x2b42
leaq -0x130(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x3db0
jmp 0x2b54
leaq -0x150(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x3db0
jmp 0x2b69
leaq -0x130(%rbp), %rdi
callq 0x37b0
movl %eax, -0x21c(%rbp)
jmp 0x2b7d
leaq -0x130(%rbp), %rdi
callq 0x37d0
movl %eax, -0x220(%rbp)
jmp 0x2b91
movl -0x220(%rbp), %edx
movl -0x21c(%rbp), %esi
leaq -0x150(%rbp), %rdi
callq 0x3cd0
jmp 0x2bab
leaq -0x150(%rbp), %rdi
callq 0x3ed0
movq 0x941a(%rip), %rdi      # 0xbfd8
leaq 0x5671(%rip), %rsi      # 0x8236
callq 0x20b0
jmp 0x2bcc
leaq -0x158(%rbp), %rdi
callq 0x4130
jmp 0x2bda
leaq -0x160(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x4150
jmp 0x2bec
leaq -0x158(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x4180
jmp 0x2c01
leaq -0x160(%rbp), %rdi
callq 0x41d0
leaq -0x158(%rbp), %rdi
callq 0x4210
movq %rax, -0x228(%rbp)
jmp 0x2c22
movq -0x228(%rbp), %rax
movss (%rax), %xmm0
movq 0x93a4(%rip), %rdi      # 0xbfd8
callq 0x2080
movq %rax, -0x230(%rbp)
jmp 0x2c42
movq -0x230(%rbp), %rdi
leaq 0x54f4(%rip), %rsi      # 0x8144
callq 0x20b0
jmp 0x2c57
leaq -0x158(%rbp), %rdi
callq 0x41d0
leaq -0x130(%rbp), %rdi
callq 0x3ed0
leaq -0xf8(%rbp), %rdi
callq 0x49e0
leaq -0xf0(%rbp), %rdi
callq 0x49e0
leaq -0xc0(%rbp), %rdi
callq 0x4700
leaq -0x80(%rbp), %rdi
callq 0x41d0
leaq -0x78(%rbp), %rdi
callq 0x41d0
leaq -0x20(%rbp), %rdi
callq 0x3ed0
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2d11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x3ed0
jmp 0x2d11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2d05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x41d0
leaq -0x158(%rbp), %rdi
callq 0x41d0
leaq -0x130(%rbp), %rdi
callq 0x3ed0
leaq -0xf8(%rbp), %rdi
callq 0x49e0
leaq -0xf0(%rbp), %rdi
callq 0x49e0
leaq -0xc0(%rbp), %rdi
callq 0x4700
leaq -0x80(%rbp), %rdi
callq 0x41d0
leaq -0x78(%rbp), %rdi
callq 0x41d0
leaq -0x20(%rbp), %rdi
callq 0x3ed0
movq -0x30(%rbp), %rdi
callq 0x2120
nopw %cs:(%rax,%rax)