// File: /workspace/github_cpp_makefile_star2_O2/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::halftoning(char const*, int, int)
void ImageProc::halftoning(const char *infile, int width, int height)
{
	Image img_orig("bw", width, height);
	Image img_halftone_fixed_thresh("bw", width, height);
	Image img_halftone_random_thresh("bw", width, height);
	Image img_halftone_dither_matrix_2("bw", width, height);
	Image img_halftone_dither_matrix_4("bw", width, height);
	Image img_halftone_error_diffusion("bw", width, height);
	img_orig.read_image(infile, img_orig.cols, img_orig.rows);

	halftone_fixed_thresh(img_orig, img_halftone_fixed_thresh);
	halftone_random_thresh(img_orig, img_halftone_random_thresh);
	halftone_dither_matrix(img_orig, img_halftone_dither_matrix_2, 2);
	halftone_dither_matrix(img_orig, img_halftone_dither_matrix_4, 4);
	error_diffusion(img_orig, img_halftone_error_diffusion);

	img_halftone_fixed_thresh.write_image("../output_images/halftone_fixed_thresh.raw", img_halftone_fixed_thresh.cols, img_halftone_fixed_thresh.rows);
	img_halftone_random_thresh.write_image("../output_images/halftone_random_thresh.raw", img_halftone_random_thresh.cols, img_halftone_random_thresh.rows);
	img_halftone_dither_matrix_2.write_image("../output_images/halftone_dither_matrix_2x2.raw", img_halftone_dither_matrix_2.cols, img_halftone_dither_matrix_2.rows);
	img_halftone_dither_matrix_4.write_image("../output_images/halftone_dither_matrix_4x4.raw", img_halftone_dither_matrix_4.cols, img_halftone_dither_matrix_4.rows);
	img_halftone_error_diffusion.write_image("../output_images/halftone_error_diffusion.raw", img_halftone_error_diffusion.cols, img_halftone_error_diffusion.rows);
	//img_modified.write_image(outfile, img_modified.cols, img_modified.rows);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %edx, %r15d
movl %esi, %r12d
movq %rdi, %r14
leaq 0x6fc9(%rip), %r13      # 0x116b4
leaq 0xa8(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movl %r12d, %edx
movl %r15d, %ecx
callq 0x3fd6
leaq 0x68(%rsp), %rdi
movq %r13, %rsi
movl %r12d, %edx
movl %r15d, %ecx
callq 0x3fd6
leaq 0x48(%rsp), %rdi
movq %r13, %rsi
movl %r12d, %edx
movl %r15d, %ecx
callq 0x3fd6
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
movl %r12d, %edx
movl %r15d, %ecx
callq 0x3fd6
leaq 0x8(%rsp), %rdi
movq %r13, %rsi
movl %r12d, %edx
movl %r15d, %ecx
callq 0x3fd6
leaq 0x88(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
movl %r12d, %edx
movl %r15d, %ecx
callq 0x3fd6
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4032
movq %rbx, %rdi
leaq 0x68(%rsp), %r14
movq %r14, %rsi
callq 0xa822
movq %rbx, %rdi
leaq 0x48(%rsp), %r15
movq %r15, %rsi
callq 0xa882
pushq $0x2
popq %rdx
movq %rbx, %rdi
leaq 0x28(%rsp), %r12
movq %r12, %rsi
callq 0xa924
pushq $0x4
popq %rdx
movq %rbx, %rdi
leaq 0x8(%rsp), %r13
movq %r13, %rsi
callq 0xa924
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xaaca
leaq 0x64d6(%rip), %rsi      # 0x10ca2
movq %r14, %rdi
callq 0x411c
leaq 0x64f2(%rip), %rsi      # 0x10ccd
movq %r15, %rdi
callq 0x411c
leaq 0x650f(%rip), %rsi      # 0x10cf9
movq %r12, %rdi
callq 0x411c
leaq 0x6530(%rip), %rsi      # 0x10d29
movq %r13, %rdi
callq 0x411c
leaq 0x6551(%rip), %rsi      # 0x10d59
movq %rbp, %rdi
callq 0x411c
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq