// File: /workspace/github_cpp_makefile_star2_O1/dannycalegari[P]circle_pack/./graphics.cc
// Function: graphics_routine(Packing&, bool&)
void graphics_routine(Packing &P, bool &finished){
	P.draw_circles();
	XFlush(display);
			
	XNextEvent(display, &report);
    	switch (report.type) {
      		case KeyPress:
  				if(XLookupKeysym(&report.xkey, 0) == XK_q){
  					finished=true;
                    XCloseDisplay(display);
                	exit(0);
                   	break;
               	};
               	if(P.write_geometry()=='S'){
           	    	if(XLookupKeysym(&report.xkey, 0) == XK_Right){
            	   		P.XZ_rotate(-TWOPI/50.0);
            	   	};
            	   	if(XLookupKeysym(&report.xkey, 0) == XK_Left){
               			P.XZ_rotate(TWOPI/50.0);
               		};
               		if(XLookupKeysym(&report.xkey, 0) == XK_Up){
               			P.YZ_rotate(-TWOPI/50.0);
               		};
               		if(XLookupKeysym(&report.xkey, 0) == XK_Down){
               			P.YZ_rotate(TWOPI/50.0);
               		};
               	} else if(P.write_geometry()=='E'){
               		if(XLookupKeysym(&report.xkey, 0) == XK_Up){
               			P.dilate(1.02);
               		};
               		if(XLookupKeysym(&report.xkey, 0) == XK_Down){
               			P.dilate(1.0/1.02);
               		};               		          
               		if(XLookupKeysym(&report.xkey, 0) == XK_g){
	               		P.reset_VIEWMATRIX();
               			P.change_geometry('S');
               		};
               	};
          //     	break;
            default:
               	break;
        };
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x7926
movq 0x70f4(%rip), %rdi      # 0xf228
callq 0x2300
movq 0x70e8(%rip), %rdi      # 0xf228
leaq 0x70f9(%rip), %rsi      # 0xf240
callq 0x22c0
cmpl $0x2, 0x70ed(%rip)      # 0xf240
jne 0x82a6
leaq 0x70e0(%rip), %rdi      # 0xf240
xorl %esi, %esi
callq 0x2270
cmpq $0x71, %rax
je 0x82ae
movzbl 0x60(%rbx), %eax
cmpl $0x45, %eax
je 0x822a
cmpl $0x53, %eax
jne 0x82a6
leaq 0x70b2(%rip), %rdi      # 0xf240
xorl %esi, %esi
callq 0x2270
cmpq $0xff53, %rax           # imm = 0xFF53
jne 0x81ad
movsd 0x2f03(%rip), %xmm0     # 0xb0a8
movq %rbx, %rdi
callq 0x7dd4
leaq 0x708c(%rip), %rdi      # 0xf240
xorl %esi, %esi
callq 0x2270
cmpq $0xff51, %rax           # imm = 0xFF51
jne 0x81d3
movsd 0x2ee5(%rip), %xmm0     # 0xb0b0
movq %rbx, %rdi
callq 0x7dd4
leaq 0x7066(%rip), %rdi      # 0xf240
xorl %esi, %esi
callq 0x2270
cmpq $0xff52, %rax           # imm = 0xFF52
jne 0x81f9
movsd 0x2eb7(%rip), %xmm0     # 0xb0a8
movq %rbx, %rdi
callq 0x7ebe
leaq 0x7040(%rip), %rdi      # 0xf240
xorl %esi, %esi
callq 0x2270
cmpq $0xff54, %rax           # imm = 0xFF54
jne 0x82a6
movsd 0x2e95(%rip), %xmm0     # 0xb0b0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x7ebe
leaq 0x700f(%rip), %rdi      # 0xf240
xorl %esi, %esi
callq 0x2270
cmpq $0xff52, %rax           # imm = 0xFF52
jne 0x8250
movsd 0x2e50(%rip), %xmm0     # 0xb098
movq %rbx, %rdi
callq 0x7fa8
leaq 0x6fe9(%rip), %rdi      # 0xf240
xorl %esi, %esi
callq 0x2270
cmpq $0xff54, %rax           # imm = 0xFF54
jne 0x8276
movsd 0x2e32(%rip), %xmm0     # 0xb0a0
movq %rbx, %rdi
callq 0x7fa8
leaq 0x6fc3(%rip), %rdi      # 0xf240
xorl %esi, %esi
callq 0x2270
cmpq $0x67, %rax
jne 0x82a6
movq %rbx, %rdi
callq 0x8092
movq %rbx, %rdi
movl $0x53, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x6322
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movb $0x1, (%r14)
movq 0x6f6f(%rip), %rdi      # 0xf228
callq 0x23e0
xorl %edi, %edi
callq 0x2230
nop