// File: /workspace/github_cpp_makefile_star2_O2/liskin[P]hybrid-screenclone/screenclone.cc
// Function: void display::record_pointer_events<mouse_replayer>(mouse_replayer*)
void display::record_pointer_events( Fun *callback ) {
	display data = clone();

	XRecordRange *rr = XRecordAllocRange();
	if ( !rr ) ERR;
	rr->device_events.first = rr->device_events.last = MotionNotify;

	XRecordClientSpec rcs = XRecordAllClients;

	XRecordContext rc = XRecordCreateContext( dpy, 0, &rcs, 1, &rr, 1 );
	if ( !rc ) ERR;

	// sync, otherwise XRecordEnableContextAsync fails
	XSync( dpy, false );
	XSync( data.dpy, false );

	if ( !XRecordEnableContextAsync( data.dpy, rc, &record_callback< Fun >, (XPointer) callback ) )
		ERR;

	std::thread( &record_thread< Fun >, data, callback ).detach();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xf8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, 0xd0(%rsp)
leaq 0xd8(%rsp), %rdi
movq %r14, %rsi
callq 0x28f4
callq 0x2460
movq %rax, 0xc8(%rsp)
testq %rax, %rax
je 0x3a8f
movw $0x606, 0x12(%rax)      # imm = 0x606
leaq 0xf0(%rsp), %rdx
movq $0x3, (%rdx)
movq (%r14), %rdi
leaq 0xc8(%rsp), %r8
pushq $0x1
popq %rcx
xorl %esi, %esi
movl %ecx, %r9d
callq 0x23b0
testq %rax, %rax
je 0x3b52
movq %rax, %r15
movq (%r14), %rdi
xorl %esi, %esi
callq 0x2430
movq 0xd8(%rsp), %rdi
xorl %esi, %esi
callq 0x2430
movq 0xd8(%rsp), %rdi
leaq 0x7be(%rip), %rdx       # 0x41ee
movq %r15, %rsi
movq %rbx, %rcx
callq 0x23c0
testl %eax, %eax
je 0x3c15
leaq 0x7a9(%rip), %rax       # 0x41f3
leaq 0x28(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x8(%rsp), %rbx
leaq 0xd8(%rsp), %rdx
leaq 0xd0(%rsp), %rcx
movq %rbx, %rdi
callq 0x425c
movq %rbx, %rdi
callq 0x23f0
leaq 0x8(%rsp), %rdi
callq 0x42ea
addq $0xf8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x20f0
movq %rax, %r14
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x1552(%rip), %rdx      # 0x5004
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x3686
leaq 0x15bf(%rip), %rdx      # 0x5087
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x3686
leaq 0x1670(%rip), %rdx      # 0x5151
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x3686
leaq 0x1576(%rip), %rdx      # 0x5073
leaq 0x28(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x3686
leaq 0x163f(%rip), %rdx      # 0x5155
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x3686
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x23a0
xorl %ebp, %ebp
movq 0x44b2(%rip), %rsi      # 0x7ff0
movq 0x4483(%rip), %rdx      # 0x7fc8
movq %r14, %rdi
callq 0x23d0
jmp 0x3cd3
pushq $0x10
popq %rdi
callq 0x20f0
movq %rax, %r14
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x148f(%rip), %rdx      # 0x5004
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x3686
leaq 0x14fc(%rip), %rdx      # 0x5087
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x3686
leaq 0x15c7(%rip), %rdx      # 0x516b
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x3686
leaq 0x14b3(%rip), %rdx      # 0x5073
leaq 0x28(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x3686
leaq 0x157c(%rip), %rdx      # 0x5155
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x3686
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x23a0
xorl %ebp, %ebp
movq 0x43ef(%rip), %rsi      # 0x7ff0
movq 0x43c0(%rip), %rdx      # 0x7fc8
movq %r14, %rdi
callq 0x23d0
jmp 0x3cd3
pushq $0x10
popq %rdi
callq 0x20f0
movq %rax, %r14
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x13cc(%rip), %rdx      # 0x5004
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x3686
leaq 0x1439(%rip), %rdx      # 0x5087
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x3686
leaq 0x1508(%rip), %rdx      # 0x516f
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x3686
leaq 0x13f0(%rip), %rdx      # 0x5073
leaq 0x28(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x3686
leaq 0x14b9(%rip), %rdx      # 0x5155
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x3686
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x23a0
xorl %ebp, %ebp
movq 0x432c(%rip), %rsi      # 0x7ff0
movq 0x42fd(%rip), %rdx      # 0x7fc8
movq %r14, %rdi
callq 0x23d0
jmp 0x3cdb
jmp 0x3cea
jmp 0x3cdb
jmp 0x3cea
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20c0
jmp 0x3cf0
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x28(%rsp), %rdi
callq 0x20c0
jmp 0x3d06
jmp 0x3d00
jmp 0x3d00
movq %rax, %rbx
movb $0x1, %bpl
leaq 0xa8(%rsp), %rdi
callq 0x20c0
jmp 0x3d1f
jmp 0x3d19
jmp 0x3d19
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x88(%rsp), %rdi
callq 0x20c0
jmp 0x3d38
jmp 0x3d32
jmp 0x3d32
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x68(%rsp), %rdi
callq 0x20c0
jmp 0x3d4e
jmp 0x3d48
jmp 0x3d48
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x48(%rsp), %rdi
callq 0x20c0
testb %bpl, %bpl
je 0x3d74
movq %r14, %rdi
callq 0x2150
jmp 0x3d74
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x42ea
movq %rbx, %rdi
callq 0x2400