// File: /workspace/github_cpp_makefile_star2_O1/rishabh-battulwar[P]imageprocessing/./src/Main.cpp
// Function: main
int main(int argc, char* argv[])
{
	int width = 512, height = 512;
	int window_size = 3, region_size = 5;
	int sigma = 1, h = 1, sigma_sim = 20;
	float threshold = 20.0, tau = 0.99, epsilon = 0.3, phi = 2;
	int target_width = 700, target_height = 700;
	int iter = 6, percentage = 10;
	//char *type = "color";
	char *method_name = "color_to_bw";
	char *infile = "../images/mandril.raw";
	char *outfile = "../images/mandril_bw.raw";
	if (argc < 3)
		usage(argv[0]);

	for(int i = 1; i < argc; i++)
	{
		if     (!(strcmp(argv[i], "-prob"))) method_name = argv[++i];
		else if(!(strcmp(argv[i], "-i"))) infile = argv[++i];
		else if(!(strcmp(argv[i], "-o"))) outfile = argv[++i];
		//else if(!(strcmp(argv[i], "bw")) || !(strcmp(argv[i], "color"))) type = argv[i];
		else if(!(strcmp(argv[i], "-w"))) width = atoi(argv[++i]);
		else if(!(strcmp(argv[i], "-h"))) height = atoi(argv[++i]);
		else if(!(strcmp(argv[i], "-tw"))) target_width = atoi(argv[++i]);
		else if(!(strcmp(argv[i], "-th"))) target_height = atoi(argv[++i]);
		else if(!(strcmp(argv[i], "-ws"))) window_size = atoi(argv[++i]);
		else if(!(strcmp(argv[i], "-rs"))) region_size = atoi(argv[++i]);
		else if(!(strcmp(argv[i], "-sigma"))) sigma = atoi(argv[++i]);
		else if(!(strcmp(argv[i], "-sigma_sim"))) sigma_sim = atoi(argv[++i]);
		else if(!(strcmp(argv[i], "-iter"))) iter = atoi(argv[++i]);
		else if(!(strcmp(argv[i], "-perc"))) percentage = atoi(argv[++i]);
		else if(!(strcmp(argv[i], "-h"))) h = atoi(argv[++i]);
		else if(!(strcmp(argv[i], "-thresh"))) threshold = atof(argv[++i]);
		else if(!(strcmp(argv[i], "-tau"))) tau = atof(argv[++i]);
		else if(!(strcmp(argv[i], "-epsilon"))) epsilon = atof(argv[++i]);
		else if(!(strcmp(argv[i], "-phi"))) phi = atof(argv[++i]);
		else
		{
			std::cerr << "\n Unknown Option : " << argv[i] << std::endl;
			usage(argv[0]);
		}
	}


	if     (!(strcmp(method_name, "color_to_bw"))) 			ImageProc::color_to_bw(infile, outfile, width, height);
	else if(!(strcmp(method_name, "image_resize")))			ImageProc::image_resize(infile, outfile, width, height, target_width, target_height);
	else if(!(strcmp(method_name, "hist_eq_cum")))			ImageProc::hist_equal_cumulative(infile, outfile, width, height);
	else if(!(strcmp(method_name, "hist_equal")))			ImageProc::hist_equal(infile, outfile, width, height);
	else if(!(strcmp(method_name, "oil_paint_effect")))		ImageProc::oil_painting(infile, outfile, width, height, window_size);
	else if(!(strcmp(method_name, "special_effect")))		ImageProc::film_special_effect(infile, outfile, width, height);
	else if(!(strcmp(method_name, "denoising")))			ImageProc::denoising(infile, outfile, width, height, window_size, sigma, threshold);
	else if(!(strcmp(method_name, "bilateral_filter")))		ImageProc::apply_bilateral_filter(infile, outfile, width, height, window_size, sigma, sigma_sim, iter);
	else if(!(strcmp(method_name, "non_local_mean")))		ImageProc::apply_non_local_mean(infile, outfile, width, height, window_size, region_size, sigma, h);
	else if(!(strcmp(method_name, "sobel")))				ImageProc::apply_sobel_operator(infile, outfile, width, height, percentage);
	else if(!(strcmp(method_name, "LoG")))					ImageProc::apply_LoG_operator(infile, outfile, width, height);
	else if(!(strcmp(method_name, "halftone")))				ImageProc::halftoning(infile, width, height);
	else if(!(strcmp(method_name, "color_halftone")))		ImageProc::color_halftoning(infile, outfile, width, height);
	else if(!(strcmp(method_name, "art_effect")))			ImageProc::apply_artistic_effect(infile, outfile, width, height, tau, epsilon, phi, window_size, sigma, sigma_sim, iter);
	else if(!(strcmp(method_name, "fingerprint")))			ImageProc::apply_morphology(infile, outfile, width, height);
	else if(!(strcmp(method_name, "binary")))				ImageProc::apply_binarization(infile, outfile, width, height);
	else if(!(strcmp(method_name, "minutiae")))				ImageProc::apply_minutae_extraction(infile, outfile, width, height);

	else
	{
		std::cout << "method_name doesn't match any method!" << std::endl;
		usage(argv[0]);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
cmpl $0x3, %edi
jl 0x10ab3
movl %edi, %ebx
movl $0x200, 0x8(%rsp)       # imm = 0x200
movl $0x3, 0x24(%rsp)
movl $0x5, 0x44(%rsp)
movl $0x14, %eax
movq %rax, 0x58(%rsp)
movss 0x12fe(%rip), %xmm0     # 0x11650
movss %xmm0, 0x38(%rsp)
movss 0x12f4(%rip), %xmm0     # 0x11654
movss %xmm0, 0x34(%rsp)
movss 0x12ea(%rip), %xmm0     # 0x11658
movss %xmm0, 0x3c(%rsp)
movl $0x2bc, 0x48(%rsp)      # imm = 0x2BC
movl $0x6, %eax
movq %rax, 0x50(%rsp)
movl $0xa, 0x40(%rsp)
leaq 0x1e49(%rip), %rax      # 0x121de
movq %rax, 0x60(%rsp)
leaq 0x1e49(%rip), %rax      # 0x121ea
movq %rax, 0x10(%rsp)
leaq 0x1e53(%rip), %rax      # 0x12200
movq %rax, 0x18(%rsp)
movl $0x1, %r15d
leaq 0x1e5a(%rip), %rbp      # 0x12219
movl $0x2bc, 0x4c(%rsp)      # imm = 0x2BC
movl $0x1, %eax
movq %rax, 0x28(%rsp)
movl $0x200, 0xc(%rsp)       # imm = 0x200
movslq %r15d, %r13
movq (%r14,%r13,8), %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2200
testl %eax, %eax
je 0x10580
movq %r12, %rdi
leaq 0x1e22(%rip), %rsi      # 0x1221f
callq 0x2200
testl %eax, %eax
je 0x10592
movq %r12, %rdi
leaq 0x1e0e(%rip), %rsi      # 0x12222
callq 0x2200
testl %eax, %eax
je 0x105a4
movq %r12, %rdi
leaq 0x1dfa(%rip), %rsi      # 0x12225
callq 0x2200
testl %eax, %eax
je 0x105b6
movq %r12, %rdi
leaq 0x1de6(%rip), %rsi      # 0x12228
callq 0x2200
testl %eax, %eax
je 0x105cc
movq %r12, %rdi
leaq 0x1dd2(%rip), %rsi      # 0x1222b
callq 0x2200
testl %eax, %eax
je 0x105e2
movq %r12, %rdi
leaq 0x1dbf(%rip), %rsi      # 0x1222f
callq 0x2200
testl %eax, %eax
je 0x105f8
movq %r12, %rdi
leaq 0x1dac(%rip), %rsi      # 0x12233
callq 0x2200
testl %eax, %eax
je 0x1060e
movq %r12, %rdi
leaq 0x1d99(%rip), %rsi      # 0x12237
callq 0x2200
testl %eax, %eax
je 0x10624
movq %r12, %rdi
leaq 0x1d86(%rip), %rsi      # 0x1223b
callq 0x2200
testl %eax, %eax
je 0x1063a
movq %r12, %rdi
leaq 0x1d76(%rip), %rsi      # 0x12242
callq 0x2200
testl %eax, %eax
je 0x1064e
movq %r12, %rdi
leaq 0x1d6a(%rip), %rsi      # 0x1224d
callq 0x2200
testl %eax, %eax
je 0x10662
movq %r12, %rdi
leaq 0x1d59(%rip), %rsi      # 0x12253
callq 0x2200
testl %eax, %eax
je 0x10676
movq %r12, %rdi
leaq 0x1d48(%rip), %rsi      # 0x12259
callq 0x2200
testl %eax, %eax
je 0x10689
movq %r12, %rdi
leaq 0x1d39(%rip), %rsi      # 0x12261
callq 0x2200
testl %eax, %eax
je 0x1068e
movq %r12, %rdi
leaq 0x1d27(%rip), %rsi      # 0x12266
callq 0x2200
testl %eax, %eax
je 0x106a8
movq %r12, %rdi
leaq 0x1d19(%rip), %rsi      # 0x1226f
callq 0x2200
testl %eax, %eax
jne 0x10a84
leal 0x1(%r13), %r15d
movq 0x8(%r14,%r13,8), %rdi
callq 0x21e0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x3c(%rsp)
jmp 0x106c0
incl %r15d
movq 0x8(%r14,%r13,8), %rax
movq %rax, 0x60(%rsp)
jmp 0x106c0
incl %r15d
movq 0x8(%r14,%r13,8), %rax
movq %rax, 0x10(%rsp)
jmp 0x106c0
incl %r15d
movq 0x8(%r14,%r13,8), %rax
movq %rax, 0x18(%rsp)
jmp 0x106c0
incl %r15d
movq 0x8(%r14,%r13,8), %rdi
callq 0x2240
movl %eax, 0xc(%rsp)
jmp 0x106c0
incl %r15d
movq 0x8(%r14,%r13,8), %rdi
callq 0x2240
movl %eax, 0x8(%rsp)
jmp 0x106c0
incl %r15d
movq 0x8(%r14,%r13,8), %rdi
callq 0x2240
movl %eax, 0x4c(%rsp)
jmp 0x106c0
incl %r15d
movq 0x8(%r14,%r13,8), %rdi
callq 0x2240
movl %eax, 0x48(%rsp)
jmp 0x106c0
incl %r15d
movq 0x8(%r14,%r13,8), %rdi
callq 0x2240
movl %eax, 0x24(%rsp)
jmp 0x106c0
incl %r15d
movq 0x8(%r14,%r13,8), %rdi
callq 0x2240
movl %eax, 0x44(%rsp)
jmp 0x106c0
incl %r15d
movq 0x8(%r14,%r13,8), %rdi
callq 0x2240
movq %rax, 0x28(%rsp)
jmp 0x106c0
incl %r15d
movq 0x8(%r14,%r13,8), %rdi
callq 0x2240
movq %rax, 0x58(%rsp)
jmp 0x106c0
incl %r15d
movq 0x8(%r14,%r13,8), %rdi
callq 0x2240
movq %rax, 0x50(%rsp)
jmp 0x106c0
incl %r15d
movq 0x8(%r14,%r13,8), %rdi
callq 0x2240
movl %eax, 0x40(%rsp)
jmp 0x106c0
incl %r15d
jmp 0x106c0
leal 0x1(%r13), %r15d
movq 0x8(%r14,%r13,8), %rdi
callq 0x21e0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x38(%rsp)
jmp 0x106c0
leal 0x1(%r13), %r15d
movq 0x8(%r14,%r13,8), %rdi
callq 0x21e0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x34(%rsp)
incl %r15d
cmpl %ebx, %r15d
jl 0x103d9
leaq 0x1b0b(%rip), %rsi      # 0x121de
movq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0x1086f
leaq 0x1b99(%rip), %rsi      # 0x12288
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0x1088b
leaq 0x1b8f(%rip), %rsi      # 0x12295
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0x108b1
leaq 0x1b84(%rip), %rsi      # 0x122a1
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0x108cd
leaq 0x1b78(%rip), %rsi      # 0x122ac
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0x108e9
leaq 0x1b72(%rip), %rsi      # 0x122bd
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0x1090a
leaq 0x1b6a(%rip), %rsi      # 0x122cc
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0x10923
leaq 0x1b5d(%rip), %rsi      # 0x122d6
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0x10946
leaq 0x1b57(%rip), %rsi      # 0x122e7
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0x10971
leaq 0x1b4f(%rip), %rsi      # 0x122f6
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0x109ad
leaq 0x1b3e(%rip), %rsi      # 0x122fc
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0x109cb
leaq 0x1b31(%rip), %rsi      # 0x12306
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0x109e4
leaq 0x1b14(%rip), %rsi      # 0x12300
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0x109f8
leaq 0x1b0c(%rip), %rsi      # 0x1230f
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0x10a11
leaq 0x1b00(%rip), %rsi      # 0x1231a
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0x10a51
leaq 0x1af5(%rip), %rsi      # 0x12326
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
je 0x10a68
leaq 0x1ae5(%rip), %rsi      # 0x1232d
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
jne 0x10abb
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0xfc64
jmp 0x1099c
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0x734e
jmp 0x1099c
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
movl 0x4c(%rsp), %r8d
movl 0x48(%rsp), %r9d
callq 0x74a4
jmp 0x1099c
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0x779e
jmp 0x1099c
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0x7958
jmp 0x1099c
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
movl 0x24(%rsp), %r8d
callq 0x7b94
jmp 0x1099c
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0x7f50
jmp 0x1099c
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
movl 0x24(%rsp), %r8d
movq 0x28(%rsp), %r9
callq 0x80fe
jmp 0x1099c
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
movl 0x24(%rsp), %r8d
movq 0x28(%rsp), %r9
pushq 0x50(%rsp)
pushq 0x60(%rsp)
callq 0x9ac6
jmp 0x10998
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
movl 0x24(%rsp), %r8d
movl 0x44(%rsp), %r9d
pushq $0x1
pushq 0x30(%rsp)
callq 0xa2a2
addq $0x10, %rsp
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
movl 0x40(%rsp), %r8d
callq 0xaba4
jmp 0x1099c
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0xb626
jmp 0x1099c
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %esi
movl 0x8(%rsp), %edx
callq 0xbf9e
jmp 0x1099c
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0xc854
jmp 0x1099c
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
movss 0x38(%rsp), %xmm0
movss 0x34(%rsp), %xmm1
movss 0x3c(%rsp), %xmm2
movl 0x24(%rsp), %r8d
movq 0x28(%rsp), %r9
pushq 0x50(%rsp)
pushq 0x60(%rsp)
callq 0xd32e
jmp 0x10998
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0xe0ca
jmp 0x1099c
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0xfbec
jmp 0x1099c
movq 0x5565(%rip), %rbx      # 0x15ff0
leaq 0x17e2(%rip), %rsi      # 0x12274
movl $0x13, %edx
movq %rbx, %rdi
callq 0x21b0
movq (%r14,%r13,8), %rsi
movq %rbx, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20a0
movq (%r14), %rdi
callq 0xfec9
movq 0x550e(%rip), %rbx      # 0x15fd0
leaq 0x186d(%rip), %rsi      # 0x12336
movl $0x25, %edx
movq %rbx, %rdi
callq 0x21b0
movq %rbx, %rdi
jmp 0x10aae
nop