// File: /workspace/github_cpp_makefile_star2_O2/Slexis-Works[P]texture-packing/testPPM.cpp
// Function: main
int main() {
	/*PPMImage img(30, 20);

	img.drawPix(1, 1, Yellow);
	img.drawPix(0, 0, Blue);
	img.drawPix(2, 0, Red);

	img.fillRect(20, 10, 9, 9, Green);

	img.saveImage("test.ppm");

	PPMImage::saveRectangle(30, 40, Green, "testSaveRectangle.ppm");

	PPMImage rectanglesBefore(200, 150), rectanglesAfter(200, 150);
	Rectangle rectR(10, 10, 40, 10, Red),
			rectG(15, 30, 20, 20, Green),
			rectB(1, 140, 198, 9, Blue);
	rectR.drawOn(rectanglesBefore);
	rectG.drawOn(rectanglesBefore);
	rectB.drawOn(rectanglesBefore);

	std::cout << "rectR and rectG " << (rectR.collides(rectG)?"overlap":"are separated") << std::endl;

	std::cout << "Flipping rectR..." << std::endl;
	rectR.flip();
	std::cout << "rectR and rectG " << (rectR.collides(rectG)?"overlap":"are separated") << std::endl;

	rectR.drawOn(rectanglesAfter);
	rectG.drawOn(rectanglesAfter);
	rectB.drawOn(rectanglesAfter);

	rectanglesBefore.saveImage("rectanglesBefore.ppm");
	rectanglesAfter.saveImage("rectanglesAfter.ppm");*/

	PPMImage shelvesImg(256, 256);

	Rectangle
		r11(50,100,Green),
		r12(90,80,Red),
		r13(200,10,Black), // Sera pas ajouté, trop large
		r14(10,85,Black), // Non plus, trop haut
		r15(100,30,Blue),
		r21(15,64,Red),
		r22(80,35,Green),
		r23(20,35,Blue),
		r24(40,36,Black); // Trop haut


	Shelf s1(256, 0, r11);
	s1.putRect(r12);
	s1.putRect(r13);
	s1.putRect(r14);
	s1.putRect(r15);
	Shelf s2(256, 100, r21);
	s2.putRect(r22);
	s2.putRect(r23);
	s2.putRect(r24);

	std::cout << "Drawing first shelf" << std::endl;
	s1.drawOn(shelvesImg);
	std::cout << "Drawing second shelf" << std::endl;
	s2.drawOn(shelvesImg);
	std::cout << "Saving image" << std::endl;

	shelvesImg.saveImage("shelves.ppm");

	return 0;
}

// Assembly:
pushq %rbx
subq $0x150, %rsp            # imm = 0x150
leaq 0x10(%rsp), %rdi
movl $0x100, %esi            # imm = 0x100
movl $0x100, %edx            # imm = 0x100
movl $0xffffff, %ecx         # imm = 0xFFFFFF
callq 0x2848
leaq 0x13c(%rsp), %rdi
pushq $0x32
popq %rsi
pushq $0x64
popq %rdx
movl $0xff00, %ecx           # imm = 0xFF00
callq 0x2d52
leaq 0x128(%rsp), %rdi
pushq $0x5a
popq %rsi
pushq $0x50
popq %rdx
movl $0xff, %ecx
callq 0x2d52
leaq 0x114(%rsp), %rdi
pushq $0xa
popq %rdx
movl $0xc8, %esi
xorl %ecx, %ecx
callq 0x2d52
leaq 0x100(%rsp), %rdi
pushq $0xa
popq %rsi
pushq $0x55
popq %rdx
xorl %ecx, %ecx
callq 0x2d52
leaq 0xec(%rsp), %rdi
pushq $0x64
popq %rsi
pushq $0x1e
popq %rdx
movl $0xff0000, %ecx         # imm = 0xFF0000
callq 0x2d52
leaq 0xd8(%rsp), %rdi
pushq $0xf
popq %rsi
pushq $0x40
popq %rdx
movl $0xff, %ecx
callq 0x2d52
leaq 0xc4(%rsp), %rdi
pushq $0x50
popq %rsi
pushq $0x23
popq %rdx
movl $0xff00, %ecx           # imm = 0xFF00
callq 0x2d52
leaq 0xb0(%rsp), %rdi
pushq $0x14
popq %rsi
pushq $0x23
popq %rdx
movl $0xff0000, %ecx         # imm = 0xFF0000
callq 0x2d52
leaq 0x9c(%rsp), %rdi
pushq $0x28
popq %rsi
pushq $0x24
popq %rdx
xorl %ecx, %ecx
callq 0x2d52
leaq 0x28(%rsp), %rdi
leaq 0x13c(%rsp), %rcx
movl $0x100, %esi            # imm = 0x100
xorl %edx, %edx
callq 0x2e3c
leaq 0x28(%rsp), %rdi
leaq 0x128(%rsp), %rsi
callq 0x2ea0
leaq 0x28(%rsp), %rdi
leaq 0x114(%rsp), %rsi
callq 0x2ea0
leaq 0x28(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x2ea0
leaq 0x28(%rsp), %rdi
leaq 0xec(%rsp), %rsi
callq 0x2ea0
leaq 0x50(%rsp), %rdi
pushq $0x64
popq %rdx
leaq 0xd8(%rsp), %rcx
movl $0x100, %esi            # imm = 0x100
callq 0x2e3c
leaq 0x50(%rsp), %rdi
leaq 0xc4(%rsp), %rsi
callq 0x2ea0
leaq 0x50(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x2ea0
leaq 0x50(%rsp), %rdi
leaq 0x9c(%rsp), %rsi
callq 0x2ea0
movq 0x59c2(%rip), %rdi      # 0x7fd8
leaq 0x29e7(%rip), %rsi      # 0x5004
callq 0x2140
movq %rax, %rdi
callq 0x2090
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2f68
movq 0x5998(%rip), %rdi      # 0x7fd8
leaq 0x29d1(%rip), %rsi      # 0x5018
callq 0x2140
movq %rax, %rdi
callq 0x2090
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2f68
movq 0x596e(%rip), %rdi      # 0x7fd8
leaq 0x29bc(%rip), %rsi      # 0x502d
callq 0x2140
movq %rax, %rdi
callq 0x2090
leaq 0x29b5(%rip), %rsi      # 0x503a
leaq 0x78(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x272e
leaq 0x10(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x2930
leaq 0x78(%rsp), %rdi
callq 0x2080
leaq 0x60(%rsp), %rdi
callq 0x2774
leaq 0x38(%rsp), %rdi
callq 0x2774
leaq 0x10(%rsp), %rdi
callq 0x28a2
xorl %eax, %eax
addq $0x150, %rsp            # imm = 0x150
popq %rbx
retq
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x2080
jmp 0x2708
jmp 0x2705
jmp 0x2700
jmp 0x26fb
jmp 0x26fb
jmp 0x26fb
jmp 0x26fb
jmp 0x26fb
jmp 0x26fb
jmp 0x26fb
jmp 0x26fb
jmp 0x26fb
movq %rax, %rbx
jmp 0x271c
movq %rax, %rbx
jmp 0x2712
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x2774
leaq 0x38(%rsp), %rdi
callq 0x2774
leaq 0x10(%rsp), %rdi
callq 0x28a2
movq %rbx, %rdi
callq 0x21e0