// File: /workspace/github_cpp_makefile_star2_O1/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 0x6228(%rip), %r13      # 0x121e7
leaq 0xa8(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movl %r12d, %edx
movl %r15d, %ecx
callq 0x4c6e
leaq 0x68(%rsp), %rdi
movq %r13, %rsi
movl %r12d, %edx
movl %r15d, %ecx
callq 0x4c6e
leaq 0x48(%rsp), %rdi
movq %r13, %rsi
movl %r12d, %edx
movl %r15d, %ecx
callq 0x4c6e
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
movl %r12d, %edx
movl %r15d, %ecx
callq 0x4c6e
leaq 0x8(%rsp), %rdi
movq %r13, %rsi
movl %r12d, %edx
movl %r15d, %ecx
callq 0x4c6e
leaq 0x88(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
movl %r12d, %edx
movl %r15d, %ecx
callq 0x4c6e
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4cde
movq %rbx, %rdi
leaq 0x68(%rsp), %r14
movq %r14, %rsi
callq 0xc0fa
movq %rbx, %rdi
leaq 0x48(%rsp), %r15
movq %r15, %rsi
callq 0xc168
movq %rbx, %rdi
leaq 0x28(%rsp), %r12
movq %r12, %rsi
movl $0x2, %edx
callq 0xc232
movq %rbx, %rdi
leaq 0x8(%rsp), %r13
movq %r13, %rsi
movl $0x4, %edx
callq 0xc232
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xc3ea
leaq 0x572d(%rip), %rsi      # 0x117d1
movq %r14, %rdi
callq 0x4e1a
leaq 0x5749(%rip), %rsi      # 0x117fc
movq %r15, %rdi
callq 0x4e1a
leaq 0x5766(%rip), %rsi      # 0x11828
movq %r12, %rdi
callq 0x4e1a
leaq 0x5787(%rip), %rsi      # 0x11858
movq %r13, %rdi
callq 0x4e1a
leaq 0x57a8(%rip), %rsi      # 0x11888
movq %rbp, %rdi
callq 0x4e1a
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq