// File: /workspace/github_cpp_makefile_star2_O3/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 0x7650
movq 0x6444(%rip), %rdi      # 0xe228
callq 0x2300
movq 0x6438(%rip), %rdi      # 0xe228
leaq 0x6449(%rip), %rsi      # 0xe240
callq 0x22c0
cmpl $0x2, 0x643d(%rip)      # 0xe240
jne 0x7f56
leaq 0x6430(%rip), %rdi      # 0xe240
xorl %esi, %esi
callq 0x2270
cmpq $0x71, %rax
je 0x7f5e
movzbl 0x60(%rbx), %eax
cmpl $0x45, %eax
je 0x7eda
cmpl $0x53, %eax
jne 0x7f56
leaq 0x6402(%rip), %rdi      # 0xe240
xorl %esi, %esi
callq 0x2270
cmpq $0xff53, %rax           # imm = 0xFF53
jne 0x7e5d
movsd 0x22bb(%rip), %xmm0     # 0xa110
movq %rbx, %rdi
callq 0x7b1c
leaq 0x63dc(%rip), %rdi      # 0xe240
xorl %esi, %esi
callq 0x2270
cmpq $0xff51, %rax           # imm = 0xFF51
jne 0x7e83
movsd 0x229d(%rip), %xmm0     # 0xa118
movq %rbx, %rdi
callq 0x7b1c
leaq 0x63b6(%rip), %rdi      # 0xe240
xorl %esi, %esi
callq 0x2270
cmpq $0xff52, %rax           # imm = 0xFF52
jne 0x7ea9
movsd 0x226f(%rip), %xmm0     # 0xa110
movq %rbx, %rdi
callq 0x7bde
leaq 0x6390(%rip), %rdi      # 0xe240
xorl %esi, %esi
callq 0x2270
cmpq $0xff54, %rax           # imm = 0xFF54
jne 0x7f56
movsd 0x224d(%rip), %xmm0     # 0xa118
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x7bde
leaq 0x635f(%rip), %rdi      # 0xe240
xorl %esi, %esi
callq 0x2270
cmpq $0xff52, %rax           # imm = 0xFF52
jne 0x7f00
movsd 0x2208(%rip), %xmm0     # 0xa100
movq %rbx, %rdi
callq 0x7ca0
leaq 0x6339(%rip), %rdi      # 0xe240
xorl %esi, %esi
callq 0x2270
cmpq $0xff54, %rax           # imm = 0xFF54
jne 0x7f26
movsd 0x21ea(%rip), %xmm0     # 0xa108
movq %rbx, %rdi
callq 0x7ca0
leaq 0x6313(%rip), %rdi      # 0xe240
xorl %esi, %esi
callq 0x2270
cmpq $0x67, %rax
jne 0x7f56
movq %rbx, %rdi
callq 0x7d62
movq %rbx, %rdi
movl $0x53, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x61e6
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movb $0x1, (%r14)
movq 0x62bf(%rip), %rdi      # 0xe228
callq 0x23e0
xorl %edi, %edi
callq 0x2230
nop