LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx5/gtx5_firmware_image.cpp
// Function: GTX5FirmwareImage::InitVid()
int GTX5FirmwareImage::InitVid()
{
	gdix_dbg("GTX5FirmwareImage InitVid run\n");
	int ret = -1;

	if (!m_firmwareData)
		goto exit;

	m_firmwareVersionMajor = m_firmwareData[GTX5_FW_IMAGE_CID_OFFSET];
	m_firmwareVersionMinor =
		((m_firmwareData[GTX5_FW_IMAGE_VID_OFFSET] << 16) |
		 (m_firmwareData[GTX5_FW_IMAGE_VID_OFFSET + 1] << 8) |
		 (m_firmwareData[GTX5_FW_IMAGE_VID_OFFSET + 2]));
	gdix_dbg("cid:0x%02x,vid 0x%02X,0x%02X,0x%02X\n",
			 m_firmwareData[GTX5_FW_IMAGE_CID_OFFSET],
			 m_firmwareData[GTX5_FW_IMAGE_VID_OFFSET],
			 m_firmwareData[GTX5_FW_IMAGE_VID_OFFSET + 1],
			 m_firmwareData[GTX5_FW_IMAGE_VID_OFFSET + 2]);
	ret = 0;
exit:
	gdix_dbg("GTX5FirmwareImage InitVid exit,exit code:%d\n", ret);
	return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x13c1d(%rip), %r14     # 0x20291
movb (%r14), %al
cmpb $0x1, %al
jne 0xc6a0
movq 0x13936(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xaf9b(%rip), %rsi      # 0x17627
leaq 0x8bdf(%rip), %rdx      # 0x15272
pushq $0x3a
popq %rcx
xorl %eax, %eax
callq 0x5180
movb (%r14), %al
movq 0x30(%rbx), %rcx
testq %rcx, %rcx
je 0xc712
movzbl 0x17(%rcx), %edx
movl %edx, 0x24(%rbx)
movzbl 0x18(%rcx), %edx
shll $0x10, %edx
movzbl 0x19(%rcx), %esi
shll $0x8, %esi
orl %edx, %esi
movzbl 0x1a(%rcx), %edx
orl %esi, %edx
movl %edx, 0x28(%rbx)
xorl %ebx, %ebx
testb $0x1, %al
je 0xc715
movq 0x138e2(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
movzbl 0x17(%rcx), %r8d
movzbl 0x18(%rcx), %r9d
movzbl 0x19(%rcx), %r10d
movzbl 0x1a(%rcx), %r11d
leaq 0x9897(%rip), %rsi      # 0x15f8b
leaq 0x8b77(%rip), %rdx      # 0x15272
xorl %ebx, %ebx
pushq $0x49
popq %rcx
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x5180
popq %rcx
popq %rdx
movb (%r14), %al
jmp 0xc715
pushq $-0x1
popq %rbx
testb $0x1, %al
je 0xc73e
movq 0x13898(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xaf2d(%rip), %rsi      # 0x17657
leaq 0x8b41(%rip), %rdx      # 0x15272
pushq $0x4c
popq %rcx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x5180
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx5/gtx5_update.cpp
// Function: GTx5Update::Run(void*)
int GTx5Update::Run(void *para)
{
	int ret = 0;
	int retry = 0;
	if (!m_Initialized) {
		gdix_err("Can't Process Update Before Initialized.\n");
		return -1;
	}
	// get all parameter
	pGTUpdatePara parameter = (pGTUpdatePara)para;

	if (!parameter->force) {
		ret = check_update();
		if (ret) {
			gdix_err("Doesn't meet the update conditions\n");
			return -3;
		}
	}

	retry = 0;
	do {
		ret = fw_update(parameter->firmwareFlag);
		if (ret) {
			gdix_dbg("Update failed\n");
			usleep(200000);
		} else {
			usleep(300000);
			gdix_dbg("Update success\n");
			return 0;
		}
	} while (retry++ < 3);
	gdix_err("Firmware update err:ret=%d\n", ret);
	return -4;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpb $0x0, 0x18(%rdi)
je 0xc7a3
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x0, (%rsi)
jne 0xc7d5
movq (%r14), %rax
movq %r14, %rdi
callq *0x20(%rax)
testl %eax, %eax
je 0xc7d5
leaq 0x13b19(%rip), %rax     # 0x20291
pushq $-0x3
popq %rbx
cmpb $0x1, (%rax)
jne 0xc893
movq 0x1384d(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
leaq 0x98ec(%rip), %rsi      # 0x16081
leaq 0x98b8(%rip), %rdx      # 0x16054
pushq $0x36
jmp 0xc88b
leaq 0x13ae7(%rip), %rax     # 0x20291
pushq $-0x1
popq %rbx
cmpb $0x1, (%rax)
jne 0xc893
movq 0x1381b(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
leaq 0x9852(%rip), %rsi      # 0x16019
leaq 0x9886(%rip), %rdx      # 0x16054
pushq $0x2d
jmp 0xc88b
pushq $0x4
popq %r12
leaq 0x13ab1(%rip), %r15     # 0x20291
pushq $0x3f
popq %r13
movl 0x4(%rbx), %esi
movq (%r14), %rax
movq %r14, %rdi
callq *0x30(%rax)
testl %eax, %eax
je 0xc85d
movl %eax, %ebp
cmpb $0x1, (%r15)
jne 0xc81e
movq 0x137b5(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0x98a9(%rip), %rsi      # 0x160b6
leaq 0x9840(%rip), %rdx      # 0x16054
movl %r13d, %ecx
xorl %eax, %eax
callq 0x5180
movl $0x30d40, %edi          # imm = 0x30D40
callq 0x5170
decl %r12d
jne 0xc7e4
pushq $-0x4
popq %rbx
cmpb $0x1, (%r15)
jne 0xc893
movq 0x1379b(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
leaq 0x90cb(%rip), %rsi      # 0x15912
leaq 0x9806(%rip), %rdx      # 0x16054
pushq $0x47
popq %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x5180
jmp 0xc893
movl $0x493e0, %edi          # imm = 0x493E0
callq 0x5170
xorl %ebx, %ebx
cmpb $0x1, (%r15)
jne 0xc893
movq 0x13742(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0x9856(%rip), %rsi      # 0x160d6
leaq 0x97cd(%rip), %rdx      # 0x16054
xorl %ebx, %ebx
pushq $0x43
popq %rcx
xorl %eax, %eax
callq 0x5180
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx8/gtx8_firmware_image.cpp
// Function: GTX8FirmwareImage::InitPid()
int GTX8FirmwareImage::InitPid()
{
	gdix_dbg("GTX8FirmwareImage::InitPid run\n");
	int ret = -1;
	int i = 0;
	int j = 0;

	if (!m_firmwareData) {
		goto exit;
	}
	for (i = 0, j = 0; i < GTX8_FW_IMAGE_PID_LEN; i++)
		if (m_firmwareData[GTX8_FW_IMAGE_PID_OFFSET + i] != 0)
			m_pid[j++] = m_firmwareData[GTX8_FW_IMAGE_PID_OFFSET + i];
	m_pid[j] = '\0';
	ret = 0;

exit:
	gdix_dbg("GTX8FirmwareImage::InitPid exit\n");
	return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x12d19(%rip), %r14     # 0x20291
cmpb $0x1, (%r14)
jne 0xd5a0
movq 0x12a33(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xa207(%rip), %rsi      # 0x17796
leaq 0x7cac(%rip), %rdx      # 0x15242
pushq $0x20
popq %rcx
xorl %eax, %eax
callq 0x5180
cmpq $0x0, 0x30(%rbx)
je 0xd5d8
xorl %eax, %eax
xorl %ecx, %ecx
movslq %ecx, %rdx
cmpq $0x8, %rax
je 0xd5cf
movq 0x30(%rbx), %rsi
movb 0xf(%rsi,%rax), %sil
testb %sil, %sil
je 0xd5ca
leal 0x1(%rdx), %ecx
movb %sil, 0x19(%rbx,%rdx)
incq %rax
jmp 0xd5ab
movb $0x0, 0x19(%rbx,%rdx)
xorl %ebx, %ebx
jmp 0xd5db
pushq $-0x1
popq %rbx
cmpb $0x1, (%r14)
jne 0xd603
movq 0x129d0(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xa1d5(%rip), %rsi      # 0x177c7
leaq 0x7c49(%rip), %rdx      # 0x15242
pushq $0x2f
popq %rcx
xorl %eax, %eax
callq 0x5180
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx8/gtx8_firmware_image.cpp
// Function: GTX8FirmwareImage::InitVid()
int GTX8FirmwareImage::InitVid()
{
	gdix_dbg("GTX8FirmwareImage InitVid run\n");
	int ret = -1;

	if (!m_firmwareData)
		goto exit;

	m_firmwareVersionMajor = m_firmwareData[GTX8_FW_IMAGE_VID_OFFSET];
	/* |--vid2--|--vid3--|--cfg_id--|
	 * reserve the last byte for config ID.
	 */
	m_firmwareVersionMinor =
		(m_firmwareData[GTX8_FW_IMAGE_VID_OFFSET + 1] << 16) |
		(m_firmwareData[GTX8_FW_IMAGE_VID_OFFSET + 2] << 8);
	gdix_dbg("cid:0x%02x,vid 0x%02X,0x%02X,0x%02X\n",
			 m_firmwareData[GTX8_FW_IMAGE_CID_OFFSET],
			 m_firmwareData[GTX8_FW_IMAGE_VID_OFFSET],
			 m_firmwareData[GTX8_FW_IMAGE_VID_OFFSET + 1],
			 m_firmwareData[GTX8_FW_IMAGE_VID_OFFSET + 2]);
	ret = 0;
exit:
	gdix_dbg("GTX8FirmwareImage InitVid exit,exit code:%d\n", ret);
	return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x12c75(%rip), %r14     # 0x20291
movb (%r14), %al
cmpb $0x1, %al
jne 0xd648
movq 0x1298e(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xa1c5(%rip), %rsi      # 0x177f9
leaq 0x7c37(%rip), %rdx      # 0x15272
pushq $0x35
popq %rcx
xorl %eax, %eax
callq 0x5180
movb (%r14), %al
movq 0x30(%rbx), %rcx
testq %rcx, %rcx
je 0xd6b4
movzbl 0x18(%rcx), %edx
movl %edx, 0x24(%rbx)
movzbl 0x19(%rcx), %edx
shll $0x10, %edx
movzbl 0x1a(%rcx), %esi
shll $0x8, %esi
orl %edx, %esi
movl %esi, 0x28(%rbx)
xorl %ebx, %ebx
testb $0x1, %al
je 0xd6b7
movq 0x12940(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
movzbl 0x17(%rcx), %r8d
movzbl 0x18(%rcx), %r9d
movzbl 0x19(%rcx), %r10d
movzbl 0x1a(%rcx), %r11d
leaq 0x88f5(%rip), %rsi      # 0x15f8b
leaq 0x7bd5(%rip), %rdx      # 0x15272
xorl %ebx, %ebx
pushq $0x46
popq %rcx
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x5180
popq %rcx
popq %rdx
movb (%r14), %al
jmp 0xd6b7
pushq $-0x1
popq %rbx
testb $0x1, %al
je 0xd6e0
movq 0x128f6(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xa15d(%rip), %rsi      # 0x17829
leaq 0x7b9f(%rip), %rdx      # 0x15272
pushq $0x49
popq %rcx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x5180
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx9/gtx9.cpp
// Function: GTx9Device::GTx9Device()
GTx9Device::GTx9Device()
{
	m_fd = -1;
	m_firmwareVersionMajor = 0;
	m_firmwareVersionMinor = 0;
	m_sensorID = 0;
	m_configID = 0;
	memset(m_pid, 0, sizeof(m_pid));
	memset(m_vid, 0, sizeof(m_vid));
	m_deviceOpen = false;
}

// Assembly:
leaq 0x10c59(%rip), %rax     # 0x1f948
movq %rax, (%rdi)
orl $-0x1, 0xc(%rdi)
andl $0x0, 0x28(%rdi)
xorl %eax, %eax
movb %al, 0x1c(%rdi)
andq $0x0, 0x20(%rdi)
andq $0x0, 0x10(%rdi)
andl $0x0, 0x18(%rdi)
movb %al, 0x8(%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx9/gtx9.cpp
// Function: GTx9Device::Open(char const*)
int GTx9Device::Open(const char *filename)
{
	if (!filename)
		return -EINVAL;

	m_fd = open(filename, O_RDWR);
	if (m_fd < 0)
		return -EINVAL;

	m_deviceOpen = true;

	return SetBasicProperties();
}

// Assembly:
pushq %rbx
testq %rsi, %rsi
je 0xed42
movq %rdi, %rbx
pushq $0x2
popq %rax
movq %rsi, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x51e0
movl %eax, 0xc(%rbx)
testl %eax, %eax
js 0xed42
movb $0x1, 0x8(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
jmpq *0xa0(%rax)
pushq $-0x16
popq %rax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx9/gtx9.cpp
// Function: GTx9Device::Close()
void GTx9Device::Close()
{
	if (!m_deviceOpen)
		return;
	close(m_fd);
	m_fd = -1;
	m_deviceOpen = false;
}

// Assembly:
cmpb $0x1, 0x8(%rdi)
jne 0xed63
pushq %rbx
movq %rdi, %rbx
movl 0xc(%rdi), %edi
callq 0x5210
orl $-0x1, 0xc(%rbx)
movb $0x0, 0x8(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx9/gtx9.cpp
// Function: GTx9Device::SetReport(unsigned char*, int)
int GTx9Device::SetReport(unsigned char *buf, int len)
{
	int retry = 5;
	int ret;

	while (retry--) {
		ret = ioctl(m_fd, HIDIOCSFEATURE(len), buf);
		if (ret == len)
			return 0;
		usleep(1000);
	}

	gdix_err("Failed set report, ret:%d\n", ret);
	return -EINVAL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, (%rsp)
movq %rdi, %r15
movl %edx, %r12d
shll $0x10, %r12d
orl $0xc0004806, %r12d      # imm = 0xC0004806
pushq $-0x5
popq %r14
xorl %r13d, %r13d
testl %r14d, %r14d
je 0xef45
movl 0xc(%r15), %edi
movq %r12, %rsi
movq (%rsp), %rdx
xorl %eax, %eax
callq 0x5160
cmpl %ebx, %eax
je 0xef55
movl %eax, %ebp
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x5170
incl %r14d
jmp 0xef19
leaq 0x11345(%rip), %rax     # 0x20291
pushq $-0x16
popq %r13
cmpb $0x1, (%rax)
je 0xef67
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1106a(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
leaq 0x8ab9(%rip), %rsi      # 0x17a31
leaq 0x8dc9(%rip), %rdx      # 0x17d48
movl $0x155, %ecx            # imm = 0x155
movl %ebp, %r8d
xorl %eax, %eax
callq 0x5180
jmp 0xef55
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx9/gtx9.cpp
// Function: GTx9Device::GetReport(unsigned char*)
int GTx9Device::GetReport(unsigned char *buf)
{
	int ret;
	int retry = 5;
	uint8_t rcv_buf[PACKAGE_LEN + 1] = {0};

	while (retry--) {
		rcv_buf[0] = REPORT_ID;
		ret = ioctl(m_fd, HIDIOCGFEATURE(PACKAGE_LEN), rcv_buf);
		if (ret == PACKAGE_LEN && rcv_buf[0] == REPORT_ID) {
			memcpy(buf, rcv_buf, PACKAGE_LEN);
			return 0;
		}
		usleep(1000);
	}

	gdix_err("Failed get report ret:%d rcvbuf[0]:0x%02x\n", ret, rcv_buf[0]);
	return -EINVAL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorps %xmm0, %xmm0
movq %rsp, %r15
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x20(%r15)
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
andw $0x0, 0x40(%r15)
pushq $-0x5
popq %r12
testl %r12d, %r12d
je 0xeffd
movb $0xe, (%rsp)
movl 0xc(%r14), %edi
movl $0xc0414807, %esi       # imm = 0xC0414807
movq %r15, %rdx
xorl %eax, %eax
callq 0x5160
movl %eax, %ebp
cmpl $0x41, %eax
jne 0xefee
cmpb $0xe, (%rsp)
je 0xf03a
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x5170
incl %r12d
jmp 0xefc5
leaq 0x1128d(%rip), %rax     # 0x20291
pushq $-0x16
popq %rbx
cmpb $0x1, (%rax)
jne 0xf04a
movq 0x10fc5(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
movzbl (%rsp), %r9d
leaq 0x8cea(%rip), %rsi      # 0x17d0c
leaq 0x8389(%rip), %rdx      # 0x173b2
movl $0x145, %ecx            # imm = 0x145
movl %ebp, %r8d
xorl %eax, %eax
callq 0x5180
jmp 0xf04a
movq %rsp, %rsi
pushq $0x41
popq %rdx
movq %rbx, %rdi
callq 0x5090
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx9/gtx9.cpp
// Function: GTx9Device::Read(unsigned int, unsigned char*, unsigned int)
int GTx9Device::Read(unsigned int addr, unsigned char *buf, unsigned int len)
{
	int ret = 0;
	int i = 0;
	uint32_t tmp_addr = addr;
	int offset = 0;
	int pkg_size = PACKAGE_LEN - 12;
	int remain_size;
	int pkg_num;

	if (!m_deviceOpen) {
		gdix_err("Device not open\n");
		return -EINVAL;
	}

	pkg_num = len / pkg_size;
	remain_size = len % pkg_size;

	for (i = 0; i < pkg_num; i++) {
		ret = ReadPkg(tmp_addr + offset, &buf[offset], pkg_size);
		if (ret < 0)
			return ret;
		offset += pkg_size;
	}

	if (remain_size > 0) {
		ret = ReadPkg(tmp_addr + offset, &buf[offset], remain_size);
		if (ret < 0)
			return ret;
	}

	return len;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpb $0x0, 0x8(%rdi)
je 0xf0aa
movl %ecx, %ebx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
pushq $0x35
popq %r13
movl %ecx, %eax
xorl %edx, %edx
divl %r13d
movl %edx, 0x4(%rsp)
movl %eax, %r12d
subl $0x1, %r12d
jb 0xf0dd
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
movl %r13d, %ecx
callq 0xed6c
testl %eax, %eax
js 0xf0f6
addq $0x35, %r14
addl $0x35, %ebp
jmp 0xf087
leaq 0x111e0(%rip), %rax     # 0x20291
pushq $-0x16
popq %rbx
cmpb $0x1, (%rax)
jne 0xf0f8
movq 0x10f18(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
leaq 0x89bf(%rip), %rsi      # 0x17a89
leaq 0x89da(%rip), %rdx      # 0x17aab
pushq $0x7c
popq %rcx
xorl %eax, %eax
callq 0x5180
jmp 0xf0f8
movl 0x4(%rsp), %ecx
testl %ecx, %ecx
je 0xf0f8
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0xed6c
testl %eax, %eax
jns 0xf0f8
movl %eax, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx9/gtx9.cpp
// Function: GTx9Device::SendCmd(unsigned char, unsigned char*, int)
int GTx9Device::SendCmd(unsigned char cmd, unsigned char *data, int dataLen)
{
	uint8_t HidBuf[PACKAGE_LEN] = {0};
	int ret;

	if (!m_deviceOpen) {
		gdix_err("Device not open\n");
		return -EINVAL;
	}

	HidBuf[0] = REPORT_ID;
	HidBuf[1] = cmd;
	HidBuf[2] = 0x00;
	HidBuf[3] = 0x00;
	HidBuf[4] = (uint8_t)dataLen;
	memcpy(&HidBuf[5], data, dataLen);
	ret = SetReport(HidBuf, dataLen + 5);
	if (ret < 0)
		gdix_err("Failed send cmd 0x%02x\n", cmd);

	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
movb $0x0, 0x40(%rsp)
cmpb $0x0, 0x8(%rdi)
je 0xf6b9
movl %esi, %ebx
movq %rdi, %r14
leaq 0x5(%rsp), %rdi
movb $0xe, -0x5(%rdi)
movb %bl, -0x4(%rdi)
movb $0x0, -0x2(%rdi)
movb %cl, -0x1(%rdi)
movslq %ecx, %r15
movq %rdx, %rsi
movq %r15, %rdx
callq 0x5090
addl $0x5, %r15d
movq %rsp, %rsi
movq %r14, %rdi
movl %r15d, %edx
callq 0xeef0
xorl %ebp, %ebp
testl %eax, %eax
jns 0xf6c8
movl %eax, %r14d
leaq 0x10be2(%rip), %rax     # 0x20291
cmpb $0x1, (%rax)
je 0xf6fb
movl %r14d, %ebp
jmp 0xf6c8
leaq 0x10bd1(%rip), %rax     # 0x20291
pushq $-0x16
popq %rbp
cmpb $0x1, (%rax)
je 0xf6d5
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x108fc(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
leaq 0x83a3(%rip), %rsi      # 0x17a89
leaq 0x85ee(%rip), %rdx      # 0x17cdb
movl $0x124, %ecx            # imm = 0x124
xorl %eax, %eax
callq 0x5180
jmp 0xf6c8
movq 0x108d6(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
movzbl %bl, %r8d
leaq 0x85d3(%rip), %rsi      # 0x17ce3
leaq 0x85c4(%rip), %rdx      # 0x17cdb
movl $0x130, %ecx            # imm = 0x130
xorl %eax, %eax
callq 0x5180
jmp 0xf6b4
nop
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx9/gtx9_firmware_image.cpp
// Function: GTX9FirmwareImage::Initialize(char const*)
int GTX9FirmwareImage::Initialize(const char *filename)
{
	int ret;

	m_initialized = false;

	if (GetDataFromFile(filename) < 0) {
		gdix_err("Failed get firmware\n");
		return -EINVAL;
	}

	gdix_info("Parse firmware file\n");
	ret = ParseFirmware();
	if (ret < 0) {
		gdix_err("Failed parse firmware\n");
		return ret;
	}

	m_initialized = true;
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
movb $0x0, 0x8(%rdi)
movq (%rdi), %rax
callq *0xb0(%rax)
leaq 0x10829(%rip), %r15     # 0x20291
movb (%r15), %cl
testl %eax, %eax
js 0xfaaa
testb %cl, %cl
je 0xfa95
movq 0x1053e(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0x8419(%rip), %rsi      # 0x17e9d
leaq 0x55a0(%rip), %rdx      # 0x1502b
pushq $0x37
popq %rcx
xorl %eax, %eax
callq 0x5180
movq %r14, %rdi
callq 0xfb02
testl %eax, %eax
js 0xfacd
movb $0x1, 0x8(%r14)
xorl %ebx, %ebx
jmp 0xfad5
pushq $-0x16
popq %rbx
testb %cl, %cl
je 0xfad5
movq 0x10520(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
leaq 0x83b5(%rip), %rsi      # 0x17e77
leaq 0x5562(%rip), %rdx      # 0x1502b
pushq $0x33
jmp 0xfaf7
movl %eax, %ebx
cmpb $0x1, (%r15)
je 0xfadd
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
movq 0x104f4(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
leaq 0x83d5(%rip), %rsi      # 0x17ec3
leaq 0x5536(%rip), %rdx      # 0x1502b
pushq $0x3a
popq %rcx
xorl %eax, %eax
callq 0x5180
jmp 0xfad5
nop
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx9/gtx9_i2c_update.cpp
// Function: checksum_cmp(unsigned char const*, int, int)
int checksum_cmp(const uint8_t *data, int size, int mode)
{
	uint32_t cal_checksum = 0;
	uint32_t r_checksum = 0;
	int i;

	if (mode == CHECKSUM_MODE_U8_LE) {
		if (size < 2)
			return 1;
		for (i = 0; i < size - 2; i++)
			cal_checksum += data[i];

		r_checksum = data[size - 2] + (data[size - 1] << 8);
		return (cal_checksum & 0xFFFF) == r_checksum ? 0 : 1;
	}

	if (size < 4)
		return 1;
	for (i = 0; i < size - 4; i += 2)
		cal_checksum += data[i] + (data[i + 1] << 8);
	r_checksum = data[size - 4] + (data[size - 3] << 8) +
				 (data[size - 2] << 16) + (data[size - 1] << 24);
	return cal_checksum == r_checksum ? 0 : 1;
}

// Assembly:
movb $0x1, %al
testl %edx, %edx
je 0x1008d
cmpl $0x4, %esi
jl 0x100e9
leal -0x4(%rsi), %ecx
xorl %edx, %edx
xorl %eax, %eax
cmpq %rcx, %rdx
jae 0x100ab
movzwl (%rdi,%rdx), %r8d
addl %r8d, %eax
addq $0x2, %rdx
jmp 0x1007a
cmpl $0x2, %esi
jl 0x100e9
leal -0x2(%rsi), %ecx
xorl %edx, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
je 0x100d1
movzbl (%rdi,%rdx), %r8d
addl %r8d, %eax
incq %rdx
jmp 0x10099
movzbl (%rdi,%rcx), %ecx
movl %esi, %edx
movzbl -0x3(%rdi,%rdx), %esi
shll $0x8, %esi
orl %ecx, %esi
movzbl -0x2(%rdi,%rdx), %ecx
shll $0x10, %ecx
orl %esi, %ecx
movzbl -0x1(%rdi,%rdx), %edx
shll $0x18, %edx
orl %ecx, %edx
jmp 0x100e4
movzbl (%rdi,%rcx), %ecx
movl %esi, %edx
movzbl -0x1(%rdi,%rdx), %edx
shll $0x8, %edx
orl %ecx, %edx
movzwl %ax, %eax
cmpl %edx, %eax
setne %al
movzbl %al, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx9/gtx9_i2c_update.cpp
// Function: gdix_append_checksum(unsigned char*, int, int)
uint32_t gdix_append_checksum(uint8_t *data, int len, int mode)
{
	uint32_t checksum = 0;
	int i;

	checksum = 0;
	if (mode == CHECKSUM_MODE_U8_LE) {
		for (i = 0; i < len; i++)
			checksum += data[i];
	} else {
		for (i = 0; i < len; i += 2)
			checksum += (data[i] + (data[i + 1] << 8));
	}

	if (mode == CHECKSUM_MODE_U8_LE) {
		data[len] = checksum & 0xff;
		data[len + 1] = (checksum >> 8) & 0xff;
		return 0xFFFF & checksum;
	}
	data[len] = checksum & 0xff;
	data[len + 1] = (checksum >> 8) & 0xff;
	data[len + 2] = (checksum >> 16) & 0xff;
	data[len + 3] = (checksum >> 24) & 0xff;
	return checksum;
}

// Assembly:
movslq %esi, %rcx
testl %edx, %edx
je 0x1010b
xorl %esi, %esi
xorl %eax, %eax
cmpq %rcx, %rsi
jge 0x10128
movzwl (%rdi,%rsi), %r8d
addl %r8d, %eax
addq $0x2, %rsi
jmp 0x100f8
xorl %r8d, %r8d
testl %esi, %esi
cmovlel %r8d, %esi
xorl %eax, %eax
cmpq %r8, %rsi
je 0x10128
movzbl (%rdi,%r8), %r9d
addl %r9d, %eax
incq %r8
jmp 0x10116
movw %ax, (%rdi,%rcx)
testl %edx, %edx
je 0x10143
movl %eax, %edx
shrl $0x10, %edx
movb %dl, 0x2(%rdi,%rcx)
movl %eax, %edx
shrl $0x18, %edx
movb %dl, 0x3(%rdi,%rcx)
retq
movzwl %ax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx9/gtx9_update.cpp
// Function: GTx9Update::check_update()
int GTx9Update::check_update()
{
	int ret;

	ret = memcmp(dev->GetProductID(), image->GetProductID(), 8);
	if (ret != 0) {
		gdix_info("Product ID mismatch %s != %s\n", dev->GetProductID(),
				  image->GetProductID());
		return -1;
	}

	if ((dev->GetFirmwareVersionMajor() != image->GetFirmwareVersionMajor()) ||
		(dev->GetFirmwareVersionMinor() != image->GetFirmwareVersionMinor())) {
		gdix_info("Current version:%d.%d\n", dev->GetFirmwareVersionMajor(),
				  dev->GetFirmwareVersionMinor());
		gdix_info("Firmware version:%d.%d\n", image->GetFirmwareVersionMajor(),
				  image->GetFirmwareVersionMinor());
		return 1;
	}

	gdix_info("No need to upgrade\n");
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
movq (%rdi), %rax
callq *0x70(%rax)
movq %rax, %r14
movq 0x10(%rbx), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq (%r14), %rcx
cmpq (%rax), %rcx
je 0x1216b
leaq 0xe179(%rip), %rax      # 0x20291
pushq $-0x1
popq %rbp
cmpb $0x1, (%rax)
jne 0x12275
movq 0xde8d(%rip), %rax      # 0x1ffb8
movq (%rax), %r14
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
callq *0x70(%rax)
movq %rax, %r15
movq 0x10(%rbx), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
leaq 0x6f78(%rip), %rsi      # 0x190c4
leaq 0x315a(%rip), %rdx      # 0x152ad
pushq $0x57
popq %rcx
movq %r14, %rdi
movq %r15, %r8
movq %rax, %r9
xorl %eax, %eax
callq 0x5180
jmp 0x12275
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
callq *0x60(%rax)
movl %eax, %ebp
movq 0x10(%rbx), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
cmpl %eax, %ebp
jne 0x121da
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
callq *0x68(%rax)
movl %eax, %ebp
movq 0x10(%rbx), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
cmpl %eax, %ebp
jne 0x121da
leaq 0xe0eb(%rip), %rax      # 0x20291
xorl %ebp, %ebp
cmpb $0x1, (%rax)
jne 0x12275
movq 0xde00(%rip), %rax      # 0x1ffb8
movq (%rax), %rdi
leaq 0x6f82(%rip), %rsi      # 0x19144
leaq 0x30e4(%rip), %rdx      # 0x152ad
xorl %ebp, %ebp
pushq $0x64
popq %rcx
xorl %eax, %eax
callq 0x5180
jmp 0x12275
leaq 0xe0b0(%rip), %r15      # 0x20291
movb (%r15), %al
cmpb $0x1, %al
jne 0x1222c
movq 0xddc9(%rip), %rax      # 0x1ffb8
movq (%rax), %r14
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
callq *0x60(%rax)
movl %eax, %ebp
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
callq *0x68(%rax)
leaq 0x6ee4(%rip), %rsi      # 0x190f3
leaq 0x3097(%rip), %rdx      # 0x152ad
pushq $0x5e
popq %rcx
movq %r14, %rdi
movl %ebp, %r8d
movl %eax, %r9d
xorl %eax, %eax
callq 0x5180
movb (%r15), %al
pushq $0x1
popq %rbp
testb $0x1, %al
je 0x12275
movq 0xdd7e(%rip), %rax      # 0x1ffb8
movq (%rax), %r14
movq 0x10(%rbx), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
movl %eax, %r15d
movq 0x10(%rbx), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
leaq 0x6ec0(%rip), %rsi      # 0x1911b
leaq 0x304b(%rip), %rdx      # 0x152ad
pushq $0x60
popq %rcx
movq %r14, %rdi
movl %r15d, %r8d
movl %eax, %r9d
xorl %eax, %eax
callq 0x5180
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/berlin_a/brla.cpp
// Function: BrlADevice::BrlADevice()
BrlADevice::BrlADevice()
{
	m_fd = -1;
	m_firmwareVersionMajor = 0;
	m_firmwareVersionMinor = 0;
	m_sensorID = 0;
	m_configID = 0;
	memset(m_pid, 0, sizeof(m_pid));
	memset(m_vid, 0, sizeof(m_vid));
	m_deviceOpen = false;
}

// Assembly:
leaq 0xd1c1(%rip), %rax      # 0x1fb80
movq %rax, (%rdi)
orl $-0x1, 0xc(%rdi)
andl $0x0, 0x28(%rdi)
xorl %eax, %eax
movb %al, 0x1c(%rdi)
andq $0x0, 0x20(%rdi)
andq $0x0, 0x10(%rdi)
andl $0x0, 0x18(%rdi)
movb %al, 0x8(%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/berlin_a/brla.cpp
// Function: BrlADevice::Open(char const*)
int BrlADevice::Open(const char *filename)
{
	if (!filename)
		return -EINVAL;

	m_fd = open(filename, O_RDWR);
	if (m_fd < 0)
		return -EINVAL;

	m_deviceOpen = true;

	return SetBasicProperties();
}

// Assembly:
pushq %rbx
testq %rsi, %rsi
je 0x12a12
movq %rdi, %rbx
pushq $0x2
popq %rax
movq %rsi, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x51e0
movl %eax, 0xc(%rbx)
testl %eax, %eax
js 0x12a12
movb $0x1, 0x8(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
jmpq *0xa0(%rax)
pushq $-0x16
popq %rax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/berlin_a/brla.cpp
// Function: BrlADevice::Close()
void BrlADevice::Close()
{
	if (!m_deviceOpen)
		return;
	close(m_fd);
	m_fd = -1;
	m_deviceOpen = false;
}

// Assembly:
cmpb $0x1, 0x8(%rdi)
jne 0x12a33
pushq %rbx
movq %rdi, %rbx
movl 0xc(%rdi), %edi
callq 0x5210
orl $-0x1, 0xc(%rbx)
movb $0x0, 0x8(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/ljc2154[P]Rummy/rummy.cpp
// Function: main
int main(int argc, char **argv)
{
	State state = initializeState();
	printState(state);
	while (gameOver(state) == false)
	{
		playUserTurn(state);
		if (gameOver(state))
			break;
		playAgentTurn(state);
		printState(state);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x13c8
leaq 0x68(%rsp), %rdi
movq %rbx, %rsi
callq 0x2a20
leaq 0x68(%rsp), %r13
movq %r13, %rdi
callq 0x14c0
leaq 0x1a0(%rsp), %rbx
movq %rsp, %r14
leaq 0x138(%rsp), %r15
leaq 0xd0(%rsp), %r12
movq %r13, %rdi
callq 0x2aa0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2a20
movq %rbx, %rdi
callq 0x1519
movl %eax, %ebp
movq %rbx, %rdi
callq 0x2aa0
testb %bpl, %bpl
jne 0x1361
movq %r14, %rdi
callq 0x1644
movq %r15, %rdi
movq %r14, %rsi
callq 0x2a20
movq %r15, %rdi
callq 0x1519
movl %eax, %ebp
movq %r15, %rdi
callq 0x2aa0
testb %bpl, %bpl
jne 0x1361
movq %r14, %rdi
callq 0x198c
movq %r12, %rdi
movq %r14, %rsi
callq 0x2a20
movq %r12, %rdi
callq 0x14c0
movq %r12, %r13
jmp 0x12ed
movq %rsp, %rdi
callq 0x2aa0
xorl %eax, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
jmp 0x13ae
jmp 0x13b5
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
jmp 0x13ae
movq %rax, %rbx
leaq 0x138(%rsp), %rdi
jmp 0x13ae
movq %rax, %rbx
leaq 0x1a0(%rsp), %rdi
callq 0x2aa0
jmp 0x13b8
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2aa0
movq %rbx, %rdi
callq 0x1160
// File: /workspace/github_cpp_makefile_star2_O2/ljc2154[P]Rummy/rummy.cpp
// Function: initializeState()
State initializeState()
{
	State state;
	state.deck = getNewDeck();
	state.remaining = initializeRemaining();
	dealCards(state.deck, state.userHand, state.agentHand);
	adjustRemaining(state.remaining, state.agentHand);
	mergeSort(state.userHand, 0, state.userHand.size());
	state.turnCard = 52;
	return state;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x48(%rdi), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
andq $0x0, 0x40(%rdi)
movq %r14, 0x50(%rdi)
movq %r14, 0x48(%rdi)
andq $0x0, 0x58(%rdi)
leaq 0x8(%rsp), %rdi
callq 0x1ac0
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2f1a
movq %r15, %rdi
callq 0x2c46
leaq 0x8(%rsp), %rdi
callq 0x1b1b
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2f6c
movq %r15, %rdi
callq 0x2c10
leaq 0x30(%rbx), %r15
leaq 0x18(%rbx), %r12
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1b6f
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x2b4e
leaq 0x20(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x1bc7
movq %r12, %rdi
callq 0x2c46
movq 0x38(%rbx), %rdx
subq 0x30(%rbx), %rdx
shrq $0x2, %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x1c0e
movl $0x34, 0x60(%rbx)
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x14ad
jmp 0x14ad
movq %rax, %r14
movq %rbx, %rdi
callq 0x2aa0
movq %r14, %rdi
callq 0x1160
// File: /workspace/github_cpp_makefile_star2_O2/ljc2154[P]Rummy/rummy.cpp
// Function: printState(State)
void printState(State state)
{
	//printHand(state.agentHand);
	printOpponentHandandDeck();
	if (state.turnCard < 52)
		printTurnCard(state.turnCard);
	printHand(state.userHand);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
callq 0x1d0e
movl 0x60(%rbx), %edi
cmpl $0x33, %edi
jg 0x14dc
callq 0x1e0d
addq $0x30, %rbx
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2b4e
movq %r14, %rdi
callq 0x1f55
movq %rsp, %rdi
callq 0x2c46
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2c46
movq %rbx, %rdi
callq 0x1160
// File: /workspace/github_cpp_makefile_star2_O2/ljc2154[P]Rummy/rummy.cpp
// Function: gameOver(State)
bool gameOver(State state)
{
	/* Check if user won */
	if (isWinner(state.userHand))
	{
		cout << "You won the game!" << endl;
		printHand(state.userHand);
		return true;
	}

	/* Check if agent won */
	if (isWinner(state.agentHand))
	{
		cout << "Read 'em and weep!" << endl;
		printHand(state.agentHand);
		cout << "You lost the game :(" << endl;
		return true;
	}

	/* No player has won */
	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %r14
leaq 0x30(%rdi), %r15
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2b4e
movq %rbx, %rdi
callq 0x21a9
movl %eax, %ebp
leaq 0x50(%rsp), %rdi
callq 0x2c46
testb %bpl, %bpl
je 0x1595
movq 0x4a76(%rip), %rdi      # 0x5fd0
leaq 0x1aaa(%rip), %rsi      # 0x300b
callq 0x10f0
movq %rax, %rdi
callq 0x1080
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2b4e
movq %rbx, %rdi
callq 0x1f55
leaq 0x38(%rsp), %rdi
callq 0x2c46
jmp 0x161a
addq $0x18, %r14
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2b4e
movq %rbx, %rdi
callq 0x21a9
movl %eax, %ebp
leaq 0x20(%rsp), %rdi
callq 0x2c46
testb %bpl, %bpl
je 0x161e
movq 0x4a07(%rip), %rdi      # 0x5fd0
leaq 0x1a4d(%rip), %rsi      # 0x301d
callq 0x10f0
movq %rax, %rdi
callq 0x1080
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2b4e
movq %rbx, %rdi
callq 0x1f55
leaq 0x8(%rsp), %rdi
callq 0x2c46
movq 0x49ca(%rip), %rdi      # 0x5fd0
leaq 0x1a23(%rip), %rsi      # 0x3030
callq 0x10f0
movq %rax, %rdi
callq 0x1080
movb $0x1, %al
jmp 0x1620
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1631
jmp 0x1631
jmp 0x1631
movq %rax, %r14
movq %rbx, %rdi
callq 0x2c46
movq %r14, %rdi
callq 0x1160
// File: /workspace/github_cpp_makefile_star2_O2/ljc2154[P]Rummy/rummy.cpp
// Function: playAgentTurn(State&)
void playAgentTurn(State &state)
{
	/* Must be rewritten with dropCard function */
	if (takeTurnCard(state))
	{
		cout << "The computer took the turn card!" << endl;
		int turnCard = state.turnCard;
		state.agentHand.push_back(turnCard);
		state.turnCard = removeWorstCard(state);
	}
	else
	{
		cout << "The computer drew from the deck." << endl;
		state.agentHand.push_back(state.deck.back());
		state.remaining.remove(state.deck.back());
		state.deck.pop_back();
		state.turnCard = removeWorstCard(state);
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x70, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2a20
movq %r14, %rdi
callq 0x26f3
movl %eax, %ebp
leaq 0x8(%rsp), %rdi
callq 0x2aa0
movq 0x460e(%rip), %rdi      # 0x5fd0
testb %bpl, %bpl
je 0x19f0
leaq 0x17a0(%rip), %rsi      # 0x316e
callq 0x10f0
movq %rax, %rdi
callq 0x1080
movl 0x60(%rbx), %eax
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
leaq 0x18(%rbx), %rdi
callq 0x2ac8
jmp 0x1a2b
leaq 0x1798(%rip), %rsi      # 0x318f
callq 0x10f0
movq %rax, %rdi
callq 0x1080
leaq 0x18(%rbx), %rdi
movq 0x8(%rbx), %rsi
addq $-0x4, %rsi
callq 0x2ac8
leaq 0x48(%rbx), %rdi
movq 0x8(%rbx), %rsi
addq $-0x4, %rsi
callq 0x2af2
addq $-0x4, 0x8(%rbx)
movq %rbx, %rdi
callq 0x28c6
movl %eax, 0x60(%rbx)
addq $0x70, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2aa0
movq %rbx, %rdi
callq 0x1160
// File: /workspace/github_cpp_makefile_star2_O2/ljc2154[P]Rummy/rummy.cpp
// Function: shuffle(std::vector<int, std::allocator<int>>&)
void shuffle(vector<int> &deck)
{
	srand(time(NULL));
	int size = deck.size();
	for (int i = size-1; i >0; i--)
	{
		int swapPos = rand() % i;
		swap(deck, i, swapPos);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %edi, %edi
callq 0x10d0
movl %eax, %edi
callq 0x10e0
movq 0x8(%rbx), %r14
subq (%rbx), %r14
shrq $0x2, %r14
leal -0x1(%r14), %r15d
cmpl $0x1, %r14d
jle 0x1aba
callq 0x1040
cltd
idivl %r15d
movq (%rbx), %rax
movl (%rax,%r15,4), %ecx
movslq %edx, %rdx
movl (%rax,%rdx,4), %esi
movl %esi, (%rax,%r15,4)
movl %ecx, (%rax,%rdx,4)
decl %r14d
decq %r15
jmp 0x1a8f
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/ljc2154[P]Rummy/rummy.cpp
// Function: getNewDeck()
vector<int> getNewDeck()
{
	vector<int> deck;
	for (int i = 0; i < 52; i++)
	{
		deck.push_back(i);
	}
	shuffle(deck);
	return deck;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
andq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
xorl %eax, %eax
leaq 0x4(%rsp), %r14
movl %eax, 0x4(%rsp)
cmpl $0x34, %eax
jge 0x1af5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2ac8
movl 0x4(%rsp), %eax
incl %eax
jmp 0x1ad9
movq %rbx, %rdi
callq 0x1a6a
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x2c46
movq %r14, %rdi
callq 0x1160
// File: /workspace/github_cpp_makefile_star2_O2/ljc2154[P]Rummy/rummy.cpp
// Function: initializeRemaining[abi:cxx11]()
list<int> initializeRemaining()
{
	list<int> remaining;
	for (int i = 0; i < 52; i++)
		remaining.push_back(i);
	return remaining;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rdi, 0x8(%rdi)
movq %rdi, (%rdi)
andq $0x0, 0x10(%rdi)
xorl %eax, %eax
leaq 0x4(%rsp), %r14
movl %eax, 0x4(%rsp)
cmpl $0x34, %eax
jge 0x1b51
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2ae6
movl 0x4(%rsp), %eax
incl %eax
jmp 0x1b35
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x2c10
movq %r14, %rdi
callq 0x1160
// File: /workspace/github_cpp_makefile_star2_O2/ljc2154[P]Rummy/rummy.cpp
// Function: dealCards(std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&)
void dealCards(vector<int> &deck, vector<int> &userHand, vector<int> &agentHand)
{
	for (int i = 0; i < 14; i ++)
	{
		int topCard = deck.back();
		deck.pop_back();
		if (i%2 == 0)
			userHand.push_back(topCard);
		else
			agentHand.push_back(topCard);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
xorl %ebp, %ebp
leaq 0xc(%rsp), %r12
cmpl $0xe, %ebp
je 0x1bba
movq 0x8(%r15), %rax
movl -0x4(%rax), %ecx
addq $-0x4, %rax
movl %ecx, 0xc(%rsp)
movq %rax, 0x8(%r15)
testb $0x1, %bpl
movq %rbx, %rdi
cmoveq %r14, %rdi
movq %r12, %rsi
callq 0x2ac8
incl %ebp
jmp 0x1b8b
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ljc2154[P]Rummy/rummy.cpp
// Function: mergeSort(std::vector<int, std::allocator<int>>&, int, int)
void mergeSort(vector<int> &integers, int start, int finish)
{
	if ((finish - start) <= 1)
		return;
	int m = (finish - start) / 2;
	mergeSort(integers, start, start+m);
	mergeSort(integers, start+m, finish);

	vector<int> temp;
	merge(integers, start, start+m, finish, temp);
	int tempIndex = 0;
	for (int i = start; i < finish; i++)
		integers[i] = temp[tempIndex++];
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
movl %edx, %r15d
subl %esi, %r15d
cmpl $0x2, %r15d
jl 0x1caa
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
shrl %r15d
addl %esi, %r15d
movl %r15d, %edx
callq 0x1c0e
movq %r14, %rdi
movl %r15d, %esi
movl %ebx, %edx
callq 0x1c0e
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x2b4e
leaq 0x20(%rsp), %rdi
movq %rsp, %r8
movl %ebp, %esi
movl %r15d, %edx
movl %ebx, %ecx
callq 0x20e1
leaq 0x20(%rsp), %rdi
callq 0x2c46
movq (%rsp), %rax
movq (%r14), %rcx
movslq %ebp, %rdx
movslq %ebx, %rsi
cmpq %rsi, %rdx
jge 0x1ca2
movl (%rax), %edi
movl %edi, (%rcx,%rdx,4)
incq %rdx
addq $0x4, %rax
jmp 0x1c8f
movq %rsp, %rdi
callq 0x2c46
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2c46
jmp 0x1cc7
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2c46
movq %rbx, %rdi
callq 0x1160
// File: /workspace/github_cpp_makefile_star2_O2/ljc2154[P]Rummy/rummy.cpp
// Function: printOpponentHandandDeck()
void printOpponentHandandDeck()
{
	/* Printing out what looks like opponent's hand */
	for (int i = 0; i < 10; i++)
	{
		for (int j = 0; j < 56; j++)
		{
			int k = j % 8;
			if (k == 7)
				cout << "* ";
			else if (i == 0 || i == 9 || k == 0)
				cout << "*";
			else
				cout << "?";
		}
		cout << endl;
	}
	cout << endl;

	/* Printing out what looks like a deck */
	for (int i = 0; i < 10; i++)
	{
		for (int j = 0; j < 8; j++)
		{
			if (i == 0 || i == 9 || j == 0 || j == 7)
				cout << "*";
			else
				cout << "?";
		}
		cout << endl;
	}
	cout << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %eax, %eax
leaq 0x12e5(%rip), %r15      # 0x3007
leaq 0x12e0(%rip), %r14      # 0x3009
movq 0x42a0(%rip), %rbx      # 0x5fd0
leaq 0x12cd(%rip), %r12      # 0x3004
cmpl $0xa, %eax
je 0x1d8a
testl %eax, %eax
movq %r14, %r13
cmoveq %r15, %r13
movl %eax, 0x4(%rsp)
cmpl $0x9, %eax
cmoveq %r15, %r13
xorl %ebp, %ebp
cmpl $0x38, %ebp
je 0x1d7a
movl %ebp, %eax
andl $0x7, %eax
je 0x1d6b
movq %r12, %rsi
cmpl $0x7, %eax
je 0x1d6e
movq %r13, %rsi
jmp 0x1d6e
movq %r15, %rsi
movq %rbx, %rdi
callq 0x10f0
incl %ebp
jmp 0x1d52
movq %rbx, %rdi
callq 0x1080
movl 0x4(%rsp), %eax
incl %eax
jmp 0x1d37
movq 0x423f(%rip), %rbx      # 0x5fd0
movq %rbx, %rdi
callq 0x1080
xorl %ebp, %ebp
leaq 0x1265(%rip), %r12      # 0x3007
cmpl $0xa, %ebp
je 0x1df3
testl %ebp, %ebp
sete %al
cmpl $0x9, %ebp
sete %r13b
orb %al, %r13b
pushq $0x8
popq %rax
movl %eax, %r15d
subl $0x1, %r15d
jb 0x1de7
cmpl $0x8, %eax
movq %r14, %rsi
cmoveq %r12, %rsi
testb %r13b, %r13b
cmovneq %r12, %rsi
cmpl $0x1, %eax
cmoveq %r12, %rsi
movq %rbx, %rdi
callq 0x10f0
movl %r15d, %eax
jmp 0x1dbc
movq %rbx, %rdi
callq 0x1080
incl %ebp
jmp 0x1da2
movq 0x41d6(%rip), %rdi      # 0x5fd0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1080
// File: /workspace/github_cpp_makefile_star2_O2/ljc2154[P]Rummy/rummy.cpp
// Function: printTurnCard(int)
void printTurnCard(int v)
{
	char suit = getSuit(v);
	char rank = getRank(v);
	for (int i = 0; i < 10; i++)
	{
		for (int j = 0; j < 8; j++)
		{
			if (i == 0 || i == 9 || j == 0 || j == 7)
				cout << "*";
			else if ((j == 1 && i == 1) || (j == 6 && i == 8) || (j == 3 && i == 4))
				cout << rank;
			else if ((j == 6 && i == 1) || (j == 1 && i == 8) || (j == 4 && i == 5))
				cout << suit;
			else
				cout << " ";
		}
		cout << endl;
	}
	cout << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movb $0x26, %bpl
cmpl $0xd, %edi
jl 0x1e37
movb $0x25, %bpl
cmpl $0x1a, %edi
jb 0x1e37
cmpl $0x27, %edi
pushq $0x24
popq %rax
pushq $0x40
popq %rbp
cmovbl %eax, %ebp
callq 0x1cf2
xorl %ecx, %ecx
movq 0x418b(%rip), %rbx      # 0x5fd0
movsbl %al, %eax
movl %eax, 0x14(%rsp)
movzbl %bpl, %eax
movl %eax, 0x8(%rsp)
cmpl $0xa, %ecx
je 0x1f3b
testl %ecx, %ecx
sete %al
cmpl $0x9, %ecx
sete %r12b
orb %al, %r12b
movl %ecx, %r13d
xorl $0x1, %r13d
movl %ecx, %r15d
xorl $0x4, %r15d
movl %ecx, %r14d
xorl $0x8, %r14d
movl %ecx, 0xc(%rsp)
xorl $0x5, %ecx
movl %ecx, 0x10(%rsp)
pushq $0x8
popq %rax
movl %eax, %ebp
subl $0x1, %ebp
jb 0x1f28
cmpl $0x8, %eax
sete %cl
cmpl $0x1, %eax
je 0x1ec6
orb %r12b, %cl
jne 0x1ec6
movl %eax, %edx
xorl $0x7, %edx
movl %r13d, %ecx
orl %edx, %ecx
jne 0x1ed9
movq %rbx, %rdi
movl 0x14(%rsp), %esi
callq 0x1120
movl %ebp, %eax
jmp 0x1e8f
movq %rbx, %rdi
leaq 0x1137(%rip), %rsi      # 0x3007
callq 0x10f0
movl %ebp, %eax
jmp 0x1e8f
movl %eax, %ecx
xorl $0x2, %ecx
movl %eax, %esi
xorl $0x5, %esi
orl %r15d, %esi
sete %sil
movl %r14d, %edi
orl %ecx, %edi
je 0x1eb6
testb %sil, %sil
jne 0x1eb6
orl %r14d, %edx
sete %dl
xorl $0x4, %eax
orl 0x10(%rsp), %eax
sete %al
orl %r13d, %ecx
je 0x1f1f
testb %dl, %dl
jne 0x1f1f
testb %al, %al
jne 0x1f1f
movq %rbx, %rdi
leaq 0x10e8(%rip), %rsi      # 0x3005
jmp 0x1ed0
movq %rbx, %rdi
movl 0x8(%rsp), %esi
jmp 0x1ebd
movq %rbx, %rdi
callq 0x1080
movl 0xc(%rsp), %ecx
incl %ecx
jmp 0x1e54
movq 0x408e(%rip), %rdi      # 0x5fd0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1080
// File: /workspace/github_cpp_makefile_star2_O2/ljc2154[P]Rummy/rummy.cpp
// Function: merge(std::vector<int, std::allocator<int>>, int, int, int, std::vector<int, std::allocator<int>>&)
void merge(vector<int> integers, int a1, int m, int b2, vector<int> &output)
{
	int a2, b1;
	a2 = b1 = m;
	while (a1 < a2 && b1 < b2)
	{
		if (integers[a1] <= integers[b1])
			output.push_back(integers[a1++]);
		else
			output.push_back(integers[b1++]);
	}

	while (a1 < a2)
		output.push_back(integers[a1++]);
	while (b1 < b2)
		output.push_back(integers[b1++]);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movl %ecx, 0x4(%rsp)
movl %edx, %r15d
movl %esi, %r12d
movq %rdi, %r14
movl %edx, %r13d
movslq %r12d, %rbp
cmpl %r15d, %r12d
jge 0x2147
cmpl 0x4(%rsp), %r13d
jge 0x2147
movq (%r14), %rsi
movl (%rsi,%rbp,4), %ecx
movslq %r13d, %r8
xorl %eax, %eax
xorl %edx, %edx
cmpl (%rsi,%r8,4), %ecx
setg %cl
setle %dil
jle 0x212e
leaq (%rsi,%r8,4), %rsi
jmp 0x2132
leaq (%rsi,%rbp,4), %rsi
movb %dil, %dl
addl %edx, %r12d
movb %cl, %al
addl %eax, %r13d
movq %rbx, %rdi
callq 0x2ac8
jmp 0x20ff
movslq %r13d, %r12
movslq %r15d, %r15
leaq (,%rbp,4), %r13
cmpq %r15, %rbp
jge 0x2171
incq %rbp
movq (%r14), %rsi
addq %r13, %rsi
movq %rbx, %rdi
callq 0x2ac8
addq $0x4, %r13
jmp 0x2155
movslq 0x4(%rsp), %r15
leaq (,%r12,4), %r13
cmpq %r15, %r12
jge 0x219a
incq %r12
movq (%r14), %rsi
addq %r13, %rsi
movq %rbx, %rdi
callq 0x2ac8
addq $0x4, %r13
jmp 0x217e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ljc2154[P]Rummy/rummy.cpp
// Function: takeTurnCard(State)
bool takeTurnCard(State state)
{
	State originalState = state;
	vector<int> testHand = state.agentHand;
	testHand.push_back(state.turnCard);	// add turn card to hand to test

	/* Empty agent hand */
	while (state.agentHand.empty() == false)
		state.agentHand.pop_back();

	/* Check all possible new hands */
	for (int i = 0; i < testHand.size(); i++)
	{
		for (int j = 0; j < testHand.size(); j++)
		{
			if (i != j)
				state.agentHand.push_back(testHand[j]);
		}

		/* Check if new hand is a winner */
		if (isWinner(state.agentHand))
			return true;

		/* Check if new hand is better than old */
		if (evaluate(state) > evaluate(originalState))
			return true;

		while (state.agentHand.empty() == false)
			state.agentHand.pop_back();
	}
	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rdi, %rbx
leaq 0x98(%rsp), %rdi
movq %rbx, %rsi
callq 0x2a20
leaq 0x18(%rbx), %r14
movq %rsp, %rdi
movq %r14, %rsi
callq 0x2b4e
leaq 0x60(%rbx), %rsi
movq %rsp, %rdi
callq 0x2ac8
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %rcx
cmpq %rax, %rcx
je 0x2749
addq $-0x4, %rcx
movq %rcx, 0x20(%rbx)
jmp 0x273a
xorl %r13d, %r13d
movq (%rsp), %rsi
movq 0x8(%rsp), %rax
movq %rax, %r15
subq %rsi, %r15
sarq $0x2, %r15
cmpq %r13, %r15
jbe 0x283e
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %rax, %rcx
subq %rsi, %rcx
sarq $0x2, %rcx
cmpq %rbp, %rcx
jbe 0x279e
cmpq %rbp, %r13
je 0x2795
addq %r12, %rsi
movq %r14, %rdi
callq 0x2ac8
movq (%rsp), %rsi
movq 0x8(%rsp), %rax
incq %rbp
addq $0x4, %r12
jmp 0x276d
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x2b4e
leaq 0x18(%rsp), %r12
movq %r12, %rdi
callq 0x21a9
movl %eax, %ebp
movq %r12, %rdi
callq 0x2c46
testb %bpl, %bpl
jne 0x283e
leaq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0x2a20
leaq 0x30(%rsp), %rdi
callq 0x23ae
leaq 0x100(%rsp), %r12
movl %eax, %ebp
movq %r12, %rdi
leaq 0x98(%rsp), %rsi
callq 0x2a20
movq %r12, %rdi
callq 0x23ae
movl %eax, %r12d
leaq 0x100(%rsp), %rdi
callq 0x2aa0
leaq 0x30(%rsp), %rdi
callq 0x2aa0
cmpl %r12d, %ebp
jg 0x283e
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %rcx
cmpq %rax, %rcx
je 0x2836
addq $-0x4, %rcx
movq %rcx, 0x20(%rbx)
jmp 0x2827
incq %r13
jmp 0x274c
cmpq %r13, %r15
seta %bl
movq %rsp, %rdi
callq 0x2c46
leaq 0x98(%rsp), %rdi
callq 0x2aa0
movl %ebx, %eax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x28a6
movq %rax, %rbx
jmp 0x28b1
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x2aa0
jmp 0x2898
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x2c46
jmp 0x28a9
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x2aa0
jmp 0x28a9
jmp 0x28a6
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2c46
leaq 0x98(%rsp), %rdi
callq 0x2aa0
movq %rbx, %rdi
callq 0x1160