LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/j-faria[P]kima/examples/arbitrary_units/kima_setup.cpp
// Function: main
int main(int argc, char** argv)
{
    datafile = "HD128621_rhk.rdb";

    load(datafile, "arb", 2);

    Sampler<RVmodel> sampler = setup<RVmodel>(argc, argv);
    sampler.run(50);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x6c0, %rsp            # imm = 0x6C0
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x4385b(%rip), %r14     # 0x646c0
leaq 0x261b1(%rip), %rsi     # 0x4701d
movq %r14, %rdi
callq 0x6770
leaq 0x8(%rsp), %rdx
movl $0x2, (%rdx)
leaq 0x261a8(%rip), %rsi     # 0x4702e
movq %r14, %rdi
callq 0x210b9
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x21162
pushq $0x32
popq %rsi
movq %r14, %rdi
callq 0x211ae
leaq 0x8(%rsp), %rdi
callq 0x21374
xorl %eax, %eax
addq $0x6c0, %rsp            # imm = 0x6C0
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x21374
movq %rbx, %rdi
callq 0x66e0
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/filter16.cpp
// Function: UpfilterX(color_t*, color_t*)
void UpfilterX(color_t *src, color_t *dst)
{
	// we mix three source pixels (A,B.C) into two destination pixels (1,2)
	// AB -> 1;  BC -> 2
	// All on same scanline.
	dst[0].r = ((src[0].r + 3 * src[1].r + 2) >> 2);
	dst[1].r = ((src[1].r * 3 + src[2].r + 2) >> 2);
	dst[0].g = ((src[0].g + 3 * src[1].g + 2) >> 2);
	dst[1].g = ((src[1].g * 3 + src[2].g + 2) >> 2);
	dst[0].b = ((src[0].b + 3 * src[1].b + 2) >> 2);
	dst[1].b = ((src[1].b * 3 + src[2].b + 2) >> 2);
	dst[0].a = ((src[0].a + 3 * src[1].a + 2) >> 2);
	dst[1].a = ((src[1].a * 3 + src[2].a + 2) >> 2);
}

// Assembly:
movq (%rdi), %xmm0
pxor %xmm1, %xmm1
punpcklwd %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
movq 0x8(%rdi), %xmm2
punpcklwd %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3]
paddd %xmm2, %xmm0
paddd %xmm2, %xmm2
paddd %xmm0, %xmm2
movdqa 0x1853a(%rip), %xmm0    # 0x1e200
paddd %xmm0, %xmm2
psrld $0x2, %xmm2
pshuflw $0xe8, %xmm2, %xmm2     # xmm2 = xmm2[0,2,2,3,4,5,6,7]
pshufhw $0xe8, %xmm2, %xmm2     # xmm2 = xmm2[0,1,2,3,4,6,6,7]
pshufd $0xe8, %xmm2, %xmm2     # xmm2 = xmm2[0,2,2,3]
movq %xmm2, (%rsi)
movq 0x8(%rdi), %xmm2
punpcklwd %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3]
movq 0x10(%rdi), %xmm3
punpcklwd %xmm1, %xmm3    # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1],xmm3[2],xmm1[2],xmm3[3],xmm1[3]
paddd %xmm2, %xmm3
paddd %xmm2, %xmm2
paddd %xmm3, %xmm2
paddd %xmm0, %xmm2
psrld $0x2, %xmm2
pshuflw $0xe8, %xmm2, %xmm0     # xmm0 = xmm2[0,2,2,3,4,5,6,7]
pshufhw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,1,2,3,4,6,6,7]
pshufd $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3]
movq %xmm0, 0x8(%rsi)
retq
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/filter16.cpp
// Function: UpfilterY(color_t*, color_t*, color_t*, color_t*, color_t*)
void UpfilterY(color_t *src1, color_t *src2, color_t *src3, color_t *dst1, color_t *dst2)
{
	dst1->r = ((src1->r + 3 * src2->r + 2) >> 2);
	dst2->r = ((src2->r * 3 + src3->r + 2) >> 2);
	dst1->g = ((src1->g + 3 * src2->g + 2) >> 2);
	dst2->g = ((src2->g * 3 + src3->g + 2) >> 2);
	dst1->b = ((src1->b + 3 * src2->b + 2) >> 2);
	dst2->b = ((src2->b * 3 + src3->b + 2) >> 2);
	dst1->a = ((src1->a + 3 * src2->a + 2) >> 2);
	dst2->a = ((src2->a * 3 + src3->a + 2) >> 2);
}

// Assembly:
movq (%rdi), %xmm0
pxor %xmm1, %xmm1
punpcklwd %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
movq (%rsi), %xmm2
punpcklwd %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3]
paddd %xmm2, %xmm0
paddd %xmm2, %xmm2
paddd %xmm0, %xmm2
movdqa 0x1841f(%rip), %xmm0    # 0x1e200
paddd %xmm0, %xmm2
psrld $0x2, %xmm2
pshuflw $0xe8, %xmm2, %xmm2     # xmm2 = xmm2[0,2,2,3,4,5,6,7]
pshufhw $0xe8, %xmm2, %xmm2     # xmm2 = xmm2[0,1,2,3,4,6,6,7]
pshufd $0xe8, %xmm2, %xmm2     # xmm2 = xmm2[0,2,2,3]
movq %xmm2, (%rcx)
movq (%rsi), %xmm2
punpcklwd %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3]
movq (%rdx), %xmm3
punpcklwd %xmm1, %xmm3    # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1],xmm3[2],xmm1[2],xmm3[3],xmm1[3]
paddd %xmm2, %xmm3
paddd %xmm2, %xmm2
paddd %xmm3, %xmm2
paddd %xmm0, %xmm2
psrld $0x2, %xmm2
pshuflw $0xe8, %xmm2, %xmm0     # xmm0 = xmm2[0,2,2,3,4,5,6,7]
pshufhw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,1,2,3,4,6,6,7]
pshufd $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3]
movq %xmm0, (%r8)
retq
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::CLinear16(int, int)
CLinear16::CLinear16(int width, int height)
{
	mWidth = width;
	mHeight = height;
	mDataSize = mWidth * mHeight * (int) sizeof(color_t);
	mData = new color_t[ mWidth * mHeight ];
	memset(mData,128,mDataSize);
	assert(mData);
	mChannel = -1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, (%rdi)
movl %edx, 0x4(%rdi)
imull %esi, %edx
leal (,%rdx,8), %eax
movslq %eax, %r14
movq %r14, 0x8(%rdi)
leaq (,%rdx,8), %rax
testl %edx, %edx
pushq $-0x1
popq %rdi
cmovnsq %rax, %rdi
callq 0x9130
movq %rax, 0x18(%rbx)
movq %rax, %rdi
movl $0x80, %esi
movq %r14, %rdx
callq 0x4070
orl $-0x1, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::ChannelSwap(int)
void CLinear16::ChannelSwap(int swap)
{
	color_t *c = mData;
	int numpixels = mWidth * mHeight;
	if (swap == 132)
	{
		for (int i = 0; i < numpixels; i++)
		{
			color_t temp = *c;
			c->g = temp.b;
			c->b = temp.g;
			c++;
		}
	}
	else if (swap == 213)
	{
		for (int i = 0; i < numpixels; i++)
		{
			color_t temp = *c;
			c->r = temp.g;
			c->g = temp.r;
			c++;
		}
	}
	else if (swap == 231)
	{
		for (int i = 0; i < numpixels; i++)
		{
			color_t temp = *c;
			c->r = temp.g;
			c->g = temp.b;
			c->b = temp.r;
			c++;
		}
	}
	else if (swap == 312)
	{
		for (int i = 0; i < numpixels; i++)
		{
			color_t temp = *c;
			c->r = temp.b;
			c->g = temp.r;
			c->b = temp.g;
			c++;
		}
	}
	else if (swap == 321)
	{
		for (int i = 0; i < numpixels; i++)
		{
			color_t temp = *c;
			c->r = temp.b;
			c->b = temp.r;
			c++;
		}
	}
}

// Assembly:
movq 0x18(%rdi), %rax
movl 0x4(%rdi), %ecx
imull (%rdi), %ecx
cmpl $0x84, %esi
je 0x67fd
cmpl $0xd5, %esi
je 0x679c
cmpl $0xe7, %esi
je 0x67dd
cmpl $0x138, %esi            # imm = 0x138
je 0x67bd
cmpl $0x141, %esi            # imm = 0x141
jne 0x681c
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
cmpl %edx, %ecx
je 0x681c
movzwl (%rax,%rdx,8), %esi
movzwl 0x4(%rax,%rdx,8), %edi
movw %si, 0x4(%rax,%rdx,8)
movw %di, (%rax,%rdx,8)
incq %rdx
jmp 0x677d
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
cmpl %edx, %ecx
je 0x681c
movd 0x2(%rax,%rdx,8), %xmm0
pshuflw $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3,4,5,6,7]
movd %xmm0, 0x2(%rax,%rdx,8)
incq %rdx
jmp 0x67a3
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
cmpl %edx, %ecx
je 0x681c
movzwl (%rax,%rdx,8), %esi
movl 0x2(%rax,%rdx,8), %edi
movw %si, 0x4(%rax,%rdx,8)
movl %edi, (%rax,%rdx,8)
incq %rdx
jmp 0x67c4
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
cmpl %edx, %ecx
je 0x681c
movzwl 0x4(%rax,%rdx,8), %esi
movl (%rax,%rdx,8), %edi
movl %edi, 0x2(%rax,%rdx,8)
movw %si, (%rax,%rdx,8)
incq %rdx
jmp 0x67e4
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
cmpl %edx, %ecx
je 0x681c
movd (%rax,%rdx,8), %xmm0
pshuflw $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3,4,5,6,7]
movd %xmm0, (%rax,%rdx,8)
incq %rdx
jmp 0x6804
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::Invert()
void CLinear16::Invert()
{
	color_t *c = mData;
	int numpixels = mWidth * mHeight;
	for (int i = 0; i < numpixels; i++)
	{
		c->r = 65535 - c->r;
		c->g = 65535 - c->g;
		c->b = 65535 - c->b;
		c++;
	}
}

// Assembly:
movq 0x18(%rdi), %rax
movl 0x4(%rdi), %ecx
imull (%rdi), %ecx
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
cmpl %edx, %ecx
je 0x6840
notw 0x4(%rax,%rdx,8)
notl (%rax,%rdx,8)
incq %rdx
jmp 0x682f
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::Init(int, int)
bool CLinear16::Init(int width, int height)
{
	mWidth = width;
	mHeight = height;
	mDataSize = mWidth * mHeight * (int)sizeof(color_t);
	mData = new color_t[ mWidth * mHeight ];
	if (!mData) return false;
	return true;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl %esi, (%rdi)
movl %edx, 0x4(%rdi)
imull %esi, %edx
leal (,%rdx,8), %eax
cltq
movq %rax, 0x8(%rdi)
leaq (,%rdx,8), %rax
testl %edx, %edx
pushq $-0x1
popq %rdi
cmovnsq %rax, %rdi
callq 0x9130
movq %rax, 0x18(%rbx)
movb $0x1, %al
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::WriteBmp(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool CLinear16::WriteBmp(std::string filename)
{
	int size;
	BitmapFileHeader bfh;
	BitmapInfoHeader bmh;

	FILE *f = fopen(filename.c_str(),"wb");
	if (!f) return false;
	size = mWidth*mHeight*3;

	memcpy(&bfh.bfType,"BM",2);
	bfh.bfSize = size + 56;
	bfh.bfOffBits = 54;
	fwrite(&bfh,1,sizeof(bfh),f);

	memset(&bmh,0,sizeof(bmh));
	bmh.biSize = sizeof(bmh);
	bmh.biWidth = mWidth;
	bmh.biHeight = -mHeight;
	bmh.biPlanes = 1;
	bmh.biBitCount = 24;
	bmh.biXPelsPerMeter = 2834;
	bmh.biYPelsPerMeter = 2834;
	fwrite(&bmh,1,sizeof(bmh),f);
	color_t *cptr = mData;
	uint8_t color[4];
	int pad = 0;
	int rowbytes = mWidth * 3;
	int modu = rowbytes & 3;
	if (modu)
		pad = 4 - modu;

	for (int y = 0; y < mHeight; y++)
	{
		for (int x = 0; x < mWidth; x++)
		{
			color[0] = cptr->b * 255 / 65535;
			color[1] = cptr->g * 255 / 65535;
			color[2] = cptr->r * 255 / 65535;
			fwrite(color,1,3,f);
			cptr++;
		}
		if (pad)
			fwrite(color,1,pad,f);
	}
	fwrite(color,1,2,f);
	fclose(f);
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %r14
movq (%rsi), %rdi
leaq 0x17a37(%rip), %rsi     # 0x1e30e
callq 0x4150
movq %rax, %rbx
testq %rax, %rax
je 0x6a21
movl (%r14), %eax
imull 0x4(%r14), %eax
leaq 0x22(%rsp), %rdi
movw $0x4d42, (%rdi)         # imm = 0x4D42
leal (%rax,%rax,2), %eax
addl $0x38, %eax
movl %eax, 0x2(%rdi)
movl $0x36, 0xa(%rdi)
pushq $0x1
popq %r15
pushq $0xe
popq %rdx
movq %r15, %rsi
movq %rbx, %rcx
callq 0x42d0
leaq 0x30(%rsp), %rdi
andq $0x0, 0x20(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movl $0x28, (%rdi)
movl (%r14), %eax
movl %eax, 0x4(%rdi)
xorl %eax, %eax
subl 0x4(%r14), %eax
movl %eax, 0x8(%rdi)
movl $0x180001, 0xc(%rdi)    # imm = 0x180001
movabsq $0xb1200000b12, %rax    # imm = 0xB1200000B12
movq %rax, 0x18(%rdi)
pushq $0x28
popq %rdx
movq %r15, %rsi
movq %rbx, %rcx
callq 0x42d0
xorl %eax, %eax
subl (%r14), %eax
movq 0x18(%r14), %r12
andl $0x3, %eax
pushq $0x4
popq %rcx
movl %eax, 0x10(%rsp)
subl %eax, %ecx
movq %rcx, 0x18(%rsp)
movw $0x101, %r15w           # imm = 0x101
leaq 0xc(%rsp), %r13
xorl %eax, %eax
cmpl 0x4(%r14), %eax
jge 0x6a06
movl %eax, 0x14(%rsp)
xorl %ebp, %ebp
cmpl (%r14), %ebp
jge 0x69e4
movzwl (%r12), %eax
xorl %edx, %edx
divw %r15w
movb %al, 0xc(%rsp)
movzwl 0x2(%r12), %eax
xorl %edx, %edx
divw %r15w
movb %al, 0xd(%rsp)
movzwl 0x4(%r12), %eax
xorl %edx, %edx
divw %r15w
movb %al, 0xe(%rsp)
movq %r13, %rdi
pushq $0x1
popq %rsi
pushq $0x3
popq %rdx
movq %rbx, %rcx
callq 0x42d0
addq $0x8, %r12
incl %ebp
jmp 0x6997
cmpl $0x0, 0x10(%rsp)
je 0x69fe
movq %r13, %rdi
pushq $0x1
popq %rsi
movq 0x18(%rsp), %rdx
movq %rbx, %rcx
callq 0x42d0
movl 0x14(%rsp), %eax
incl %eax
jmp 0x698b
leaq 0xc(%rsp), %rdi
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
movq %rbx, %rcx
callq 0x42d0
movq %rbx, %rdi
callq 0x42a0
testq %rbx, %rbx
setne %al
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::UpsampleX(CLinear16*)
void CLinear16::UpsampleX(CLinear16 *bmp)
{
	color_t *src = mData - 1;
	color_t *dst = bmp->mData;
	for (int y = 0; y < mHeight; y++)
	{
		UpfilterXLeft(src++, dst);
		dst += 2;
		for (int x = 1; x < mWidth-1; x++)
		{
			UpfilterX(src++, dst);
			dst += 2;
		}
		UpfilterXRight(src++, dst);
		dst += 2;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %r14
addq $-0x8, %r14
movq 0x18(%rsi), %r15
xorl %ebp, %ebp
pushq $0x1
popq %r12
cmpl 0x4(%rbx), %ebp
jge 0x6d9d
movq %r14, %rdi
movq %r15, %rsi
callq 0x5d1e
addq $0x10, %r14
addq $0x20, %r15
movl %r12d, %r13d
leaq -0x10(%r15), %rsi
leaq -0x8(%r14), %rdi
movl (%rbx), %eax
decl %eax
cmpl %eax, %r13d
jge 0x6d94
callq 0x5c9d
incl %r13d
addq $0x8, %r14
addq $0x10, %r15
jmp 0x6d71
callq 0x5d6f
incl %ebp
jmp 0x6d56
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::UpsampleY(CLinear16*)
void CLinear16::UpsampleY(CLinear16 *bmp)
{
	color_t *src1 = mData - mWidth;
	color_t *src2 = mData;
	color_t *src3 = mData + mWidth;
	color_t *dst1 = bmp->mData;
	color_t *dst2 = bmp->mData + bmp->mWidth;
	for (int y = 0; y < mHeight; y++)
	{
		if (y == 0)
		{
			for (int x = 0; x < mWidth; x++)
			{
				UpfilterY(src2, src2, src3, dst1++, dst2++);
				src1++; src2++; src3++;
			}
		}
		else if (y == mHeight - 1)
		{
			for (int x = 0; x < mWidth; x++)
			{
				UpfilterY(src1, src2, src2, dst1++, dst2++);
				src1++; src2++; src3++;
			}
		}
		else
		{
			for (int x = 0; x < mWidth; x++)
			{
				Upfilter(src1++, src2++, src3++, dst1++, dst2++);
			}
		}
		dst1 += bmp->mWidth;
		dst2 += bmp->mWidth;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x18(%rdi), %r15
movq %rdi, 0x8(%rsp)
movslq (%rdi), %rax
leaq (,%rax,8), %rcx
movq %r15, %rdi
subq %rcx, %rdi
leaq (%r15,%rax,8), %r9
movq 0x18(%rsi), %rcx
movq %rsi, 0x10(%rsp)
movslq (%rsi), %rdx
leaq (%rcx,%rdx,8), %r8
movl $0x0, 0x4(%rsp)
movq 0x8(%rsp), %rdx
movl 0x4(%rdx), %edx
cmpl %edx, 0x4(%rsp)
jge 0x6f50
cmpl $0x0, 0x4(%rsp)
je 0x6ea8
decl %edx
cmpl %edx, 0x4(%rsp)
jne 0x6eef
movq %r9, %r12
xorl %ebx, %ebx
cmpl %eax, %ebx
jge 0x6f34
leaq 0x8(%rcx), %r14
leaq 0x8(%r8), %rbp
movq %rdi, %r13
movq %r15, %rsi
movq %r15, %rdx
callq 0x5db9
movq %r13, %rdi
addq $0x8, %rdi
addq $0x8, %r15
addq $0x8, %r12
incl %ebx
movq 0x8(%rsp), %rax
movl (%rax), %eax
movq %r14, %rcx
movq %rbp, %r8
jmp 0x6e6a
movq %rdi, %r13
xorl %ebx, %ebx
cmpl %eax, %ebx
jge 0x6eea
leaq 0x8(%rcx), %rbp
leaq 0x8(%r8), %r14
movq %r15, %rdi
movq %r15, %rsi
movq %r9, %rdx
movq %r9, %r12
callq 0x5db9
movq %r12, %r9
addq $0x8, %r13
addq $0x8, %r15
addq $0x8, %r9
incl %ebx
movq 0x8(%rsp), %rax
movl (%rax), %eax
movq %rbp, %rcx
movq %r14, %r8
jmp 0x6ead
movq %r13, %rdi
jmp 0x6f37
xorl %edx, %edx
cmpl %eax, %edx
jge 0x6f37
leaq 0x8(%rdi), %r14
leaq 0x8(%r15), %rbp
leaq 0x8(%r9), %r13
leaq 0x8(%rcx), %r12
leaq 0x8(%r8), %rbx
movq %r15, %rsi
movl %edx, %r15d
movq %r9, %rdx
callq 0x5e37
movl %r15d, %edx
incl %edx
movq 0x8(%rsp), %rax
movl (%rax), %eax
movq %r14, %rdi
movq %rbp, %r15
movq %r13, %r9
movq %r12, %rcx
movq %rbx, %r8
jmp 0x6ef1
movq %r12, %r9
movq 0x10(%rsp), %rdx
movslq (%rdx), %rdx
leaq (%rcx,%rdx,8), %rcx
leaq (%r8,%rdx,8), %r8
incl 0x4(%rsp)
jmp 0x6e40
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::DownsampleX(CLinear16*)
void CLinear16::DownsampleX(CLinear16 *bmp)
{
	assert((mWidth  & 0xfffe) == bmp->mWidth*2);
	assert(mHeight == bmp->mHeight);
	color_t *src = mData - 1;
	color_t *dst = bmp->mData;
	for (int y = 0; y < bmp->mHeight; y++)
	{
		DownfilterXLeft(src, dst++);
		src += 2;
		for (int x = 1; x < bmp->mWidth-1; x++)
		{
			DownfilterX(src, dst++);
			src += 2;
		}
		DownfilterXRight(src, dst++);
		src += 2 + (mWidth&1);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0xfffe, %eax           # imm = 0xFFFE
andl (%rdi), %eax
movl (%rsi), %ecx
addl %ecx, %ecx
cmpl %ecx, %eax
jne 0x731c
movq %rdi, %rbx
movq %rsi, %r14
movl 0x4(%rdi), %eax
cmpl 0x4(%rsi), %eax
jne 0x733b
movq 0x18(%rbx), %r15
addq $-0x8, %r15
movq 0x18(%r14), %r12
xorl %ebp, %ebp
cmpl %eax, %ebp
jge 0x730d
movq %r15, %rdi
movq %r12, %rsi
callq 0x5434
addq $0x10, %r15
addq $0x10, %r12
pushq $0x1
popq %r13
leaq -0x8(%r12), %rsi
movl (%r14), %eax
decl %eax
movq %r15, %rdi
cmpl %eax, %r13d
jge 0x72f3
callq 0x53d4
incl %r13d
addq $0x10, %r15
addq $0x8, %r12
jmp 0x72cf
callq 0x54cd
movl (%rbx), %eax
andl $0x1, %eax
leaq (%r15,%rax,8), %r15
addq $0x10, %r15
incl %ebp
movl 0x4(%r14), %eax
jmp 0x72b4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x16fee(%rip), %rdi     # 0x1e311
leaq 0x16f66(%rip), %rsi     # 0x1e290
leaq 0x17050(%rip), %rcx     # 0x1e381
movl $0x1f6, %edx            # imm = 0x1F6
callq 0x4100
leaq 0x17068(%rip), %rdi     # 0x1e3aa
leaq 0x16f47(%rip), %rsi     # 0x1e290
leaq 0x17031(%rip), %rcx     # 0x1e381
movl $0x1f7, %edx            # imm = 0x1F7
callq 0x4100
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::WriteSimple16(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, ESimpleFormat)
bool CLinear16::WriteSimple16(std::string filename, ESimpleFormat format)
{
	int bytesPerPixel;
	TSimpleHeader header;
	int bytesPerLine;
	;

	FILE *f = fopen(filename.c_str(), "wb");
	if (f == NULL) 
		return false;
	switch (format)
	{
	case ESimpleFormatRgba:
	case ESimpleFormatBgra:
		bytesPerPixel = 8;
		break;
	case ESimpleFormatRgb:
	case ESimpleFormatBgr:
		bytesPerPixel = 6;
		break;
	case ESimpleFormatL:
		bytesPerPixel = 2;
		break;
	case ESimpleFormatLa:
		bytesPerPixel = 4;
		break;
	default:
		assert(0);
	return false;
	}

	header.cookieA = 'PMIS';
	header.cookieB = 'ECIL';
	header.datasize = bytesPerPixel * mWidth * mHeight;
	header.width = mWidth;
	header.height = mHeight;
	header.bits = 16;
	header.format = format;
	fwrite(&header,1,sizeof(TSimpleHeader),f);
	bytesPerLine = mWidth * bytesPerPixel;
	uint16_t *dst = (uint16_t *) malloc(bytesPerLine);
	color_t *src = mData;
	for (int i = 0; i < mHeight; i++)
	{
		WriteSimpleScanline(src, dst, format);
		fwrite(dst,1,bytesPerLine,f);
		src += mWidth;
	}
	fclose(f);
	free(dst);
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %r12d
movq %rdi, %r15
movq (%rsi), %rdi
leaq 0x16a70(%rip), %rsi     # 0x1e30e
callq 0x4150
movq %rax, %r13
testq %rax, %rax
je 0x797d
leal -0xc3b(%r12), %eax
cmpl $0x6, %eax
jae 0x7992
movl %eax, %eax
leaq 0x169af(%rip), %rcx     # 0x1e278
movslq (%rcx,%rax,4), %r14
movabsq $0x4543494c504d4953, %rax # imm = 0x4543494C504D4953
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
movl (%r15), %eax
movl 0x4(%r15), %ecx
movl %eax, %edx
imull %ecx, %edx
imull %r14d, %edx
movslq %edx, %rdx
movq %rdx, 0x8(%rdi)
movl %eax, 0x10(%rdi)
movl %ecx, 0x14(%rdi)
movl $0x10, 0x18(%rdi)
movq %r12, (%rsp)
movl %r12d, 0x1c(%rdi)
pushq $0x1
popq %rsi
pushq $0x20
popq %rdx
movq %r13, %rbx
movq %r13, %rcx
callq 0x42d0
movslq (%r15), %r13
imulq %r14, %r13
movq %r13, %rdi
callq 0x4140
movq %rax, %rbp
movq 0x18(%r15), %r12
xorl %r14d, %r14d
cmpl 0x4(%r15), %r14d
jge 0x796a
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq (%rsp), %rcx
callq 0x7576
movq %rbp, %rdi
pushq $0x1
popq %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x42d0
movslq (%r15), %rax
leaq (%r12,%rax,8), %r12
incl %r14d
jmp 0x7935
movq %rbx, %r13
movq %rbx, %rdi
callq 0x42a0
movq %rbp, %rdi
callq 0x41c0
testq %r13, %r13
setne %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x16a82(%rip), %rdi     # 0x1e41b
leaq 0x168f0(%rip), %rsi     # 0x1e290
leaq 0x16a76(%rip), %rcx     # 0x1e41d
movl $0x2d5, %edx            # imm = 0x2D5
callq 0x4100
nop
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::ConvertToMonochrome()
void CLinear16::ConvertToMonochrome()
{
	color_t *c = mData;
	for (int y = 0; y < mHeight; y++)
	{
		for (int x = 0; x < mWidth; x++)
		{
			// scale by 10000
			int luma = c->r * 2126 + c->g * 7152 + c->b * 722 + 5000;
			luma /= 10000;
			c->r = luma;
			c->g = luma;
			c->b = luma;
			c++;
		}
	}

}

// Assembly:
movq 0x18(%rdi), %rcx
movl (%rdi), %esi
movl 0x4(%rdi), %edi
xorl %r8d, %r8d
testl %esi, %esi
cmovlel %r8d, %esi
testl %edi, %edi
cmovlel %r8d, %edi
movl $0x2710, %r9d           # imm = 0x2710
movl %esi, %r10d
cmpl %edi, %r8d
je 0x7bbd
subl $0x1, %r10d
jb 0x7bb8
movzwl 0x4(%rcx), %eax
imull $0x84e, %eax, %eax      # imm = 0x84E
movzwl 0x2(%rcx), %edx
imull $0x1bf0, %edx, %edx     # imm = 0x1BF0
addl %eax, %edx
movzwl (%rcx), %eax
imull $0x2d2, %eax, %eax      # imm = 0x2D2
addl %edx, %eax
addl $0x1388, %eax           # imm = 0x1388
xorl %edx, %edx
divl %r9d
movw %ax, 0x4(%rcx)
movw %ax, 0x2(%rcx)
movw %ax, (%rcx)
addq $0x8, %rcx
jmp 0x7b76
incl %r8d
jmp 0x7b6e
retq
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::CompositePremultiplied(CLinear16*)
void CLinear16::CompositePremultiplied(CLinear16 *overlay)
{
	color_t *src = overlay->mData;
	color_t *dst = mData;
	for (int y = 0; y < mHeight; y++)
	{
		for (int x = 0; x < mWidth; x++)
		{
			if (src->a == 0xffff)
			{
				// destination gets 100% of source
				*dst = *src;
			}
			else if (src->a > 0)
			{
				// destination gets 100% of source
				int b = 0xffff - src->a;
				dst->b = dst->b * b / 65535 + src->b;
				dst->g = dst->g * b / 65535 + src->g;
				dst->r = dst->r * b / 65535 + src->r;
			}
			src++;
			dst++;
		}
	}
}

// Assembly:
movq 0x18(%rsi), %rcx
movq 0x18(%rdi), %rsi
xorl %r8d, %r8d
movl $0xffff, %r9d           # imm = 0xFFFF
cmpl 0x4(%rdi), %r8d
jge 0x7c4c
xorl %r10d, %r10d
cmpl (%rdi), %r10d
jge 0x7c47
movzwl 0x6(%rcx), %r11d
testl %r11d, %r11d
je 0x7c3a
cmpl $0xffff, %r11d          # imm = 0xFFFF
jne 0x7bf8
movq (%rcx), %rax
movq %rax, (%rsi)
jmp 0x7c3a
notl %r11d
andl %r9d, %r11d
movzwl (%rsi), %eax
imull %r11d, %eax
xorl %edx, %edx
divl %r9d
addw (%rcx), %ax
movw %ax, (%rsi)
movzwl 0x2(%rsi), %eax
imull %r11d, %eax
xorl %edx, %edx
divl %r9d
addw 0x2(%rcx), %ax
movw %ax, 0x2(%rsi)
movzwl 0x4(%rsi), %eax
imull %r11d, %eax
xorl %edx, %edx
divl %r9d
addw 0x4(%rcx), %ax
movw %ax, 0x4(%rsi)
addq $0x8, %rcx
addq $0x8, %rsi
incl %r10d
jmp 0x7bd8
incl %r8d
jmp 0x7bcf
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::CompositeStraight(CLinear16*)
void CLinear16::CompositeStraight(CLinear16 *overlay)
{
	color_t *src = overlay->mData;
	color_t *dst = mData;
	for (int y = 0; y < mHeight; y++)
	{
		for (int x = 0; x < mWidth; x++)
		{
			if (src->a == 0xffff)
			{
				// destination gets 100% of source
				*dst = *src;
			}
			else if (src->a > 0)
			{
				// destination gets 100% of source
				int b = 0xffff - src->a;
				dst->b = (dst->b * b + src->b * src->a) / 65535;
				dst->g = (dst->g * b + src->g * src->a) / 65535;
				dst->r = (dst->r * b + src->r * src->a) / 65535;
			}
			src++;
			dst++;
		}
	}
}

// Assembly:
pushq %rbx
movq 0x18(%rsi), %rcx
movq 0x18(%rdi), %rsi
xorl %r8d, %r8d
movl $0xffff, %r9d           # imm = 0xFFFF
cmpl 0x4(%rdi), %r8d
jge 0x7cf3
xorl %r10d, %r10d
cmpl (%rdi), %r10d
jge 0x7ceb
movzwl 0x6(%rcx), %r11d
testl %r11d, %r11d
je 0x7cde
cmpl $0xffff, %r11d          # imm = 0xFFFF
jne 0x7c8d
movq (%rcx), %rax
movq %rax, (%rsi)
jmp 0x7cde
movl %r11d, %ebx
xorl %r9d, %ebx
movzwl (%rsi), %edx
imull %ebx, %edx
movzwl (%rcx), %eax
imull %r11d, %eax
addl %edx, %eax
xorl %edx, %edx
divl %r9d
movw %ax, (%rsi)
movzwl 0x2(%rsi), %edx
imull %ebx, %edx
movzwl 0x2(%rcx), %eax
imull %r11d, %eax
addl %edx, %eax
xorl %edx, %edx
divl %r9d
movw %ax, 0x2(%rsi)
movzwl 0x4(%rsi), %edx
imull %ebx, %edx
movzwl 0x4(%rcx), %eax
imull %r11d, %eax
addl %edx, %eax
xorl %edx, %edx
divl %r9d
movw %ax, 0x4(%rsi)
addq $0x8, %rcx
addq $0x8, %rsi
incl %r10d
jmp 0x7c6d
incl %r8d
jmp 0x7c60
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::WriteLumaToAlpha(bool)
void CLinear16::WriteLumaToAlpha(bool invertLuma)
{
	color_t *c = mData;
	for (int y = 0; y < mHeight; y++)
	{
		for (int x = 0; x < mWidth; x++)
		{
			int luma = c->r * 2126 + c->g * 7152 +c->b * 722 + 5000;
			luma /= 10000;
			c->a = invertLuma ? 65535 - luma : luma;
			c++;
		}
	}
}

// Assembly:
movq 0x18(%rdi), %rcx
movl (%rdi), %r8d
movl 0x4(%rdi), %edi
xorl %r9d, %r9d
testl %r8d, %r8d
cmovlel %r9d, %r8d
testl %edi, %edi
cmovlel %r9d, %edi
movl $0x2710, %r10d          # imm = 0x2710
movl %r8d, %r11d
cmpl %edi, %r9d
je 0x7d68
subl $0x1, %r11d
jb 0x7d63
movzwl 0x4(%rcx), %eax
imull $0x84e, %eax, %eax      # imm = 0x84E
movzwl 0x2(%rcx), %edx
imull $0x1bf0, %edx, %edx     # imm = 0x1BF0
addl %eax, %edx
movzwl (%rcx), %eax
imull $0x2d2, %eax, %eax      # imm = 0x2D2
addl %edx, %eax
addl $0x1388, %eax           # imm = 0x1388
xorl %edx, %edx
divl %r10d
movl %eax, %edx
notl %edx
testb %sil, %sil
cmovel %eax, %edx
movw %dx, 0x6(%rcx)
addq $0x8, %rcx
jmp 0x7d1e
incl %r9d
jmp 0x7d16
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::BlitImage(CLinear16*, int, int)
void CLinear16::BlitImage(CLinear16 *image, int dstX, int dstY)
{
	if (dstX + image->mWidth > mWidth)
	{
		assert(0);
		return;
	}
	if (dstY + image->mHeight > mHeight)
	{
		assert(0);
		return;
	}
	color_t *src = image->mData;
	color_t *dst = mData + dstY*mWidth + dstX;
	for (int y = 0; y < image->mHeight; y++)
	{
		for (int x = 0; x < image->mWidth; x++)
		{
			*dst++ = *src++;
		}
		dst += mWidth - image->mWidth;
	}
}

// Assembly:
pushq %rax
movl (%rsi), %eax
leal (%rax,%rdx), %r9d
movl (%rdi), %r8d
cmpl %r8d, %r9d
jg 0x7de5
movl 0x4(%rsi), %r9d
leal (%r9,%rcx), %r10d
cmpl 0x4(%rdi), %r10d
jg 0x7e04
imull %ecx, %r8d
movslq %r8d, %r8
shlq $0x3, %r8
addq 0x18(%rdi), %r8
movq 0x18(%rsi), %rcx
movslq %edx, %rdx
leaq (%r8,%rdx,8), %rdx
xorl %r8d, %r8d
cmpl %r9d, %r8d
jge 0x7de3
xorl %r9d, %r9d
cmpl %eax, %r9d
jge 0x7dc6
movq (%rcx), %rax
addq $0x8, %rcx
movq %rax, (%rdx)
addq $0x8, %rdx
incl %r9d
movl (%rsi), %eax
jmp 0x7dac
movslq (%rdi), %r9
shlq $0x3, %r9
movslq %eax, %r10
shlq $0x3, %r10
subq %r10, %r9
addq %r9, %rdx
incl %r8d
movl 0x4(%rsi), %r9d
jmp 0x7da4
popq %rax
retq
leaq 0x1662f(%rip), %rdi     # 0x1e41b
leaq 0x1649d(%rip), %rsi     # 0x1e290
leaq 0x166d6(%rip), %rcx     # 0x1e4d0
movl $0x385, %edx            # imm = 0x385
callq 0x4100
leaq 0x16610(%rip), %rdi     # 0x1e41b
leaq 0x1647e(%rip), %rsi     # 0x1e290
leaq 0x166b7(%rip), %rcx     # 0x1e4d0
movl $0x38a, %edx            # imm = 0x38A
callq 0x4100
nop
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::Flip(bool, bool)
void CLinear16::Flip(bool flipX, bool flipY)
{
	color_t *src;
	color_t *dst;
	color_t temp;

	if (flipY)
	{
		for (int y = 0; y < mHeight/2; y++)
		{
			src = mData + y * mWidth;
			dst = mData + (mHeight - 1 - y) * mWidth;
			if (flipX)
			{
				dst += mWidth - 1;
				for (int x = 0; x < mWidth; x++)
				{
					temp = *src;
					*src++ = *dst;
					*dst-- = temp;
				}
			}
			else
			{
				for (int x = 0; x < mWidth; x++)
				{
					temp = *src;
					*src++ = *dst;
					*dst++ = temp;
				}
			}
		}
	}
	else if (flipX)
	{
		for (int y = 0; y < mHeight; y++)
		{
			src = mData + y * mWidth;
			dst = src + mWidth - 1;
			for (int x = 0; x < mWidth/2; x++)
			{
				temp = *src;
				*src++ = *dst;
				*dst-- = temp;
			}
		}
	}
}

// Assembly:
pushq %rbx
testl %edx, %edx
je 0x8242
xorl %r8d, %r8d
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movl $0x2, %r10d
movl 0x4(%rdi), %ecx
movl %ecx, %eax
cltd
idivl %r10d
cmpl %eax, %r8d
jge 0x8295
movq 0x18(%rdi), %r11
movl (%rdi), %eax
testb %sil, %sil
je 0x81fe
movslq %eax, %rbx
movl %eax, %edx
imull %r8d, %edx
movslq %edx, %rdx
leaq (%r11,%rdx,8), %rdx
addl %r9d, %ecx
imull %eax, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
leaq (%rcx,%rbx,8), %rcx
addq %r11, %rcx
addq $-0x8, %rcx
xorl %r11d, %r11d
cmpl %eax, %r11d
jge 0x8237
movq (%rdx,%r11,8), %rax
movq (%rcx), %rbx
movq %rbx, (%rdx,%r11,8)
movq %rax, (%rcx)
movl (%rdi), %eax
incq %r11
addq $-0x8, %rcx
jmp 0x81e0
movl %eax, %edx
imull %r8d, %edx
movslq %edx, %rdx
leaq (%r11,%rdx,8), %rdx
addl %r9d, %ecx
imull %eax, %ecx
movslq %ecx, %rcx
leaq (%r11,%rcx,8), %rcx
xorl %r11d, %r11d
cmpl %eax, %r11d
jge 0x8237
movq (%rdx,%r11,8), %rax
movq (%rcx,%r11,8), %rbx
movq %rbx, (%rdx,%r11,8)
movq %rax, (%rcx,%r11,8)
movl (%rdi), %eax
incq %r11
jmp 0x821b
incl %r8d
decl %r9d
jmp 0x8198
testb %sil, %sil
je 0x8295
xorl %ecx, %ecx
movl $0x2, %esi
cmpl 0x4(%rdi), %ecx
jge 0x8295
movslq (%rdi), %rax
movl %eax, %edx
imull %ecx, %edx
movslq %edx, %r8
shlq $0x3, %r8
addq 0x18(%rdi), %r8
movq %rax, %r9
decq %r9
xorl %r10d, %r10d
cltd
idivl %esi
cmpl %eax, %r10d
jge 0x8291
movq (%r8,%r10,8), %rax
movq (%r8,%r9,8), %rdx
movq %rdx, (%r8,%r10,8)
movq %rax, (%r8,%r9,8)
movl (%rdi), %eax
incq %r10
decq %r9
jmp 0x826f
incl %ecx
jmp 0x824e
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::Rotate90()
void CLinear16::Rotate90()
{
	CLinear16 *temp = new CLinear16(mWidth, mHeight);

	color_t *src = mData;

	for (int y = 0; y < mHeight; y++)
	{
		color_t *dst = temp->mData + mWidth - 1 - y;
		for (int x = 0; x < mWidth; x++)
		{
			*dst = *src++;
			dst += mWidth;
		}
	}

	BlitImage(temp, 0, 0);

	delete temp;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
pushq $0x20
popq %rdi
callq 0x90f0
movq %rax, %rbx
movl (%r14), %esi
movl 0x4(%r14), %edx
movq %rax, %rdi
callq 0x6498
movq 0x18(%r14), %rax
xorl %ecx, %ecx
movslq 0x4(%r14), %rdx
cmpq %rdx, %rcx
jge 0x8305
movslq (%r14), %rsi
movq %rsi, %rdx
shlq $0x3, %rdx
addq 0x18(%rbx), %rdx
leaq (,%rcx,8), %rdi
subq %rdi, %rdx
addq $-0x8, %rdx
xorl %edi, %edi
cmpl %esi, %edi
jge 0x8300
movq (%rax), %rsi
addq $0x8, %rax
movq %rsi, (%rdx)
movslq (%r14), %rsi
leaq (%rdx,%rsi,8), %rdx
incl %edi
jmp 0x82e7
incq %rcx
jmp 0x82bf
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x7d6a
movq %rbx, %rdi
callq 0x64ec
pushq $0x20
popq %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x83e0
movq %rax, %r14
pushq $0x20
popq %rsi
movq %rbx, %rdi
callq 0x83e0
movq %r14, %rdi
callq 0x4310
// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::Rotate(int)
void CLinear16::Rotate(int angle)
{
	assert(mWidth == mHeight);
	angle = angle % 360;
	switch (angle)
	{
	case 0:
		break;
	case 90:
		Rotate90();
		break;
	case 180:
		Flip(true, true);
		break;
	case 270:
		Flip(true, true);
		Rotate90();
		break;
	default:
		assert(0);
	}
}

// Assembly:
pushq %rbx
movl (%rdi), %eax
cmpl 0x4(%rdi), %eax
jne 0x83b7
movl $0x168, %ecx            # imm = 0x168
movl %esi, %eax
cltd
idivl %ecx
testl %edx, %edx
je 0x839f
movq %rdi, %rbx
cmpl $0x10e, %edx            # imm = 0x10E
je 0x83a1
cmpl $0xb4, %edx
je 0x8391
cmpl $0x5a, %edx
je 0x83ae
leaq 0x160a2(%rip), %rdi     # 0x1e41b
leaq 0x15f10(%rip), %rsi     # 0x1e290
leaq 0x1622f(%rip), %rcx     # 0x1e5b6
movl $0x439, %edx            # imm = 0x439
callq 0x4100
pushq $0x1
popq %rdx
movq %rbx, %rdi
movl %edx, %esi
popq %rbx
jmp 0x8180
popq %rbx
retq
pushq $0x1
popq %rdx
movq %rbx, %rdi
movl %edx, %esi
callq 0x8180
movq %rbx, %rdi
popq %rbx
jmp 0x8298
leaq 0x161e6(%rip), %rdi     # 0x1e5a4
leaq 0x15ecb(%rip), %rsi     # 0x1e290
leaq 0x161ea(%rip), %rcx     # 0x1e5b6
movl $0x428, %edx            # imm = 0x428
callq 0x4100
nopw %cs:(%rax,%rax)
// File: /workspace/github_cpp_makefile_star2_O2/mrGoncharuk[P]foldermonitor/src/main.cpp
// Function: daemonize()
int	daemonize()
{
	pid_t pid, sid;

	pid = fork();
	if(pid > 0)
	{
		exit(EXIT_SUCCESS);
	}
	else if(pid < 0)
	{
		exit(EXIT_FAILURE);
	}
	umask(0);

	openlog("daemon-foldermonitor", LOG_NOWAIT | LOG_PID, LOG_MAIL);
	syslog(LOG_NOTICE, "Staring daemon-foldermonitor...");

	sid = setsid();
	if(sid < 0)
	{
		syslog(LOG_ERR, "Could not generate session ID for child process");
		exit(EXIT_FAILURE);
	}

	if((chdir("/")) < 0)
	{
		syslog(LOG_ERR, "Could not change working directory to /");
		exit(EXIT_FAILURE);
	}


	const char *pidfile = "/var/run/daemon-foldermonitor.pid";
	int pidFilehandle = open(pidfile, O_RDWR | O_CREAT, 0666);
	if (pidFilehandle == -1 )
	{
		syslog(LOG_INFO, "Could not open PID lock file %s, exiting", pidfile);
		exit(EXIT_FAILURE);
	}
	int fr = flock(pidFilehandle, LOCK_EX | LOCK_NB);
	if (fr < 0)
	{
		syslog(LOG_INFO, "Daemon already running. Terminating current daemon with pid <%d>.", getpid());
		exit(EXIT_FAILURE);
	}
	std::string strpid = std::to_string(getpid());
	write(pidFilehandle, strpid.c_str(), strpid.length());
	
	close(STDIN_FILENO);
	close(STDOUT_FILENO);
	close(STDERR_FILENO);
	return pidFilehandle;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
callq 0x2080
testl %eax, %eax
jg 0x2601
js 0x2656
xorl %edi, %edi
callq 0x2320
leaq 0x1ac0(%rip), %rdi      # 0x4004
pushq $0x11
popq %rsi
pushq $0x10
popq %rdx
callq 0x21a0
leaq 0x1ac3(%rip), %rsi      # 0x4019
pushq $0x5
popq %rdi
xorl %eax, %eax
callq 0x2050
callq 0x2200
testl %eax, %eax
js 0x2608
leaq 0x1b1b(%rip), %rdi      # 0x408f
callq 0x22c0
testl %eax, %eax
js 0x2611
leaq 0x1b09(%rip), %rdi      # 0x4091
pushq $0x42
popq %rsi
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x2170
cmpl $-0x1, %eax
je 0x2624
movl %eax, %ebx
pushq $0x6
popq %rsi
movl %eax, %edi
callq 0x2360
testl %eax, %eax
js 0x263e
callq 0x22a0
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movl %eax, %esi
callq 0x2899
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movl %ebx, %edi
callq 0x20b0
xorl %edi, %edi
callq 0x2390
pushq $0x1
popq %rdi
callq 0x2390
pushq $0x2
popq %rdi
callq 0x2390
leaq 0x8(%rsp), %rdi
callq 0x20f0
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
xorl %edi, %edi
callq 0x2220
leaq 0x1a2a(%rip), %rsi      # 0x4039
jmp 0x2618
leaq 0x1a51(%rip), %rsi      # 0x4069
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x2050
jmp 0x2656
leaq 0x1a88(%rip), %rsi      # 0x40b3
leaq 0x1a5f(%rip), %rdx      # 0x4091
pushq $0x6
popq %rdi
xorl %eax, %eax
callq 0x2050
jmp 0x2656
callq 0x22a0
leaq 0x1a92(%rip), %rsi      # 0x40dc
pushq $0x6
popq %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2050
pushq $0x1
popq %rdi
callq 0x2220
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x2310
// File: /workspace/github_cpp_makefile_star2_O2/mrGoncharuk[P]foldermonitor/src/DbWriter.cpp
// Function: DBWriter::executeQuery(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void 	DBWriter::executeQuery(const std::string &query)
{
	int ret;
	char *errmsg;

	std::lock_guard<std::mutex> lock(dbMutex);
	ret = sqlite3_exec(db, query.c_str(), nullptr, nullptr, &errmsg);
	if (ret == SQLITE_OK)
		syslog(LOG_NOTICE, "DW> Query executed successfully.");
	else
	{
		syslog(LOG_ERR, "DW> Error while migrating data from. Query: [%s]. Error message: %s.", query.c_str(), errmsg);
		sqlite3_free(errmsg);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %r15
leaq 0x30(%rdi), %rbx
movq %rbx, %rdi
callq 0x2ca2
movq 0x8(%r15), %rdi
movq (%r14), %rsi
leaq 0x8(%rsp), %r8
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2260
testl %eax, %eax
je 0x2c43
movq (%r14), %rdx
movq 0x8(%rsp), %rcx
leaq 0x17ff(%rip), %rsi      # 0x442c
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x2050
movq 0x8(%rsp), %rdi
callq 0x2240
jmp 0x2c54
leaq 0x17c1(%rip), %rsi      # 0x440b
pushq $0x5
popq %rdi
xorl %eax, %eax
callq 0x2050
movq %rbx, %rdi
callq 0x2180
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x2180
movq %r14, %rdi
callq 0x2310
nop
// File: /workspace/github_cpp_makefile_star2_O2/mrGoncharuk[P]foldermonitor/src/DirectoryMonitor.cpp
// Function: DirectoryMonitor::~DirectoryMonitor()
DirectoryMonitor::~DirectoryMonitor()
{
	syslog(LOG_NOTICE, "DM> File watcher destroyed.");
	if (fileDescriptor > 0 && watchDescriptor > 0)
		inotify_rm_watch(fileDescriptor, watchDescriptor);
	if (fileDescriptor > 0)
		close(fileDescriptor);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x17e5(%rip), %rsi      # 0x44a8
pushq $0x5
popq %rdi
xorl %eax, %eax
callq 0x2050
movl (%rbx), %edi
testl %edi, %edi
jle 0x2cea
movl 0x4(%rbx), %esi
testl %esi, %esi
jle 0x2ce5
callq 0x2110
movl (%rbx), %edi
testl %edi, %edi
jle 0x2cea
callq 0x2390
addq $0x8, %rbx
movq %rbx, %rdi
popq %rbx
jmp 0x20f0
movq %rax, %rdi
callq 0x2c96
nop
// File: /workspace/github_cpp_makefile_star2_O2/mrGoncharuk[P]foldermonitor/src/DirectoryMonitor.cpp
// Function: DirectoryMonitor::initWatcher()
bool DirectoryMonitor::initWatcher()
{
	fileDescriptor = inotify_init();
	if (fileDescriptor < 0)
	{
		syslog (LOG_ERR, "DM> Error while inotify initialization.");
		syslog (LOG_NOTICE, "DM> Daemon stops.");
		return false;
	}
	watchDescriptor = inotify_add_watch(fileDescriptor, fname.c_str(), IN_CREATE);
	if (watchDescriptor < 0)
	{
		syslog (LOG_ERR, "DM> Error while starting watching folder.");
		syslog (LOG_NOTICE, "DM> Daemon stops.");
		return false;
	}
	syslog(LOG_NOTICE, "DM> File watcher initialized successfully.");
	return true;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x2330
movl %eax, (%rbx)
testl %eax, %eax
js 0x2d75
movq 0x8(%rbx), %rsi
movl %eax, %edi
movl $0x100, %edx            # imm = 0x100
callq 0x2130
movl %eax, 0x4(%rbx)
testl %eax, %eax
js 0x2d7e
movb $0x1, %bl
leaq 0x17cf(%rip), %rsi      # 0x4542
jmp 0x2d98
leaq 0x1762(%rip), %rsi      # 0x44de
jmp 0x2d85
leaq 0x1793(%rip), %rsi      # 0x4518
xorl %ebx, %ebx
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x2050
leaq 0x176e(%rip), %rsi      # 0x4506
pushq $0x5
popq %rdi
xorl %eax, %eax
callq 0x2050
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/mrGoncharuk[P]foldermonitor/src/DirectoryMonitor.cpp
// Function: DirectoryMonitor::startWatching(std::mutex&, std::__cxx11::list<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&, std::atomic<bool>&)
void	DirectoryMonitor::startWatching(std::mutex &p_mutex, std::list<std::string> &filenames, std::atomic<bool> &isRunning)
{
	char buffer[BufferSize];
	int i;
	int total_read;
	while (isRunning)
	{
		i = 0;
		total_read = read(fileDescriptor, buffer, BufferSize);
		if (total_read < 0)
			syslog (LOG_ERR, "DM> Error while reading folder events.");
		while (i < total_read)
		{
			inotify_event *event = reinterpret_cast<inotify_event *>(buffer + i);
			if (event->len)
			{
				if (!(event->mask & IN_ISDIR))
				{
					std::lock_guard<std::mutex> lock(p_mutex);
					syslog (LOG_INFO, "DM> File created <%s>", event->name);

					filenames.push_back(fname + event->name);
				}
			}
			i += MonitorEventSize + event->len;
		}
	}
	syslog(LOG_NOTICE, "DM> Monitoring of <%s> stops.", fname.c_str());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3048, %rsp           # imm = 0x3048
movq %rcx, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
leaq 0x8(%rdi), %rax
movq %rax, (%rsp)
leaq 0x20(%rsp), %r13
movq 0x10(%rsp), %rax
movb (%rax), %al
testb $0x1, %al
je 0x2e95
movq 0x8(%rsp), %rax
movl (%rax), %edi
movl $0x3000, %edx           # imm = 0x3000
leaq 0x40(%rsp), %rsi
callq 0x2290
movq %rax, %rbp
testl %ebp, %ebp
jns 0x2e13
pushq $0x3
popq %rdi
leaq 0x1761(%rip), %rsi      # 0x456d
xorl %eax, %eax
callq 0x2050
xorl %r15d, %r15d
cmpl %ebp, %r15d
jge 0x2dd6
movslq %r15d, %rcx
movl 0x4c(%rsp,%rcx), %eax
testl %eax, %eax
je 0x2e8a
leaq (%rsp,%rcx), %r12
addq $0x40, %r12
testb $0x40, 0x7(%r12)
jne 0x2e8c
movq %rbx, %rdi
callq 0x2ca2
leaq 0x10(%r12), %r14
pushq $0x6
popq %rdi
leaq 0x1747(%rip), %rsi      # 0x4594
movq %r14, %rdx
xorl %eax, %eax
callq 0x2050
movq %r13, %rdi
movq (%rsp), %rsi
movq %r14, %rdx
callq 0x2eef
movq 0x18(%rsp), %rdi
movq %r13, %rsi
callq 0x2ee4
movq %r13, %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x2180
movl 0xc(%r12), %eax
jmp 0x2e8c
xorl %eax, %eax
addl %eax, %r15d
addl $0x10, %r15d
jmp 0x2e16
movq (%rsp), %rax
movq (%rax), %rdx
leaq 0x1707(%rip), %rsi      # 0x45aa
pushq $0x5
popq %rdi
xorl %eax, %eax
callq 0x2050
addq $0x3048, %rsp           # imm = 0x3048
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x20f0
jmp 0x2ed3
jmp 0x2ed0
movq %rax, %r14
movq %rbx, %rdi
callq 0x2180
movq %r14, %rdi
callq 0x2310
nop
// File: /workspace/github_cpp_makefile_star2_O2/mrGoncharuk[P]foldermonitor/src/FileReader.cpp
// Function: FileReader::extractData(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
std::string FileReader::extractData(const std::string &fname)
{
	syslog(LOG_NOTICE, "FR> Start processing <%s>", fname.c_str());
	std::string		query = "INSERT INTO filedata VALUES('";
	std::ifstream 	ifs(fname.c_str());
	std::string		data;
	if (ifs)
	{
		std::getline(ifs, data, ':');
		query = query + data + "','";
		std::getline(ifs, data, ':');
		query = query + data + "');";
		ifs.close();
		syslog(LOG_NOTICE, "FR> first query <%s>", query.c_str());
		syslog(LOG_NOTICE, "FR> File <%s>, processed successfully.", fname.c_str());
	}
	else
		syslog(LOG_ERR, "FR> Error while opening file <%s>", fname.c_str());
	return (query);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rdx
leaq 0x15b7(%rip), %rsi      # 0x45c8
pushq $0x5
popq %rbp
movl %ebp, %edi
xorl %eax, %eax
callq 0x2050
leaq 0x15be(%rip), %rsi      # 0x45e2
leaq 0x60(%rsp), %rdx
movq %rbx, %rdi
callq 0x20d0
movq (%r14), %rsi
leaq 0x60(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x2340
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x60(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x80(%rsp,%rax)
je 0x3074
leaq 0x15d8(%rip), %rsi      # 0x4644
pushq $0x3
popq %rbp
jmp 0x3144
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rsi
pushq $0x3a
popq %rdx
callq 0x2350
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
movq %rbx, %rsi
callq 0x31d3
leaq 0x1563(%rip), %rdx      # 0x4600
leaq 0x40(%rsp), %rdi
movq %rsp, %rsi
callq 0x31b4
leaq 0x40(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2230
movq %r15, %rdi
callq 0x20f0
movq %rsp, %rdi
callq 0x20f0
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rsi
pushq $0x3a
popq %rdx
callq 0x2350
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
movq %rbx, %rsi
callq 0x31d3
leaq 0x1511(%rip), %rdx      # 0x4604
leaq 0x40(%rsp), %rdi
movq %rsp, %rsi
callq 0x31b4
leaq 0x40(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2230
movq %r15, %rdi
callq 0x20f0
movq %rsp, %rdi
callq 0x20f0
leaq 0x60(%rsp), %rdi
callq 0x2060
movq (%rbx), %rdx
leaq 0x14d4(%rip), %rsi      # 0x4608
movl %ebp, %edi
xorl %eax, %eax
callq 0x2050
leaq 0x14d9(%rip), %rsi      # 0x461d
movq (%r14), %rdx
movl %ebp, %edi
xorl %eax, %eax
callq 0x2050
leaq 0x20(%rsp), %rdi
callq 0x20f0
leaq 0x60(%rsp), %rdi
callq 0x2070
movq %rbx, %rax
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3179
jmp 0x318d
movq %rax, %r14
movq %rsp, %rdi
callq 0x20f0
jmp 0x3190
jmp 0x318d
movq %rax, %r14
jmp 0x31a4
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x20f0
leaq 0x60(%rsp), %rdi
callq 0x2070
movq %rbx, %rdi
callq 0x20f0
movq %r14, %rdi
callq 0x2310
// File: /workspace/github_cpp_makefile_star2_O2/mrGoncharuk[P]foldermonitor/src/MigrationManager.cpp
// Function: MigrationManager::migrateSolo(std::mutex&, std::__cxx11::list<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&, std::atomic<bool>&)
void 	MigrationManager::migrateSolo(std::mutex &list_mutex, std::list<std::string> &filenames, std::atomic<bool> &isRunning)
{
	std::string currFileName;

	while (isRunning)
	{
		list_mutex.lock();
		if (filenames.empty())
			list_mutex.unlock();
		else
		{
			currFileName = filenames.front();
			filenames.pop_front();
			list_mutex.unlock();
			std::string query = FileReader::extractData(currFileName);
			dbwriter->executeQuery(query);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdi, %r12
movb $0x0, (%rax)
leaq 0x8(%rsp), %r13
leaq 0x28(%rsp), %rbp
movb (%rbx), %al
testb $0x1, %al
je 0x32b9
movq %r15, %rdi
callq 0x2ca2
movq (%r14), %rsi
cmpq %r14, %rsi
je 0x32af
addq $0x10, %rsi
movq %r13, %rdi
callq 0x2140
movq %r14, %rdi
callq 0x38fc
movq %r15, %rdi
callq 0x2180
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2ff4
movq (%r12), %rdi
movq (%rdi), %rax
movq %rbp, %rsi
callq *0x8(%rax)
movq %rbp, %rdi
callq 0x20f0
jmp 0x325b
movq %r15, %rdi
callq 0x2180
jmp 0x325b
leaq 0x8(%rsp), %rdi
callq 0x20f0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x20f0
jmp 0x32e6
jmp 0x32e3
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x2310
// File: /workspace/github_cpp_makefile_star2_O2/mrGoncharuk[P]foldermonitor/src/MigrationManager.cpp
// Function: MigrationManager::migrateData(std::mutex&, std::__cxx11::list<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&, std::atomic<bool>&)
void	MigrationManager::migrateData(std::mutex &list_mutex, std::list<std::string> &filenames, std::atomic<bool> &isRunning)
{
	if (threadAmount == 1)
	{
		syslog(LOG_NOTICE, "MM> Data migration will be executed in solo thread mode.");
		migrateSolo(list_mutex, filenames, isRunning);
	}
	else
	{
		syslog(LOG_NOTICE, "MM> Data migration will be executed in <%d> threads.", threadAmount);
		migrateThreaded(list_mutex, filenames, isRunning);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movl 0x8(%rdi), %edx
cmpl $0x1, %edx
jne 0x37bf
leaq 0xf11(%rip), %rsi       # 0x46aa
pushq $0x5
popq %rdi
xorl %eax, %eax
callq 0x2050
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3226
leaq 0xf1d(%rip), %rsi       # 0x46e3
pushq $0x5
popq %rdi
xorl %eax, %eax
callq 0x2050
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x32f8