LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::color_to_bw(char const*, char const*, int, int)
void ImageProc::color_to_bw(const char *infile, const char *outfile, int width, int height)
{
	Image img_color("color", width, height);	//object for input color image
	Image img_bw("bw", width, height);			//object for output b-&-w image

	img_color.read_image(infile, img_color.cols, img_color.rows);	//reading input image from file

	for(int i = 0; i < img_bw.rows; i++)
		for(int j = 0; j < img_bw.cols; j++)
			for(int k = 0; k < img_bw.channels; k++)
				img_bw.setvalue(i,j,k,((img_color.getvalue(i,j,0)*0.21)\
									  +(img_color.getvalue(i,j,1)*0.72)\
									  +(img_color.getvalue(i,j,2)*0.07))); //using Luminosity formula: grayscale_value = 0.21*R + 0.72*G + 0.07*B

	img_bw.write_image(outfile, img_bw.cols, img_bw.rows);	//writing image to output file
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, 0x8(%rsp)
movq %rdi, %r15
leaq 0xa3f4(%rip), %rsi      # 0x116c8
leaq 0x38(%rsp), %r12
movq %r12, %rdi
callq 0x4c56
leaq 0xaf6b(%rip), %rsi      # 0x12253
leaq 0x18(%rsp), %r13
movq %r13, %rdi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x4c56
movl 0x8(%r12), %eax
movl %eax, 0x4(%rsp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x4cb2
movslq 0xc(%r13), %rax
movq %rax, 0x10(%rsp)
testq %rax, %rax
jle 0x73ea
movl 0x20(%rsp), %ecx
movl 0x28(%rsp), %edx
movq 0x50(%rsp), %rsi
movl 0x48(%rsp), %edi
movq 0x30(%rsp), %r8
movl %ecx, %r9d
imull %edx, %r9d
xorl %r10d, %r10d
movsd 0xa150(%rip), %xmm0     # 0x11498
movsd 0xa150(%rip), %xmm1     # 0x114a0
movsd 0xa150(%rip), %xmm2     # 0x114a8
xorl %r11d, %r11d
testl %ecx, %ecx
jle 0x73d9
movl 0x4(%rsp), %eax
movl %eax, %r14d
imull %r11d, %r14d
movl %r10d, %r15d
xorl %r12d, %r12d
testl %edx, %edx
jle 0x73ce
movslq %r15d, %r13
addq %r8, %r13
leal (%r14,%r12), %ebx
imull %edi, %ebx
movslq %ebx, %rbx
xorl %ebp, %ebp
movzbl (%rsi,%rbx), %eax
xorps %xmm3, %xmm3
cvtsi2sd %eax, %xmm3
movzbl 0x1(%rsi,%rbx), %eax
xorps %xmm4, %xmm4
cvtsi2sd %eax, %xmm4
mulsd %xmm0, %xmm4
mulsd %xmm1, %xmm3
addsd %xmm4, %xmm3
movzbl 0x2(%rsi,%rbx), %eax
xorps %xmm4, %xmm4
cvtsi2sd %eax, %xmm4
mulsd %xmm2, %xmm4
addsd %xmm3, %xmm4
cvttsd2si %xmm4, %eax
movb %al, (%r13,%rbp)
incq %rbp
cmpq %rbp, %rdx
jne 0x7386
incq %r12
addl %edx, %r15d
cmpq %rcx, %r12
jne 0x7370
incq %r11
addl %r9d, %r10d
cmpq 0x10(%rsp), %r11
jne 0x735b
leaq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x4dee
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::oil_painting(char const*, char const*, int, int, int)
void ImageProc::oil_painting(const char *infile, const char *outfile, int width, int height, int window_size)
{
	Image img_orig("color", width, height);
	Image img_oil("color", width, height);

	img_orig.read_image(infile, img_orig.cols, img_orig.rows);
	oil_paint_filter(img_orig, img_oil, window_size);

	img_oil.write_image(outfile, img_oil.cols, img_oil.rows);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r8d, 0xc(%rsp)
movl %ecx, %r14d
movl %edx, %r15d
movq %rsi, 0x10(%rsp)
movq %rdi, %r12
leaq 0x9ba8(%rip), %r13      # 0x116c8
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4c56
leaq 0x18(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
movl %r15d, %edx
movl %r14d, %ecx
callq 0x4c56
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4cb2
movq %rbx, %rdi
movq %rbp, %rsi
movl 0xc(%rsp), %edx
callq 0x7b7c
movq %rbp, %rdi
movq 0x10(%rsp), %rsi
callq 0x4dee
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::film_special_effect(char const*, char const*, int, int)
void ImageProc::film_special_effect(const char *infile, const char *outfile, int width, int height)
{
	Image img_orig("color", width, height);
	Image img_film("color", width, height);

	img_orig.read_image(infile, img_orig.cols, img_orig.rows);
	film_effect_filter(img_orig, img_film);

	img_film.write_image(outfile, img_film.cols, img_film.rows);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, (%rsp)
movq %rdi, %r15
leaq 0x968f(%rip), %r12      # 0x116c8
leaq 0x28(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x4c56
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x4c56
movq %r13, %rdi
movq %r15, %rsi
callq 0x4cb2
movq %r13, %rdi
movq %rbx, %rsi
callq 0x8090
movq %rbx, %rdi
movq (%rsp), %rsi
callq 0x4dee
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::film_effect_filter(Image&, Image&)
void ImageProc::film_effect_filter(Image &img_orig, Image &img_modified)
{
	for(int i = 0; i < img_modified.rows; i++)
		for(int j = 0; j < img_modified.cols; j++)
			for(int k = 0; k < img_modified.channels; k++)
			{
				img_modified.setvalue(i,j,k,(255-img_orig.getvalue(i,(img_orig.cols-j),k)));
			}

	int gmax[3] = {255,205,180};
	int gmin[3] = { 80, 30, 20};
	float scaling_factor[3];
	for(int i = 0; i < 3; i++)
		scaling_factor[i] = (gmax[i]-gmin[i]) / 255.0;
	for(int i = 0; i < img_modified.rows; i++)
		for(int j = 0; j < img_modified.cols; j++)
			for(int k = 0; k < img_modified.channels; k++)
			{
				img_modified.setvalue(i,j,k,((img_modified.getvalue(i,j,k)
											  * scaling_factor[k])
											  + gmin[k]));
			}
}

// Assembly:
movl 0xc(%rsi), %edx
testl %edx, %edx
jle 0x81b8
pushq %rbx
movl 0x8(%rsi), %r8d
xorl %eax, %eax
movl $0x1, %ecx
testl %r8d, %r8d
jle 0x8110
movl 0x10(%rsi), %r10d
xorl %edx, %edx
xorl %r9d, %r9d
testl %r10d, %r10d
jle 0x8103
xorl %r8d, %r8d
movl 0x8(%rdi), %r11d
imull %ecx, %r11d
addl %edx, %r11d
imull 0x10(%rdi), %r11d
movslq %r11d, %r11
addq 0x18(%rdi), %r11
movb (%r8,%r11), %r11b
notb %r11b
movl 0x8(%rsi), %ebx
imull %eax, %ebx
addl %r9d, %ebx
imull %r10d, %ebx
movslq %ebx, %r10
addq 0x18(%rsi), %r10
movb %r11b, (%r8,%r10)
movl 0x10(%rsi), %r10d
incq %r8
cmpl %r10d, %r8d
jl 0x80bd
movl 0x8(%rsi), %r8d
incl %r9d
decl %edx
cmpl %r8d, %r9d
jl 0x80b5
movl 0xc(%rsi), %edx
incl %eax
incl %ecx
cmpl %edx, %eax
jl 0x80a7
movsd 0x94b0(%rip), %xmm0     # 0x115d0
movsd %xmm0, -0x10(%rsp)
movl $0x3f20a0a1, -0x8(%rsp) # imm = 0x3F20A0A1
testl %edx, %edx
jle 0x81b7
movl 0x8(%rsi), %edi
xorl %eax, %eax
leaq 0x954e(%rip), %rcx      # 0x11690
testl %edi, %edi
jle 0x81b1
movl 0x10(%rsi), %r8d
xorl %edx, %edx
testl %r8d, %r8d
jle 0x81a8
movq %rcx, %rdi
xorl %r9d, %r9d
movl 0x8(%rsi), %r10d
imull %eax, %r10d
addl %edx, %r10d
imull %r8d, %r10d
movslq %r10d, %r8
addq 0x18(%rsi), %r8
movzbl (%r9,%r8), %r10d
xorps %xmm0, %xmm0
cvtsi2ss %r10d, %xmm0
xorps %xmm1, %xmm1
cvtsi2ssl (%rdi), %xmm1
mulss -0x10(%rsp,%r9,4), %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %r10d
movb %r10b, (%r9,%r8)
incq %r9
movslq 0x10(%rsi), %r8
addq $0x4, %rdi
cmpq %r8, %r9
jl 0x8157
movl 0x8(%rsi), %edi
incl %edx
cmpl %edi, %edx
jl 0x814c
movl 0xc(%rsi), %edx
incl %eax
cmpl %edx, %eax
jl 0x8142
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::mergesort(int*, int, int)
void ImageProc::mergesort(int *a, int low, int high)
{
	int mid;
	if (low < high)
	{
		mid = (low + high) / 2;
		mergesort(a, low, mid);
		mergesort(a, mid + 1, high);
		merge(a, low, high, mid);
	}
	return;
}

// Assembly:
cmpl %edx, %esi
jge 0x990d
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %r14d
movq %rdi, %r15
leal (%rbx,%r14), %eax
movl %eax, %r12d
shrl $0x1f, %r12d
addl %eax, %r12d
sarl %r12d
movl %r12d, %edx
callq 0x98b6
leal 0x1(%r12), %esi
movq %r15, %rdi
movl %ebx, %edx
callq 0x98b6
movq %r15, %rdi
movl %r14d, %esi
movl %ebx, %edx
movl %r12d, %ecx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x9a5a
retq
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::get_median(int*, int)
int ImageProc::get_median(int *sorted_array, int size)
{
	// Middle or average of middle values in the sorted array.
	int median = 0.0;
	if ((size % 2) == 0) {
		median = (int)((sorted_array[size / 2] + sorted_array[(size / 2) - 1]) / 2.0);
	}
	else {
		median = sorted_array[size / 2];
	}

	return median;
}

// Assembly:
testb $0x1, %sil
jne 0x9931
sarl %esi
movslq %esi, %rax
movl -0x4(%rdi,%rax,4), %ecx
addl (%rdi,%rax,4), %ecx
cvtsi2sd %ecx, %xmm0
mulsd 0x77fc(%rip), %xmm0     # 0x11128
cvttsd2si %xmm0, %eax
retq
movl %esi, %eax
shrl $0x1f, %eax
addl %esi, %eax
sarl %eax
cltq
movl (%rdi,%rax,4), %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::get_MSE(Image&, Image&)
float ImageProc::get_MSE(Image &img_orig, Image &img_modified)
{
	float sum = 0.0, MSE;
	for(int i = 0; i < img_orig.rows; i++)
		for(int j = 0; j < img_orig.cols; j++)
			sum += pow((img_modified.getvalue(i,j,0) - img_orig.getvalue(i,j,0)),2);

	MSE = sum / (img_modified.rows * img_modified.cols);
	std::cout << MSE << std::endl;
	return MSE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movslq 0xc(%rdi), %rax
movq %rax, (%rsp)
testq %rax, %rax
jle 0x99ee
movl 0x8(%rdi), %edx
movl 0x10(%rdi), %r8d
movq 0x18(%rsi), %r9
movl 0x8(%rsi), %r11d
movq %rsi, 0x10(%rsp)
movl 0x10(%rsi), %r10d
movq 0x18(%rdi), %rdi
movl %r11d, 0xc(%rsp)
imull %r10d, %r11d
movl %edx, %ebx
imull %r8d, %ebx
xorps %xmm1, %xmm1
xorl %r14d, %r14d
xorl %ebp, %ebp
xorl %r15d, %r15d
movq %rdx, %r12
movl %r14d, %r13d
movl %ebp, %eax
testl %edx, %edx
jle 0x99d4
cltq
movzbl (%r9,%rax), %esi
movslq %r13d, %r13
movzbl (%rdi,%r13), %ecx
subl %ecx, %esi
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
mulsd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
addsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm1
addl %r10d, %eax
addl %r8d, %r13d
decq %r12
jne 0x99a1
incq %r15
addl %r11d, %ebp
addl %ebx, %r14d
cmpq (%rsp), %r15
jne 0x9995
movq 0x10(%rsp), %rsi
movl 0xc(%rsp), %eax
jmp 0x99f4
movl 0x8(%rsi), %eax
xorps %xmm1, %xmm1
imull 0xc(%rsi), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
divss %xmm0, %xmm1
movss %xmm1, (%rsp)
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movq 0xc5ba(%rip), %rdi      # 0x15fd0
callq 0x2250
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20d0
movss (%rsp), %xmm0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::merge(int*, int, int, int)
void ImageProc::merge(int *a, int low, int high, int mid)
{
	int i, j, k, c[50];
	i = low;
	k = low;
	j = mid + 1;
	while (i <= mid && j <= high)
	{
		if (a[i] < a[j])
		{
			c[k] = a[i];
			k++;	i++;
		}
		else
		{
			c[k] = a[j];
			k++;	j++;
		}
	}
	while (i <= mid)
	{
		c[k] = a[i];
		k++;	i++;
	}
	while (j <= high)
	{
		c[k] = a[j];
		k++;	j++;
	}
	for (i = low; i < k; i++)
	{
		a[i] = c[i];
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %ecx, %r12d
movl %edx, %r15d
movl %esi, %ebx
movq %rdi, %r14
leal 0x1(%r12), %ebp
cmpl %ecx, %esi
setg %al
cmpl %edx, %ecx
setge %cl
orb %al, %cl
movslq %esi, %r13
jne 0x9ad3
leaq (%rsp,%r13,4), %rdx
addq $0x10, %rdx
movl %ebx, %eax
movl %ebx, %ecx
movslq %ecx, %rcx
movl (%r14,%rcx,4), %esi
movslq %ebp, %rbp
movl (%r14,%rbp,4), %edi
xorl %r8d, %r8d
xorl %r9d, %r9d
cmpl %edi, %esi
setge %r8b
setl %r9b
cmovll %esi, %edi
addl %r9d, %ecx
addl %r8d, %ebp
movl %edi, (%rdx)
incl %eax
cmpl %r12d, %ecx
jg 0x9ad7
addq $0x4, %rdx
cmpl %r15d, %ebp
jle 0x9a98
jmp 0x9ad7
movl %ebx, %ecx
movl %ebx, %eax
subl %ecx, %r12d
jl 0x9b0b
movq %r13, 0x8(%rsp)
movslq %eax, %r13
leaq (%rsp,%r13,4), %rdi
addq $0x10, %rdi
movslq %ecx, %rax
leaq (%r14,%rax,4), %rsi
leaq 0x4(,%r12,4), %rdx
callq 0x20f0
leal (%r12,%r13), %eax
incl %eax
movq 0x8(%rsp), %r13
subl %ebp, %r15d
jl 0x9b35
movslq %eax, %r12
leaq (%rsp,%r12,4), %rdi
addq $0x10, %rdi
movslq %ebp, %rax
leaq (%r14,%rax,4), %rsi
leaq 0x4(,%r15,4), %rdx
callq 0x20f0
leal (%r12,%r15), %eax
incl %eax
cmpl %ebx, %eax
jle 0x9b56
leaq (%r14,%r13,4), %rdi
leaq (%rsp,%r13,4), %rsi
addq $0x10, %rsi
notl %ebx
addl %ebx, %eax
leaq 0x4(,%rax,4), %rdx
callq 0x20f0
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::apply_non_local_mean(char const*, char const*, int, int, int, int, int, int)
void ImageProc::apply_non_local_mean(const char *infile, const char *outfile, int width, int height, int window_size, int region_size, int sigma, int h)
{
	Image img_orig("color", width, height);
	Image img_modified("color", width, height);
	img_orig.read_image(infile, img_orig.cols, img_orig.rows);

	non_local_mean(img_orig, img_modified, window_size, region_size, sigma, h);

	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 $0x58, %rsp
movl %r9d, 0xc(%rsp)
movl %r8d, 0x8(%rsp)
movl %ecx, %r15d
movl %edx, %r12d
movq %rsi, 0x10(%rsp)
movq %rdi, %r13
leaq 0x7329(%rip), %rbx      # 0x116c8
leaq 0x38(%rsp), %rbp
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x4c56
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movl %r12d, %edx
movl %r15d, %ecx
callq 0x4c56
movq %rbp, %rdi
movq %r13, %rsi
callq 0x4cb2
movq %rbp, %rdi
movq %r14, %rsi
movl 0x8(%rsp), %edx
movl 0xc(%rsp), %ecx
movl 0x90(%rsp), %r8d
movl 0x98(%rsp), %r9d
callq 0xa410
movq %r14, %rdi
movq 0x10(%rsp), %rsi
callq 0x4dee
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::hist_equal_proc(Image&, Image&)
void ImageProc::hist_equal_proc(Image &img_orig, Image &img_modified)
{
	//Image img_bw("bw", width, height);

	//img_bw.read_image(infile, width, height);

	int histogram_bins[256] = {0};

	for(int i = 0; i < img_orig.rows; i++)
		for(int j = 0; j < img_orig.cols; j++)
			if((img_orig.getvalue(i,j,0) >= 0) && (img_orig.getvalue(i,j,0) < 256))
				histogram_bins[img_orig.getvalue(i,j,0)]++;


	int hist_cumulative[256] = {0};
	hist_cumulative[0] = histogram_bins[0];
	for(int i = 1; i < 256; i++)
		hist_cumulative[i] = hist_cumulative[i-1] + histogram_bins[i];


	for(int i = 0; i < img_modified.rows; i++)
		for(int j = 0; j < img_modified.cols; j++)
			if      (img_orig.getvalue(i,j,0) < 0  ) img_modified.setvalue(i,j,0,0);
			else if (img_orig.getvalue(i,j,0) > 255) img_modified.setvalue(i,j,0,255);
			else    img_modified.setvalue(i,j,0,(255 * hist_cumulative[img_orig.getvalue(i,j,0)] \
															      / hist_cumulative[255]));


	//img_modified.write_image(outfile, width, height);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x808, %rsp            # imm = 0x808
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x400(%rsp), %rdi
xorl %ebp, %ebp
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x20c0
movslq 0xc(%r14), %rax
testq %rax, %rax
jle 0xabe1
movl 0x8(%r14), %ecx
movl 0x10(%r14), %edx
movq 0x18(%r14), %rsi
movl %ecx, %edi
imull %edx, %edi
xorl %r8d, %r8d
xorl %r9d, %r9d
movq %rcx, %r10
movl %r8d, %r11d
testl %ecx, %ecx
jle 0xabcf
movslq %r11d, %r11
movzbl (%rsi,%r11), %r15d
incl 0x400(%rsp,%r15,4)
addl %edx, %r11d
decq %r10
jne 0xabb7
incq %r9
addl %edi, %r8d
cmpq %rax, %r9
jne 0xabad
movl 0x400(%rsp), %ebp
movq %rsp, %r15
movl $0x400, %edx            # imm = 0x400
movq %r15, %rdi
xorl %esi, %esi
callq 0x20c0
movl %ebp, (%r15)
movl $0x1, %eax
addl 0x400(%rsp,%rax,4), %ebp
movl %ebp, (%rsp,%rax,4)
incq %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0xabfb
movl 0xc(%rbx), %eax
testl %eax, %eax
jle 0xac79
movl 0x3fc(%rsp), %ecx
movl 0x8(%rbx), %edi
xorl %esi, %esi
testl %edi, %edi
jle 0xac73
xorl %r8d, %r8d
movq 0x18(%r14), %rax
movl 0x8(%r14), %edx
imull %esi, %edx
addl %r8d, %edx
imull 0x10(%r14), %edx
movslq %edx, %rdx
movzbl (%rax,%rdx), %eax
movl (%rsp,%rax,4), %edx
movl %edx, %eax
shll $0x8, %eax
subl %edx, %eax
cltd
idivl %ecx
movq 0x18(%rbx), %rdx
imull %esi, %edi
addl %r8d, %edi
imull 0x10(%rbx), %edi
movslq %edi, %rdi
movb %al, (%rdx,%rdi)
incl %r8d
movl 0x8(%rbx), %edi
cmpl %edi, %r8d
jl 0xac2a
movl 0xc(%rbx), %eax
incl %esi
cmpl %eax, %esi
jl 0xac23
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::get_histogram(Image&, int*)
void ImageProc::get_histogram(Image &img_orig, int histogram_bins[256])
{
	for(int i = 0; i < 256; i++)
	{
		histogram_bins[i] = 0;
	}

	for(int i = 0; i < img_orig.rows; i++)
		for(int j = 0; j < img_orig.cols; j++)
			if((img_orig.getvalue(i,j,0) >= 0) && (img_orig.getvalue(i,j,0) < 256))
				histogram_bins[img_orig.getvalue(i,j,0)]++;

}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
xorl %ebp, %ebp
movl $0x400, %edx            # imm = 0x400
movq %rsi, %rdi
xorl %esi, %esi
callq 0x20c0
movl 0xc(%r14), %edx
testl %edx, %edx
jle 0xb679
movq 0x18(%r14), %rax
movl 0x8(%r14), %ecx
testl %ecx, %ecx
jle 0xb673
xorl %edx, %edx
imull %ebp, %ecx
addl %edx, %ecx
imull 0x10(%r14), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %ecx
incl (%rbx,%rcx,4)
incl %edx
movl 0x8(%r14), %ecx
cmpl %ecx, %edx
jl 0xb651
movl 0xc(%r14), %edx
incl %ebp
cmpl %edx, %ebp
jl 0xb64b
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::apply_LoG_operator(char const*, char const*, int, int)
void ImageProc::apply_LoG_operator(const char *infile, const char *outfile, int width, int height)
{
	Image img_orig("bw", width, height);
	Image img_modified("bw", width, height);
	img_orig.read_image(infile, img_orig.cols, img_orig.rows);

	LoG_edge_detector(img_orig, img_modified);

	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 $0x48, %rsp
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, (%rsp)
movq %rdi, %r15
leaq 0x6b98(%rip), %r12      # 0x12253
leaq 0x28(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x4c56
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x4c56
movq %r13, %rdi
movq %r15, %rsi
callq 0x4cb2
movq %r13, %rdi
movq %rbx, %rsi
callq 0xb712
movq %rbx, %rdi
movq (%rsp), %rsi
callq 0x4dee
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::halftone_fixed_thresh(Image&, Image&)
void ImageProc::halftone_fixed_thresh(Image &img_orig, Image &img_modified)
{
	for(int i = 0; i < img_modified.rows; i++)
		for(int j = 0; j < img_modified.cols; j++)
			for(int k = 0; k < img_modified.channels; k++)
				if(img_orig.getvalue(i,j,k) <= 127)	img_modified.setvalue(i,j,k,0  );
				else								img_modified.setvalue(i,j,k,255);
}

// Assembly:
movl 0xc(%rsi), %ecx
testl %ecx, %ecx
jle 0xc2a0
movl 0x8(%rsi), %edx
xorl %eax, %eax
testl %edx, %edx
jle 0xc29a
movl 0x10(%rsi), %r8d
xorl %ecx, %ecx
testl %r8d, %r8d
jle 0xc291
xorl %edx, %edx
movl 0x8(%rdi), %r9d
imull %eax, %r9d
addl %ecx, %r9d
imull 0x10(%rdi), %r9d
movslq %r9d, %r9
addq 0x18(%rdi), %r9
movb (%rdx,%r9), %r9b
movl 0x8(%rsi), %r10d
imull %eax, %r10d
addl %ecx, %r10d
imull %r8d, %r10d
movslq %r10d, %r8
addq 0x18(%rsi), %r8
sarb $0x7, %r9b
movb %r9b, (%rdx,%r8)
movl 0x10(%rsi), %r8d
incq %rdx
cmpl %r8d, %edx
jl 0xc249
movl 0x8(%rsi), %edx
incl %ecx
cmpl %edx, %ecx
jl 0xc242
movl 0xc(%rsi), %ecx
incl %eax
cmpl %ecx, %eax
jl 0xc238
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::halftone_random_thresh(Image&, Image&)
void ImageProc::halftone_random_thresh(Image &img_orig, Image &img_modified)
{
	srand(time(0));
	for(int i = 0; i < img_modified.rows; i++)
		for(int j = 0; j < img_modified.cols; j++)
			for(int k = 0; k < img_modified.channels; k++)
				if(img_orig.getvalue(i,j,k) <= rand() % 255)	img_modified.setvalue(i,j,k,0  );
				else											img_modified.setvalue(i,j,k,255);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x2120
movl %eax, %edi
callq 0x2140
movl 0xc(%rbx), %ecx
testl %ecx, %ecx
jle 0xc36a
movl 0x8(%rbx), %eax
testl %eax, %eax
jle 0xc35e
movl 0x10(%rbx), %ecx
xorl %ebp, %ebp
testl %ecx, %ecx
jle 0xc355
xorl %r12d, %r12d
movl 0x8(%r14), %eax
imull %r15d, %eax
addl %ebp, %eax
imull 0x10(%r14), %eax
cltq
addq 0x18(%r14), %rax
movzbl (%r12,%rax), %r13d
callq 0x2080
cltq
imulq $-0x7f7f7f7f, %rax, %rcx # imm = 0x80808081
shrq $0x20, %rcx
addl %eax, %ecx
movl %ecx, %edx
shrl $0x1f, %edx
sarl $0x7, %ecx
addl %edx, %ecx
movl %ecx, %edx
shll $0x8, %edx
subl %edx, %ecx
addl %eax, %ecx
cmpl %r13d, %ecx
setl %al
movl 0x8(%rbx), %ecx
imull %r15d, %ecx
addl %ebp, %ecx
imull 0x10(%rbx), %ecx
movslq %ecx, %rcx
addq 0x18(%rbx), %rcx
negb %al
movb %al, (%r12,%rcx)
movl 0x10(%rbx), %ecx
incq %r12
cmpl %ecx, %r12d
jl 0xc2e6
movl 0x8(%rbx), %eax
incl %ebp
cmpl %eax, %ebp
jl 0xc2df
movl 0xc(%rbx), %ecx
incl %r15d
cmpl %ecx, %r15d
jl 0xc2d2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::color_halftoning(char const*, char const*, int, int)
void ImageProc::color_halftoning(const char *infile, const char *outfile, int width, int height)
{
	Image img_orig("color", width, height);
	Image img_modified("color", width, height);
	img_orig.read_image(infile, img_orig.cols, img_orig.rows);

	error_diffusion(img_orig, img_modified);
	//mbvq_error_diffusion(img_orig, img_modified);

	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 $0x48, %rsp
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, (%rsp)
movq %rdi, %r15
leaq 0x4d07(%rip), %r12      # 0x116c8
leaq 0x28(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x4c56
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x4c56
movq %r13, %rdi
movq %r15, %rsi
callq 0x4cb2
movq %r13, %rdi
movq %rbx, %rsi
callq 0xc532
movq %rbx, %rdi
movq (%rsp), %rsi
callq 0x4dee
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::nearest_vertex(float*, int, int, int, int)
int ImageProc::nearest_vertex(float distance[8], int i, int j, int k, int l)
{
	if 		(distance[i] < distance[j] && distance[i] < distance[k] && distance[i] < distance[l])	return i;
	else if (distance[j] < distance[i] && distance[i] < distance[k] && distance[i] < distance[l])	return j;
	else if (distance[k] < distance[i] && distance[i] < distance[j] && distance[i] < distance[l])	return k;
	else if (distance[l] < distance[i] && distance[i] < distance[j] && distance[i] < distance[k])	return l;
}

// Assembly:
movl %esi, %eax
movslq %esi, %rsi
movss (%rdi,%rsi,4), %xmm0
movslq %edx, %rsi
movss (%rdi,%rsi,4), %xmm1
ucomiss %xmm0, %xmm1
movslq %ecx, %r9
movslq %r8d, %rsi
jbe 0xd2e0
movss (%rdi,%r9,4), %xmm2
ucomiss %xmm0, %xmm2
jbe 0xd2e0
movss (%rdi,%rsi,4), %xmm2
ucomiss %xmm0, %xmm2
ja 0xd315
ucomiss %xmm1, %xmm0
movss (%rdi,%r9,4), %xmm2
jbe 0xd2fc
ucomiss %xmm0, %xmm2
jbe 0xd2fc
movss (%rdi,%rsi,4), %xmm3
ucomiss %xmm0, %xmm3
movl %edx, %eax
ja 0xd315
movss (%rdi,%rsi,4), %xmm3
ucomiss %xmm0, %xmm3
cmovbel %esi, %ecx
ucomiss %xmm2, %xmm0
cmovbel %esi, %ecx
ucomiss %xmm0, %xmm1
cmovbel %esi, %ecx
movl %ecx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::rgb2cielab(Image&, Image&)
void ImageProc::rgb2cielab(Image &img_orig, Image &img_modified)
{
	double L,A,B,r,g,b;
	for(int i = 0; i < img_orig.rows; i++)
		for(int j = 0; j < img_orig.cols; j++)
		{
			r = (double)(img_orig.getvalue(i,j,0)/255.0);
			g = (double)(img_orig.getvalue(i,j,1)/255.0);
			b = (double)(img_orig.getvalue(i,j,2)/255.0);
			Rgb2Lab(&L,&A,&B,r,g,b);
			//std::cout << L << " " << A << " " << B <<std::endl;
			img_modified.setvalue(i,j,0,(unsigned char)(L));
			img_modified.setvalue(i,j,1,(unsigned char)(A));
			img_modified.setvalue(i,j,2,(unsigned char)(B));
			//std::cout << img_modified.getvalue(i,j,0) << " " << img_modified.getvalue(i,j,1) << " " << img_modified.getvalue(i,j,2)<<std::endl;
		}
}

// Assembly:
movl 0xc(%rdi), %ecx
testl %ecx, %ecx
jle 0xde6b
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbp
movl 0x8(%rdi), %eax
xorl %ebx, %ebx
movsd 0x3741(%rip), %xmm3     # 0x114b0
leaq 0x20(%rsp), %r12
leaq 0x18(%rsp), %r13
leaq 0x10(%rsp), %r14
movq %rdi, 0x8(%rsp)
testl %eax, %eax
jle 0xde53
xorl %r15d, %r15d
movq 0x18(%rdi), %rcx
imull %ebx, %eax
addl %r15d, %eax
imull 0x10(%rdi), %eax
cltq
movzbl (%rcx,%rax), %esi
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
divsd %xmm3, %xmm0
movzbl 0x1(%rcx,%rax), %esi
xorps %xmm1, %xmm1
cvtsi2sd %esi, %xmm1
divsd %xmm3, %xmm1
movzbl 0x2(%rcx,%rax), %eax
xorps %xmm2, %xmm2
cvtsi2sd %eax, %xmm2
divsd %xmm3, %xmm2
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x6806
movq 0x8(%rsp), %rdi
movsd 0x36c8(%rip), %xmm3     # 0x114b0
cvttsd2si 0x20(%rsp), %eax
movq 0x18(%rbp), %rcx
movl 0x8(%rbp), %esi
imull %ebx, %esi
addl %r15d, %esi
imull 0x10(%rbp), %esi
movslq %esi, %rsi
movb %al, (%rcx,%rsi)
cvttsd2si 0x18(%rsp), %eax
movq 0x18(%rbp), %rcx
movl 0x8(%rbp), %esi
imull %ebx, %esi
addl %r15d, %esi
imull 0x10(%rbp), %esi
movslq %esi, %rsi
movb %al, 0x1(%rcx,%rsi)
cvttsd2si 0x10(%rsp), %eax
movq 0x18(%rbp), %rcx
movl 0x8(%rbp), %esi
imull %ebx, %esi
addl %r15d, %esi
imull 0x10(%rbp), %esi
movslq %esi, %rsi
movb %al, 0x2(%rcx,%rsi)
incl %r15d
movl 0x8(%rdi), %eax
cmpl %eax, %r15d
jl 0xdd8e
movl 0xc(%rdi), %ecx
incl %ebx
cmpl %ecx, %ebx
jl 0xdd83
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::apply_morphology(char const*, char const*, int, int)
void ImageProc::apply_morphology(const char *infile, const char *outfile, int width, int height)
{
	Image img_orig_bw("bw", width, height);
	Image img_binary("bw", width, height);
	Image img_shrinked("bw", width, height);
	Image img_thinned("bw", width, height);
	Image img_skeletonized("bw", width, height);
	Image img_unsharped("bw", width, height);
	Image img_modified("bw", width, height);
	Image img_modified_color("color", width, height);

	img_orig_bw.read_image(infile, img_orig_bw.cols, img_orig_bw.rows);

	//unsharp_mask(img_orig_bw, img_unsharp_masked);
	otsu_th(img_orig_bw, img_binary);
	img_binary.write_image("../output_images/morphology_binarized_img.raw", img_binary.cols, img_binary.rows);

	shrink(img_binary, img_shrinked);
	thin(img_binary, img_thinned);
	skeletonize(img_binary, img_skeletonized);

	img_shrinked.write_image("../output_images/morphology_shrinked_img.raw", img_shrinked.cols, img_shrinked.rows);
	img_thinned.write_image("../output_images/morphology_thinned_img.raw", img_thinned.cols, img_thinned.rows);
	img_skeletonized.write_image("../output_images/morphology_skeletonized_img.raw", img_skeletonized.cols, img_skeletonized.rows);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movl %ecx, %r14d
movl %edx, %r15d
movq %rdi, %rbp
leaq 0x4162(%rip), %r12      # 0x12253
leaq 0xe8(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x4c56
leaq 0xc8(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movl %r15d, %edx
movl %r14d, %ecx
callq 0x4c56
leaq 0x48(%rsp), %rdi
movq %r12, %rsi
movl %r15d, %edx
movl %r14d, %ecx
callq 0x4c56
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
movl %r15d, %edx
movl %r14d, %ecx
callq 0x4c56
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
movl %r15d, %edx
movl %r14d, %ecx
callq 0x4c56
leaq 0xa8(%rsp), %rdi
movq %r12, %rsi
movl %r15d, %edx
movl %r14d, %ecx
callq 0x4c56
leaq 0x88(%rsp), %rdi
movq %r12, %rsi
movl %r15d, %edx
movl %r14d, %ecx
callq 0x4c56
leaq 0x353f(%rip), %rsi      # 0x116c8
leaq 0x68(%rsp), %rdi
movl %r15d, %edx
movl %r14d, %ecx
callq 0x4c56
movq %r13, %rdi
movq %rbp, %rsi
callq 0x4cb2
movq %r13, %rdi
movq %rbx, %rsi
callq 0xe22e
leaq 0x37e4(%rip), %rsi      # 0x1199a
movq %rbx, %rdi
callq 0x4dee
movq %rbx, %rdi
leaq 0x48(%rsp), %r14
movq %r14, %rsi
callq 0xe414
movq %rbx, %rdi
leaq 0x28(%rsp), %r15
movq %r15, %rsi
callq 0xed08
movq %rbx, %rdi
leaq 0x8(%rsp), %rbx
movq %rbx, %rsi
callq 0xf4ea
leaq 0x37d3(%rip), %rsi      # 0x119c8
movq %r14, %rdi
callq 0x4dee
leaq 0x37f1(%rip), %rsi      # 0x119f5
movq %r15, %rdi
callq 0x4dee
leaq 0x380e(%rip), %rsi      # 0x11a21
movq %rbx, %rdi
callq 0x4dee
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::apply_binarization(char const*, char const*, int, int)
void ImageProc::apply_binarization(const char* infile, const char *outfile, int width, int height)
{
	Image img_orig_bw("bw", width, height);
	Image img_binary("bw", width, height);

	img_orig_bw.read_image(infile, img_orig_bw.cols, img_orig_bw.rows);
	//unsharp_mask(img_orig_bw, img_unsharp_masked);
	otsu_th(img_orig_bw, img_binary);
	img_binary.write_image(outfile, img_binary.cols, img_binary.rows);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, (%rsp)
movq %rdi, %r15
leaq 0x2566(%rip), %r12      # 0x12253
leaq 0x28(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x4c56
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x4c56
movq %r13, %rdi
movq %r15, %rsi
callq 0x4cb2
movq %r13, %rdi
movq %rbx, %rsi
callq 0xe22e
movq %rbx, %rdi
movq (%rsp), %rsi
callq 0x4dee
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/ctz[P]openssl-bench/bench.cc
// Function: usage()
static int usage() {
  puts("usage: bench [--threads N] [--rsa|--ecdsa] "
       "<handshake|handshake-resume|handshake-ticket> <suite>");
  puts("usage: bench [--threads N] bulk <suite> <plaintext-size>");
  puts("usage: bench memory <count>");
  return 1;
}

// Assembly:
pushq %rax
leaq 0x30e0(%rip), %rdi      # 0x70ac
callq 0x3400
leaq 0x3135(%rip), %rdi      # 0x710d
callq 0x3400
leaq 0x3162(%rip), %rdi      # 0x7146
popq %rax
jmp 0x3400
// File: /workspace/github_cpp_makefile_star2_O3/ctz[P]openssl-bench/bench.cc
// Function: apply_work_multiplier(unsigned long)
static size_t apply_work_multiplier(size_t work) {
  const char *multiplier = getenv("BENCH_MULTIPLIER");
  if (multiplier) {
    return size_t(work * atof(multiplier));
  }
  return work;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x280a(%rip), %rdi      # 0x7397
callq 0x3340
testq %rax, %rax
je 0x4bcf
cvtsi2sd %rbx, %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rax, %rdi
callq 0x3350
mulsd 0x8(%rsp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x247c(%rip), %xmm0     # 0x7040
cvttsd2si %xmm0, %rbx
andq %rcx, %rbx
orq %rax, %rbx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/ctz[P]openssl-bench/bench.cc
// Function: chkerr(int)
static bool chkerr(int err) {
  if (err == SSL_ERROR_SYSCALL || err == SSL_ERROR_SSL) {
    ERR_print_errors_fp(stdout);
    puts("error");
    exit(1);
    return true;
  }
  return err == 0;
}

// Assembly:
movl %edi, %eax
andl $-0x5, %eax
cmpl $0x1, %eax
je 0x4be8
testl %edi, %edi
sete %al
retq
pushq %rax
movq 0x53d8(%rip), %rax      # 0x9fc8
movq (%rax), %rdi
callq 0x3180
leaq 0x27c3(%rip), %rdi      # 0x73c2
callq 0x3400
movl $0x1, %edi
callq 0x3330
// File: /workspace/github_cpp_makefile_star2_O3/ctz[P]openssl-bench/bench.cc
// Function: do_handshake_step(Conn&, Conn&)
static bool do_handshake_step(Conn &client, Conn &server) {
  bool s_connected = server.accept();
  bool c_connected = client.connect();

  if (s_connected && c_connected) {
    return false;
  }

  client.transfer_to(server);
  server.transfer_to(client);
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x6246
movl %eax, %r15d
movq %rbx, %rdi
callq 0x6264
movl %eax, %ebp
andb %r15b, %bpl
jne 0x4c4b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5dc8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x5dc8
xorb $0x1, %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/ctz[P]openssl-bench/bench.cc
// Function: new_session_cb(ssl_st*, ssl_session_st*)
static int new_session_cb(SSL *ssl, SSL_SESSION *sess) {
  Conn *conn = (Conn *)SSL_get_app_data(ssl);
  if (conn) {
    return conn->save_one_session(sess);
  }
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x30f0
testq %rax, %rax
je 0x56c0
cmpq $0x0, 0x30(%rax)
jne 0x56c0
movq %r14, 0x30(%rax)
movl $0x1, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/ctz[P]openssl-bench/bench.cc
// Function: Context::set_ciphers(char const*)
void set_ciphers(const char *ciphers) {
    if (!strcmp(ciphers, "TLS_AES_128_GCM_SHA256") ||
        !strcmp(ciphers, "TLS_AES_256_GCM_SHA384") ||
        !strcmp(ciphers, "TLS_CHACHA20_POLY1305_SHA256")) {
      int err =
          SSL_CTX_set1_groups_list(m_ctx, "X25519MLKEM768:X25519:P-256:P-384");
      assert(err == 1);
      set_version(TLS1_3_VERSION, TLS1_3_VERSION);
#ifndef BORINGSSL
      SSL_CTX_set_ciphersuites(m_ctx, ciphers);
#else
      // boringssl does not have any direct way to configure TLS1.3 cipher
      // suites. however, it does have "compliance policies" which give limited
      // control over their order, and a configuration switch for pretending
      // hardware-accelerated AES is absent -- which prioritises chacha.
      //
      // So we can arrange for one ciphersuite, as follows:
      //
      // - TLS_CHACHA20_POLY1305_SHA256:
      // `SSL_CTX_set_aes_hw_override_for_testing(ctx, false)`
      // - TLS_AES_128_GCM_SHA256: the default
      // - TLS_AES_256_GCM_SHA384: `SSL_CTX_set_compliance_policy(ctx,
      // ssl_compliance_policy_cnsa_202407)`
      if (!strcmp(ciphers, "TLS_AES_256_GCM_SHA384")) {
        SSL_CTX_set_compliance_policy(m_ctx, ssl_compliance_policy_cnsa_202407);
      } else if (!strcmp(ciphers, "TLS_CHACHA20_POLY1305_SHA256")) {
        bssl::SSL_CTX_set_aes_hw_override_for_testing(m_ctx, false);
      } else {
        assert(!strcmp(ciphers, "TLS_AES_128_GCM_SHA256"));
      }
#endif
    } else {
      set_version(TLS1_2_VERSION, TLS1_2_VERSION);
      SSL_CTX_set_cipher_list(m_ctx, ciphers);
    }
  }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1a87(%rip), %rsi      # 0x7162
movq %rbx, %rdi
callq 0x33a0
testl %eax, %eax
je 0x5747
leaq 0x1a8b(%rip), %rsi      # 0x7179
movq %rbx, %rdi
callq 0x33a0
testl %eax, %eax
je 0x5747
leaq 0x1a8f(%rip), %rsi      # 0x7190
movq %rbx, %rdi
callq 0x33a0
testl %eax, %eax
je 0x5747
movq (%r14), %rdi
movl $0x303, %edx            # imm = 0x303
movl $0x7b, %esi
xorl %ecx, %ecx
callq 0x3260
movq (%r14), %rdi
movl $0x303, %edx            # imm = 0x303
movl $0x7c, %esi
xorl %ecx, %ecx
callq 0x3260
movq (%r14), %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3280
movq (%r14), %rdi
leaq 0x1a5c(%rip), %rcx      # 0x71ad
movl $0x5c, %esi
xorl %edx, %edx
callq 0x3260
cmpl $0x1, %eax
jne 0x579c
movq (%r14), %rdi
movl $0x304, %edx            # imm = 0x304
movl $0x7b, %esi
xorl %ecx, %ecx
callq 0x3260
movq (%r14), %rdi
movl $0x304, %edx            # imm = 0x304
movl $0x7c, %esi
xorl %ecx, %ecx
callq 0x3260
movq (%r14), %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3320
leaq 0x1a2c(%rip), %rdi      # 0x71cf
leaq 0x1a2e(%rip), %rsi      # 0x71d8
leaq 0x1a30(%rip), %rcx      # 0x71e1
movl $0x63, %edx
callq 0x31d0
nop
// File: /workspace/github_cpp_makefile_star2_O3/ctz[P]openssl-bench/bench.cc
// Function: Context::load_server_creds(KeyType)
void load_server_creds(const KeyType which) {
    int err;

    switch (which) {
    case KeyType::RSA2048:
      err = SSL_CTX_use_certificate_chain_file(
          m_ctx, "../rustls/test-ca/rsa-2048/end.fullchain");
      assert(err == 1);
      err = SSL_CTX_use_PrivateKey_file(
          m_ctx, "../rustls/test-ca/rsa-2048/end.key", SSL_FILETYPE_PEM);
      assert(err == 1);
      break;
    case KeyType::ECDSAP256:
      err = SSL_CTX_use_certificate_chain_file(
          m_ctx, "../rustls/test-ca/ecdsa-p256/end.fullchain");
      assert(err == 1);
      err = SSL_CTX_use_PrivateKey_file(
          m_ctx, "../rustls/test-ca/ecdsa-p256/end.key", SSL_FILETYPE_PEM);
      assert(err == 1);
      break;
    }
  }

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpl $0x1, %esi
je 0x5815
testl %esi, %esi
jne 0x5842
movq (%rbx), %rdi
leaq 0x1a36(%rip), %rsi      # 0x7209
callq 0x3210
cmpl $0x1, %eax
jne 0x5844
movq (%rbx), %rdi
leaq 0x1a7a(%rip), %rsi      # 0x7261
movl $0x1, %edx
callq 0x3030
cmpl $0x1, %eax
je 0x5842
leaq 0x19d2(%rip), %rdi      # 0x71cf
leaq 0x19d4(%rip), %rsi      # 0x71d8
leaq 0x1a27(%rip), %rcx      # 0x7232
movl $0x38, %edx
callq 0x31d0
movq (%rbx), %rdi
leaq 0x1a65(%rip), %rsi      # 0x7284
callq 0x3210
cmpl $0x1, %eax
jne 0x5863
movq (%rbx), %rdi
leaq 0x1a7c(%rip), %rsi      # 0x72af
movl $0x1, %edx
callq 0x3030
cmpl $0x1, %eax
jne 0x5882
popq %rbx
retq
leaq 0x1984(%rip), %rdi      # 0x71cf
leaq 0x1986(%rip), %rsi      # 0x71d8
leaq 0x19d9(%rip), %rcx      # 0x7232
movl $0x35, %edx
callq 0x31d0
leaq 0x1965(%rip), %rdi      # 0x71cf
leaq 0x1967(%rip), %rsi      # 0x71d8
leaq 0x19ba(%rip), %rcx      # 0x7232
movl $0x3d, %edx
callq 0x31d0
leaq 0x1946(%rip), %rdi      # 0x71cf
leaq 0x1948(%rip), %rsi      # 0x71d8
leaq 0x199b(%rip), %rcx      # 0x7232
movl $0x40, %edx
callq 0x31d0
nop
// File: /workspace/github_cpp_makefile_star2_O3/ctz[P]openssl-bench/bench.cc
// Function: Context::load_client_creds(KeyType)
void load_client_creds(const KeyType which) {
    int err;
    switch (which) {
    case KeyType::RSA2048:
      err = SSL_CTX_load_verify_locations(
          m_ctx, "../rustls/test-ca/rsa-2048/ca.cert", NULL);
      break;
    case KeyType::ECDSAP256:
      err = SSL_CTX_load_verify_locations(
          m_ctx, "../rustls/test-ca/ecdsa-p256/ca.cert", NULL);
      break;
    }
    assert(err == 1);
  }

// Assembly:
pushq %rax
testl %esi, %esi
je 0x58b5
cmpl $0x1, %esi
jne 0x58cb
leaq 0x1a44(%rip), %rsi      # 0x72f7
jmp 0x58bc
leaq 0x1a18(%rip), %rsi      # 0x72d4
movq (%rdi), %rdi
xorl %edx, %edx
callq 0x3360
cmpl $0x1, %eax
jne 0x58cd
popq %rax
retq
leaq 0x18fb(%rip), %rdi      # 0x71cf
leaq 0x18fd(%rip), %rsi      # 0x71d8
leaq 0x1a3a(%rip), %rcx      # 0x731c
movl $0x51, %edx
callq 0x31d0
// File: /workspace/github_cpp_makefile_star2_O3/ctz[P]openssl-bench/bench.cc
// Function: Conn::transfer_to(Conn&)
void transfer_to(Conn &other) {
    uint8_t buf[262144] = {0};

    bool new_bytes = false;

    while (true) {
      int err = BIO_read(m_writes_to, buf, sizeof(buf));

      if (err == 0 || err == -1) {
        break;
      } else if (err > 0) {
        if (!new_bytes) {
          other.drop_read_bytes();
          new_bytes = true;
        }

        other.m_read_buffer.insert(other.m_read_buffer.end(), buf, buf + err);
      }
    }

    if (new_bytes) {
      other.install_read_bio();
    }
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40008, %rsp          # imm = 0x40008
movq %rsi, %rbx
movq %rdi, %r14
movq %rsp, %r15
movl $0x40000, %edx          # imm = 0x40000
movq %r15, %rdi
xorl %esi, %esi
callq 0x31b0
movq 0x28(%r14), %rdi
movq %r15, %rsi
movl $0x40000, %edx          # imm = 0x40000
callq 0x3300
movl %eax, %r13d
leal 0x1(%r13), %eax
cmpl $0x2, %eax
jb 0x5e6c
leaq 0x8(%rbx), %r15
xorl %ebp, %ebp
movq %rsp, %r12
testl %r13d, %r13d
jle 0x5e43
testb $0x1, %bpl
jne 0x5e2d
movq %rbx, %rdi
callq 0x5f0a
movb $0x1, %bpl
movq 0x10(%rbx), %rsi
movl %r13d, %eax
leaq (%rsp,%rax), %rcx
movq %r15, %rdi
movq %r12, %rdx
callq 0x5fee
movq 0x28(%r14), %rdi
movq %r12, %rsi
movl $0x40000, %edx          # imm = 0x40000
callq 0x3300
movl %eax, %r13d
incl %eax
cmpl $0x1, %eax
ja 0x5e17
testb $0x1, %bpl
je 0x5e6c
movq %rbx, %rdi
callq 0x5f82
addq $0x40008, %rsp          # imm = 0x40008
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/ctz[P]openssl-bench/bench.cc
// Function: Conn::read(unsigned char*, unsigned long)
void read(uint8_t *buf, size_t n) {
    while (n) {
      int rd = SSL_read(m_ssl, buf, n);

      assert(rd >= 0);
      buf += rd;
      n -= rd;
    }
  }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdx, %rdx
je 0x5eac
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%r15), %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x3060
testl %eax, %eax
js 0x5eb2
movl %eax, %eax
addq %rax, %r14
subq %rax, %rbx
jne 0x5e91
popq %rbx
popq %r14
popq %r15
retq
leaq 0x155d(%rip), %rdi      # 0x7416
leaq 0x1318(%rip), %rsi      # 0x71d8
leaq 0x1557(%rip), %rcx      # 0x741e
movl $0x139, %edx            # imm = 0x139
callq 0x31d0
nop
// File: /workspace/github_cpp_makefile_star2_O3/ctz[P]openssl-bench/bench.cc
// Function: Conn::drop_read_bytes()
void drop_read_bytes() {
    // eliminate processed bytes from read buffer
    char *old_buf = nullptr;
    long old_len = BIO_get_mem_data(m_reads_from, &old_buf);
    long consumed = m_read_buffer.size() - old_len;
    m_read_buffer.erase(m_read_buffer.begin(),
                        m_read_buffer.begin() + consumed);
    // caller _MUST_ now call install_read_bio() prior to touching
    // m_ssl
  }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rcx
movq $0x0, (%rcx)
movq 0x20(%rdi), %rdi
movl $0x3, %esi
xorl %edx, %edx
callq 0x30d0
movq 0x8(%rbx), %r14
movq 0x10(%rbx), %rcx
leaq (%rax,%r14), %rdx
cmpq %rdx, %rcx
je 0x5f77
movq %rcx, %r15
subq %rax, %r15
movq %rcx, %rdx
subq %r15, %rdx
je 0x5f65
movq %r14, %rdi
movq %r15, %rsi
callq 0x3480
movq 0x10(%rbx), %rax
movq %rax, %rcx
jmp 0x5f68
movq %r15, %rax
subq %r15, %rax
addq %rax, %r14
cmpq %r14, %rcx
je 0x5f77
movq %r14, 0x10(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/ctz[P]openssl-bench/bench.cc
// Function: Conn::install_read_bio()
void install_read_bio() {
    static uint8_t empty_buf[0] = {};
    m_reads_from =
        BIO_new_mem_buf(m_read_buffer.data() ? m_read_buffer.data() : empty_buf,
                        m_read_buffer.size());
    assert(m_reads_from != nullptr);
    BIO_set_mem_eof_return(m_reads_from, -1);
    SSL_set0_rbio(m_ssl, m_reads_from); // frees previous m_reads_from
  }

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rax
testq %rax, %rax
leaq 0x4335(%rip), %rdi      # 0xa2c9
cmovneq %rax, %rdi
movl 0x10(%rbx), %esi
subl %eax, %esi
callq 0x30a0
movq %rax, 0x20(%rbx)
testq %rax, %rax
je 0x5fce
movq %rax, %rdi
movl $0x82, %esi
movq $-0x1, %rdx
xorl %ecx, %ecx
callq 0x30d0
movq (%rbx), %rdi
movq 0x20(%rbx), %rsi
popq %rbx
jmp 0x34f0
leaq 0x140b(%rip), %rdi      # 0x73e0
leaq 0x11fc(%rip), %rsi      # 0x71d8
leaq 0x1415(%rip), %rcx      # 0x73f8
movl $0xcd, %edx
callq 0x31d0
nop
// File: /workspace/github_cpp_makefile_star2_O3/ctz[P]openssl-bench/bench.cc
// Function: LatencyOutput::LatencyOutput(char const*)
LatencyOutput(const char *which) : m_output(nullptr) {
    const char *file_prefix = getenv("BENCH_LATENCY");
    if (file_prefix) {
      std::ostringstream thread_id;
      thread_id << std::this_thread::get_id();
      char filename[128] = {0};
      snprintf(filename, sizeof(filename), "%s-%s-%s-latency.tsv", file_prefix,
               which, thread_id.str().c_str());
      m_output = fopen(filename, "w+");
    }
  }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rsi, %r14
movq %rdi, %rbx
movq $0x0, (%rdi)
leaq 0x1236(%rip), %rdi      # 0x7580
callq 0x3340
testq %rax, %rax
je 0x6452
movq %rax, %r15
leaq 0xa0(%rsp), %rdi
callq 0x3380
callq 0x3250
testq %rax, %rax
je 0x6384
leaq 0xa0(%rsp), %rdi
movq %rax, %rsi
callq 0x31e0
jmp 0x639d
leaq 0x121b(%rip), %rsi      # 0x75a6
leaq 0xa0(%rsp), %rdi
movl $0x24, %edx
callq 0x32f0
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
leaq 0xa8(%rsp), %rsi
movq %rsp, %rdi
callq 0x3440
leaq 0x10(%rsp), %r12
movq -0x10(%r12), %r9
leaq 0x119f(%rip), %rdx      # 0x758e
leaq 0x20(%rsp), %rdi
movl $0x80, %esi
movq %r15, %rcx
movq %r14, %r8
xorl %eax, %eax
callq 0x3450
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x641d
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x117f(%rip), %rsi      # 0x75a3
leaq 0x20(%rsp), %rdi
callq 0x3310
movq %rax, (%rbx)
movq 0x3ba8(%rip), %rsi      # 0x9fe0
leaq 0xa0(%rsp), %rdi
callq 0x31a0
leaq 0x110(%rsp), %rdi
callq 0x3110
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x6463
movq %rax, %rbx
movq 0x3b73(%rip), %rsi      # 0x9fe0
leaq 0xa0(%rsp), %rdi
callq 0x31a0
leaq 0x110(%rsp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x34c0
nop
// File: /workspace/github_cpp_makefile_star2_O3/ctz[P]openssl-bench/bench.cc
// Function: Context::enable_resume()
void enable_resume() {
    SSL_CTX_sess_set_new_cb(m_ctx, new_session_cb);
    SSL_CTX_set_session_cache_mode(m_ctx, SSL_SESS_CACHE_BOTH);
    SSL_CTX_set_session_id_context(m_ctx, (const uint8_t *)"localhost",
                                   strlen("localhost"));
    SSL_CTX_sess_set_cache_size(m_ctx, 1024 * 1024);
  }

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
leaq -0xe9f(%rip), %rsi      # 0x569b
callq 0x3290
movq (%rbx), %rdi
movl $0x3, %edx
movl $0x2c, %esi
xorl %ecx, %ecx
callq 0x3260
movq (%rbx), %rdi
leaq 0xee4(%rip), %rsi       # 0x7441
movl $0x9, %edx
callq 0x3460
movq (%rbx), %rdi
movl $0x100000, %edx         # imm = 0x100000
movl $0x2a, %esi
xorl %ecx, %ecx
popq %rbx
jmp 0x3260
// File: /workspace/github_cpp_makefile_star2_O3/ctz[P]openssl-bench/bench.cc
// Function: Conn::show_kx()
void show_kx() {
    printf("negotiated v=%s cs=%s kx=%s\n", SSL_get_cipher_version(m_ssl),
           SSL_get_cipher(m_ssl),
#ifdef BORINGSSL
           OBJ_nid2ln(SSL_get_negotiated_group(m_ssl))
#else
           // OpenSSL 3.5.0 broke the working of OBJ_nid2ln by not registering
           // NIDs for built-in groups.
           SSL_group_to_name(m_ssl, SSL_get_negotiated_group(m_ssl))
#endif
    );
  }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
movq (%rdi), %rdi
callq 0x3170
movq %rax, %rdi
callq 0x3200
movq %rax, %rbx
movq (%r14), %rdi
callq 0x3170
movq %rax, %rdi
callq 0x32e0
movq %rax, %r15
movq (%r14), %r14
movq %r14, %rdi
movl $0x86, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3130
movq %r14, %rdi
movl %eax, %esi
callq 0x3370
leaq 0x10eb(%rip), %rdi      # 0x76ba
movq %rbx, %rsi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x3050