// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x28(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x20(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
leaq -0x78(%rbp), %rdi
xorl %esi, %esi
movl $0x50, %edx
callq 0x2170
movq -0x28(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x90(%rbp)
movq $0x0, -0x88(%rbp)
movb $0x0, -0x80(%rbp)
movq -0x10(%rbp), %rax
movb 0x18(%rax), %al
andb $0x1, %al
movb %al, -0x7f(%rbp)
leaq 0x3add(%rip), %rdi      # 0x6004
leaq -0x78(%rbp), %rsi
callq 0x2830
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x98(%rbp)
jne 0x254e
callq 0x2060
movq %rax, %rdi
callq 0x2250
cmpq $0x0, -0x70(%rbp)
je 0x255c
cmpq $0x0, -0x68(%rbp)
jne 0x2594
movq 0x5a95(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
leaq 0x3aa1(%rip), %rsi      # 0x600e
movb $0x0, %al
callq 0x2200
leaq 0x3a89(%rip), %rdi      # 0x6004
xorl %eax, %eax
movl %eax, %esi
callq 0x2830
callq 0x2060
movl $0x4f, (%rax)
jmp 0x27fd
cmpq $0x0, -0x18(%rbp)
setne %al
andb $0x1, %al
movb %al, -0x80(%rbp)
leaq -0x90(%rbp), %rax
movq %rax, -0x30(%rbp)
movq 0x5c45(%rip), %rax      # 0x81f8
movl $0x2, (%rax)
movq 0x5c48(%rip), %rax      # 0x8208
movq $0x0, (%rax)
movq -0x18(%rbp), %rdx
movl $0x2, %eax
movl $0x3, %ecx
cmpq $0x0, %rdx
cmovnel %ecx, %eax
movslq %eax, %rcx
movq 0x5c22(%rip), %rax      # 0x8208
movq %rcx, 0x8(%rax)
leaq -0x78(%rbp), %rdi
leaq 0x5bb(%rip), %rsi       # 0x2bb0
callq *-0x70(%rbp)
cmpl $0x0, %eax
je 0x260b
leaq 0x3a24(%rip), %rdi      # 0x6028
movb $0x0, %al
callq 0x3ed0
cmpq $0x0, -0x18(%rbp)
je 0x2740
movups -0x38(%rbp), %xmm0
movq %rsp, %rax
movups %xmm0, 0x40(%rax)
movups -0x78(%rbp), %xmm0
movups -0x68(%rbp), %xmm1
movups -0x58(%rbp), %xmm2
movups -0x48(%rbp), %xmm3
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
leaq -0x90(%rbp), %rdi
callq 0x2bf0
testb $0x1, %al
jne 0x266b
movq -0x48(%rbp), %rsi
imulq -0x50(%rbp), %rsi
subq $0x8, %rsi
leaq 0x39e0(%rip), %rdi      # 0x6044
movb $0x0, %al
callq 0x3ed0
movq 0x5b96(%rip), %rax      # 0x8208
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movups -0x38(%rbp), %xmm0
movq %rsp, %rax
movups %xmm0, 0x58(%rax)
movups -0x78(%rbp), %xmm0
movups -0x68(%rbp), %xmm1
movups -0x58(%rbp), %xmm2
movups -0x48(%rbp), %xmm3
movups %xmm3, 0x48(%rax)
movups %xmm2, 0x38(%rax)
movups %xmm1, 0x28(%rax)
movups %xmm0, 0x18(%rax)
movq -0x80(%rbp), %rcx
movq %rcx, 0x10(%rax)
movups -0x90(%rbp), %xmm0
movups %xmm0, (%rax)
leaq 0x4f0(%rip), %rdi       # 0x2bb0
callq 0x2d10
cmpl $0x0, %eax
je 0x26d8
leaq 0x39bd(%rip), %rdi      # 0x608e
movb $0x0, %al
callq 0x3ed0
movq 0x5b29(%rip), %rax      # 0x8208
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x68(%rbp), %rax
movups -0x38(%rbp), %xmm0
movq %rsp, %rcx
movups %xmm0, 0x40(%rcx)
movups -0x78(%rbp), %xmm0
movups -0x68(%rbp), %xmm1
movups -0x58(%rbp), %xmm2
movups -0x48(%rbp), %xmm3
movups %xmm3, 0x30(%rcx)
movups %xmm2, 0x20(%rcx)
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
leaq 0x48a(%rip), %rdi       # 0x2bb0
callq *%rax
cmpl $0x0, %eax
je 0x273b
leaq 0x3978(%rip), %rdi      # 0x60ac
movb $0x0, %al
callq 0x3ed0
jmp 0x27dd
movq 0x5ac1(%rip), %rax      # 0x8208
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movups -0x38(%rbp), %xmm0
movq %rsp, %rax
movups %xmm0, 0x58(%rax)
movups -0x78(%rbp), %xmm0
movups -0x68(%rbp), %xmm1
movups -0x58(%rbp), %xmm2
movups -0x48(%rbp), %xmm3
movups %xmm3, 0x48(%rax)
movups %xmm2, 0x38(%rax)
movups %xmm1, 0x28(%rax)
movups %xmm0, 0x18(%rax)
movq -0x80(%rbp), %rcx
movq %rcx, 0x10(%rax)
movups -0x90(%rbp), %xmm0
movups %xmm0, (%rax)
leaq 0x41b(%rip), %rdi       # 0x2bb0
callq 0x2d10
cmpl $0x0, %eax
je 0x27ad
leaq 0x38e8(%rip), %rdi      # 0x608e
movb $0x0, %al
callq 0x3ed0
movq -0x58(%rbp), %rax
movups -0x38(%rbp), %xmm0
movq %rsp, %rcx
movups %xmm0, 0x40(%rcx)
movups -0x78(%rbp), %xmm0
movups -0x68(%rbp), %xmm1
movups -0x58(%rbp), %xmm2
movups -0x48(%rbp), %xmm3
movups %xmm3, 0x30(%rcx)
movups %xmm2, 0x20(%rcx)
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
callq *%rax
movq 0x5a24(%rip), %rax      # 0x8208
movq 0x8(%rax), %rcx
movq 0x5a19(%rip), %rax      # 0x8208
movq %rcx, (%rax)
callq 0x2060
movl $0x0, (%rax)
movq -0x98(%rbp), %rdi
callq 0x2390
movq 0x59e8(%rip), %rax      # 0x81f8
movl $0x0, (%rax)
callq 0x2060
movq %rax, %rdi
callq 0x2250
nopw %cs:(%rax,%rax)