// File: /workspace/github_cpp_makefile_star2_O3/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 %r14
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
leaq 0x30(%rsp), %rdi
movl $0x100, %esi            # imm = 0x100
movl $0x100, %edx            # imm = 0x100
movl $0xffffff, %ecx         # imm = 0xFFFFFF
callq 0x29e0
leaq 0x134(%rsp), %rdi
movl $0x32, %esi
movl $0x64, %edx
movl $0xff00, %ecx           # imm = 0xFF00
callq 0x31fa
leaq 0x120(%rsp), %rdi
movl $0x5a, %esi
movl $0x50, %edx
movl $0xff, %ecx
callq 0x31fa
leaq 0x10c(%rsp), %rdi
movl $0xc8, %esi
movl $0xa, %edx
xorl %ecx, %ecx
callq 0x31fa
leaq 0xf8(%rsp), %rdi
movl $0xa, %esi
movl $0x55, %edx
xorl %ecx, %ecx
callq 0x31fa
leaq 0xe4(%rsp), %rdi
movl $0x64, %esi
movl $0x1e, %edx
movl $0xff0000, %ecx         # imm = 0xFF0000
callq 0x31fa
leaq 0xd0(%rsp), %rdi
movl $0xf, %esi
movl $0x40, %edx
movl $0xff, %ecx
callq 0x31fa
leaq 0xbc(%rsp), %rdi
movl $0x50, %esi
movl $0x23, %edx
movl $0xff00, %ecx           # imm = 0xFF00
callq 0x31fa
leaq 0xa8(%rsp), %rdi
movl $0x14, %esi
movl $0x23, %edx
movl $0xff0000, %ecx         # imm = 0xFF0000
callq 0x31fa
leaq 0x94(%rsp), %rdi
movl $0x28, %esi
movl $0x24, %edx
xorl %ecx, %ecx
callq 0x31fa
leaq 0x8(%rsp), %rdi
leaq 0x134(%rsp), %rcx
movl $0x100, %esi            # imm = 0x100
xorl %edx, %edx
callq 0x32e8
leaq 0x8(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x3382
leaq 0x8(%rsp), %rdi
leaq 0x10c(%rsp), %rsi
callq 0x3382
leaq 0x8(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x3382
leaq 0x8(%rsp), %rdi
leaq 0xe4(%rsp), %rsi
callq 0x3382
leaq 0x48(%rsp), %rdi
leaq 0xd0(%rsp), %rcx
movl $0x100, %esi            # imm = 0x100
movl $0x64, %edx
callq 0x32e8
leaq 0x48(%rsp), %rdi
leaq 0xbc(%rsp), %rsi
callq 0x3382
leaq 0x48(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x3382
leaq 0x48(%rsp), %rdi
leaq 0x94(%rsp), %rsi
callq 0x3382
movq 0x688c(%rip), %rbx      # 0x8fd8
leaq 0x38b1(%rip), %rsi      # 0x6004
movl $0x13, %edx
movq %rbx, %rdi
callq 0x2150
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq 0x685a(%rip), %rdi      # 0x8fd8
callq 0x2040
movq %rax, %rdi
callq 0x20a0
leaq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x355e
movq 0x6837(%rip), %rbx      # 0x8fd8
leaq 0x3870(%rip), %rsi      # 0x6018
movl $0x14, %edx
movq %rbx, %rdi
callq 0x2150
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq 0x6805(%rip), %rdi      # 0x8fd8
callq 0x2040
movq %rax, %rdi
callq 0x20a0
leaq 0x48(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x355e
movq 0x67e2(%rip), %rbx      # 0x8fd8
leaq 0x3830(%rip), %rsi      # 0x602d
movl $0xc, %edx
movq %rbx, %rdi
callq 0x2150
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq 0x67b0(%rip), %rdi      # 0x8fd8
callq 0x2040
movq %rax, %rdi
callq 0x20a0
leaq 0x80(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x37f2(%rip), %rsi      # 0x603a
leaq 0x37f6(%rip), %rdx      # 0x6045
leaq 0x70(%rsp), %rdi
callq 0x294a
leaq 0x30(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x2aca
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x2882
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x2140
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x2899
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x28b0
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
leaq 0x30(%rsp), %rdi
callq 0x2a3c
xorl %eax, %eax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x2909
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x2909
jmp 0x2906
jmp 0x2901
jmp 0x28fc
jmp 0x28fc
jmp 0x28fc
jmp 0x28fc
jmp 0x28fc
jmp 0x28fc
jmp 0x28fc
jmp 0x28fc
jmp 0x28fc
movq %rax, %rbx
jmp 0x2937
movq %rax, %rbx
jmp 0x2920
movq %rax, %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x2920
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x2937
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
leaq 0x30(%rsp), %rdi
callq 0x2a3c
movq %rbx, %rdi
callq 0x21c0
nop