// File: /workspace/github_cpp_makefile_star2_O2/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 0x62dc
movq 0x6a12(%rip), %rdi      # 0xd230
callq 0x2310
movq 0x6a06(%rip), %rdi      # 0xd230
leaq 0x6a17(%rip), %rsi      # 0xd248
callq 0x22d0
cmpl $0x2, 0x6a0b(%rip)      # 0xd248
jne 0x698e
leaq 0x69fe(%rip), %rdi      # 0xd248
xorl %esi, %esi
callq 0x2280
cmpq $0x71, %rax
je 0x6996
movzbl 0x60(%rbx), %eax
cmpl $0x45, %eax
je 0x6914
cmpl $0x53, %eax
jne 0x698e
leaq 0x69d0(%rip), %rdi      # 0xd248
xorl %esi, %esi
callq 0x2280
cmpq $0xff53, %rax           # imm = 0xFF53
jne 0x6897
movsd 0x2891(%rip), %xmm0     # 0x9120
movq %rbx, %rdi
callq 0x662a
leaq 0x69aa(%rip), %rdi      # 0xd248
xorl %esi, %esi
callq 0x2280
cmpq $0xff51, %rax           # imm = 0xFF51
jne 0x68bd
movsd 0x2873(%rip), %xmm0     # 0x9128
movq %rbx, %rdi
callq 0x662a
leaq 0x6984(%rip), %rdi      # 0xd248
xorl %esi, %esi
callq 0x2280
cmpq $0xff52, %rax           # imm = 0xFF52
jne 0x68e3
movsd 0x2845(%rip), %xmm0     # 0x9120
movq %rbx, %rdi
callq 0x66b6
leaq 0x695e(%rip), %rdi      # 0xd248
xorl %esi, %esi
callq 0x2280
cmpq $0xff54, %rax           # imm = 0xFF54
jne 0x698e
movsd 0x2823(%rip), %xmm0     # 0x9128
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x66b6
leaq 0x692d(%rip), %rdi      # 0xd248
xorl %esi, %esi
callq 0x2280
cmpq $0xff52, %rax           # imm = 0xFF52
jne 0x693a
movsd 0x27de(%rip), %xmm0     # 0x9110
movq %rbx, %rdi
callq 0x6742
leaq 0x6907(%rip), %rdi      # 0xd248
xorl %esi, %esi
callq 0x2280
cmpq $0xff54, %rax           # imm = 0xFF54
jne 0x6960
movsd 0x27c0(%rip), %xmm0     # 0x9118
movq %rbx, %rdi
callq 0x6742
leaq 0x68e1(%rip), %rdi      # 0xd248
xorl %esi, %esi
callq 0x2280
cmpq $0x67, %rax
jne 0x698e
movq %rbx, %rdi
callq 0x67ce
pushq $0x53
popq %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x5098
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movb $0x1, (%r14)
movq 0x688f(%rip), %rdi      # 0xd230
callq 0x23f0
xorl %edi, %edi
callq 0x2240
nop