// File: /workspace/github_c_makefile_star2_O2/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, 0x10(%rsp)
movq %rdi, %rbx
leaq 0x20(%rsp), %rdi
andq $0x0, 0x10(%rdi)
xorpd %xmm0, %xmm0
movapd %xmm0, (%rdi)
leaq 0x60(%rsp), %rsi
movl $0x10, (%rsi)
callq 0x2fa2
leaq 0x60(%rsp), %rsi
movl $0x9, (%rsi)
leaq 0x20(%rsp), %rdi
callq 0x2fa2
leaq 0x210(%rsp), %rdi
callq 0x2060
leaq 0x150(%rsp), %rdi
callq 0x2060
leaq 0x60(%rsp), %rdi
leaq 0x1b0(%rsp), %rax
movq %rbx, %rsi
movq %rax, %rbx
movq %rax, %rdx
callq 0x2e7e
leaq 0xc0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
xorl %edx, %edx
callq 0x21d0
leaq 0x60(%rsp), %rdi
callq 0x2280
leaq 0xc0(%rsp), %rdi
callq 0x20b0
testb %al, %al
je 0x2d57
movq %r14, 0x8(%rsp)
leaq 0x2d0(%rsp), %r12
leaq 0x40(%rsp), %rbp
movl $0x0, 0x4(%rsp)
xorl %r14d, %r14d
testb $0x1, %r14b
jne 0x2d5c
andq $0x0, 0x70(%rsp)
movl $0x2010000, 0x60(%rsp)  # imm = 0x2010000
leaq 0x210(%rsp), %r14
movq %r14, 0x68(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x22d0
movq %r14, %rdi
callq 0x2120
movq %r14, %rdi
movl %eax, %r14d
callq 0x2120
testb %al, %al
jne 0x2ab2
leaq 0x150(%rsp), %rdi
callq 0x2120
testb %al, %al
je 0x2ab9
xorl %ebx, %ebx
jmp 0x2c89
leaq 0x60(%rsp), %rdi
pushq $0x1
popq %rdx
movl %edx, %esi
pushq $0x5
popq %rcx
callq 0x2270
movq %rbx, %rdi
callq 0x2060
leaq 0x270(%rsp), %rdi
callq 0x2060
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0x2b7c
movupd (%rax), %xmm0
movapd %xmm0, 0x40(%rsp)
movq %r12, %rdi
leaq 0x150(%rsp), %rsi
callq 0x20d0
movq %r12, %rsi
leaq 0xf0(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rdx
callq 0x2040
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2070
movq %r15, %rdi
callq 0x2080
movq %r12, %r13
movq %r12, %rdi
callq 0x2080
movq %r12, %rdi
leaq 0x210(%rsp), %rsi
callq 0x20d0
movq %r15, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2040
leaq 0x270(%rsp), %rdi
movq %r15, %rsi
callq 0x2070
movq %r15, %rdi
callq 0x2080
movq %r12, %rdi
callq 0x2080
jmp 0x2ba1
movq %rbx, %rdi
leaq 0x150(%rsp), %rsi
callq 0x20e0
leaq 0x270(%rsp), %rdi
leaq 0x210(%rsp), %rsi
callq 0x20e0
andq $0x0, 0x100(%rsp)
movl $0x1010000, %eax        # imm = 0x1010000
movl %eax, 0xf0(%rsp)
andq $0x0, 0x2e0(%rsp)
movq %rbx, 0xf8(%rsp)
andq $0x0, 0x50(%rsp)
movl %eax, 0x2d0(%rsp)
leaq 0x270(%rsp), %rax
movq %rax, 0x2d8(%rsp)
movl $0x2010000, 0x40(%rsp)  # imm = 0x2010000
leaq 0x60(%rsp), %rax
movq %rax, 0x48(%rsp)
callq 0x2220
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq %rbp, %rdx
pushq $0x3
popq %rcx
movq %rax, %r8
callq 0x2180
andq $0x0, 0x100(%rsp)
movl $0x1010000, 0xf0(%rsp) # imm = 0x1010000
leaq 0x60(%rsp), %rax
movq %rax, 0xf8(%rsp)
callq 0x2220
movq %rbx, %rdi
xorl %esi, %esi
leaq 0x18(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %rax, %r9
callq 0x21e0
movsd 0x13b4(%rip), %xmm0     # 0x4010
ucomisd 0x18(%rsp), %xmm0
setae %bl
leaq 0x270(%rsp), %rdi
callq 0x2080
leaq 0x1b0(%rsp), %rdi
callq 0x2080
leaq 0x60(%rsp), %rdi
callq 0x2080
orb %r14b, %bl
cmpb $0x1, %bl
jne 0x2d1d
leaq 0x330(%rsp), %rbx
movq %rbx, %rdi
pushq $0x40
popq %rsi
leaq 0x138c(%rip), %rdx      # 0x4036
movq 0x10(%rsp), %rcx
movl 0x4(%rsp), %r8d
xorl %eax, %eax
callq 0x2110
leaq 0x60(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
leaq 0x270(%rsp), %rdx
callq 0x2e7e
leaq 0x1b0(%rsp), %rbx
andq $0x0, 0x1c0(%rsp)
movl $0x1010000, 0x1b0(%rsp) # imm = 0x1010000
leaq 0x150(%rsp), %rax
movq %rax, 0x1b8(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
leaq 0x20(%rsp), %rdx
callq 0x2090
incl 0x4(%rsp)
movq %r15, %rdi
callq 0x2280
jmp 0x2d2a
leaq 0x1b0(%rsp), %rbx
leaq 0x60(%rsp), %r15
movq %r15, %rdi
leaq 0x210(%rsp), %rsi
callq 0x20d0
leaq 0x150(%rsp), %rdi
movq %r15, %rsi
callq 0x2070
movq %r15, %rdi
callq 0x2080
jmp 0x2a53
pushq $-0x1
popq %rbx
jmp 0x2d5e
xorl %ebx, %ebx
leaq 0xc0(%rsp), %rdi
callq 0x2130
leaq 0x150(%rsp), %rdi
callq 0x2080
leaq 0x210(%rsp), %rdi
callq 0x2080
leaq 0x20(%rsp), %rdi
callq 0x2f6e
movl %ebx, %eax
addq $0x378, %rsp            # imm = 0x378
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2e41
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x2280
jmp 0x2e51
movq %rax, %rbx
jmp 0x2e51
jmp 0x2dc4
movq %rax, %rbx
jmp 0x2e6b
jmp 0x2dfe
jmp 0x2dd4
jmp 0x2de6
jmp 0x2dfe
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x2080
jmp 0x2de9
movq %rax, %rbx
leaq 0x2d0(%rsp), %rdi
callq 0x2080
jmp 0x2e01
jmp 0x2dfe
jmp 0x2dfe
jmp 0x2e41
movq %rax, %rbx
leaq 0x270(%rsp), %rdi
callq 0x2080
leaq 0x1b0(%rsp), %rdi
callq 0x2080
jmp 0x2e35
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x2280
jmp 0x2e44
jmp 0x2e41
jmp 0x2e41
jmp 0x2e41
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x2080
jmp 0x2e44
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x2130
leaq 0x150(%rsp), %rdi
callq 0x2080
leaq 0x210(%rsp), %rdi
callq 0x2080
leaq 0x20(%rsp), %rdi
callq 0x2f6e
movq %rbx, %rdi
callq 0x21f0
nop