// File: /workspace/github_c_makefile_star2_O2/albinoloverats[P]hide/src/hide.c
// Function: process
extern void *process(void *args)
{
	process_options_t *options = args;
	hide_files_t files = options->files;
	image_info_t image_info = { files.image_in, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL };
	data_info_t data_info = { files.data_file, 0, false, options->fill };

	void *so = find_supported_formats(DIR_LIBRARY, &image_info);
	if (!so)
		pthread_exit(&errno);

	if (!(image_info.read && image_info.write))
	{
		fprintf(stderr, "Unsupported image format\n");
		find_supported_formats(DIR_LIBRARY, NULL);
		errno = EFTYPE;
		goto done;
	}

	/*
	 * current hack for JPEG images: use ->extra to indicate whether
	 * hiding or finding
	 */
	data_info.hide = (bool)files.image_out;
	image_info.extra = &data_info;

#ifndef __DEBUG__
	*ui.status = CLI_RUN;
	ui.total->offset = 0;
	ui.total->size = files.image_out ? 3 : 2;
#endif

	/*
	 * read the source image
	 */
	if (image_info.read(&image_info, progress_current_update))
		die("Failed to read source image");

	if (files.image_out)
	{
		if (!will_fit(&data_info, image_info))
			die("Too much data to hide; find a larger image\nAvailable capacity: %" PRIu64 " bytes\n", HIDE_CAPACITY);
		/*
		 * overlay the data on the image
		 */
#ifndef __DEBUG__
		ui.total->offset++;
#endif
		if (process_file(data_info, image_info, progress_current_update))
			die("Failed during data processing");
		/*
		 * write the image with the hidden data
		 */
#ifndef __DEBUG__
		ui.total->offset++;
#endif
		image_info.file = files.image_out;
		if (image_info.write(image_info, progress_current_update))
			die("Failed to write output image");
	}
	else
	{
		/*
		 * extract the hidden data
		 */
#ifndef __DEBUG__
		ui.total->offset++;
#endif
		if (process_file(data_info, image_info, progress_current_update))
			die("Failed during data processing");
		image_info.free(image_info);
	}

#ifndef __DEBUG__
	ui.total->offset = ui.total->size;
#endif
	errno = EXIT_SUCCESS;
done:
	dlclose(so);
#ifndef __DEBUG__
	*ui.status = CLI_DONE;
	pthread_exit(&errno);
#else
	return &errno;
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x160, %rsp            # imm = 0x160
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
movq 0x10(%rdi), %r15
xorps %xmm0, %xmm0
leaq 0x80(%rsp), %rsi
movups %xmm0, 0x38(%rsi)
movups %xmm0, 0x28(%rsi)
movups %xmm0, 0x18(%rsi)
movups %xmm0, 0x8(%rsi)
andq $0x0, 0x48(%rsi)
movq %rcx, 0x68(%rsp)
andq $0x0, 0x70(%rsp)
movq %rax, (%rsi)
movb $0x0, 0x78(%rsp)
movb 0x18(%rdi), %al
movb %al, 0x79(%rsp)
leaq 0x2add(%rip), %rdi      # 0x5004
callq 0x2763
testq %rax, %rax
je 0x259d
movq %rax, %rbx
movq 0x88(%rsp), %rax
testq %rax, %rax
je 0x254c
cmpq $0x0, 0x90(%rsp)
jne 0x25aa
movq 0x5aa5(%rip), %rax      # 0x7ff8
movq (%rax), %rcx
leaq 0x2ab1(%rip), %rdi      # 0x500e
pushq $0x19
popq %rsi
pushq $0x1
popq %rdx
callq 0x2350
leaq 0x2a95(%rip), %rdi      # 0x5004
xorl %esi, %esi
callq 0x2763
pushq $0x4f
popq %rbp
callq 0x2060
movq %rax, %r14
movl %ebp, (%rax)
movq %rbx, %rdi
callq 0x23a0
movq 0x5c76(%rip), %rax      # 0x8208
andl $0x0, (%rax)
movq %r14, %rdi
callq 0x2250
callq 0x2060
movq %rax, %rdi
callq 0x2250
xorl %ecx, %ecx
testq %r15, %r15
setne %cl
leaq 0x68(%rsp), %rdx
setne 0x10(%rdx)
leaq 0x80(%rsp), %rdi
movq %rdx, 0x48(%rdi)
movq 0x5c3a(%rip), %rdx      # 0x8208
movl $0x2, (%rdx)
movq 0x5c3d(%rip), %rdx      # 0x8218
andq $0x0, (%rdx)
orq $0x2, %rcx
movq %rcx, 0x8(%rdx)
leaq 0x421(%rip), %rsi       # 0x2a0f
callq *%rax
testl %eax, %eax
jne 0x265e
testq %r15, %r15
je 0x266a
movq 0xb0(%rsp), %r12
imulq 0xa8(%rsp), %r12
movq 0x68(%rsp), %rdi
leaq 0xd0(%rsp), %r14
movq %r14, %rsi
callq 0x2120
movq 0x30(%r14), %rax
addq $-0x8, %r12
cmpq %r12, %rax
jbe 0x26d3
callq 0x2060
movl $0x1c, (%rax)
movq 0xa8(%rsp), %rsi
imulq 0xb0(%rsp), %rsi
addq $-0x8, %rsi
leaq 0x29ed(%rip), %rdi      # 0x5044
xorl %eax, %eax
callq 0x3262
leaq 0x29c3(%rip), %rdi      # 0x5028
jmp 0x275c
movq 0x5ba7(%rip), %rax      # 0x8218
incq (%rax)
leaq 0x18(%rsp), %rdi
pushq $0xa
popq %rcx
leaq 0x80(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x2a2e
testl %eax, %eax
jne 0x2755
pushq $0xa
popq %rcx
leaq 0x80(%rsp), %rax
movq %rsp, %rdi
movq %rax, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq *0x20(%rax)
movq 0x5b53(%rip), %rax      # 0x8218
movq 0x8(%rax), %rcx
movq %rcx, (%rax)
xorl %ebp, %ebp
jmp 0x2579
bswapq %rax
movq %rax, 0x70(%rsp)
movb $0x1, 0x78(%rsp)
movq 0x5b31(%rip), %rax      # 0x8218
incq (%rax)
leaq 0x18(%rsp), %rdi
pushq $0xa
popq %rcx
leaq 0x80(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x2a2e
testl %eax, %eax
jne 0x2755
movq 0x5af8(%rip), %rax      # 0x8218
incq (%rax)
leaq 0x80(%rsp), %rax
movq %r15, (%rax)
pushq $0xa
popq %rcx
movq %rsp, %rdi
movq %rax, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x2ce(%rip), %rdi       # 0x2a0f
callq *0x10(%rax)
testl %eax, %eax
je 0x26be
leaq 0x2959(%rip), %rdi      # 0x50ac
jmp 0x275c
leaq 0x2932(%rip), %rdi      # 0x508e
xorl %eax, %eax
callq 0x3262