// File: /workspace/github_c_makefile_star2_O1/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, 0x38(%rsp)
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x10, 0x48(%rsp)
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0x2a7a
movl $0x10, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x2a89
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x30ec
movl $0x9, 0x48(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x2aae
movl $0x9, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x2abd
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x30ec
leaq 0x210(%rsp), %rdi
callq 0x2060
leaq 0x1b0(%rsp), %rdi
callq 0x2060
leaq 0x48(%rsp), %rdi
leaq 0x150(%rsp), %rdx
movq %rbx, %rsi
callq 0x301e
leaq 0x120(%rsp), %rdi
leaq 0x48(%rsp), %rbp
movq %rbp, %rsi
xorl %edx, %edx
callq 0x21c0
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b1e
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2190
leaq 0x120(%rsp), %rdi
callq 0x20b0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testb %al, %al
je 0x2ebd
movq %r14, 0x30(%rsp)
leaq 0x270(%rsp), %r12
leaq 0xa8(%rsp), %r13
movl $0x0, 0xc(%rsp)
leaq 0x150(%rsp), %r14
leaq 0x50(%rsp), %rax
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movl $0x2010000, 0x48(%rsp)  # imm = 0x2010000
leaq 0x210(%rsp), %rbx
movq %rbx, 0x50(%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 0x2bb9
leaq 0x1b0(%rsp), %rdi
callq 0x2120
testb %al, %al
je 0x2bc1
xorl %r14d, %r14d
jmp 0x2dbf
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 0x30(%rsp), %rax
testq %rax, %rax
je 0x2ca8
movupd (%rax), %xmm0
movupd %xmm0, 0xa8(%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 0x2ccd
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), %rax
movq %rax, 0x278(%rsp)
leaq 0xb0(%rsp), %rax
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movl $0x2010000, 0xa8(%rsp) # imm = 0x2010000
movq %r15, 0xb0(%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 0x40(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %rax, %r9
callq 0x21d0
movsd 0x128d(%rip), %xmm0     # 0x4020
ucomisd 0x40(%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 0x2e80
movl $0x40, %esi
leaq 0x330(%rsp), %r14
movq %r14, %rdi
leaq 0x124b(%rip), %rdx      # 0x402e
movq 0x38(%rsp), %rcx
movl 0xc(%rsp), %r8d
xorl %eax, %eax
callq 0x2110
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%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 0x305c
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 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x2e7a
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2190
incl 0xc(%rsp)
jmp 0x2e88
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 0x2b5d
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 0x2efb
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 0x2f11
movq %rax, %rbx
jmp 0x2ffe
jmp 0x2fd4
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2fe4
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x2fe4
movq %rax, %rbx
jmp 0x2fe4
jmp 0x2f7f
jmp 0x2f55
jmp 0x2f67
jmp 0x2f7f
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x2080
jmp 0x2f6a
movq %rax, %rbx
leaq 0x270(%rsp), %rdi
callq 0x2080
jmp 0x2f82
jmp 0x2f7f
jmp 0x2f7f
jmp 0x2fd4
movq %rax, %rbx
leaq 0x2d0(%rsp), %rdi
callq 0x2080
leaq 0x150(%rsp), %rdi
callq 0x2080
jmp 0x2fc8
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x2fd7
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x2fd7
jmp 0x2fd4
jmp 0x2fd4
jmp 0x2fd4
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x2080
jmp 0x2fd7
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 0x3015
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x21e0
nop