// File: /workspace/github_cpp_makefile_star2_O1/kebwi[P]Trifid/src/ImageProcs.cpp
// Function: denoiseGrayImage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void denoiseGrayImage(string filename, string manualShrinkageThresholdStr)
{
	cout << "Denoising gray image..." << endl;
	
	//Open the image
	ImageReal grayImage;
	grayImage.readFile(filename);
	
	//Construct a steerable pyramid of the image
	SteerablePyramid steerPyr;
	steerPyr.DoFullWaveletAnalysis(grayImage.img(), grayImage.width(), grayImage.height(), true);
	
	if (gGenerateIntermediateImages)
		steerPyr.GeneratePGMimages(grayImage.filename().c_str());
	
	int numLevels = steerPyr.NumLevels();
	cout << "Steerable pyramid will be built with " << numLevels << " levels" << endl;
	if (gManualShrinkageThresholds[0].size() != numLevels + 1)
		gManualShrinkageThresholds[0].resize(numLevels + 1);
	cout << "Thresholds:" << endl;
	cout << "  H:  " << setw(10) << gManualShrinkageThresholds[0][0] << endl;
	cout << "  B:  ";
	for (int i = 1; i < gManualShrinkageThresholds[0].size(); i++)
		cout << setw(10) << gManualShrinkageThresholds[0][i];
	cout << endl << endl;
	
	//Shrink the coefficients
	steerPyr.SoftThreshold(gManualShrinkageThresholds[0]);
	
	if (gGenerateIntermediateImages)
	{
		string s = grayImage.filename() + "_sk";
		steerPyr.GeneratePGMimages(s.c_str());
	}
	
	//Synthesize the steerable pyramid
	ImageReal grayImageShrunk(grayImage.width(), grayImage.height());
	steerPyr.DoFullWaveletSynthesis(grayImageShrunk.img());
	/*
	stringstream denoiseParamSS;
	denoiseParamSS << "_";
	for (int c = 0; c < 3; c++)
	{
		if (c == 0)
			denoiseParamSS << "R";
		else if (c == 1)
			denoiseParamSS << "G";
		else denoiseParamSS << "B";
		
		denoiseParamSS << gManualShrinkageThresholds[c][0];
		for (int i = 1; i < gManualShrinkageThresholds[c].size(); i++)
			denoiseParamSS << "," << gManualShrinkageThresholds[c][i];
	}
	*/
	grayImageShrunk.setFilename(grayImage.filename());
	grayImageShrunk.appendFilename("_dn");
	grayImageShrunk.appendFilename(manualShrinkageThresholdStr);
	grayImageShrunk.writeFile(1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rsi, %rbx
movq %rdi, %r14
movq 0x1f03d(%rip), %r15     # 0x36fd0
leaq 0x15a51(%rip), %rsi     # 0x2d9eb
movl $0x17, %edx
movq %r15, %rdi
callq 0x3360
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x32e0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31f0
leaq 0x78(%rsp), %rdi
callq 0xcfd0
leaq 0x108(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0xf8(%rsp), %rdi
callq 0xa97e
leaq 0x78(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0xd69c
movq 0xf8(%rsp), %rdi
cmpq %r15, %rdi
je 0x1802a
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x3310
leaq 0x118(%rsp), %rdi
callq 0x1afc0
movq 0xb0(%rsp), %rsi
movl 0xa0(%rsp), %edx
movl 0xa4(%rsp), %ecx
leaq 0x118(%rsp), %rdi
movl $0x1, %r8d
callq 0x1db64
leaq 0x1f48a(%rip), %r15     # 0x374f1
cmpb $0x1, (%r15)
jne 0x180bc
leaq 0x30(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %rdi
callq 0xa97e
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdi
callq 0x1f6b0
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x180bc
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3310
leaq 0x118(%rsp), %rdi
callq 0x1c844
movl %eax, %ebp
movq 0x1eefe(%rip), %rdi     # 0x36fd0
leaq 0x1592a(%rip), %rsi     # 0x2da03
movl $0x25, %edx
callq 0x3360
movq 0x1eee6(%rip), %rdi     # 0x36fd0
movl %ebp, %esi
callq 0x34e0
movq %rax, %r14
leaq 0x1592e(%rip), %rsi     # 0x2da29
movl $0x7, %edx
movq %rax, %rdi
callq 0x3360
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x32e0
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31f0
leaq 0x1f41a(%rip), %r12     # 0x37550
movq 0x8(%r12), %rax
subq (%r12), %rax
sarq $0x3, %rax
incl %ebp
movslq %ebp, %rsi
cmpq %rsi, %rax
je 0x18159
leaq 0x1f3fc(%rip), %rdi     # 0x37550
callq 0xa084
movq 0x1ee70(%rip), %r14     # 0x36fd0
leaq 0x158ca(%rip), %rsi     # 0x2da31
movl $0xb, %edx
movq %r14, %rdi
callq 0x3360
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x32e0
movsbl %al, %esi
movq 0x1ee3e(%rip), %rdi     # 0x36fd0
callq 0x3040
movq %rax, %rdi
callq 0x31f0
movq 0x1ee2a(%rip), %r14     # 0x36fd0
leaq 0x158d0(%rip), %rsi     # 0x2da7d
movl $0x6, %edx
movq %r14, %rdi
callq 0x3360
movq (%r14), %rax
movq -0x18(%rax), %rax
movq $0xa, 0x10(%r14,%rax)
movq (%r12), %rax
movsd (%rax), %xmm0
movq %r14, %rdi
callq 0x3480
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x32e0
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31f0
movq 0x1edc5(%rip), %r14     # 0x36fd0
leaq 0x15874(%rip), %rsi     # 0x2da86
movl $0x6, %edx
movq %r14, %rdi
callq 0x3360
movq (%r12), %rax
movq 0x8(%r12), %rcx
subq %rax, %rcx
cmpq $0x9, %rcx
jb 0x1826d
movl $0x1, %r13d
movq (%r14), %rcx
movq -0x18(%rcx), %rcx
movq $0xa, 0x10(%r14,%rcx)
movsd (%rax,%r13,8), %xmm0
movq %r14, %rdi
callq 0x3480
incq %r13
movq (%r12), %rax
movq 0x8(%r12), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r13, %rcx
ja 0x18237
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x32e0
movsbl %al, %esi
movq 0x1ed45(%rip), %rdi     # 0x36fd0
callq 0x3040
movq %rax, %rdi
callq 0x31f0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x32e0
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31f0
leaq 0x1f287(%rip), %rsi     # 0x37550
leaq 0x60(%rsp), %rdi
callq 0x121b2
leaq 0x118(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x1eab2
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x182fc
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x3310
cmpb $0x1, (%r15)
leaq 0x10(%rsp), %r14
jne 0x183bd
movq %rsp, %rdi
movq %r14, (%rdi)
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
addq %rsi, %rdx
callq 0xa97e
leaq 0x1576b(%rip), %rsi     # 0x2da9b
movq %rsp, %rdi
callq 0x3540
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1835f
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x18366
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x28(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x18394
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3310
movq 0x20(%rsp), %rsi
leaq 0x118(%rsp), %rdi
callq 0x1f6b0
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x183bd
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3310
movl 0xa0(%rsp), %esi
movl 0xa4(%rsp), %edx
leaq 0x20(%rsp), %rdi
callq 0xd07e
movq 0x58(%rsp), %rsi
leaq 0x118(%rsp), %rdi
callq 0x1e5f8
leaq 0xe8(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
addq %rsi, %rdx
leaq 0xd8(%rsp), %rdi
callq 0xa97e
leaq 0x20(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0xcf04
movq 0xd8(%rsp), %rdi
cmpq %r15, %rdi
je 0x18442
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x3310
movq %rsp, %rdi
movq %r14, (%rdi)
leaq 0x155ee(%rip), %rsi     # 0x2da3d
leaq 0x155ea(%rip), %rdx     # 0x2da40
callq 0xaa0e
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0xcf1e
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x1847e
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3310
leaq 0xc8(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0xb8(%rsp), %rdi
callq 0xa97e
leaq 0x20(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0xcf1e
movq 0xb8(%rsp), %rdi
cmpq %r14, %rdi
je 0x184d0
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x3310
leaq 0x168(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movl $0x1, %edx
callq 0xdabe
leaq 0x178(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18508
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x3310
leaq 0x20(%rsp), %rdi
callq 0xd0fc
leaq 0x118(%rsp), %rdi
callq 0x1b33a
leaq 0x78(%rsp), %rdi
callq 0xd0fc
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
jne 0x1857a
jmp 0x18639
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x18639
movq 0x10(%rsp), %rsi
jmp 0x1857f
jmp 0x18636
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x18639
movq 0x30(%rsp), %rsi
incq %rsi
jmp 0x185f3
jmp 0x18636
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
cmpq %r14, %rdi
je 0x18628
movq 0xc8(%rsp), %rsi
jmp 0x185d2
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x18628
movq 0x10(%rsp), %rsi
jmp 0x185d2
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
cmpq %r15, %rdi
je 0x18628
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x3310
jmp 0x18628
jmp 0x18636
movq %rax, %rbx
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x18639
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x3310
jmp 0x18639
jmp 0x18636
jmp 0x18620
movq %rax, %rbx
movq 0xf8(%rsp), %rdi
cmpq %r15, %rdi
je 0x18646
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x3310
jmp 0x18646
movq %rax, %rbx
jmp 0x18646
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xd0fc
jmp 0x18639
jmp 0x18636
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x1b33a
leaq 0x78(%rsp), %rdi
callq 0xd0fc
movq %rbx, %rdi
callq 0x3500