LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: wh_get_device_private_access_func(WdtDevice*, FuncPtrStructDevOperation*)
int wh_get_device_private_access_func(WDT_DEV* pdev,  FUNC_PTR_STRUCT_DEV_OPERATION*  pFuncs)
{
	if (!pFuncs || !pdev)
		return 0;

	if (pdev->board_info.dev_type & FW_WDT8755) {
		pFuncs->p_wh_program_chunk = (LPFUNC_wh_program_chunk) wh_w8755_dev_program_chunk;
		pFuncs->p_wh_verify_chunk	= (LPFUNC_wh_verify_chunk) wh_w8755_dev_verify_chunk;
		pFuncs->p_wh_flash_write_data = (LPFUNC_wh_flash_write_data) wh_w8755_dev_flash_write_data;
		pFuncs->p_wh_flash_get_checksum = (LPFUNC_wh_flash_get_checksum) wh_w8755_dev_flash_get_checksum;
 		pFuncs->p_wh_send_commands = (LPFUNC_wh_send_commands) wh_w8755_dev_send_commands;

		return wh_w8755_dev_set_basic_op(pdev);
	}

	if (pdev->board_info.dev_type & FW_WDT8760_2) {
		pFuncs->p_wh_program_chunk = (LPFUNC_wh_program_chunk) wh_w8760_dev_program_chunk;
		pFuncs->p_wh_verify_chunk	= (LPFUNC_wh_verify_chunk) wh_w8760_dev_verify_chunk;
		pFuncs->p_wh_flash_write_data = (LPFUNC_wh_flash_write_data) wh_w8760_dev_flash_write_data;
		pFuncs->p_wh_flash_get_checksum = (LPFUNC_wh_flash_get_checksum) wh_w8760_dev_flash_get_checksum;
 		pFuncs->p_wh_send_commands = (LPFUNC_wh_send_commands) wh_w8760_dev_send_commands;

		return wh_w8760_dev_set_basic_op(pdev);
	}
	if (pdev->board_info.dev_type & FW_WDT8790) {
		pFuncs->p_wh_flash_write_data = (LPFUNC_wh_flash_write_data)wh_w8790_dev_flash_write_data;
		pFuncs->p_wh_flash_get_checksum = (LPFUNC_wh_flash_get_checksum)wh_w8790_dev_flash_get_checksum;
		pFuncs->p_wh_send_commands = (LPFUNC_wh_send_commands)wh_w8790_dev_send_commands;
		pFuncs->p_wh_flash_erase = (LPFUNC_wh_flash_erase)wh_w8790_dev_flash_erase;


		return wh_w8790_dev_set_basic_op(pdev);
	}


	return 0;

}

// Assembly:
testq %rsi, %rsi
sete %al
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0x6eab
movl 0x188(%rdi), %eax
testb $0x20, %al
jne 0x6e6a
testl $0x2800, %eax           # imm = 0x2800
je 0x6ea5
leaq -0x1d92(%rip), %rax     # 0x50a4
movq %rax, (%rsi)
leaq -0x2264(%rip), %rax     # 0x4bdc
movq %rax, 0x8(%rsi)
leaq -0x23a0(%rip), %rax     # 0x4aab
movq %rax, 0x18(%rsi)
leaq -0x2324(%rip), %rax     # 0x4b32
movq %rax, 0x20(%rsi)
leaq -0x257f(%rip), %rax     # 0x48e2
movq %rax, 0x28(%rsi)
jmp 0x3ecf
leaq -0x3516(%rip), %rax     # 0x395b
movq %rax, (%rsi)
leaq -0x352c(%rip), %rax     # 0x394f
movq %rax, 0x8(%rsi)
leaq -0x4200(%rip), %rax     # 0x2c86
movq %rax, 0x18(%rsi)
leaq -0x3ac6(%rip), %rax     # 0x33cb
movq %rax, 0x20(%rsi)
leaq -0x4131(%rip), %rax     # 0x2d6b
movq %rax, 0x28(%rsi)
jmp 0x39ab
btl $0x9, %eax
jb 0x6eae
xorl %eax, %eax
retq
leaq -0x7b5(%rip), %rax      # 0x6700
movq %rax, 0x18(%rsi)
leaq -0xcd1(%rip), %rax      # 0x61ef
movq %rax, 0x20(%rsi)
leaq -0x91c(%rip), %rax      # 0x65af
movq %rax, 0x28(%rsi)
leaq -0x79c(%rip), %rax      # 0x673a
movq %rax, 0x30(%rsi)
jmp 0x5223
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: check_firmware_id(WdtDevice*, unsigned int)
int check_firmware_id(WDT_DEV *pdev, UINT32 fwid)
{
	if ((fwid & 0xF0000000) == 0x30000000) {
		if (pdev->pparam->argus & OPTION_INFO)		
			printf("It is WDT8755 or WDT8752 !\n");	
		return FW_WDT8755;
	}

	if ((fwid & 0xFFFF0000) == 0xFFFF0000) {
		if (pdev->pparam->argus & OPTION_INFO)		
			printf("It is WDT8752 recovery fw !\n");	
		return FW_WDT8755;
	}	

	if ((fwid & 0xF0000000) == 0x40000000) {
		if (pdev->pparam->argus & OPTION_INFO)	
			printf("It is WDT8760 alike !\n");	
		return FW_WDT8760;
	}

	if ((fwid & 0xFF000000) == 0x51000000) {
                if(pdev->pparam->argus & OPTION_INFO)
                        printf("It is WDT8730 !\n");
                return FW_NOT_SUPPORT;

        }

	//TODO: We will add new devices here and should before FW_WDT8970 for compatibility.

	if ((fwid & 0xFF000000) == 0x50000000) {
		if(pdev->pparam->argus & OPTION_INFO)
			printf("It is WDT8790 !\n");
		return FW_WDT8790;

	}
	
	return FW_WITH_CMD;
}

// Assembly:
pushq %rbx
movl %esi, %eax
andl $0xf0000000, %eax       # imm = 0xF0000000
cmpl $0x30000000, %eax       # imm = 0x30000000
jne 0x6f8e
movq 0x280(%rdi), %rax
movl $0x20, %ebx
testb $0x8, (%rax)
je 0x7023
leaq 0x5678(%rip), %rdi      # 0xc601
jmp 0x701e
cmpl $0xffff0000, %esi       # imm = 0xFFFF0000
jb 0x6fb0
movq 0x280(%rdi), %rax
movl $0x20, %ebx
testb $0x8, (%rax)
je 0x7023
leaq 0x5637(%rip), %rdi      # 0xc5e5
jmp 0x701e
cmpl $0x40000000, %eax       # imm = 0x40000000
jne 0x6fd1
movq 0x280(%rdi), %rax
movl $0x800, %ebx            # imm = 0x800
testb $0x8, (%rax)
je 0x7023
leaq 0x5600(%rip), %rdi      # 0xc5cf
jmp 0x701e
andl $0xff000000, %esi       # imm = 0xFF000000
cmpl $0x50000000, %esi       # imm = 0x50000000
je 0x7006
movl $0x2, %ebx
cmpl $0x51000000, %esi       # imm = 0x51000000
jne 0x7023
movq 0x280(%rdi), %rax
movl $0x4, %ebx
testb $0x8, (%rax)
je 0x7023
leaq 0x55bb(%rip), %rdi      # 0xc5bf
jmp 0x701e
movq 0x280(%rdi), %rax
movl $0x200, %ebx            # imm = 0x200
testb $0x8, (%rax)
je 0x7023
leaq 0x5591(%rip), %rdi      # 0xc5af
callq 0x2270
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: check_is_all_ff(unsigned char*, int)
int check_is_all_ff(BYTE* data, int length)
{
	if (data == 0)
		return 0;

	int idx;

	for (idx = 0; idx < length; idx++)
		if (data[idx] != 0xFF)
			return 0;
	return 1;
}

// Assembly:
testq %rdi, %rdi
je 0x7056
movl $0x1, %eax
testl %esi, %esi
jle 0x7055
movl %esi, %ecx
xorl %edx, %edx
cmpb $-0x1, (%rdi,%rdx)
jne 0x7056
incq %rdx
cmpq %rdx, %rcx
jne 0x7047
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: count_ff_bytes(unsigned char*, int, int)
int count_ff_bytes(BYTE* data, int start, int size)
{
	int count = 0;
	for (int i = 0; i < size; i++)
	{
		if (data[start + i] == 0xFF)
			count++;
	}
	return count;
}

// Assembly:
testl %edx, %edx
jle 0x707e
movslq %esi, %rax
movl %edx, %ecx
addq %rax, %rdi
xorl %edx, %edx
xorl %eax, %eax
xorl %esi, %esi
cmpb $-0x1, (%rdi,%rdx)
sete %sil
addl %esi, %eax
incq %rdx
cmpq %rdx, %rcx
jne 0x7069
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: wh_open_whiff_file(char*)
WH_HANDLE wh_open_whiff_file(char* path)
{
	FILE*			pfile = NULL;
	WIF_FILE 		*pcur_wif = NULL;

	pfile = fopen(path, "rb");
	if (!pfile)
		return NULL;

	pcur_wif = (WIF_FILE*) malloc(sizeof(WIF_FILE));
	if (!pcur_wif) {
		fclose(pfile);
		return NULL;
	}

	/* set file ptr to the end */
	fseek(pfile, 0, SEEK_END);
	pcur_wif->data_len = ftell(pfile);

	/* set the file ptr the beginning */
	rewind(pfile);		

	pcur_wif->pdata = (BYTE*) malloc(pcur_wif->data_len + 32);

	if (!pcur_wif->pdata)
		goto failed;

	if (fread(pcur_wif->pdata, 1, pcur_wif->data_len, pfile) == pcur_wif->data_len)	{	
		process_whiff_file(pcur_wif);
		fclose(pfile);

		return (WH_HANDLE) pcur_wif;
	}

failed:
	wh_close_whiff_file((WH_HANDLE) pcur_wif);
		
	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
leaq 0x546c(%rip), %rsi      # 0xc55b
callq 0x21d0
testq %rax, %rax
je 0x71a5
movq %rax, %r14
movl $0x18, %edi
callq 0x21f0
testq %rax, %rax
je 0x719d
movq %rax, %rbx
movq %r14, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x21c0
movq %r14, %rdi
callq 0x2030
movl %eax, 0x8(%rbx)
movq %r14, %rdi
callq 0x2070
movl 0x8(%rbx), %r15d
leal 0x20(%r15), %edi
callq 0x21f0
movq %rax, (%rbx)
testq %rax, %rax
je 0x7193
movl $0x1, %esi
movq %rax, %rdi
movq %r15, %rdx
movq %r14, %rcx
callq 0x2240
movl 0x8(%rbx), %ecx
cmpq %rcx, %rax
jne 0x7193
movq (%rbx), %rax
cmpl $0x46464952, (%rax)     # imm = 0x46464952
jne 0x7189
cmpl $0x46494857, 0x8(%rax)  # imm = 0x46494857
jne 0x7189
cmpl 0x4(%rax), %ecx
jne 0x7189
addq $0xc, %rax
movq %rax, 0x10(%rbx)
movq %r14, %rdi
callq 0x21a0
jmp 0x71a7
movq %rbx, %rdi
callq 0x71b0
jmp 0x71a5
movq %r14, %rdi
callq 0x21a0
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: wh_close_whiff_file(void*)
int wh_close_whiff_file(WH_HANDLE handle)
{
	WIF_FILE	*pcur_wif = (WIF_FILE*) handle;

	if (pcur_wif) {
		if (pcur_wif->pdata)
			free(pcur_wif->pdata);

		free(pcur_wif);
		return 1;
	}

	return 0;
}

// Assembly:
testq %rdi, %rdi
je 0x71d5
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x71c6
callq 0x21e0
movq %rbx, %rdi
callq 0x21e0
movl $0x1, %eax
popq %rbx
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: wh_get_chunk_info(void*, unsigned int, ChunkInfoEx*)
int wh_get_chunk_info(WH_HANDLE handle, UINT32 chunk_index, CHUNK_INFO_EX* pchunk_info_ex)
{
	WIF_FILE	*pcur_wif = (WIF_FILE*) handle;

	if (!pcur_wif)
		return 0;

	UINT32	chunk_four_cc = get_chunk_fourcc (chunk_index);

	if (!chunk_four_cc)
		return 0;

	if (!pcur_wif->pformat_chunk)
		return 0;

	/* check if the chunk is existed */
	if (pcur_wif->pformat_chunk->enableFlag | chunk_index) {
		
		/* 12 is the header size */
		UINT32	chunk_start_pos = 12 + sizeof (FORMAT_CHUNK);
		CHUNK_DATA*	pchunk_data = NULL;

		while (chunk_start_pos < pcur_wif->data_len) {
			pchunk_data = (CHUNK_DATA*) & pcur_wif->pdata[chunk_start_pos];

			/* we got it */
			if (pchunk_data->ckID == chunk_four_cc)	{
				memcpy((void*) &pchunk_info_ex->chuckInfo, (void*) &pchunk_data->chunkInfo, sizeof(CHUNK_INFO));
				pchunk_info_ex->length = pchunk_data->chunkInfo.length;
				pchunk_info_ex->pData = (BYTE*) &pcur_wif->pdata[chunk_start_pos + 8 + sizeof(CHUNK_INFO)];
				
				return 1;
			} else
				/* 8 is the header size */
				chunk_start_pos = chunk_start_pos + pchunk_data->ckSize + 8;
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x7260
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
movl %esi, %edi
callq 0x8743
testl %eax, %eax
je 0x7260
movq 0x10(%r15), %rcx
testq %rcx, %rcx
je 0x7260
orl 0xc(%rcx), %ebp
je 0x7260
movl 0x8(%r15), %edx
cmpl $0x29, %edx
jb 0x7260
movq (%r15), %rsi
movl $0x28, %ecx
movl %ecx, %r8d
leaq (%rsi,%r8), %rdi
cmpl %eax, (%rsi,%r8)
je 0x7233
movl 0x4(%rdi), %edi
addl %edi, %ecx
addl $0x8, %ecx
cmpl %edx, %ecx
jb 0x7218
jmp 0x7260
movq 0x18(%rdi), %rax
movq %rax, 0x10(%r14)
movups 0x8(%rdi), %xmm0
movups %xmm0, (%r14)
movl 0xc(%rdi), %eax
movl %eax, 0x20(%r14)
movq (%r15), %rax
addl $0x8, %ecx
addq %rcx, %rax
addq $0x18, %rax
movq %rax, 0x18(%r14)
movl $0x1, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: load_wif(WdtDevice*, char*)
int load_wif(WDT_DEV *pdev, char *path)
{
	if (!pdev || !path)
		return 0;

	strcpy(pdev->wif_access.wif_path, path);

	pdev->wif_access.wif_handle = pdev->func_wh_open_whiff(pdev->wif_access.wif_path);

	if (!pdev->wif_access.wif_handle) {
		wh_printf("Parse input file error");
		return 0;
	}

	memset(&pdev->wif_access.wif_chunk_info, 0, sizeof(CHUNK_INFO_EX));

	return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
xorl %ebp, %ebp
orb %al, %cl
jne 0x72da
movq %rdi, %rbx
leaq 0x58(%rdi), %r14
movq %r14, %rdi
callq 0x2180
movq %r14, %rdi
callq *0x308(%rbx)
movq %rax, 0x158(%rbx)
testq %rax, %rax
je 0x72ca
xorps %xmm0, %xmm0
movups %xmm0, 0x170(%rbx)
movups %xmm0, 0x160(%rbx)
movq $0x0, 0x180(%rbx)
movl $0x1, %ebp
jmp 0x72da
leaq 0x4b8f(%rip), %rdi      # 0xbe60
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x2506
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: fw_version_check(ExecParam*, BoardInfo*, ChunkInfoEx*)
int fw_version_check(EXEC_PARAM *pparam, BOARD_INFO *pinfo, CHUNK_INFO_EX *pchunk_info)
{
	if (!pparam || !pinfo || !pchunk_info)
		return 0;

	char	fw_id = ((pchunk_info->chuckInfo.versionNumber >> 12) & 0xF);
	char	chip_id = ((pinfo->firmware_id >> 12) & 0xF);
	
	if (fw_id != chip_id) {
		printf("This firmware is not matched with this chip, fwid(%x), chip_id(%x)\n", fw_id, chip_id);
		return 0;
	} 

	if (pinfo->dev_type & FW_WDT8760) {
		if ((pchunk_info->chuckInfo.temp & 0xFF000000) != 0x31000000) {			
			printf("The device type is not matched with this firmware (%x)\n", pchunk_info->chuckInfo.temp);
			return 0;
		}
	} else if (pinfo->dev_type & FW_WDT8762) {
		if ((pchunk_info->chuckInfo.temp & 0xFF000000) != 0x32000000) { 		
			printf("The device type is not matched with this firmware (%x)\n", pchunk_info->chuckInfo.temp);
			return 0;
		}
	}

	wh_printf("The firmware vession: dev %x, wif %x\n", pinfo->firmware_id,
			  pchunk_info->chuckInfo.versionNumber); 

	unsigned int fw_ver = pchunk_info->chuckInfo.versionNumber & 0xFFF;
	unsigned int chip_fw_ver = pinfo->firmware_id & 0xFFF;

	/* just ignore the recovery firmware */
	if (( fw_ver <= chip_fw_ver) && (chip_fw_ver != 0xFFF)) 
		return 2;

	return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
testq %rdx, %rdx
sete %al
xorl %ebp, %ebp
orb %cl, %al
jne 0x7636
movq %rdx, %r14
movq %rsi, %rbx
movl 0xc(%rdx), %edx
movl %edx, %eax
shrl $0xc, %eax
andl $0xf, %eax
movl 0x10(%rsi), %esi
movl %esi, %ecx
shrl $0xc, %ecx
andl $0xf, %ecx
cmpl %ecx, %eax
jne 0x75dd
movl (%rbx), %eax
btl $0xb, %eax
jb 0x75f3
btl $0xd, %eax
jae 0x7607
movl 0x14(%r14), %eax
movl %eax, %ecx
andl $0xff000000, %ecx       # imm = 0xFF000000
cmpl $0x32000000, %ecx       # imm = 0x32000000
je 0x7607
leaq 0x4991(%rip), %rdi      # 0xbf61
xorl %ebp, %ebp
movl %eax, %esi
xorl %eax, %eax
callq 0x2050
jmp 0x7636
leaq 0x4939(%rip), %rdi      # 0xbf1d
xorl %ebp, %ebp
movl %eax, %esi
movl %ecx, %edx
xorl %eax, %eax
callq 0x2050
jmp 0x7636
movl 0x14(%r14), %eax
movl %eax, %ecx
andl $0xff000000, %ecx       # imm = 0xFF000000
cmpl $0x31000000, %ecx       # imm = 0x31000000
jne 0x75c9
leaq 0x498b(%rip), %rdi      # 0xbf99
xorl %eax, %eax
callq 0x2506
movl $0xfff, %eax            # imm = 0xFFF
movl 0xc(%r14), %ecx
andl %eax, %ecx
movl 0x10(%rbx), %edx
andl %eax, %edx
cmpl %edx, %ecx
setbe %cl
cmpl %eax, %edx
setne %al
andb %cl, %al
movzbl %al, %ebp
incl %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: config_id_check(ExecParam*, BoardInfo*, ChunkInfoEx*)
int config_id_check(EXEC_PARAM *pparam, BOARD_INFO *pinfo, CHUNK_INFO_EX *pchunk_info)
{
	if (!pparam || !pinfo || !pchunk_info)
		return 0;

	unsigned int 	xmlId = 0;

	if (pchunk_info->chuckInfo.attribute & 0x2)
		xmlId = pchunk_info->chuckInfo.versionNumber;

	wh_printf("The config data in dev: %04x, wif: %04x\n", xmlId, pinfo->sys_param.xmls_id1);
	if (xmlId == pinfo->sys_param.xmls_id1) 
		return 2;

	return 1;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
testq %rdx, %rdx
sete %sil
xorl %eax, %eax
orb %cl, %sil
jne 0x768b
xorl %ebp, %ebp
testb $0x2, 0x10(%rdx)
je 0x766a
movl 0xc(%rdx), %ebp
movzwl 0x20(%rbx), %edx
leaq 0x494a(%rip), %rdi      # 0xbfbf
movl %ebp, %esi
xorl %eax, %eax
callq 0x2506
movzwl 0x20(%rbx), %ecx
xorl %eax, %eax
cmpl %ecx, %ebp
sete %al
incl %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: program_one_chunk(WdtDevice*, char const*, unsigned int, unsigned int, ChunkInfoEx*)
int program_one_chunk(WDT_DEV *pdev, const char *chunk_name, UINT32 chunk_id, UINT32 option, CHUNK_INFO_EX *pinfo)
{
	CHUNK_INFO_EX	chunk_info;
	CHUNK_INFO_EX	*pchunk_info = NULL;

	if (!pdev)
		return 0;

	if (pinfo == NULL) {
		memset(&chunk_info, 0, sizeof(CHUNK_INFO_EX));
		if (pdev->func_wh_get_chunk_info(pdev->wif_access.wif_handle, chunk_id, &chunk_info))
			pchunk_info = &chunk_info;
		else
			return 1;
	} else
		pchunk_info = pinfo;

	if (!pchunk_info)
		return 0;
		
	printf("\n[%s] programming ....\n", chunk_name);
				
	if (!pdev->funcs_device_private.p_wh_program_chunk(pdev, pchunk_info, option ))	{
		char	msg[64];

		sprintf(msg, "[%s] Write chunk error", chunk_name);
		wh_printf(msg);
		return 0;	
	}

	printf("[%s] chunk program : pass...\n", chunk_name);
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x70, %rsp
testq %rdi, %rdi
je 0x7728
movq %r8, %r12
movl %ecx, %r14d
movq %rsi, %rbx
movq %rdi, %r15
testq %r8, %r8
jne 0x76e9
xorps %xmm0, %xmm0
movq %rsp, %r12
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
movq $0x0, 0x20(%r12)
movq 0x158(%r15), %rdi
movl %edx, %esi
movq %r12, %rdx
callq *0x318(%r15)
testl %eax, %eax
je 0x7721
leaq 0x48f8(%rip), %rdi      # 0xbfe8
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2050
movq %r15, %rdi
movq %r12, %rsi
movl %r14d, %edx
callq *0x2b0(%r15)
testl %eax, %eax
je 0x772c
leaq 0x4900(%rip), %rdi      # 0xc017
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2050
movl $0x1, %ebp
jmp 0x774f
xorl %ebp, %ebp
jmp 0x774f
leaq 0x48cd(%rip), %rsi      # 0xc000
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2080
movq %r14, %rdi
xorl %eax, %eax
callq 0x2506
movl %ebp, %eax
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: show_wif_info(WdtDevice*, ExecParam*)
int show_wif_info(WDT_DEV *pdev, EXEC_PARAM *pparam)
{
	if (!pdev || !pparam)
		return 0;
	if(show_wif2_info((char*)pparam->image_file))
		return 1;

	if (!load_wif(pdev, (char*)pparam->image_file))
		return 0;

	CHUNK_INFO_EX chunk_info_ex;
	if (pdev->func_wh_get_chunk_info(pdev->wif_access.wif_handle, CHUNK_ID_FRWR, &chunk_info_ex)) 
		printf("FW id: 0x%08x\n", chunk_info_ex.chuckInfo.versionNumber);

	if (pdev->func_wh_get_chunk_info(pdev->wif_access.wif_handle, CHUNK_ID_CNFG, &chunk_info_ex)) {
		UINT32	config_id = 0;
		
		if (chunk_info_ex.chuckInfo.attribute & 0x2)
			config_id = chunk_info_ex.chuckInfo.versionNumber;
		printf("Config id: 0x%x\n", config_id);		
	}
	
	if (!close_wif(pdev))
		return 0; 
	
	return 1;
}

// Assembly:
testq %rdi, %rdi
sete %cl
testq %rsi, %rsi
sete %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x8289
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x10(%rsi), %rdi
callq 0xa446
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0x8282
movq 0x10(%r14), %rsi
movq %rbx, %rdi
callq 0x726d
movl %eax, %ecx
movl $0x0, %eax
testl %ecx, %ecx
je 0x8282
movq 0x158(%rbx), %rdi
movq %rsp, %rdx
movl $0x1, %esi
callq *0x318(%rbx)
testl %eax, %eax
je 0x8225
movl 0xc(%rsp), %esi
leaq 0x41e5(%rip), %rdi      # 0xc403
xorl %eax, %eax
callq 0x2050
movq 0x158(%rbx), %rdi
movq %rsp, %rdx
movl $0x2, %esi
callq *0x318(%rbx)
testl %eax, %eax
je 0x825a
movl 0x10(%rsp), %esi
shll $0x1e, %esi
sarl $0x1f, %esi
andl 0xc(%rsp), %esi
leaq 0x41bf(%rip), %rdi      # 0xc412
xorl %eax, %eax
callq 0x2050
movq 0x158(%rbx), %rdi
callq *0x310(%rbx)
movl %eax, %ebx
testl %eax, %eax
jne 0x827b
leaq 0x3c03(%rip), %rdi      # 0xbe77
xorl %eax, %eax
callq 0x2506
xorl %eax, %eax
testl %ebx, %ebx
setne %al
addq $0x28, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: find_hid_dev_name(int, int, int, char*)
int find_hid_dev_name(int bus, int vid, int pid, char *device_name)
{
	int ret = 0;
	struct dirent * dev_dir_entry;
	DIR * dev_dir;
	char device_ids[32];

	snprintf(device_ids, 15, "%04X:%04X:%04X", bus, vid, pid);

	dev_dir = opendir("/sys/bus/hid/devices");
	if (!dev_dir) {
		printf("open dev dir failed !\n");
		return 0;
	}

	while ((dev_dir_entry = readdir(dev_dir)) != NULL) {
		if (!strncmp(dev_dir_entry->d_name, device_ids, 14)) {
			strcpy(device_name, dev_dir_entry->d_name);
			ret = 1;
			break;
		}
	}
	closedir(dev_dir);

	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rcx, %rbx
movl %edx, %r9d
movl %esi, %r8d
movl %edi, %ecx
leaq 0x417b(%rip), %rdx      # 0xc423
xorl %ebp, %ebp
movq %rsp, %rdi
movl $0xf, %esi
xorl %eax, %eax
callq 0x2290
leaq 0x4172(%rip), %rdi      # 0xc432
callq 0x2250
testq %rax, %rax
je 0x830a
movq %rax, %r14
movq %rsp, %r15
movq %r14, %rdi
callq 0x2260
testq %rax, %rax
je 0x8318
movq %rax, %r12
addq $0x13, %r12
movl $0xe, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x20e0
testl %eax, %eax
jne 0x82d0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2180
movl $0x1, %ebp
jmp 0x831a
leaq 0x43e7(%rip), %rdi      # 0xc6f8
callq 0x2270
jmp 0x8322
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x22a0
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: write_devname_to_sys_attr(char const*, char const*)
int write_devname_to_sys_attr(const char *attr, const char *action)
{
	int fd;
	ssize_t size;

	fd = open(attr, O_WRONLY);
	if (fd < 0) {
		printf("%s: open file error !", __func__);
		return 0;
	}

	for (;;) {
		size = write(fd, action, strlen(action));
		if (size < 0) {
			if (errno == EINTR)
				continue;

			return 0;
		}
		break;
	}

	close(fd);

	return (size == (ssize_t) strlen(action));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
xorl %ebp, %ebp
movl $0x1, %esi
xorl %eax, %eax
callq 0x2140
testl %eax, %eax
js 0x858e
movl %eax, %r14d
movq %rbx, %rdi
callq 0x20d0
movl %r14d, %edi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x20b0
testq %rax, %rax
jns 0x85a5
callq 0x2040
cmpl $0x4, (%rax)
je 0x8565
xorl %ebp, %ebp
jmp 0x85c1
leaq 0x3ef3(%rip), %rdi      # 0xc488
leaq 0x3f02(%rip), %rsi      # 0xc49e
xorl %eax, %eax
callq 0x2050
jmp 0x85c1
movq %rax, %r15
movl %r14d, %edi
callq 0x22e0
movq %rbx, %rdi
callq 0x20d0
xorl %ebp, %ebp
cmpq %rax, %r15
sete %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: rebind_driver(WdtDevice*)
int rebind_driver(WDT_DEV *pdev)
{
	int 	bus = 0x18;
	int 	vendor = pdev->board_info.vid;
	int 	product = pdev->board_info.pid;
	char	hid_dev_name[64];
	char	driver_path[64];
	char	i2c_dev_name[64];
	char	attr_str[70];

	printf("Start to rebind driver !\n");

	if (!find_hid_dev_name(bus, vendor, product, hid_dev_name)) {
		printf("Not found hid device: 0x%x:0x%x:0x%x\n", bus, vendor, product);
		return 0;
	}



	strcpy(driver_path, "/sys/bus/i2c/drivers/");

	if (!find_device_name(hid_dev_name, i2c_dev_name, driver_path)) {
		printf("find device name failed %s\n", hid_dev_name);
		return 0;
	}


	sprintf(attr_str, "%s%s", driver_path, "unbind");


	if (!write_devname_to_sys_attr(attr_str, i2c_dev_name)) {
		printf("failed to unbind HID device %s %s\n", attr_str, i2c_dev_name);
		return 0;
	}
	
	wh_sleep(300);

	sprintf(attr_str, "%s%s", driver_path, "bind");

	if (!write_devname_to_sys_attr(attr_str, i2c_dev_name)) {
		printf("failed to bind HID device %s %s\n", attr_str, i2c_dev_name);
		return 0;
	}

	wh_sleep(300);

	printf("Rebind driver is done !\n");

	return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
movl 0x18c(%rdi), %ebp
movl 0x190(%rdi), %r14d
leaq 0x4121(%rip), %rdi      # 0xc70e
callq 0x2270
leaq 0xd0(%rsp), %rcx
movl $0x18, %edi
movl %ebp, %esi
movl %r14d, %edx
callq 0x828a
testl %eax, %eax
je 0x86e0
movups 0x3ec6(%rip), %xmm0     # 0xc4de
leaq 0x90(%rsp), %rdx
movaps %xmm0, (%rdx)
movabsq $0x2f737265766972, %rax # imm = 0x2F737265766972
movq %rax, 0xe(%rdx)
leaq 0xd0(%rsp), %rdi
movq %rsp, %rsi
callq 0x8331
testl %eax, %eax
je 0x86fc
leaq 0x3e15(%rip), %rsi      # 0xc465
leaq 0x3eb9(%rip), %rcx      # 0xc510
xorl %ebx, %ebx
leaq 0x40(%rsp), %r14
leaq 0x90(%rsp), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2080
movq %rsp, %rsi
movq %r14, %rdi
callq 0x8546
testl %eax, %eax
je 0x8716
movl $0x12c, %edi            # imm = 0x12C
callq 0x259c
leaq 0x3dd1(%rip), %rsi      # 0xc465
leaq 0x2a54(%rip), %rcx      # 0xb0ef
xorl %ebx, %ebx
leaq 0x40(%rsp), %r14
leaq 0x90(%rsp), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2080
movq %rsp, %rsi
movq %r14, %rdi
callq 0x8546
testl %eax, %eax
je 0x871f
movl $0x12c, %edi            # imm = 0x12C
callq 0x259c
leaq 0x4053(%rip), %rdi      # 0xc727
callq 0x2270
movl $0x1, %ebx
jmp 0x8735
leaq 0x3dd1(%rip), %rdi      # 0xc4b8
xorl %ebx, %ebx
movl $0x18, %esi
movl %ebp, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x2050
jmp 0x8735
leaq 0x3df1(%rip), %rdi      # 0xc4f4
xorl %ebx, %ebx
leaq 0xd0(%rsp), %rsi
xorl %eax, %eax
callq 0x2050
jmp 0x8735
leaq 0x3dfa(%rip), %rdi      # 0xc517
jmp 0x8726
leaq 0x3e14(%rip), %rdi      # 0xc53a
leaq 0x40(%rsp), %rsi
movq %rsp, %rdx
xorl %eax, %eax
callq 0x2050
movl %ebx, %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: get_chunk_fourcc(unsigned int)
UINT32 get_chunk_fourcc(UINT32 chunk_index)
{
	switch (chunk_index) {
		case	CHUNK_ID_FRMT:
			return FOURCC_ID_FRMT;
		case	CHUNK_ID_FRWR:
			return FOURCC_ID_FRWR;
		case	CHUNK_ID_CNFG:
			return FOURCC_ID_CNFG;
		case	CHUNK_ID_HDRS:
			return FOURCC_ID_HDRS;
		case	CHUNK_ID_FSBT:
			return FOURCC_ID_FSBT;
		case	CHUNK_ID_BINF:
			return FOURCC_ID_BINF;
		case	CHUNK_ID_RCVY:
			return FOURCC_ID_RCVY;
		case	CHUNK_ID_TSTB:
			return FOURCC_ID_TSTB;
		case	CHUNK_ID_EXTB:
			return FOURCC_ID_EXTB;
		case	CHUNK_ID_FRWD:
			return FOURCC_ID_FRWD;
		case 	CHUNK_ID_CNFD:
			return FOURCC_ID_CNFD;
		default:
			return 0;
	}
	return 0;
}

// Assembly:
cmpl $0xf, %edi
jle 0x8762
cmpl $0x7f, %edi
jg 0x877f
cmpl $0x10, %edi
je 0x87c1
cmpl $0x20, %edi
je 0x87b5
cmpl $0x40, %edi
jne 0x87cd
movl $0x54535442, %eax       # imm = 0x54535442
retq
cmpl $0x8, %edi
ja 0x87cd
movl %edi, %eax
leaq 0x3680(%rip), %rcx      # 0xbdf0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x544d5246, %eax       # imm = 0x544D5246
retq
cmpl $0x80, %edi
je 0x87c7
cmpl $0x200, %edi            # imm = 0x200
je 0x87bb
cmpl $0x400, %edi            # imm = 0x400
jne 0x87cd
movl $0x44464e43, %eax       # imm = 0x44464E43
retq
movl $0x54425346, %eax       # imm = 0x54425346
retq
movl $0x53524448, %eax       # imm = 0x53524448
retq
movl $0x47464e43, %eax       # imm = 0x47464E43
retq
movl $0x52575246, %eax       # imm = 0x52575246
retq
movl $0x52435659, %eax       # imm = 0x52435659
retq
movl $0x44575246, %eax       # imm = 0x44575246
retq
movl $0x464e4942, %eax       # imm = 0x464E4942
retq
movl $0x45585442, %eax       # imm = 0x45585442
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: misr_16b(unsigned short, unsigned short)
UINT16 misr_16b(UINT16 current_value, UINT16 new_value)
{
	unsigned int a, b;
	unsigned int bit0;
	UINT16 y;

	a = current_value;
	b = new_value;
	bit0 = a^(b&1);
	bit0 ^= a>>1;
	bit0 ^= a>>2;
	bit0 ^= a>>4;
	bit0 ^= a>>5;
	bit0 ^= a>>7;
	bit0 ^= a>>11;
	bit0 ^= a>>15;
	y = (a<<1)^b;
	y = (y&~1) | (bit0&1);

	return y;
}

// Assembly:
pushq %rbx
movl %edi, %ecx
movl %edi, %r8d
movl %edi, %edx
movl %edi, %r9d
movl %edi, %r10d
movl %edi, %r11d
movl %esi, %eax
xorl %edi, %eax
leal (%rdi,%rdi), %ebx
shrl %edi
shrl $0x2, %ecx
xorl %edi, %ecx
shrl $0x4, %r8d
shrl $0x5, %edx
xorl %r8d, %edx
xorl %ecx, %edx
shrl $0x7, %r9d
shrl $0xb, %r10d
xorl %r9d, %r10d
shrl $0xf, %r11d
xorl %r10d, %r11d
xorl %edx, %r11d
xorl %r11d, %eax
andl $-0x2, %esi
xorl %esi, %ebx
andl $0x1, %eax
orl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: misr_for_halfwords(unsigned short, unsigned char*, int, int)
UINT16 misr_for_halfwords(UINT16 current_value, BYTE *buf, int start, int hword_count)
{
	int i;
	UINT32 checksum = current_value;
	UINT16 *p_hword = (UINT16 *)&buf[start];
	
	for (i = 0; i < hword_count; i++)
		checksum = misr_16b(checksum, *p_hword++);

	return checksum;
}

// Assembly:
testl %ecx, %ecx
jle 0x8963
movslq %edx, %rax
addq %rax, %rsi
movl %ecx, %ecx
xorl %edx, %edx
movzwl (%rsi,%rdx,2), %r8d
movzwl %di, %eax
movl %eax, %r9d
shrl %r9d
movl %eax, %r10d
shrl $0x2, %r10d
xorl %r9d, %r10d
movl %eax, %r9d
shrl $0x4, %r9d
movl %eax, %r11d
shrl $0x5, %r11d
xorl %r9d, %r11d
xorl %r10d, %r11d
movl %eax, %r9d
shrl $0x7, %r9d
movl %eax, %r10d
shrl $0xb, %r10d
xorl %r9d, %r10d
shrl $0xf, %eax
xorl %r10d, %eax
xorl %r11d, %eax
xorl %edi, %eax
xorl %r8d, %eax
addl %edi, %edi
andl $-0x2, %r8d
xorl %edi, %r8d
andl $0x1, %eax
orl %r8d, %eax
incq %rdx
movl %eax, %edi
cmpl %edx, %ecx
jne 0x88ff
retq
movl %edi, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/wdt_dev_api.cpp
// Function: misr_for_bytes(unsigned short, unsigned char*, int, int)
UINT16 misr_for_bytes(UINT16 current_value, BYTE *bytes, int start, int size)
{
	UINT32 checksum = current_value;

	if (size / 2 > 0)
		checksum = misr_for_halfwords(checksum, bytes, start, size / 2);

	if ((size % 2) != 0)
		checksum = misr_16b(checksum, bytes[start + size - 1]);
	
	return checksum;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %ecx, %ebx
movl %edx, %ebp
movq %rsi, %r14
movl %edi, %eax
cmpl $0x2, %ecx
jl 0x8989
movl %ebx, %ecx
shrl %ecx
movzwl %ax, %edi
movq %r14, %rsi
movl %ebp, %edx
callq 0x88f1
testb $0x1, %bl
je 0x89df
addl %ebp, %ebx
movslq %ebx, %rcx
movzbl -0x1(%r14,%rcx), %ecx
movzwl %ax, %edx
movl %edx, %esi
shrl %esi
movl %edx, %edi
shrl $0x2, %edi
xorl %esi, %edi
movl %edx, %esi
shrl $0x4, %esi
movl %edx, %r8d
shrl $0x5, %r8d
xorl %esi, %r8d
xorl %edi, %r8d
movl %edx, %esi
shrl $0x7, %esi
movl %edx, %edi
shrl $0xb, %edi
xorl %esi, %edi
shrl $0xf, %edx
xorl %edi, %edx
xorl %r8d, %edx
xorl %eax, %edx
xorl %ecx, %edx
addl %eax, %eax
andl $-0x2, %ecx
xorl %eax, %ecx
andl $0x1, %edx
orl %ecx, %edx
movl %edx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/func_i2c.cpp
// Function: wh_i2c_scan_driver_path(WdtDevice*, int*)
int wh_i2c_scan_driver_path(WDT_DEV* pdev, int *adaptor_no)
{
	DIR *d;
	struct dirent *dir = NULL;
	int found = 0;
	int dev_addr = 0;

	/* weida driver path in sysfs */
	char dev_sysfs_path[] = "/sys/bus/i2c/drivers/wdt87xx_i2c";

	d = opendir(dev_sysfs_path);	
	if (d) {
		if (pdev->pparam->argus & OPTION_INFO)
			printf("Scan I2C device in driver path...\n");
		while ((dir = readdir(d)) != NULL) {
			sscanf(dir->d_name, "%d-%x", adaptor_no, &dev_addr);
			if (dev_addr == DEFAULT_I2C_ADDR) {
				found = 1;
				pdev->board_info.i2c_address = DEFAULT_I2C_ADDR;
				pdev->is_legacy = 1;
				break;	
			}
		}
		closedir(d);
	}

	return found;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
movl $0x0, 0x4(%rsp)
leaq 0x3d5c(%rip), %rdi      # 0xc760
callq 0x2250
testq %rax, %rax
je 0x8a81
movq %rax, %rbx
movq 0x280(%r14), %rax
testb $0x8, (%rax)
je 0x8a29
leaq 0x406e(%rip), %rdi      # 0xca92
callq 0x2270
leaq 0x3ddd(%rip), %r12      # 0xc80d
xorl %ebp, %ebp
leaq 0x4(%rsp), %r13
movq %rbx, %rdi
callq 0x2260
testq %rax, %rax
je 0x8a77
addq $0x13, %rax
movq %rax, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x2190
cmpl $0x2c, 0x4(%rsp)
jne 0x8a37
movb $0x2c, 0x1d6(%r14)
movl $0x1, 0x4(%r14)
movl $0x1, %ebp
movq %rbx, %rdi
callq 0x22a0
jmp 0x8a83
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/func_i2c.cpp
// Function: get_i2c_dev_count()
int get_i2c_dev_count(){
	char dev_sys_class_path[] = "/sys/class/i2c-adapter";
	int count = 0;
	struct dirent *dir = NULL;
	DIR *d;
	d = opendir(dev_sys_class_path);
	if(d){
		while ((dir = readdir(d)) != NULL) {
                    if(strncmp("i2c", dir->d_name, 3) == 0)
                        count ++;
		}
		closedir(d);
	}
	if(count == 0)
		return 16;
	else
		return count;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
leaq 0x3cf1(%rip), %rdi      # 0xc790
callq 0x2250
testq %rax, %rax
je 0x8af3
movq %rax, %rbx
movq %rax, %rdi
callq 0x2260
xorl %ebp, %ebp
testq %rax, %rax
je 0x8ae9
leaq 0x3d51(%rip), %r14      # 0xc813
addq $0x13, %rax
movl $0x3, %edx
movq %r14, %rdi
movq %rax, %rsi
callq 0x20e0
cmpl $0x1, %eax
adcl $0x0, %ebp
movq %rbx, %rdi
callq 0x2260
testq %rax, %rax
jne 0x8ac2
movq %rbx, %rdi
callq 0x22a0
jmp 0x8af5
xorl %ebp, %ebp
testl %ebp, %ebp
movl $0x10, %eax
cmovnel %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/func_i2c.cpp
// Function: wh_i2c_scan_adaptor_path(WdtDevice*, int*)
int wh_i2c_scan_adaptor_path(WDT_DEV* pdev, int *adaptor_no)
{
	DIR *d;
	struct dirent *dir = NULL;
	int found = 0;
	int adp_no = 0;
	char dev_path[64];			

	/* i2c device path in sysfs */
	char dev_sysfs_adapter_path[] = "/sys/bus/i2c/devices";	

	if (pdev->pparam->argus & OPTION_INFO)
		printf("Scan I2C device in adapter path...\n");		
	int i2c_max_count = get_i2c_dev_count();
        

	wh_printf("i2c_cnt %d \n", i2c_max_count);
	adp_no = 0;
	while (adp_no < i2c_max_count) {
		sprintf(dev_path, "%s/i2c-%d", dev_sysfs_adapter_path, adp_no);
		d = opendir(dev_path);	
		if (d) {	
			wh_printf("scan %s\n", dev_path);
			while ((dir = readdir(d)) != NULL) {
				if (memcmp(dir->d_name, ACPI_NAME_HID, strlen(ACPI_NAME_HID)) == 0) {
					char* reg_gen_hid  = strdup(&dir->d_name[4]);
					wh_printf("current reg_gen_hid:%s \n", reg_gen_hid);
					pdev->board_info.i2c_address = get_i2c_address_map(reg_gen_hid);
					wh_printf("i2c_address %x\n", pdev->board_info.i2c_address);
					found = 1;
					break;	
				}				
			}
		}
		closedir(d);
	
		if (found)
			break;
		
		adp_no ++;
	}

	*adaptor_no = adp_no;

	return found;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movaps 0x3c91(%rip), %xmm0     # 0xc7b0
movaps %xmm0, 0x10(%rsp)
movabsq $0x73656369766564, %rax # imm = 0x73656369766564
movq %rax, 0x1d(%rsp)
movq 0x280(%rdi), %rax
testb $0x8, (%rax)
je 0x8b4b
leaq 0x3f6e(%rip), %rdi      # 0xcab4
callq 0x2270
callq 0x8a94
movl %eax, %r12d
leaq 0x3cbd(%rip), %rdi      # 0xc817
xorl %ebp, %ebp
movl %eax, %esi
xorl %eax, %eax
callq 0x2506
movl $0x0, %eax
testl %r12d, %r12d
jle 0x8c7c
movq %r14, 0x8(%rsp)
movq %rbx, (%rsp)
leaq 0x30(%rsp), %rbx
leaq 0x10(%rsp), %r14
movabsq $0x544844572d633269, %r13 # imm = 0x544844572D633269
xorl %ebp, %ebp
movq %rbx, %rdi
leaq 0x3c88(%rip), %rsi      # 0xc824
movq %r14, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2080
movq %rbx, %rdi
callq 0x2250
movq %rax, %r15
testq %rax, %rax
je 0x8bde
leaq 0x3c6f(%rip), %rdi      # 0xc82e
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2506
movq %r15, %rdi
callq 0x2260
testq %rax, %rax
je 0x8bde
cmpq %r13, 0x13(%rax)
jne 0x8bc9
jmp 0x8bf7
movq %r15, %rdi
callq 0x22a0
incl %ebp
cmpl %r12d, %ebp
jne 0x8b92
xorl %eax, %eax
movl %r12d, %ebp
jmp 0x8c78
addq $0x17, %rax
movq %rax, %rdi
callq 0x22d0
movq %rax, %rbx
leaq 0x3c2a(%rip), %rdi      # 0xc837
movq %rax, %rsi
xorl %eax, %eax
callq 0x2506
movl $0x8, %r14d
leaq 0x80fc(%rip), %r12      # 0x10d20
movq -0x8(%r14,%r12), %rsi
movl $0x8, %edx
movq %rbx, %rdi
callq 0x20e0
testl %eax, %eax
je 0x8c4b
addq $0x10, %r14
cmpq $0x98, %r14
jne 0x8c24
movb $0x2c, %al
jmp 0x8c4f
movb (%r14,%r12), %al
movq 0x8(%rsp), %rcx
movb %al, 0x1d6(%rcx)
movzbl %al, %esi
leaq 0x3274(%rip), %rdi      # 0xbed8
xorl %eax, %eax
callq 0x2506
movq %r15, %rdi
callq 0x22a0
movl $0x1, %eax
movq (%rsp), %rbx
movl %ebp, (%rbx)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/func_i2c.cpp
// Function: wh_i2c_scan_hid_of_path(WdtDevice*, int*)
int wh_i2c_scan_hid_of_path(WDT_DEV* pdev, int *adaptor_no)
{
        DIR     *d;
        struct dirent *dir = NULL;
        int found = 0;
        int dev_addr = 0;

        /* hid over i2c driver path in sysfs */
        char dev_sysfs_hid_path[] = "/sys/bus/i2c/drivers/i2c_hid_of";

        d = opendir(dev_sysfs_hid_path);
        if (d) {
                if (pdev->pparam->argus & OPTION_INFO)
                        printf("Scan I2C device in hid of path...\n");

                while ((dir = readdir(d)) != NULL) {
                        sscanf(dir->d_name, "%d-%x", adaptor_no, &dev_addr);
                        if (dev_addr == DEFAULT_I2C_ADDR) {
                                found = 1;
				pdev->board_info.i2c_address = DEFAULT_I2C_ADDR;
                                break;
                        }
                }
                closedir(d);
        }

        return found;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
movl $0x0, 0x4(%rsp)
leaq 0x3b23(%rip), %rdi      # 0xc7d0
callq 0x2250
testq %rax, %rax
je 0x8d22
movq %rax, %rbx
movq 0x280(%r14), %rax
testb $0x8, (%rax)
je 0x8cd2
leaq 0x3e0a(%rip), %rdi      # 0xcad7
callq 0x2270
leaq 0x3b34(%rip), %r12      # 0xc80d
xorl %ebp, %ebp
leaq 0x4(%rsp), %r13
movq %rbx, %rdi
callq 0x2260
testq %rax, %rax
je 0x8d18
addq $0x13, %rax
movq %rax, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x2190
cmpl $0x2c, 0x4(%rsp)
jne 0x8ce0
movb $0x2c, 0x1d6(%r14)
movl $0x1, %ebp
movq %rbx, %rdi
callq 0x22a0
jmp 0x8d24
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/func_i2c.cpp
// Function: wh_i2c_scan_hid_path(WdtDevice*, int*)
int wh_i2c_scan_hid_path(WDT_DEV* pdev, int *adaptor_no)
{
	DIR *d;
	struct dirent *dir = NULL;
	int found = 0;
	int dev_addr = 0;

	/* hid over i2c driver path in sysfs */
	char dev_sysfs_hid_path[] = "/sys/bus/i2c/drivers/i2c_hid";	

	d = opendir(dev_sysfs_hid_path);	
	if (d) {
		if (pdev->pparam->argus & OPTION_INFO)
			printf("Scan I2C device in hid path...\n");
		
		while ((dir = readdir(d)) != NULL) {
			sscanf(dir->d_name, "%d-%x", adaptor_no, &dev_addr);
			if (dev_addr == DEFAULT_I2C_ADDR) {
				found = 1;
				pdev->board_info.i2c_address = DEFAULT_I2C_ADDR;
				break;	
			}
		}
		closedir(d);
	}		

	return found;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
movl $0x0, 0x4(%rsp)
leaq 0x3a9b(%rip), %rdi      # 0xc7f0
callq 0x2250
testq %rax, %rax
je 0x8dca
movq %rax, %rbx
movq 0x280(%r14), %rax
testb $0x8, (%rax)
je 0x8d7a
leaq 0x3d84(%rip), %rdi      # 0xcaf9
callq 0x2270
leaq 0x3a8c(%rip), %r12      # 0xc80d
xorl %ebp, %ebp
leaq 0x4(%rsp), %r13
movq %rbx, %rdi
callq 0x2260
testq %rax, %rax
je 0x8dc0
addq $0x13, %rax
movq %rax, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x2190
cmpl $0x2c, 0x4(%rsp)
jne 0x8d88
movb $0x2c, 0x1d6(%r14)
movl $0x1, %ebp
movq %rbx, %rdi
callq 0x22a0
jmp 0x8dcc
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/func_i2c.cpp
// Function: wh_i2c_scan_device(WdtDevice*)
int wh_i2c_scan_device(WDT_DEV* pdev)
{
	int found = 0;
	int adaptor_no = -1;
	long file_no = 0;

	if (!pdev)
		return 0;

	strcpy(g_dev_path, "/dev/i2c-2");

	pdev->dev_state = DS_ENUM;

	found = wh_i2c_scan_adaptor_path(pdev, &adaptor_no);

	if(!found)
		found = wh_i2c_scan_hid_of_path(pdev, &adaptor_no);

	if (!found)
                found = wh_i2c_scan_hid_path(pdev, &adaptor_no);

	if(!found)
	        found = wh_i2c_scan_driver_path(pdev, &adaptor_no);

	if (!found)
		printf("Use the default i2c-dev: %s\n", g_dev_path);
	else
		sprintf(g_dev_path, "/dev/i2c-%d", adaptor_no);

	file_no = open(g_dev_path, O_RDWR);

	if (file_no < 0) {
		printf("Open device failed! file_no %ld \n", file_no);
		perror("Error: ");
		return 0;
	}

	pdev->adaptor_no = adaptor_no;

	close(file_no);

	return 1;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl $0xffffffff, 0x4(%rsp)  # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x8ea1
movq %rdi, %rbx
movabsq $0x6332692f7665642f, %rax # imm = 0x6332692F7665642F
movq %rax, 0x859b(%rip)      # 0x113a0
movl $0x322d63, 0x8598(%rip) # imm = 0x322D63
movl $0x1, 0x278(%rdi)
leaq 0x4(%rsp), %rsi
callq 0x8b04
testl %eax, %eax
jne 0x8e5a
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0x8c8d
testl %eax, %eax
jne 0x8e5a
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0x8d35
testl %eax, %eax
jne 0x8e5a
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0x89e4
testl %eax, %eax
je 0x8eb5
movl 0x4(%rsp), %edx
leaq 0x853b(%rip), %rdi      # 0x113a0
leaq 0x3a0c(%rip), %rsi      # 0xc878
xorl %eax, %eax
callq 0x2080
leaq 0x8526(%rip), %rdi      # 0x113a0
xorl %ebp, %ebp
movl $0x2, %esi
xorl %eax, %eax
callq 0x2140
testl %eax, %eax
js 0x8eac
movl 0x4(%rsp), %ecx
movl %ecx, 0x8(%rbx)
movl %eax, %edi
callq 0x22e0
movl $0x1, %ebp
jmp 0x8ea3
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl %eax, %edi
callq 0x2300
jmp 0x8ea3
leaq 0x399f(%rip), %rdi      # 0xc85b
leaq 0x84dd(%rip), %rsi      # 0x113a0
xorl %eax, %eax
callq 0x2050
jmp 0x8e73
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/func_i2c.cpp
// Function: wh_i2c_open_device(WdtDevice*)
int wh_i2c_open_device(WDT_DEV* pdev)
{
	long		fileno = 0;
	unsigned long	funcs = 0;

	if (!pdev)
		return 0;
	else 
		fileno = open(pdev->dev_path, O_RDWR);


	if (fileno >= 0) {
		if (ioctl(fileno, I2C_FUNCS, &funcs) < 0) {
			wh_printf("Can't get the i2c funcs !\n");
			wh_printf("strerror(errno): %s\n", strerror(errno));
			close(fileno);
			fileno = 0;
		}

		if (!(funcs & I2C_FUNC_I2C)) {
			wh_printf("Oops, no I2C function support !\n");
			close(fileno);
			fileno = 0;
		}

		pdev->dev_handle = (WH_HANDLE) fileno;
	} else
		printf("Can't open device %s\n", pdev->dev_path);

	return (fileno >= 0);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq $0x0, 0x8(%rsp)
testq %rdi, %rdi
je 0x8f4e
movq %rdi, %r14
leaq 0xc(%rdi), %r15
movq %r15, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x2140
movl %eax, %ebx
testl %eax, %eax
js 0x8f52
leaq 0x8(%rsp), %rdx
movl $0x705, %esi            # imm = 0x705
movl %ebx, %edi
xorl %eax, %eax
callq 0x2220
testl %eax, %eax
js 0x8f65
movl %ebx, %r15d
jmp 0x8f9a
xorl %ebx, %ebx
jmp 0x8fc3
leaq 0x39a6(%rip), %rdi      # 0xc8ff
movq %r15, %rsi
xorl %eax, %eax
callq 0x2050
jmp 0x8fbe
leaq 0x3942(%rip), %rdi      # 0xc8ae
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x2506
callq 0x2040
movl (%rax), %edi
callq 0x20a0
leaq 0x3940(%rip), %rdi      # 0xc8c9
movq %rax, %rsi
xorl %eax, %eax
callq 0x2506
movl %ebx, %edi
callq 0x22e0
testb $0x1, 0x8(%rsp)
jne 0x8fba
leaq 0x3936(%rip), %rdi      # 0xc8de
xorl %eax, %eax
callq 0x2506
movl %r15d, %edi
callq 0x22e0
xorl %r15d, %r15d
movq %r15, 0x50(%r14)
notl %ebx
shrl $0x1f, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/func_i2c.cpp
// Function: wh_i2c_get_param_hid(WdtDevice*, BoardInfo*)
int wh_i2c_get_param_hid(WDT_DEV *pdev, BOARD_INFO *pinfo)
{
	BYTE buf[80] = {0};

	buf[0] = HID_DESC_REG_OFFSET;
	buf[1] = 0x00;

	if (!wh_i2c_xfer(pdev, pdev->board_info.i2c_address, buf, 2, (BYTE*) &pinfo->dev_hid_desc, sizeof(I2C_HID_DESC))) {
		wh_printf("failed to get hid desc\n");
		return 0;
	}

	pinfo->vid = pinfo->dev_hid_desc.wVendorID;
	pinfo->pid = pinfo->dev_hid_desc.wProductID;
	pdev->board_info.vid = pinfo->vid;
	pdev->board_info.pid = pinfo->pid;
	pdev->board_info.dev_hid_desc = pinfo->dev_hid_desc;


	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movq %rsp, %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x40(%rdx)
movaps %xmm0, 0x30(%rdx)
movaps %xmm0, 0x20(%rdx)
movaps %xmm0, 0x10(%rdx)
movw $0x20, (%rdx)
movzbl 0x1d6(%rdi), %esi
leaq 0x4f(%r14), %r15
movl $0x2, %ecx
movq %r15, %r8
movl $0x1e, %r9d
callq 0x9096
testl %eax, %eax
je 0x907a
movzwl 0x63(%r14), %eax
movl %eax, 0x4(%r14)
movzwl 0x65(%r14), %ecx
movl %ecx, 0x8(%r14)
movl %eax, 0x18c(%rbx)
movl %ecx, 0x190(%rbx)
movups (%r15), %xmm0
movups 0xe(%r15), %xmm1
movups %xmm0, 0x1d7(%rbx)
movups %xmm1, 0x1e5(%rbx)
movl $0x1, %ebx
jmp 0x908a
leaq 0x3894(%rip), %rdi      # 0xc915
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2506
movl %ebx, %eax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/func_i2c.cpp
// Function: wh_i2c_xfer(WdtDevice*, unsigned char, unsigned char*, unsigned int, unsigned char*, unsigned int)
int wh_i2c_xfer(WDT_DEV *pdev, BYTE slave_addr, BYTE* txbuf, UINT32 tx_len,
		BYTE* rxbuf, UINT32 rx_len)	
{
	int err = 0;
	struct i2c_rdwr_ioctl_data	i2c_rdwr_data;
	struct i2c_msg msgs[2];		
	
	if (!txbuf || !rxbuf || !pdev) {
		wh_printf("%s : pointer is null\n", __func__);
		return 0;
	}
		
	msgs[0].addr	= slave_addr;
	msgs[0].flags	= 0;
	msgs[0].len = tx_len;
	msgs[0].buf = (char*) txbuf;
	
	msgs[1].addr	= slave_addr;
	msgs[1].flags	= I2C_M_RD;
	msgs[1].len = rx_len;
	msgs[1].buf = (char*) rxbuf;
	
	i2c_rdwr_data.msgs = msgs;
	i2c_rdwr_data.nmsgs = 2;

	err = ioctl( (long) pdev->dev_handle, I2C_RDWR, &i2c_rdwr_data);	
	
	if (err < 0) {
		wh_printf("%s: ioctl operation failed: (%d)\n", __func__, err);
		wh_printf("strerror(errno): %s\n", strerror(errno));
		return 0;

	}
	
//	wh_udelay(I2C_OPERATION_DELAY_US);
	return 1;
}

// Assembly:
pushq %rbx
subq $0x30, %rsp
testq %rdi, %rdi
je 0x9140
testq %rdx, %rdx
je 0x9140
testq %r8, %r8
je 0x9140
movzbl %sil, %eax
leaq 0x10(%rsp), %rsi
movw %ax, (%rsi)
movw $0x0, 0x2(%rsi)
movw %cx, 0x4(%rsi)
movq %rdx, 0x8(%rsi)
movw %ax, 0x10(%rsi)
movw $0x1, 0x12(%rsi)
movw %r9w, 0x14(%rsi)
movq %r8, 0x18(%rsi)
movq %rsp, %rdx
movq %rsi, (%rdx)
movl $0x2, 0x8(%rdx)
movl 0x50(%rdi), %edi
movl $0x707, %esi            # imm = 0x707
xorl %eax, %eax
callq 0x2220
movl $0x1, %ebx
testl %eax, %eax
jns 0x9157
leaq 0x38d3(%rip), %rdi      # 0xc9e2
leaq 0x38f8(%rip), %rsi      # 0xca0e
movl %eax, %edx
xorl %eax, %eax
callq 0x2506
callq 0x2040
movl (%rax), %edi
callq 0x20a0
leaq 0x3797(%rip), %rdi      # 0xc8c9
movq %rax, %rsi
xorl %eax, %eax
callq 0x2506
xorl %ebx, %ebx
jmp 0x9157
leaq 0x387b(%rip), %rdi      # 0xc9c2
leaq 0x38c0(%rip), %rsi      # 0xca0e
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2506
movl %ebx, %eax
addq $0x30, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/chenhn123[P]wdt_util_src/wdt_ct/func_i2c.cpp
// Function: wh_i2c_tx(WdtDevice*, unsigned char, unsigned char*, unsigned int)
int wh_i2c_tx(WDT_DEV *pdev, BYTE slave_addr, BYTE* pbuf, UINT32 buf_size)
{
	int err;
	struct i2c_rdwr_ioctl_data	i2c_rdwr_data;
	struct i2c_msg msgs[1];	
	
	if (!pbuf || !pdev) {
		wh_printf("%s : pointer is null\n", __func__);
		return 0;
	}
	
	msgs[0].addr	= slave_addr;
	msgs[0].flags	= 0; //I2C_M_IGNORE_NAK;
	msgs[0].len = buf_size;
	msgs[0].buf = (char*) pbuf;
	
	i2c_rdwr_data.msgs = msgs;
	i2c_rdwr_data.nmsgs = 1;

	err = ioctl( (long) pdev->dev_handle, I2C_RDWR, &i2c_rdwr_data);
	
	if (err < 0) {
		wh_printf("%s: ioctl operation failed: (%d)\n", __func__, err);
		wh_printf("strerror(errno): %s\n", strerror(errno));
		return 0;
	}

	
	//wh_udelay(I2C_OPERATION_DELAY_US);

	return buf_size;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movl %ecx, %ebx
testq %rdx, %rdx
setne %al
testq %rdi, %rdi
setne %cl
testb %al, %cl
je 0x99ad
movzbl %sil, %eax
movq %rsp, %rcx
movw %ax, (%rcx)
movw $0x0, 0x2(%rcx)
movw %bx, 0x4(%rcx)
movq %rdx, 0x8(%rcx)
leaq 0x10(%rsp), %rdx
movq %rcx, (%rdx)
movl $0x1, 0x8(%rdx)
movl 0x50(%rdi), %edi
movl $0x707, %esi            # imm = 0x707
xorl %eax, %eax
callq 0x2220
testl %eax, %eax
jns 0x99c4
leaq 0x3066(%rip), %rdi      # 0xc9e2
leaq 0x3055(%rip), %rsi      # 0xc9d8
movl %eax, %edx
xorl %eax, %eax
callq 0x2506
callq 0x2040
movl (%rax), %edi
callq 0x20a0
leaq 0x2f2a(%rip), %rdi      # 0xc8c9
movq %rax, %rsi
xorl %eax, %eax
callq 0x2506
xorl %ebx, %ebx
jmp 0x99c4
leaq 0x300e(%rip), %rdi      # 0xc9c2
leaq 0x301d(%rip), %rsi      # 0xc9d8
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2506
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
retq