// File: /workspace/github_c_makefile_star2_O3/szanni[P]slideextract/slideextract.cpp
// Function: se_extract_slides
int
se_extract_slides(const char *file, const char *outprefix, struct roi *roi)
{
	int num = 0;
	char str[64];

	std::vector<int> image_properties;
	image_properties.push_back(IMWRITE_PNG_COMPRESSION);
	image_properties.push_back(9);

	Mat current;
	Mat last;

	VideoCapture capture = VideoCapture(file, CAP_ANY);
	if (!capture.isOpened())
		return -1;

	bool is_final_frame = false;
	while (!is_final_frame) {
		capture.read(current);

		is_final_frame = current.empty();
		bool is_changed_frame = !current.empty() && !last.empty()
			&& _se_compare_image (last, current, roi) <= 0.999;

		if (is_final_frame || is_changed_frame) {
			snprintf (str, sizeof(str)/sizeof(*str), "%s%d.png", outprefix, num++);
			imwrite(str, last, image_properties);
		}

		last = current.clone();
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x378, %rsp            # imm = 0x378
movq %rdx, %r14
movq %rsi, 0x30(%rsp)
movq %rdi, %rbx
xorpd %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movapd %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq 0x40(%rsp), %rdx
movl $0x10, (%rdx)
xorl %esi, %esi
callq 0x30d2
movq 0x18(%rsp), %rsi
movl $0x9, 0x40(%rsp)
cmpq 0x20(%rsp), %rsi
je 0x2a9b
movl $0x9, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x2aaa
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x30d2
leaq 0x210(%rsp), %rdi
callq 0x2060
leaq 0x1b0(%rsp), %rdi
callq 0x2060
leaq 0x40(%rsp), %rdi
leaq 0x150(%rsp), %rdx
movq %rbx, %rsi
callq 0x2ffe
leaq 0x120(%rsp), %rdi
leaq 0x40(%rsp), %rbp
movq %rbp, %rsi
xorl %edx, %edx
callq 0x21c0
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b0b
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2190
leaq 0x120(%rsp), %rdi
callq 0x20b0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testb %al, %al
je 0x2e9e
movq %r14, 0x28(%rsp)
leaq 0x270(%rsp), %r12
leaq 0xa0(%rsp), %r13
movl $0x0, 0xc(%rsp)
leaq 0x150(%rsp), %r14
movq $0x0, 0x50(%rsp)
movl $0x2010000, 0x40(%rsp)  # imm = 0x2010000
leaq 0x210(%rsp), %rbx
movq %rbx, 0x48(%rsp)
leaq 0x120(%rsp), %rdi
movq %rbp, %r15
movq %rbp, %rsi
callq 0x22b0
movq %rbx, %rdi
callq 0x2120
movq %rbx, %rdi
movl %eax, %ebx
callq 0x2120
testb %al, %al
jne 0x2ba2
leaq 0x1b0(%rsp), %rdi
callq 0x2120
testb %al, %al
je 0x2baa
xorl %r14d, %r14d
jmp 0x2da0
movq %r15, %rdi
movl $0x1, %esi
movl $0x1, %edx
movl $0x5, %ecx
callq 0x2260
movq %r14, %rdi
callq 0x2060
leaq 0x2d0(%rsp), %rdi
callq 0x2060
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x2c91
movupd (%rax), %xmm0
movapd %xmm0, 0xa0(%rsp)
movq %r12, %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x20d0
movq %r12, %rsi
leaq 0xc0(%rsp), %rdi
movq %r13, %rdx
callq 0x2040
movq %r13, %rbp
movq %r14, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x2070
leaq 0xc0(%rsp), %rdi
callq 0x2080
movq %r12, %r13
movq %r12, %rdi
callq 0x2080
movq %r12, %rdi
leaq 0x210(%rsp), %rsi
callq 0x20d0
leaq 0xc0(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %r13
movq %rbp, %rdx
callq 0x2040
leaq 0x2d0(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x2070
leaq 0xc0(%rsp), %rdi
callq 0x2080
movq %r12, %rdi
callq 0x2080
jmp 0x2cb6
movq %r14, %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x20e0
leaq 0x2d0(%rsp), %rdi
leaq 0x210(%rsp), %rsi
callq 0x20e0
xorl %eax, %eax
movq %rax, 0xd0(%rsp)
movl $0x1010000, %ecx        # imm = 0x1010000
movl %ecx, 0xc0(%rsp)
movq %r14, 0xc8(%rsp)
movq %rax, 0x280(%rsp)
movl %ecx, 0x270(%rsp)
leaq 0x2d0(%rsp), %rcx
movq %rcx, 0x278(%rsp)
movq %rax, 0xb0(%rsp)
movl $0x2010000, 0xa0(%rsp) # imm = 0x2010000
movq %r15, 0xa8(%rsp)
callq 0x2210
leaq 0xc0(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
movl $0x3, %ecx
movq %rax, %r8
callq 0x2170
movq $0x0, 0xd0(%rsp)
movl $0x1010000, 0xc0(%rsp) # imm = 0x1010000
movq %r15, 0xc8(%rsp)
callq 0x2210
movq %r14, %rdi
xorl %esi, %esi
leaq 0x38(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %rax, %r9
callq 0x21d0
movsd 0x129c(%rip), %xmm0     # 0x4010
ucomisd 0x38(%rsp), %xmm0
setae %r14b
leaq 0x2d0(%rsp), %rdi
callq 0x2080
leaq 0x150(%rsp), %rdi
callq 0x2080
movq %r15, %rdi
callq 0x2080
orb %bl, %r14b
cmpb $0x1, %r14b
jne 0x2e61
movl $0x40, %esi
leaq 0x330(%rsp), %r14
movq %r14, %rdi
leaq 0x1272(%rip), %rdx      # 0x4036
movq 0x30(%rsp), %rcx
movl 0xc(%rsp), %r8d
xorl %eax, %eax
callq 0x2110
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq %r14, %rdi
callq 0x21b0
leaq (%rsp,%rax), %rdx
addq $0x330, %rdx            # imm = 0x330
movq %r15, %rbp
movq %r15, %rdi
movq %r14, %rsi
callq 0x303c
leaq 0x150(%rsp), %r14
movq $0x0, 0x160(%rsp)
movl $0x1010000, 0x150(%rsp) # imm = 0x1010000
leaq 0x1b0(%rsp), %rax
movq %rax, 0x158(%rsp)
movq %rbp, %rdi
movq %r14, %rsi
leaq 0x10(%rsp), %rdx
callq 0x2090
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x2e5b
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2190
incl 0xc(%rsp)
jmp 0x2e69
leaq 0x150(%rsp), %r14
movq %r15, %rbp
movq %r15, %rdi
leaq 0x210(%rsp), %rsi
callq 0x20d0
leaq 0x1b0(%rsp), %rdi
movq %rbp, %rsi
callq 0x2070
movq %rbp, %rdi
callq 0x2080
testb %bl, %bl
je 0x2b4a
xorl %ebx, %ebx
leaq 0x120(%rsp), %rdi
callq 0x2130
leaq 0x1b0(%rsp), %rdi
callq 0x2080
leaq 0x210(%rsp), %rdi
callq 0x2080
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2edc
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movl %ebx, %eax
addq $0x378, %rsp            # imm = 0x378
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2f26
jmp 0x2fb5
movq %rax, %rbx
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2fc5
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x2fc5
movq %rax, %rbx
jmp 0x2fc5
movq %rax, %rbx
jmp 0x2fdf
jmp 0x2f60
jmp 0x2f36
jmp 0x2f48
jmp 0x2f60
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x2080
jmp 0x2f4b
movq %rax, %rbx
leaq 0x270(%rsp), %rdi
callq 0x2080
jmp 0x2f63
jmp 0x2f60
jmp 0x2f60
jmp 0x2fb5
movq %rax, %rbx
leaq 0x2d0(%rsp), %rdi
callq 0x2080
leaq 0x150(%rsp), %rdi
callq 0x2080
jmp 0x2fa9
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x2fb8
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x2fb8
jmp 0x2fb5
jmp 0x2fb5
jmp 0x2fb5
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x2080
jmp 0x2fb8
movq %rax, %rbx
leaq 0x120(%rsp), %rdi
callq 0x2130
leaq 0x1b0(%rsp), %rdi
callq 0x2080
leaq 0x210(%rsp), %rdi
callq 0x2080
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2ff6
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x21e0