// File: /workspace/github_cpp_makefile_star2_O1/liskin[P]hybrid-screenclone/screenclone.cc
// Function: image_replayer::image_replayer(display const&, display const&, xinerama_screen const&)
image_replayer( const display &_src, const display &_dst, const xinerama_screen &_src_screen )
		: src( &_src ), dst( &_dst), src_screen( &_src_screen )
		, src_window( src->root() ), dst_window( dst->root() )
		, damaged( true )
	{	
		size_t sz = src_screen->info.width * src_screen->info.height * 4;
		src_info.shmid = dst_info.shmid = shmget( IPC_PRIVATE, sz, IPC_CREAT | 0666 );
		src_info.shmaddr = dst_info.shmaddr = (char *) shmat( src_info.shmid, 0, 0);
		src_info.readOnly = dst_info.readOnly = false;
		shmctl( src_info.shmid, IPC_RMID, NULL );

		src_image = XShmCreateImage( src->dpy, DefaultVisual( src->dpy, DefaultScreen( src->dpy ) ),
			DefaultDepth( src->dpy, DefaultScreen( src->dpy ) ), ZPixmap, src_info.shmaddr,
			&src_info, src_screen->info.width, src_screen->info.height );
		dst_image = XShmCreateImage( dst->dpy, DefaultVisual( dst->dpy, DefaultScreen( dst->dpy ) ),
			DefaultDepth( dst->dpy, DefaultScreen( dst->dpy ) ), ZPixmap, dst_info.shmaddr,
			&dst_info, src_screen->info.width, src_screen->info.height );

		XShmAttach( src->dpy, &src_info );
		XShmAttach( dst->dpy, &dst_info );

		dst_gc = DefaultGC( dst->dpy, DefaultScreen( dst->dpy ) );
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsi, (%rdi)
movq %rdx, 0x8(%rdi)
movq %rcx, 0x10(%rdi)
movq (%rsi), %rax
movq 0xe8(%rax), %rdi
movslq 0xe0(%rax), %rax
shlq $0x7, %rax
movq 0x10(%rdi,%rax), %rax
movq %rsi, 0x18(%rbx)
movq %rax, 0x20(%rbx)
xorl %r12d, %r12d
movq %r12, 0x28(%rbx)
movq (%rdx), %rax
movq 0xe8(%rax), %rsi
movslq 0xe0(%rax), %rax
shlq $0x7, %rax
movq 0x10(%rsi,%rax), %rax
movq %rdx, 0x30(%rbx)
movq %rax, 0x38(%rbx)
movq %r12, 0x40(%rbx)
movb $0x1, 0xa0(%rbx)
movswl 0x10(%rcx), %eax
movswl 0x12(%rcx), %ecx
imull %eax, %ecx
shll $0x2, %ecx
movslq %ecx, %rsi
xorl %edi, %edi
movl $0x3b6, %edx            # imm = 0x3B6
callq 0x20e0
leaq 0x68(%rbx), %r14
movl %eax, 0x70(%rbx)
leaq 0x48(%rbx), %r15
movl %eax, 0x50(%rbx)
movl %eax, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x22e0
movq %rax, 0x78(%rbx)
movq %rax, 0x58(%rbx)
movl %r12d, 0x80(%rbx)
movl %r12d, 0x60(%rbx)
movl 0x50(%rbx), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2170
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
movq (%rax), %rdi
movq 0xe8(%rdi), %rax
movslq 0xe0(%rdi), %rdx
shlq $0x7, %rdx
movq 0x40(%rax,%rdx), %rsi
movl 0x38(%rax,%rdx), %edx
movq 0x58(%rbx), %r8
movswl 0x10(%rcx), %eax
movswl 0x12(%rcx), %r10d
movl $0x2, %ecx
movq %r15, %r9
pushq %r10
pushq %rax
callq 0x22b0
addq $0x10, %rsp
movq %rax, 0x88(%rbx)
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
movq (%rax), %rdi
movq 0xe8(%rdi), %rax
movslq 0xe0(%rdi), %rdx
shlq $0x7, %rdx
movq 0x40(%rax,%rdx), %rsi
movl 0x38(%rax,%rdx), %edx
movq 0x78(%rbx), %r8
movswl 0x10(%rcx), %eax
movswl 0x12(%rcx), %r10d
movl $0x2, %ecx
movq %r14, %r9
pushq %r10
pushq %rax
callq 0x22b0
addq $0x10, %rsp
movq %rax, 0x90(%rbx)
movq (%rbx), %rax
movq (%rax), %rdi
movq %r15, %rsi
callq 0x2290
movq 0x8(%rbx), %rax
movq (%rax), %rdi
movq %r14, %rsi
callq 0x2290
movq 0x8(%rbx), %rax
movq (%rax), %rax
movq 0xe8(%rax), %rcx
movslq 0xe0(%rax), %rax
shlq $0x7, %rax
movq 0x48(%rcx,%rax), %rax
movq %rax, 0x98(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq