// File: /workspace/github_c_makefile_star2_O2/szanni[P]slideextract/slideextract.cpp
// Function: se_select_roi
int
se_select_roi(const char *file, struct roi *roi)
{
	VideoCapture capture = VideoCapture(file, CAP_ANY);

	if (!capture.isOpened())
		return -1;

	int key = -1;
	Mat frame;
	Mat clone;
	namedWindow("frame", WINDOW_AUTOSIZE);

	while (key == -1)
	{
		capture.read(frame);
		if (frame.empty())
			break;

		setMouseCallback("frame", _se_mouseHandler, &frame);

		if (selected_roi)
		{
			clone = frame.clone();
			rectangle(clone, point1, point2, CV_RGB(0, 255, 0), 1, 8, 0);
			imshow("frame", clone);
		}
		else
		{
			imshow("frame", frame);
		}

		key = waitKey (10);
	}

	startWindowThread();

	destroyAllWindows();

	if (selected_roi)
	{
		roi->x = (point1.x < point2.x) ? point1.x : point2.x;
		roi->y = (point1.y < point2.y) ? point1.y : point2.y;
		roi->width = abs(point2.x - point1.x);
		roi->height = abs(point2.y - point1.y);
		return 0;
	}

	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rsi, 0x38(%rsp)
movq %rdi, %rsi
leaq 0xe8(%rsp), %rdi
leaq 0x148(%rsp), %rdx
callq 0x2e7e
leaq 0xb8(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
xorl %edx, %edx
callq 0x21d0
leaq 0xe8(%rsp), %rdi
callq 0x2280
leaq 0xb8(%rsp), %rdi
callq 0x20b0
testb %al, %al
je 0x263e
leaq 0xe8(%rsp), %r14
movq %r14, %rdi
callq 0x2060
leaq 0x148(%rsp), %r15
movq %r15, %rdi
callq 0x2060
leaq 0x1bb6(%rip), %rsi      # 0x4030
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x2e7e
leaq 0x50(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x2140
leaq 0x50(%rsp), %r12
movq %r12, %rdi
callq 0x2280
pushq $-0x1
popq %rax
leaq 0x1b83(%rip), %rbp      # 0x4030
leaq 0x10(%rsp), %rbx
xorps %xmm0, %xmm0
movhps 0x1b4c(%rip), %xmm0     # xmm0 = xmm0[0,1],mem[0,1]
movaps %xmm0, 0x40(%rsp)
pushq $0xa
popq %r13
cmpl $-0x1, %eax
jne 0x2643
andq $0x0, 0x60(%rsp)
movl $0x2010000, 0x50(%rsp)  # imm = 0x2010000
movq %r14, 0x58(%rsp)
leaq 0xb8(%rsp), %rdi
movq %r12, %rsi
callq 0x22d0
movq %r14, %rdi
callq 0x2120
testb %al, %al
jne 0x2643
movq %r12, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x2e7e
movq %r12, %rdi
leaq 0x249(%rip), %rsi       # 0x2762
movq %r14, %rdx
callq 0x22b0
movq %r12, %rdi
callq 0x2280
cmpb $0x1, 0x3c74(%rip)      # 0x61a4
jne 0x25fb
movq %r12, %rdi
movq %r14, %rsi
callq 0x20d0
movq %r15, %rdi
movq %r12, %rsi
callq 0x2070
movq %r12, %rdi
callq 0x2080
andq $0x0, 0x20(%rsp)
movl $0x3010000, 0x10(%rsp)  # imm = 0x3010000
movq %r15, 0x18(%rsp)
movl 0x3c27(%rip), %eax      # 0x6194
movl %eax, 0x30(%rsp)
movl 0x3c21(%rip), %eax      # 0x6198
movl %eax, 0x34(%rsp)
movl 0x3c1b(%rip), %eax      # 0x619c
movl %eax, 0x28(%rsp)
movl 0x3c15(%rip), %eax      # 0x61a0
movl %eax, 0x2c(%rsp)
movq %r12, %rdi
callq 0x2f5a
movaps 0x40(%rsp), %xmm0
movaps %xmm0, 0x50(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%r12)
andl $0x0, (%rsp)
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %r12, %rcx
pushq $0x1
popq %r8
pushq $0x8
popq %r9
callq 0x2050
movq %r12, %rdi
movq %rbp, %rsi
leaq 0xf(%rsp), %rdx
callq 0x2e7e
andq $0x0, 0x20(%rsp)
movl $0x1010000, 0x10(%rsp)  # imm = 0x1010000
movq %r15, 0x18(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2030
jmp 0x2629
movq %r12, %rdi
movq %rbp, %rsi
leaq 0xf(%rsp), %rdx
callq 0x2e7e
andq $0x0, 0x20(%rsp)
movl $0x1010000, 0x10(%rsp)  # imm = 0x1010000
movq %r14, 0x18(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2030
movq %r12, %rdi
callq 0x2280
movl %r13d, %edi
callq 0x22a0
jmp 0x24c5
pushq $-0x1
popq %rbx
jmp 0x26bf
callq 0x20c0
callq 0x22c0
cmpb $0x1, 0x3b50(%rip)      # 0x61a4
jne 0x26a2
movl 0x3b38(%rip), %eax      # 0x6194
movl 0x3b3a(%rip), %ecx      # 0x619c
movl %eax, %edx
subl %ecx, %edx
cmovll %eax, %ecx
negl %edx
movq 0x38(%rsp), %rdi
movl %ecx, (%rdi)
movl 0x3b20(%rip), %eax      # 0x6198
movl 0x3b22(%rip), %ecx      # 0x61a0
movl %eax, %esi
subl %ecx, %esi
cmovll %eax, %ecx
negl %esi
movl %edx, %eax
negl %eax
cmovsl %edx, %eax
movl %ecx, 0x4(%rdi)
movl %eax, 0x8(%rdi)
movl %esi, %eax
negl %eax
cmovsl %esi, %eax
movl %eax, 0xc(%rdi)
xorl %ebx, %ebx
jmp 0x26a5
pushq $-0x1
popq %rbx
leaq 0x148(%rsp), %rdi
callq 0x2080
leaq 0xe8(%rsp), %rdi
callq 0x2080
leaq 0xb8(%rsp), %rdi
callq 0x2130
movl %ebx, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x271d
jmp 0x2730
jmp 0x2730
movq %rax, %rbx
jmp 0x274d
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x2280
jmp 0x275a
movq %rax, %rbx
jmp 0x275a
jmp 0x2730
jmp 0x2730
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x2080
jmp 0x2733
jmp 0x2730
jmp 0x271d
jmp 0x2730
jmp 0x271d
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x2280
jmp 0x2733
jmp 0x2730
jmp 0x2730
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
callq 0x2080
leaq 0xe8(%rsp), %rdi
callq 0x2080
leaq 0xb8(%rsp), %rdi
callq 0x2130
movq %rbx, %rdi
callq 0x21f0