// File: /workspace/github_cpp_makefile_star2_O3/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 0x10b6f
movl %edi, %r13d
movl $0x200, 0x8(%rsp)       # imm = 0x200
movl $0x3, 0x24(%rsp)
movl $0x5, 0x44(%rsp)
movl $0x14, %eax
movq %rax, 0x58(%rsp)
movss 0x1293(%rip), %xmm0     # 0x116bc
movss %xmm0, 0x38(%rsp)
movss 0x1289(%rip), %xmm0     # 0x116c0
movss %xmm0, 0x34(%rsp)
movss 0x127f(%rip), %xmm0     # 0x116c4
movss %xmm0, 0x3c(%rsp)
movl $0x2bc, 0x48(%rsp)      # imm = 0x2BC
movl $0x6, %eax
movq %rax, 0x50(%rsp)
movl $0xa, 0x40(%rsp)
leaq 0x1dde(%rip), %rax      # 0x1224a
movq %rax, 0x60(%rsp)
leaq 0x1dde(%rip), %rax      # 0x12256
movq %rax, 0x10(%rsp)
leaq 0x1de8(%rip), %rax      # 0x1226c
movq %rax, 0x18(%rsp)
movl $0x1, %ebp
leaq 0x1df0(%rip), %r15      # 0x12285
movl $0x2bc, 0x4c(%rsp)      # imm = 0x2BC
movl $0x1, %eax
movq %rax, 0x28(%rsp)
movl $0x200, 0xc(%rsp)       # imm = 0x200
movslq %ebp, %rbx
movq (%r14,%rbx,8), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x21f0
testl %eax, %eax
je 0x10650
cmpb $0x2d, (%r12)
jne 0x10520
cmpb $0x69, 0x1(%r12)
jne 0x104e4
cmpb $0x0, 0x2(%r12)
je 0x106a0
cmpb $0x6f, 0x1(%r12)
jne 0x104f8
cmpb $0x0, 0x2(%r12)
je 0x106b1
cmpb $0x77, 0x1(%r12)
jne 0x1050c
cmpb $0x0, 0x2(%r12)
je 0x106d7
cmpb $0x68, 0x1(%r12)
jne 0x10520
cmpb $0x0, 0x2(%r12)
je 0x106ec
movq %r12, %rdi
leaq 0x1d61(%rip), %rsi      # 0x1228b
callq 0x21f0
testl %eax, %eax
je 0x10661
movq %r12, %rdi
leaq 0x1d4e(%rip), %rsi      # 0x1228f
callq 0x21f0
testl %eax, %eax
je 0x10676
movq %r12, %rdi
leaq 0x1d3b(%rip), %rsi      # 0x12293
callq 0x21f0
testl %eax, %eax
je 0x1068b
movq %r12, %rdi
leaq 0x1d28(%rip), %rsi      # 0x12297
callq 0x21f0
testl %eax, %eax
je 0x106c2
movq %r12, %rdi
leaq 0x1d15(%rip), %rsi      # 0x1229b
callq 0x21f0
testl %eax, %eax
je 0x106fe
movq %r12, %rdi
leaq 0x1d05(%rip), %rsi      # 0x122a2
callq 0x21f0
testl %eax, %eax
je 0x10711
movq %r12, %rdi
leaq 0x1cf9(%rip), %rsi      # 0x122ad
callq 0x21f0
testl %eax, %eax
je 0x10724
movq %r12, %rdi
leaq 0x1ce8(%rip), %rsi      # 0x122b3
callq 0x21f0
testl %eax, %eax
je 0x10737
movq %r12, %rdi
leaq 0x1cd7(%rip), %rsi      # 0x122b9
callq 0x21f0
testl %eax, %eax
je 0x10749
movq %r12, %rdi
leaq 0x1cc8(%rip), %rsi      # 0x122c1
callq 0x21f0
testl %eax, %eax
je 0x1074d
movq %r12, %rdi
leaq 0x1cb6(%rip), %rsi      # 0x122c6
callq 0x21f0
testl %eax, %eax
je 0x10766
movq %r12, %rdi
leaq 0x1ca8(%rip), %rsi      # 0x122cf
callq 0x21f0
testl %eax, %eax
jne 0x10b40
leal 0x1(%rbx), %ebp
movq 0x8(%r14,%rbx,8), %rdi
callq 0x21d0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x3c(%rsp)
jmp 0x1077d
incl %ebp
movq 0x8(%r14,%rbx,8), %rax
movq %rax, 0x60(%rsp)
jmp 0x1077d
incl %ebp
movq 0x8(%r14,%rbx,8), %rdi
callq 0x2230
movl %eax, 0x4c(%rsp)
jmp 0x1077d
incl %ebp
movq 0x8(%r14,%rbx,8), %rdi
callq 0x2230
movl %eax, 0x48(%rsp)
jmp 0x1077d
incl %ebp
movq 0x8(%r14,%rbx,8), %rdi
callq 0x2230
movl %eax, 0x24(%rsp)
jmp 0x1077d
incl %ebp
movq 0x8(%r14,%rbx,8), %rax
movq %rax, 0x10(%rsp)
jmp 0x1077d
incl %ebp
movq 0x8(%r14,%rbx,8), %rax
movq %rax, 0x18(%rsp)
jmp 0x1077d
incl %ebp
movq 0x8(%r14,%rbx,8), %rdi
callq 0x2230
movl %eax, 0x44(%rsp)
jmp 0x1077d
incl %ebp
movq 0x8(%r14,%rbx,8), %rdi
callq 0x2230
movl %eax, 0xc(%rsp)
jmp 0x1077d
incl %ebp
movq 0x8(%r14,%rbx,8), %rdi
callq 0x2230
movl %eax, 0x8(%rsp)
jmp 0x1077d
incl %ebp
movq 0x8(%r14,%rbx,8), %rdi
callq 0x2230
movq %rax, 0x28(%rsp)
jmp 0x1077d
incl %ebp
movq 0x8(%r14,%rbx,8), %rdi
callq 0x2230
movq %rax, 0x58(%rsp)
jmp 0x1077d
incl %ebp
movq 0x8(%r14,%rbx,8), %rdi
callq 0x2230
movq %rax, 0x50(%rsp)
jmp 0x1077d
incl %ebp
movq 0x8(%r14,%rbx,8), %rdi
callq 0x2230
movl %eax, 0x40(%rsp)
jmp 0x1077d
incl %ebp
jmp 0x1077d
leal 0x1(%rbx), %ebp
movq 0x8(%r14,%rbx,8), %rdi
callq 0x21d0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x38(%rsp)
jmp 0x1077d
leal 0x1(%rbx), %ebp
movq 0x8(%r14,%rbx,8), %rdi
callq 0x21d0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x34(%rsp)
incl %ebp
cmpl %r13d, %ebp
jl 0x104af
leaq 0x1abb(%rip), %rsi      # 0x1224a
movq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x21f0
testl %eax, %eax
je 0x1092b
leaq 0x1b3d(%rip), %rsi      # 0x122e8
movq %rbx, %rdi
callq 0x21f0
testl %eax, %eax
je 0x10947
leaq 0x1b33(%rip), %rsi      # 0x122f5
movq %rbx, %rdi
callq 0x21f0
testl %eax, %eax
je 0x1096d
leaq 0x1b28(%rip), %rsi      # 0x12301
movq %rbx, %rdi
callq 0x21f0
testl %eax, %eax
je 0x10989
leaq 0x1b1c(%rip), %rsi      # 0x1230c
movq %rbx, %rdi
callq 0x21f0
testl %eax, %eax
je 0x109a5
leaq 0x1b16(%rip), %rsi      # 0x1231d
movq %rbx, %rdi
callq 0x21f0
testl %eax, %eax
je 0x109c6
leaq 0x1b0e(%rip), %rsi      # 0x1232c
movq %rbx, %rdi
callq 0x21f0
testl %eax, %eax
je 0x109df
leaq 0x1b01(%rip), %rsi      # 0x12336
movq %rbx, %rdi
callq 0x21f0
testl %eax, %eax
je 0x10a02
leaq 0x1afb(%rip), %rsi      # 0x12347
movq %rbx, %rdi
callq 0x21f0
testl %eax, %eax
je 0x10a2d
leaq 0x1af3(%rip), %rsi      # 0x12356
movq %rbx, %rdi
callq 0x21f0
testl %eax, %eax
je 0x10a69
leaq 0x1ae2(%rip), %rsi      # 0x1235c
movq %rbx, %rdi
callq 0x21f0
testl %eax, %eax
je 0x10a87
leaq 0x1ad5(%rip), %rsi      # 0x12366
movq %rbx, %rdi
callq 0x21f0
testl %eax, %eax
je 0x10aa0
leaq 0x1ab8(%rip), %rsi      # 0x12360
movq %rbx, %rdi
callq 0x21f0
testl %eax, %eax
je 0x10ab4
leaq 0x1ab0(%rip), %rsi      # 0x1236f
movq %rbx, %rdi
callq 0x21f0
testl %eax, %eax
je 0x10acd
leaq 0x1aa4(%rip), %rsi      # 0x1237a
movq %rbx, %rdi
callq 0x21f0
testl %eax, %eax
je 0x10b0d
leaq 0x1a99(%rip), %rsi      # 0x12386
movq %rbx, %rdi
callq 0x21f0
testl %eax, %eax
je 0x10b24
leaq 0x1a89(%rip), %rsi      # 0x1238d
movq %rbx, %rdi
callq 0x21f0
testl %eax, %eax
jne 0x10b77
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0xfd44
jmp 0x10a58
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0x72b2
jmp 0x10a58
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 0x7408
jmp 0x10a58
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0x7702
jmp 0x10a58
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0x78bc
jmp 0x10a58
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
movl 0x24(%rsp), %r8d
callq 0x7af8
jmp 0x10a58
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0x8018
jmp 0x10a58
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 0x81ba
jmp 0x10a58
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 0x9b68
jmp 0x10a54
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 0xa372
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 0xac88
jmp 0x10a58
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0xb69a
jmp 0x10a58
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %esi
movl 0x8(%rsp), %edx
callq 0xc0d0
jmp 0x10a58
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0xc9a0
jmp 0x10a58
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 0xd316
jmp 0x10a54
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0xe0d0
jmp 0x10a58
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0xfccc
jmp 0x10a58
movq 0x54a9(%rip), %r15      # 0x15ff0
leaq 0x1786(%rip), %rsi      # 0x122d4
movl $0x13, %edx
movq %r15, %rdi
callq 0x21a0
movq (%r14,%rbx,8), %rsi
movq %r15, %rdi
callq 0x2160
movq %rax, %rdi
callq 0x20a0
movq (%r14), %rdi
callq 0xff9f
movq 0x5452(%rip), %rbx      # 0x15fd0
leaq 0x1811(%rip), %rsi      # 0x12396
movl $0x25, %edx
movq %rbx, %rdi
callq 0x21a0
movq %rbx, %rdi
jmp 0x10b6a
nop