LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3bd2(%rip), %rdi      # 0xb70e
callq 0x2270
pushq $0x18
popq %rdi
leaq 0xd0(%rsp), %rcx
movl %ebp, %esi
movl %r14d, %edx
callq 0x7802
testl %eax, %eax
je 0x7c2b
movups 0x3979(%rip), %xmm0     # 0xb4de
leaq 0x90(%rsp), %rdx
movaps %xmm0, (%rdx)
movabsq $0x2f737265766972, %rax # imm = 0x2F737265766972
movq %rax, 0xe(%rdx)
leaq 0xd0(%rsp), %rdi
movq %rsp, %rsi
callq 0x78ab
testl %eax, %eax
je 0x7c45
leaq 0x38c8(%rip), %rsi      # 0xb465
leaq 0x396c(%rip), %rcx      # 0xb510
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 0x7a97
testl %eax, %eax
je 0x7c5f
movl $0x12c, %edi            # imm = 0x12C
callq 0x2555
leaq 0x3884(%rip), %rsi      # 0xb465
leaq 0x2507(%rip), %rcx      # 0xa0ef
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 0x7a97
testl %eax, %eax
je 0x7c68
movl $0x12c, %edi            # imm = 0x12C
callq 0x2555
leaq 0x3b06(%rip), %rdi      # 0xb727
callq 0x2270
pushq $0x1
popq %rbx
jmp 0x7c7e
leaq 0x3886(%rip), %rdi      # 0xb4b8
xorl %ebx, %ebx
pushq $0x18
popq %rsi
movl %ebp, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x2050
jmp 0x7c7e
leaq 0x38a8(%rip), %rdi      # 0xb4f4
xorl %ebx, %ebx
leaq 0xd0(%rsp), %rsi
xorl %eax, %eax
callq 0x2050
jmp 0x7c7e
leaq 0x38b1(%rip), %rdi      # 0xb517
jmp 0x7c6f
leaq 0x38cb(%rip), %rdi      # 0xb53a
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_O2/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:
pushq %r15
pushq %r14
pushq %rbx
movl %ecx, %ebx
movl %edi, %eax
movslq %edx, %r14
addq %rsi, %r14
xorl %r15d, %r15d
testl %ecx, %ecx
cmovlel %r15d, %ebx
cmpl %r15d, %ebx
je 0x7dd5
movzwl (%r14,%r15,2), %esi
movzwl %ax, %edi
callq 0x7d3e
incq %r15
jmp 0x7dbe
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x7dfe
movl %ebx, %ecx
shrl %ecx
movzwl %ax, %edi
movq %r14, %rsi
movl %ebp, %edx
callq 0x7da6
testb $0x1, %bl
jne 0x7e08
popq %rbx
popq %r14
popq %rbp
retq
addl %ebp, %ebx
movslq %ebx, %rcx
movzbl -0x1(%r14,%rcx), %esi
movzwl %ax, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x7d3e
// File: /workspace/github_cpp_makefile_star2_O2/chenhn123[P]wdt_util_src/wdt_ct/dev_def.h
// Function: get_i2c_address_map(char const*)
inline BYTE get_i2c_address_map(const char* generic_hid_name){

       I2C_ADDRESS_TABLE address_map[] = {
            { "WDHT0002", DEFAULT_I2C_ADDR },
            { "WDHT1F01", DEFAULT_I2C_ADDR },
            { "WDHT1F02", DEFAULT_I2C_ADDR },
            { "WDHT1F03", DEFAULT_I2C_ADDR },
            { "WDHT1F04", DEFAULT_I2C_ADDR },
            { "WDHT2001", DEFAULT_I2C_ADDR },
            { "WDHT2002", DEFAULT_I2C_ADDR },
            { "WDHT2601", 0x3c },
            { "WDHT2602", 0x3c },
       };
       for(size_t i =0;i< (sizeof (address_map) / sizeof (address_map[0]));i++){
           if(strncmp(generic_hid_name, address_map[i].generic_hid, 8) == 0 ){
               return address_map[i].address;
           }
       }
       return DEFAULT_I2C_ADDR;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %ecx, %ecx
leaq 0x8e5d(%rip), %r15      # 0x10c90
pushq $0x8
popq %r14
leaq 0x10(%rcx), %r12
cmpq $0xa0, %r12
je 0x7e61
movq (%rcx,%r15), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x20e0
movq %r12, %rcx
testl %eax, %eax
jne 0x7e37
movb -0x8(%r12,%r15), %al
jmp 0x7e63
movb $0x2c, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
andl $0x0, 0x4(%rsp)
leaq 0x38d3(%rip), %rdi      # 0xb760
callq 0x2250
testq %rax, %rax
je 0x7f08
movq %rax, %rbx
movq 0x280(%r14), %rax
testb $0x8, (%rax)
je 0x7eb2
leaq 0x3be1(%rip), %rdi      # 0xba8e
callq 0x2270
leaq 0x3954(%rip), %r12      # 0xb80d
xorl %ebp, %ebp
leaq 0x4(%rsp), %r13
movq %rbx, %rdi
callq 0x2260
testq %rax, %rax
je 0x7efe
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 0x7ec0
movb $0x2c, 0x1d6(%r14)
movl $0x1, 0x4(%r14)
pushq $0x1
popq %rbp
movq %rbx, %rdi
callq 0x22a0
jmp 0x7f0a
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_O2/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 0x386a(%rip), %rdi      # 0xb790
callq 0x2250
testq %rax, %rax
je 0x7f77
movq %rax, %r14
xorl %ebx, %ebx
pushq $0x63
popq %rbp
movq %r14, %rdi
callq 0x2260
testq %rax, %rax
je 0x7f6b
movzbl 0x13(%rax), %ecx
subl $0x69, %ecx
jne 0x7f61
movzbl 0x14(%rax), %ecx
subl $0x32, %ecx
jne 0x7f61
movzbl 0x15(%rax), %eax
movl %ebp, %ecx
subl %eax, %ecx
jmp 0x7f63
negl %ecx
cmpl $0x1, %ecx
adcl $0x0, %ebx
jmp 0x7f38
movq %r14, %rdi
callq 0x22a0
testl %ebx, %ebx
jne 0x7f7a
pushq $0x10
popq %rbx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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, 0x8(%rsp)
movaps 0x3815(%rip), %xmm0     # 0xb7b0
movaps %xmm0, 0x10(%rsp)
movabsq $0x73656369766564, %rax # imm = 0x73656369766564
movq %rax, 0x1d(%rsp)
movq %rdi, (%rsp)
movq 0x280(%rdi), %rax
testb $0x8, (%rax)
je 0x7fcb
leaq 0x3aea(%rip), %rdi      # 0xbab0
callq 0x2270
callq 0x7f1b
movl %eax, %r12d
leaq 0x3839(%rip), %rdi      # 0xb813
xorl %r15d, %r15d
movl %eax, %esi
xorl %eax, %eax
callq 0x24bf
testl %r12d, %r12d
cmovlel %r15d, %r12d
leaq 0x30(%rsp), %r14
movabsq $0x544844572d633269, %rbx # imm = 0x544844572D633269
xorl %ebp, %ebp
cmpl %r12d, %ebp
je 0x80c9
movq %r14, %rdi
leaq 0x380f(%rip), %rsi      # 0xb820
leaq 0x10(%rsp), %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2080
movq %r14, %rdi
callq 0x2250
movq %rax, %r13
testq %rax, %rax
je 0x8055
leaq 0x37f4(%rip), %rdi      # 0xb82a
movq %r14, %rsi
xorl %eax, %eax
callq 0x24bf
movq %r13, %rdi
callq 0x2260
testq %rax, %rax
je 0x8055
cmpq %rbx, 0x13(%rax)
jne 0x8040
jmp 0x8061
movq %r13, %rdi
callq 0x22a0
incl %ebp
jmp 0x7ffe
addq $0x17, %rax
movq %rax, %rdi
callq 0x22d0
movq %rax, %rbx
leaq 0x37bc(%rip), %rdi      # 0xb833
movq %rax, %rsi
xorl %eax, %eax
callq 0x24bf
movq %rbx, %rdi
callq 0x7e1f
movq (%rsp), %rcx
movb %al, 0x1d6(%rcx)
movzbl %al, %esi
leaq 0x2e3b(%rip), %rdi      # 0xaed8
xorl %eax, %eax
callq 0x24bf
movq %r13, %rdi
callq 0x22a0
pushq $0x1
popq %r15
movq 0x8(%rsp), %rax
movl %ebp, (%rax)
movl %r15d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r12d, %ebp
jmp 0x80b0
// File: /workspace/github_cpp_makefile_star2_O2/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
andl $0x0, 0x4(%rsp)
leaq 0x36e5(%rip), %rdi      # 0xb7d0
callq 0x2250
testq %rax, %rax
je 0x815e
movq %rax, %rbx
movq 0x280(%r14), %rax
testb $0x8, (%rax)
je 0x8110
leaq 0x39c8(%rip), %rdi      # 0xbad3
callq 0x2270
leaq 0x36f6(%rip), %r12      # 0xb80d
xorl %ebp, %ebp
leaq 0x4(%rsp), %r13
movq %rbx, %rdi
callq 0x2260
testq %rax, %rax
je 0x8154
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 0x811e
movb $0x2c, 0x1d6(%r14)
pushq $0x1
popq %rbp
movq %rbx, %rdi
callq 0x22a0
jmp 0x8160
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_O2/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
andl $0x0, 0x4(%rsp)
leaq 0x3662(%rip), %rdi      # 0xb7f0
callq 0x2250
testq %rax, %rax
je 0x8201
movq %rax, %rbx
movq 0x280(%r14), %rax
testb $0x8, (%rax)
je 0x81b3
leaq 0x3947(%rip), %rdi      # 0xbaf5
callq 0x2270
leaq 0x3653(%rip), %r12      # 0xb80d
xorl %ebp, %ebp
leaq 0x4(%rsp), %r13
movq %rbx, %rdi
callq 0x2260
testq %rax, %rax
je 0x81f7
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 0x81c1
movb $0x2c, 0x1d6(%r14)
pushq $0x1
popq %rbp
movq %rbx, %rdi
callq 0x22a0
jmp 0x8203
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_O2/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
orl $-0x1, 0x4(%rsp)
testq %rdi, %rdi
je 0x82d1
movq %rdi, %rbx
movabsq $0x6332692f7665642f, %rax # imm = 0x6332692F7665642F
movq %rax, 0x9167(%rip)      # 0x113a0
movl $0x322d63, 0x9164(%rip) # imm = 0x322D63
movl $0x1, 0x278(%rdi)
leaq 0x4(%rsp), %rsi
callq 0x7f81
testl %eax, %eax
jne 0x828e
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0x80ce
testl %eax, %eax
jne 0x828e
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0x8171
testl %eax, %eax
jne 0x828e
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0x7e70
testl %eax, %eax
je 0x82fb
movl 0x4(%rsp), %edx
leaq 0x9107(%rip), %rdi      # 0x113a0
leaq 0x35d4(%rip), %rsi      # 0xb874
xorl %eax, %eax
callq 0x2080
leaq 0x90f2(%rip), %rdi      # 0x113a0
xorl %ebp, %ebp
pushq $0x2
popq %rsi
xorl %eax, %eax
callq 0x2140
testl %eax, %eax
js 0x82dc
movl 0x4(%rsp), %ecx
movl %ecx, 0x8(%rbx)
movl %eax, %edi
callq 0x22e0
pushq $0x1
popq %rbp
jmp 0x82d3
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movslq %eax, %rsi
leaq 0x359a(%rip), %rdi      # 0xb880
xorl %eax, %eax
callq 0x2050
leaq 0x35ae(%rip), %rdi      # 0xb8a2
callq 0x2160
jmp 0x82d3
leaq 0x3555(%rip), %rdi      # 0xb857
leaq 0x9097(%rip), %rsi      # 0x113a0
xorl %eax, %eax
callq 0x2050
jmp 0x82a7
// File: /workspace/github_cpp_makefile_star2_O2/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
andq $0x0, 0x8(%rsp)
testq %rdi, %rdi
je 0x838d
movq %rdi, %r14
leaq 0xc(%rdi), %r15
pushq $0x2
popq %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x2140
movl %eax, %ebx
testl %eax, %eax
js 0x8391
leaq 0x8(%rsp), %rdx
movl $0x705, %esi            # imm = 0x705
movl %ebx, %edi
xorl %eax, %eax
callq 0x2220
testl %eax, %eax
js 0x83a4
movl %ebx, %r15d
jmp 0x83d9
xorl %ebx, %ebx
jmp 0x8402
leaq 0x3563(%rip), %rdi      # 0xb8fb
movq %r15, %rsi
xorl %eax, %eax
callq 0x2050
jmp 0x83fd
leaq 0x34ff(%rip), %rdi      # 0xb8aa
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x24bf
callq 0x2040
movl (%rax), %edi
callq 0x20a0
leaq 0x34fd(%rip), %rdi      # 0xb8c5
movq %rax, %rsi
xorl %eax, %eax
callq 0x24bf
movl %ebx, %edi
callq 0x22e0
testb $0x1, 0x8(%rsp)
jne 0x83f9
leaq 0x34f3(%rip), %rdi      # 0xb8da
xorl %eax, %eax
callq 0x24bf
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_O2/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)
movb $0x20, (%rdx)
movzbl 0x1d6(%rdi), %esi
leaq 0x4f(%r14), %r15
pushq $0x2
popq %rcx
pushq $0x1e
popq %r9
movq %r15, %r8
callq 0x84cb
testl %eax, %eax
je 0x84af
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)
pushq $0x1
popq %rbx
jmp 0x84bf
leaq 0x345b(%rip), %rdi      # 0xb911
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x24bf
movl %ebx, %eax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x8532
testq %rdx, %rdx
je 0x8532
testq %r8, %r8
je 0x8532
movzbl %sil, %eax
leaq 0x10(%rsp), %rsi
movw %ax, (%rsi)
andw $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
xorl %ebx, %ebx
movl $0x707, %esi            # imm = 0x707
xorl %eax, %eax
callq 0x2220
testl %eax, %eax
js 0x8544
pushq $0x1
popq %rbx
jmp 0x8578
leaq 0x3485(%rip), %rdi      # 0xb9be
leaq 0x34ca(%rip), %rsi      # 0xba0a
xorl %ebx, %ebx
jmp 0x8571
leaq 0x3493(%rip), %rdi      # 0xb9de
leaq 0x34b8(%rip), %rsi      # 0xba0a
movl %eax, %edx
xorl %eax, %eax
callq 0x24bf
callq 0x2040
movl (%rax), %edi
callq 0x20a0
leaq 0x3357(%rip), %rdi      # 0xb8c5
movq %rax, %rsi
xorl %eax, %eax
callq 0x24bf
movl %ebx, %eax
addq $0x30, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x8dab
movzbl %sil, %eax
movq %rsp, %rcx
movw %ax, (%rcx)
andw $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 0x8dc2
leaq 0x2c64(%rip), %rdi      # 0xb9de
leaq 0x2c53(%rip), %rsi      # 0xb9d4
movl %eax, %edx
xorl %eax, %eax
callq 0x24bf
callq 0x2040
movl (%rax), %edi
callq 0x20a0
leaq 0x2b28(%rip), %rdi      # 0xb8c5
movq %rax, %rsi
xorl %eax, %eax
callq 0x24bf
xorl %ebx, %ebx
jmp 0x8dc2
leaq 0x2c0c(%rip), %rdi      # 0xb9be
leaq 0x2c1b(%rip), %rsi      # 0xb9d4
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x24bf
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/chenhn123[P]wdt_util_src/wdt_ct/wif2_handler.cpp
// Function: get_wif2(char*, WifFile2*)
int get_wif2(char *path, WIF_FILE2 *out_pcur_wif)
{
	FILE *pfile = NULL;
	int ret = 1;

	pfile = fopen(path, "rb");
	if (!pfile){
		printf("Failed to read file: %s\n", path);
		return 0;
	}

	/* set file ptr to the end */
	fseek(pfile, 0, SEEK_END);
	out_pcur_wif->data_len = ftell(pfile);

	/* set the file ptr the beginning */
	rewind(pfile);
	UINT32 pdataSize = out_pcur_wif->data_len;

	out_pcur_wif->pdata = (BYTE *)malloc(pdataSize);

	if (!out_pcur_wif->pdata) {
		ret = 0;
		goto finish;
	}

	if (fread(out_pcur_wif->pdata, 1, out_pcur_wif->data_len, pfile) == out_pcur_wif->data_len) {
		ret = process_wif2(out_pcur_wif);
		if (ret == 1) {
			ret = 1;
			goto finish;
		} else {
			ret = 0;
			goto finish;
		}
	} else {
		ret = 0;
		goto finish;
	}

finish:

	fclose(pfile);

	return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r12
leaq 0x24ea(%rip), %rsi      # 0xb55b
callq 0x21d0
testq %rax, %rax
je 0x90e3
movq %rax, %r14
xorl %ebx, %ebx
pushq $0x2
popq %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x21c0
movq %r14, %rdi
callq 0x2030
movl %eax, 0x8(%r15)
movq %r14, %rdi
callq 0x2070
movl 0x8(%r15), %r12d
movq %r12, %rdi
callq 0x21f0
movq %rax, (%r15)
testq %rax, %rax
je 0x90d9
pushq $0x1
popq %rsi
movq %rax, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0x2240
movl 0x8(%r15), %ecx
cmpq %rcx, %rax
jne 0x90d9
movq %r15, %rdi
callq 0x9020
movl %eax, %ebx
movq %r14, %rdi
callq 0x21a0
jmp 0x90f6
leaq 0x2ab3(%rip), %rdi      # 0xbb9d
xorl %ebx, %ebx
movq %r12, %rsi
xorl %eax, %eax
callq 0x2050
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/chenhn123[P]wdt_util_src/wdt_ct/wif2_handler.cpp
// Function: append_WIF2_flash_node(WIF2FlashNode**, WIF2FlashSpace)
int append_WIF2_flash_node(struct WIF2FlashNode **head_ref, WIF2_Flash_Space new_data)
{
	/* 1. allocate node */
	struct WIF2FlashNode *new_node = (struct WIF2FlashNode *)malloc(sizeof(struct WIF2FlashNode));
	if (!new_node)
		return 0;

	struct WIF2FlashNode *last = *head_ref; /* used in step 5*/

	/* 2. put in the data  */
	new_node->Space = new_data;

	/* 3. This new node is going to be the last node, so make next of
	it as NULL*/
	new_node->Next = NULL;

	/* 4. If the Linked List is empty, then make the new node as head */
	if (*head_ref == NULL) {
		*head_ref = new_node;
		return 0;
	}

	/* 5. Else traverse till the last node */
	while (last->Next != NULL)
		last = last->Next;

	/* 6. Change the next of last node */
	last->Next = new_node;
	return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
pushq $0x10
popq %rdi
callq 0x21f0
testq %rax, %rax
je 0x9307
movq (%rbx), %rcx
movq %r14, (%rax)
andq $0x0, 0x8(%rax)
testq %rcx, %rcx
je 0x930b
movq %rcx, %rbx
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
jne 0x92f2
addq $0x8, %rbx
pushq $0x1
popq %rcx
jmp 0x930d
xorl %ecx, %ecx
jmp 0x9310
xorl %ecx, %ecx
movq %rax, (%rbx)
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/chenhn123[P]wdt_util_src/wdt_ct/wif2_handler.cpp
// Function: free_WIF2_flash_node(WIF2FlashNode*)
void free_WIF2_flash_node(WIF2FlashNode *pHead)
{
	WIF2FlashNode *pNode = pHead, *pNext;

	while (NULL != pNode) {
		pNext = pNode->Next;
		free(pNode);
		pNode = pNext;
	}
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x932e
movq 0x8(%rdi), %rbx
callq 0x21e0
movq %rbx, %rdi
jmp 0x931b
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/chenhn123[P]wdt_util_src/wdt_ct/wif2_handler.cpp
// Function: do_update_fw_by_wif2_flow(WdtDevice*, WifFile2*)
int do_update_fw_by_wif2_flow(WDT_DEV *pdev, WIF_FILE2 *pcur_wif)
{
	if (!do_update_fw_by_wif2_chunk_fera(pdev, pcur_wif, FOURCC_ID_FERA))
		return 0;

	if (!do_update_fw_by_wif2_chunk_fbin(pdev, pcur_wif, FOURCC_ID_FBIN))
		return 0;

	pdev->funcs_device_private.p_wh_send_commands(pdev, WH_CMD_RESET, 0);
	printf("Reset device ... \n");
	wh_sleep(2000);

	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %r14
movl $0x41524546, %edx       # imm = 0x41524546
callq 0x951a
xorl %ebx, %ebx
testl %eax, %eax
je 0x9680
movq %r14, %rdi
movq %r15, %rsi
movl $0x4e494246, %edx       # imm = 0x4E494246
callq 0x9115
testl %eax, %eax
je 0x9680
pushq $0x1
popq %rbx
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq *0x2d8(%r14)
leaq 0x2041(%rip), %rdi      # 0xb6b2
callq 0x2270
movl $0x7d0, %edi            # imm = 0x7D0
callq 0x2555
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/chenhn123[P]wdt_util_src/wdt_ct/wif2_handler.cpp
// Function: do_show_wif2_info_chunk(WifFile2*)
int do_show_wif2_info_chunk(WIF_FILE2 *pcur_wif)
{
	if (!pcur_wif)
		return 0;
	WIF2_Info_Chunk *pchunk_info_ex;
	pchunk_info_ex = (WIF2_Info_Chunk *)malloc(sizeof(WIF2_Info_Chunk));
	if (!pchunk_info_ex)
		return 0;
	int ret = 1;
	UINT32 chunk_start_pos = 0 + sizeof(ChunkHeader);
	WIF2_Chunk_Header *pchunk_data = NULL;

	while (chunk_start_pos < pcur_wif->data_len) {
		pchunk_data = (WIF2_Chunk_Header *)&pcur_wif->pdata[chunk_start_pos];
		/* we got it */
		if (pchunk_data->FourCC == FOURCC_ID_INFO) {
			pchunk_info_ex->Header.FourCC = pchunk_data->FourCC;
			pchunk_info_ex->Header.Size = pchunk_data->Size;
			pchunk_info_ex->BinaryData = (BYTE *)malloc(pchunk_data->Size);
			if (!pchunk_info_ex->BinaryData) {
				ret = 0;
				goto finish;
			}

			memcpy((BYTE *)pchunk_info_ex->BinaryData, (BYTE *)&pcur_wif->pdata[chunk_start_pos],
			       pchunk_data->Size);
			for (size_t i = 0; i < pchunk_data->Size; i++)
				printf("%c", (unsigned char)(pchunk_info_ex->BinaryData[i]));
			printf("\n");

			chunk_start_pos = chunk_start_pos + pchunk_data->Size + 8;
			if (pchunk_info_ex->BinaryData)
				free(pchunk_info_ex->BinaryData);

		} else {
			/* 8 is the header size */
			chunk_start_pos = chunk_start_pos + pchunk_data->Size + 8;
		}
	}
finish:
	if (pchunk_info_ex)
		free(pchunk_info_ex);

	return ret;
}

// Assembly:
testq %rdi, %rdi
je 0x9726
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
pushq $0xc
popq %rbx
cmpl 0x8(%r14), %ebx
jae 0x9721
movq (%r14), %r15
movl %ebx, %ebp
movl 0x4(%r15,%rbp), %r12d
cmpl $0x4f464e49, (%r15,%rbp) # imm = 0x4F464E49
jne 0x9719
movq %r12, %rdi
callq 0x21f0
testq %rax, %rax
je 0x9729
movq %rax, %r13
addq %rbp, %r15
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x2150
xorl %ebp, %ebp
movl %r12d, %eax
cmpq %rax, %rbp
jae 0x9705
movzbl (%r13,%rbp), %edi
callq 0x2200
incq %rbp
movl 0x4(%r15), %r12d
jmp 0x96e9
pushq $0xa
popq %rdi
callq 0x2200
movl 0x4(%r15), %r12d
movq %r13, %rdi
callq 0x21e0
addl %r12d, %ebx
addl $0x8, %ebx
jmp 0x96ac
pushq $0x1
popq %rax
jmp 0x972b
xorl %eax, %eax
retq
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chenhn123[P]wdt_util_src/wdt_ct/wif2_handler.cpp
// Function: show_wif2_info(char*)
int show_wif2_info(char *path)
{
	WIF_FILE2 wif2;
	int ret;
	ret = get_wif2(path, &wif2);
	if (ret == 0)
		goto finish;
	ret = do_show_wif2_info_chunk(&wif2);

finish:
	free_wif2(&wif2);
	return ret;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rsp, %rsi
callq 0x905c
testl %eax, %eax
je 0x9757
movq %rsp, %rdi
callq 0x9692
movl %eax, %ebx
jmp 0x9759
xorl %ebx, %ebx
movq %rsp, %rdi
callq 0x9047
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/chenhn123[P]wdt_util_src/wdt_ct/wif2_handler.cpp
// Function: update_fw_by_wif2(WdtDevice*, char*)
int update_fw_by_wif2(WDT_DEV *pdev, char *path)
{
	WIF_FILE2 wif2;
	int ret;
	ret = get_wif2(path, &wif2);
	if (ret == 0) {
		goto finish;
	}
	ret = do_update_fw_by_wif2_flow(pdev, &wif2);

finish:
	free_wif2(&wif2);
	printf("Operation done!\n");

	return ret;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rax
movq %rdi, %rbx
movq %rsp, %rsi
movq %rax, %rdi
callq 0x905c
testl %eax, %eax
je 0x9792
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x962a
movl %eax, %ebx
jmp 0x9794
xorl %ebx, %ebx
movq %rsp, %rdi
callq 0x9047
leaq 0x247a(%rip), %rdi      # 0xbc1d
callq 0x2270
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/chenhn123[P]wdt_util_src/wdt_ct/wif2_handler.cpp
// Function: check_fw_by_wif2(WdtDevice*, char*)
int check_fw_by_wif2(WDT_DEV *pdev, char *path)
{
	WIF_FILE2 wif2;
	int ret;
	ret = get_wif2(path, &wif2);
	if (ret == 0) {
		goto finish;
	}
	ret = do_check_fw_by_wif2_flow(pdev, &wif2);

finish:
	free_wif2(&wif2);

	pdev->funcs_device.p_wh_close_device(pdev);
	printf("Operation done!\n");

	return ret;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x905c
testl %eax, %eax
je 0x97de
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x9688
movl %eax, %ebp
jmp 0x97e0
xorl %ebp, %ebp
leaq 0x8(%rsp), %rdi
callq 0x9047
movq %rbx, %rdi
callq *0x2a0(%rbx)
leaq 0x2423(%rip), %rdi      # 0xbc1d
callq 0x2270
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/wwdatabase[P]database/./smmana/sm.h
// Function: SM_Manager::create_db(char const*)
RC SM_Manager::create_db(const char* dbname)
{
	char* name;
	DB new_db(dbname);
	databases.push_back(new_db);// revise the system file
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x120, %rsp            # imm = 0x120
movq %rdi, %rbx
leaq -0x128(%rbp), %r14
movq %r14, %rdi
callq 0x4a0c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4a40
leaq -0x28(%rbp), %rdi
callq 0x58da
xorl %eax, %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq -0x28(%rbp), %rdi
callq 0x58da
movq %rbx, %rdi
callq 0x2330
// File: /workspace/github_cpp_makefile_star2_O2/wwdatabase[P]database/./smmana/sm.h
// Function: SM_Manager::drop_db(char const*)
RC SM_Manager::drop_db(const char* dbname)// still need to revise the system file
{
	for(vector<DB>::iterator i = databases.begin();i != databases.end();i++)
	{
		if(strcmp(dbname,i->dbname) == 0)
		{
			char command[255] = "rm -r ";
			strcat(command,dbname);
			system(command);
			printf("Deletion finished!\n");
			databases.erase(i);
			return 0;
		}
	}
	printf("database does not exists!\n");
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdi), %r14
movq 0x8(%rdi), %r12
cmpq %r12, %r14
je 0x3470
movq %r15, %rdi
movq %r14, %rsi
callq 0x2260
testl %eax, %eax
je 0x347e
addq $0x118, %r14            # imm = 0x118
jmp 0x3453
leaq 0x4022(%rip), %rdi      # 0x7499
callq 0x22e0
jmp 0x34ce
leaq -0x120(%rbp), %r12
movl $0xff, %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x2100
movl $0x2d206d72, (%r12)     # imm = 0x2D206D72
movw $0x2072, 0x4(%r12)      # imm = 0x2072
movq %r12, %rdi
movq %r15, %rsi
callq 0x2340
movq %r12, %rdi
callq 0x2160
leaq 0x3fc8(%rip), %rdi      # 0x7486
callq 0x22e0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4a7e
xorl %eax, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/wwdatabase[P]database/./smmana/sm.h
// Function: SM_Manager::use_db(char const*)
RC SM_Manager::use_db(const char* dbname)
{
	int i;
	for(i = 0;i < databases.size();i++)
	{
		if(strcmp(dbname,databases[i].dbname) == 0)
		{
			current_db_index = i;
			printf("Current in database %s\n",databases[i].dbname);
			break;
		}
	}
	if(i == databases.size())
	{
		printf("Database %s does not exists!\n",dbname);
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %r15
movq 0x8(%rdi), %rax
subq %r15, %rax
movl $0x118, %ecx            # imm = 0x118
cqto
idivq %rcx
movq %rax, %r12
xorl %r13d, %r13d
cmpq %r13, %r12
je 0x3559
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2260
testl %eax, %eax
je 0x352e
incq %r13
addq $0x118, %r15            # imm = 0x118
jmp 0x350e
movl %r13d, 0x18(%r14)
leaq 0x3d50(%rip), %rdi      # 0x7289
movq %r15, %rsi
xorl %eax, %eax
callq 0x2040
movq 0x8(%r14), %rax
subq (%r14), %rax
movl $0x118, %ecx            # imm = 0x118
cqto
idivq %rcx
cmpq %r13, %rax
jne 0x356a
leaq 0x3d41(%rip), %rdi      # 0x72a1
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2040
xorl %eax, %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/wwdatabase[P]database/./smmana/sm.h
// Function: SM_Manager::show_db(char const*)
RC SM_Manager::show_db(const char* dbname)
{
	cout << "Show database:" << endl;
	if(strcmp(dbname,"*") == 0)
	{
		for(vector<DB>::iterator i = databases.begin();i != databases.end();i++)
		{
				printf("Database name: %s\n",i->dbname);
				printf("Table name:\n");
				for(int j =0 ;j <(i->table).size();j++)
				{
					cout << (i->table)[j].tablename << endl;
				}
		}
	}
	else{
			for(vector<DB>::iterator i = databases.begin();i != databases.end();i++)
			{
				if(strcmp(dbname,i->dbname) == 0)
				{
					printf("Database name: %s\n",i->dbname);
					printf("Table name:\n");
					for(int j =0 ;j <(i->table).size();j++)
					{
						cout << (i->table)[j].tablename << endl;
					}
					break;
				}

			}
		}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, -0x30(%rbp)
movq 0x7a40(%rip), %rdi      # 0xafd8
leaq 0x3d20(%rip), %rsi      # 0x72bf
callq 0x21b0
movq %rax, %rdi
callq 0x20d0
cmpb $0x2a, (%r15)
jne 0x35bd
cmpb $0x0, 0x1(%r15)
je 0x3657
movq -0x30(%rbp), %rax
movq (%rax), %r14
movq 0x8(%rax), %rbx
cmpq %rbx, %r14
je 0x36da
movq %r15, %rdi
movq %r14, %rsi
callq 0x2260
testl %eax, %eax
je 0x35e9
addq $0x118, %r14            # imm = 0x118
jmp 0x35c8
leaq 0x3cde(%rip), %rdi      # 0x72ce
xorl %r15d, %r15d
movq %r14, %rsi
xorl %eax, %eax
callq 0x2040
leaq 0x3eaf(%rip), %rdi      # 0x74b3
callq 0x22e0
movl $0xd0, %r12d
movq 0x79c2(%rip), %rbx      # 0xafd8
xorl %r13d, %r13d
movq 0x100(%r14), %rsi
movq 0x108(%r14), %rax
subq %rsi, %rax
cqto
idivq %r12
cmpq %r13, %rax
jbe 0x36da
addq %r15, %rsi
movq %rbx, %rdi
callq 0x21b0
movq %rax, %rdi
callq 0x20d0
incq %r13
addq $0xd0, %r15
jmp 0x3619
movq -0x30(%rbp), %rax
movq (%rax), %r14
movl $0xd0, %r15d
movq 0x796d(%rip), %r13      # 0xafd8
movq -0x30(%rbp), %rax
cmpq 0x8(%rax), %r14
je 0x36da
leaq 0x3c52(%rip), %rdi      # 0x72ce
movq %r14, %rsi
xorl %eax, %eax
callq 0x2040
leaq 0x3e26(%rip), %rdi      # 0x74b3
callq 0x22e0
xorl %r12d, %r12d
xorl %ebx, %ebx
movq 0x100(%r14), %rsi
movq 0x108(%r14), %rax
subq %rsi, %rax
cqto
idivq %r15
cmpq %rbx, %rax
jbe 0x36d1
addq %r12, %rsi
movq %r13, %rdi
callq 0x21b0
movq %rax, %rdi
callq 0x20d0
incq %rbx
addq $0xd0, %r12
jmp 0x3697
addq $0x118, %r14            # imm = 0x118
jmp 0x366b
xorl %eax, %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/wwdatabase[P]database/./smmana/sm.h
// Function: SM_Manager::drop_table(char const*)
RC SM_Manager::drop_table(const char* tablename)//////////////need more
{
	for(int i = 0;i < databases[current_db_index].table.size();i++)
	{
		if(strcmp(tablename,databases[current_db_index].table[i].tablename) == 0)
		{// delete this table,
			string de_file(databases[i].dbname);
			de_file = de_file + "/"+tablename;
			record_manager->destroyFile(de_file.c_str());
			databases[current_db_index].table.erase(databases[current_db_index].table.begin()+i);
			de_file = de_file+".www";
			record_manager->destroyFile(de_file.c_str());
			return 0;
				//delete corresponding table info
		}

	}
	printf("Table %s does not exists!\n",tablename);
	return 0;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movslq 0x18(%rdi), %rax
movq %rdi, -0x30(%rbp)
movq (%rdi), %r15
imulq $0x118, %rax, %rax      # imm = 0x118
movq 0x100(%r15,%rax), %rsi
movq 0x108(%r15,%rax), %rax
subq %rsi, %rax
movl $0xd0, %r13d
cqto
idivq %r13
movq %rax, %r12
addq $-0x118, %r15           # imm = 0xFEE8
incq %r12
decq %r12
je 0x3d7b
addq $-0xd0, %r13
addq $0x118, %r15            # imm = 0x118
leaq 0xd0(%rsi), %rbx
movq %r14, %rdi
callq 0x2260
movq %rbx, %rsi
testl %eax, %eax
jne 0x3c79
leaq -0x50(%rbp), %r12
leaq -0x70(%rbp), %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x46c6
leaq 0x3621(%rip), %rdx      # 0x72e1
leaq -0x90(%rbp), %rdi
movq %r12, %rsi
callq 0x4b15
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movq %r14, %rdx
callq 0x4aec
leaq -0x50(%rbp), %r14
leaq -0x70(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2220
movq %r15, %rdi
callq 0x20b0
leaq -0x90(%rbp), %rdi
callq 0x20b0
movq (%r14), %rsi
callq 0x3378
movq -0x30(%rbp), %rcx
movslq 0x18(%rcx), %rax
movq (%rcx), %rcx
imulq $0x118, %rax, %rax      # imm = 0x118
leaq (%rcx,%rax), %rdi
addq $0x100, %rdi            # imm = 0x100
movq (%rdi), %rsi
subq %r13, %rsi
callq 0x4be6
leaq 0x35a3(%rip), %rdx      # 0x72e3
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x4b15
leaq -0x50(%rbp), %rbx
leaq -0x70(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2220
movq %r14, %rdi
callq 0x20b0
movq (%rbx), %rsi
callq 0x3378
leaq -0x50(%rbp), %rdi
callq 0x20b0
jmp 0x3d8c
leaq 0x3566(%rip), %rdi      # 0x72e8
movq %r14, %rsi
xorl %eax, %eax
callq 0x2040
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3db4
jmp 0x3db4
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x20b0
jmp 0x3db7
jmp 0x3db4
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x2330
// File: /workspace/github_cpp_makefile_star2_O2/statgen[P]statgen/lib/tclap-1.2.0/examples/test2.cpp
// Function: main
int main(int argc, char** argv)
{

	parseOptions(argc,argv);

	cout << "for float we got : " << _floatTest << endl
		 << "for int we got : " << _intTest<< endl
		 << "for string we got : " << _stringTest<< endl
		 << "for ulabeled we got : " << _utest << endl
		 << "for bool A we got : " << _boolTestA << endl
		 << "for bool B we got : " << _boolTestB << endl
		 << "for bool C we got : " << _boolTestC << endl;

}

// Assembly:
pushq %rax
callq 0x4634
movq 0xdaa7(%rip), %rdi      # 0x11fd0
leaq 0x7afe(%rip), %rsi      # 0xc02e
callq 0x41c0
movss 0xdccb(%rip), %xmm0     # 0x12208
movq %rax, %rdi
callq 0x4170
movq %rax, %rdi
callq 0x40e0
leaq 0x7aee(%rip), %rsi      # 0xc042
movq %rax, %rdi
callq 0x41c0
movl 0xdca2(%rip), %esi      # 0x12204
movq %rax, %rdi
callq 0x42f0
movq %rax, %rdi
callq 0x40e0
leaq 0x7adb(%rip), %rsi      # 0xc054
movq %rax, %rdi
callq 0x41c0
leaq 0xdc88(%rip), %rsi      # 0x12210
movq %rax, %rdi
callq 0x41b0
movq %rax, %rdi
callq 0x40e0
leaq 0x7aca(%rip), %rsi      # 0xc069
movq %rax, %rdi
callq 0x41c0
leaq 0xdc82(%rip), %rsi      # 0x12230
movq %rax, %rdi
callq 0x41b0
movq %rax, %rdi
callq 0x40e0
leaq 0x7abb(%rip), %rsi      # 0xc080
movq %rax, %rdi
callq 0x41c0
movzbl 0xdc38(%rip), %esi      # 0x1220c
movq %rax, %rdi
callq 0x42c0
movq %rax, %rdi
callq 0x40e0
leaq 0x7aaa(%rip), %rsi      # 0xc095
movq %rax, %rdi
callq 0x41c0
movzbl 0xdc13(%rip), %esi      # 0x1220d
movq %rax, %rdi
callq 0x42c0
movq %rax, %rdi
callq 0x40e0
leaq 0x7a99(%rip), %rsi      # 0xc0aa
movq %rax, %rdi
callq 0x41c0
movzbl 0xdbee(%rip), %esi      # 0x1220e
movq %rax, %rdi
callq 0x42c0
movq %rax, %rdi
callq 0x40e0
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O2/Blaze2305[P]Compiler-Design-2021-Assignment/main.cpp
// Function: main
int main(int argc, char *argv[]){
	// Check if the file is passed as an argument or not
	// if not then error out
 	if(argc != 2){
		std::cout<<"\nFile Missing , Invalid number of arguments\n";
		return 1;
	}
	std::cout<<"----------------------------------------------------------------------------\n";
	std::cout<<argv[1]<<std::endl;
	std::cout<<"----------------------------------------------------------------------------\n";
	

	// TESTING SCANNER 
	// Scanner scanner = Scanner(argv[1]);
	// while(true){
	// 	TokenRecord val = scanner.getToken();
	// 	std::cout<<val;
	// 	if(val.tokenType==EOT){
	// 		break;
	// 	}
	// }

	Parser parser = Parser(argv[1]);
	try{
		parser.parse();
	}catch(std::runtime_error err){
		std::cout<<"INVALID \n";
		std::cout<<err.what();
		exit(1);
	}
	std::cout<<"VALID CODE\n";
	parser.showSymbolTable();

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xb8, %rsp
cmpl $0x2, %edi
jne 0x5245
movq %rsi, %rbx
movq 0x9e21(%rip), %r14      # 0xefd0
leaq 0x4fad(%rip), %r15      # 0xa163
movq %r14, %rdi
movq %r15, %rsi
callq 0x21d0
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x21d0
movq %rax, %rdi
callq 0x2110
movq %r14, %rdi
movq %r15, %rsi
callq 0x21d0
movq 0x8(%rbx), %rsi
leaq -0x48(%rbp), %rdi
leaq -0x28(%rbp), %rdx
callq 0x530a
leaq -0xd0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x5bd0
leaq -0x48(%rbp), %rdi
callq 0x23b8
leaq -0xd0(%rbp), %rdi
callq 0x5ffa
movq 0x9db3(%rip), %rdi      # 0xefd0
leaq 0x4f06(%rip), %rsi      # 0xa12a
callq 0x21d0
leaq -0xd0(%rbp), %rdi
callq 0x5cf8
leaq -0xd0(%rbp), %rdi
callq 0x5cae
xorl %eax, %eax
jmp 0x525b
movq 0x9d84(%rip), %rdi      # 0xefd0
leaq 0x4ea0(%rip), %rsi      # 0xa0f3
callq 0x21d0
pushq $0x1
popq %rax
addq $0xb8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
cmpl $0x1, %edx
jne 0x52f5
movq %rbx, %rdi
callq 0x2250
leaq -0x28(%rbp), %rdi
movq %rax, %rsi
callq 0x20e0
movq %rbx, %rdi
callq 0x20d0
movq 0x9d38(%rip), %rdi      # 0xefd0
leaq 0x4e81(%rip), %rsi      # 0xa120
callq 0x21d0
leaq -0x28(%rbp), %rdi
callq 0x2290
movq 0x9d1c(%rip), %rdi      # 0xefd0
movq %rax, %rsi
callq 0x21d0
pushq $0x1
popq %rdi
callq 0x2230
movq %rax, %rbx
leaq -0x28(%rbp), %rdi
callq 0x23c0
callq 0x2320
jmp 0x52f5
movq %rax, %rdi
callq 0x5532
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x23b8
jmp 0x5301
movq %rax, %rbx
jmp 0x5301
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x5cae
movq %rbx, %rdi
callq 0x2370
nop
// File: /workspace/github_cpp_makefile_star2_O2/Blaze2305[P]Compiler-Design-2021-Assignment/src/Models/Structs.cpp
// Function: operator<<(std::ostream&, SymTabRow const&)
std::ostream& operator<< (std::ostream& out, const SymTabRow& obj){
	out<<"\n------------------------------------------------------------------------------\n";
	out<<"Symbol Name --> "<<obj.symbolName<<std::endl;
	out<<"Type --> "<<obj.type<<std::endl;
	out<<"Value --> "<<obj.attribute<<std::endl;
	out<<"Line Number --> "<<obj.lineNumber<<std::endl;
	out<<"\n------------------------------------------------------------------------------\n";
	return out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x46ed(%rip), %r14      # 0xa160
movq %r14, %rsi
callq 0x21d0
leaq 0x472f(%rip), %rsi      # 0xa1b1
movq %rbx, %rdi
callq 0x21d0
movq %rax, %rdi
movq %r15, %rsi
callq 0x21c0
movq %rax, %rdi
callq 0x2110
leaq 0x4735(%rip), %rsi      # 0xa1d9
movq %rbx, %rdi
callq 0x21d0
leaq 0x20(%r15), %rsi
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x2110
leaq 0x4723(%rip), %rsi      # 0xa1ea
movq %rbx, %rdi
callq 0x21d0
leaq 0x40(%r15), %rsi
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x2110
leaq 0x46d8(%rip), %rsi      # 0xa1c2
movq %rbx, %rdi
callq 0x21d0
movl 0x60(%r15), %esi
movq %rax, %rdi
callq 0x2360
movq %rax, %rdi
callq 0x2110
movq %rbx, %rdi
movq %r14, %rsi
callq 0x21d0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq