LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/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 0x86e2
cmpl $0x7f, %edi
jg 0x86ff
cmpl $0x10, %edi
je 0x8741
cmpl $0x20, %edi
je 0x8735
cmpl $0x40, %edi
jne 0x874d
movl $0x54535442, %eax       # imm = 0x54535442
retq
cmpl $0x8, %edi
ja 0x874d
movl %edi, %eax
leaq 0x3700(%rip), %rcx      # 0xbdf0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x544d5246, %eax       # imm = 0x544D5246
retq
cmpl $0x80, %edi
je 0x8747
cmpl $0x200, %edi            # imm = 0x200
je 0x873b
cmpl $0x400, %edi            # imm = 0x400
jne 0x874d
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_O3/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 0x88e3
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 0x887f
retq
movl %edi, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x8909
movl %ebx, %ecx
shrl %ecx
movzwl %ax, %edi
movq %r14, %rsi
movl %ebp, %edx
callq 0x8871
testb $0x1, %bl
je 0x895f
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_O3/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 0x3ddc(%rip), %rdi      # 0xc760
callq 0x2250
testq %rax, %rax
je 0x8a01
movq %rax, %rbx
movq 0x280(%r14), %rax
testb $0x8, (%rax)
je 0x89a9
leaq 0x40ea(%rip), %rdi      # 0xca8e
callq 0x2270
leaq 0x3e5d(%rip), %r12      # 0xc80d
xorl %ebp, %ebp
leaq 0x4(%rsp), %r13
movq %rbx, %rdi
callq 0x2260
testq %rax, %rax
je 0x89f7
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 0x89b7
movb $0x2c, 0x1d6(%r14)
movl $0x1, 0x4(%r14)
movl $0x1, %ebp
movq %rbx, %rdi
callq 0x22a0
jmp 0x8a03
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_O3/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 %rbx
pushq %rax
leaq 0x3d72(%rip), %rdi      # 0xc790
callq 0x2250
testq %rax, %rax
je 0x8a84
movq %rax, %rbx
movq %rax, %rdi
callq 0x2260
testq %rax, %rax
je 0x8a7c
xorl %ebp, %ebp
movzbl 0x13(%rax), %ecx
subl $0x69, %ecx
jne 0x8a59
movzbl 0x14(%rax), %ecx
subl $0x32, %ecx
jne 0x8a59
movzbl 0x15(%rax), %eax
movl $0x63, %ecx
subl %eax, %ecx
jmp 0x8a5b
negl %ecx
cmpl $0x1, %ecx
adcl $0x0, %ebp
movq %rbx, %rdi
callq 0x2260
testq %rax, %rax
jne 0x8a3a
movq %rbx, %rdi
callq 0x22a0
testl %ebp, %ebp
jne 0x8a89
jmp 0x8a84
movq %rbx, %rdi
callq 0x22a0
movl $0x10, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x3d03(%rip), %xmm0     # 0xc7b0
movaps %xmm0, 0x10(%rsp)
movabsq $0x73656369766564, %rax # imm = 0x73656369766564
movq %rax, 0x1d(%rsp)
movq 0x280(%rdi), %rax
testb $0x8, (%rax)
je 0x8ad9
leaq 0x3fdc(%rip), %rdi      # 0xcab0
callq 0x2270
callq 0x8a14
movl %eax, %r12d
leaq 0x3d2b(%rip), %rdi      # 0xc813
xorl %ebp, %ebp
movl %eax, %esi
xorl %eax, %eax
callq 0x2506
movl $0x0, %eax
testl %r12d, %r12d
jle 0x8c0a
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 0x3cf6(%rip), %rsi      # 0xc820
movq %r14, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2080
movq %rbx, %rdi
callq 0x2250
movq %rax, %r15
testq %rax, %rax
je 0x8b6c
leaq 0x3cdd(%rip), %rdi      # 0xc82a
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2506
movq %r15, %rdi
callq 0x2260
testq %rax, %rax
je 0x8b6c
cmpq %r13, 0x13(%rax)
jne 0x8b57
jmp 0x8b85
movq %r15, %rdi
callq 0x22a0
incl %ebp
cmpl %r12d, %ebp
jne 0x8b20
xorl %eax, %eax
movl %r12d, %ebp
jmp 0x8c06
addq $0x17, %rax
movq %rax, %rdi
callq 0x22d0
movq %rax, %rbx
leaq 0x3c98(%rip), %rdi      # 0xc833
movq %rax, %rsi
xorl %eax, %eax
callq 0x2506
movl $0x8, %r14d
leaq 0x816e(%rip), %r12      # 0x10d20
movq -0x8(%r14,%r12), %rsi
movl $0x8, %edx
movq %rbx, %rdi
callq 0x20e0
testl %eax, %eax
je 0x8bd9
addq $0x10, %r14
cmpq $0x98, %r14
jne 0x8bb2
movb $0x2c, %al
jmp 0x8bdd
movb (%r14,%r12), %al
movq 0x8(%rsp), %rcx
movb %al, 0x1d6(%rcx)
movzbl %al, %esi
leaq 0x32e6(%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_O3/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 0x3b95(%rip), %rdi      # 0xc7d0
callq 0x2250
testq %rax, %rax
je 0x8cb0
movq %rax, %rbx
movq 0x280(%r14), %rax
testb $0x8, (%rax)
je 0x8c60
leaq 0x3e78(%rip), %rdi      # 0xcad3
callq 0x2270
leaq 0x3ba6(%rip), %r12      # 0xc80d
xorl %ebp, %ebp
leaq 0x4(%rsp), %r13
movq %rbx, %rdi
callq 0x2260
testq %rax, %rax
je 0x8ca6
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 0x8c6e
movb $0x2c, 0x1d6(%r14)
movl $0x1, %ebp
movq %rbx, %rdi
callq 0x22a0
jmp 0x8cb2
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_O3/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 0x3b0d(%rip), %rdi      # 0xc7f0
callq 0x2250
testq %rax, %rax
je 0x8d58
movq %rax, %rbx
movq 0x280(%r14), %rax
testb $0x8, (%rax)
je 0x8d08
leaq 0x3df2(%rip), %rdi      # 0xcaf5
callq 0x2270
leaq 0x3afe(%rip), %r12      # 0xc80d
xorl %ebp, %ebp
leaq 0x4(%rsp), %r13
movq %rbx, %rdi
callq 0x2260
testq %rax, %rax
je 0x8d4e
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 0x8d16
movb $0x2c, 0x1d6(%r14)
movl $0x1, %ebp
movq %rbx, %rdi
callq 0x22a0
jmp 0x8d5a
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_O3/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 0x8e2f
movq %rdi, %rbx
movabsq $0x6332692f7665642f, %rax # imm = 0x6332692F7665642F
movq %rax, 0x860d(%rip)      # 0x113a0
movl $0x322d63, 0x860a(%rip) # imm = 0x322D63
movl $0x1, 0x278(%rdi)
leaq 0x4(%rsp), %rsi
callq 0x8a92
testl %eax, %eax
jne 0x8de8
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0x8c1b
testl %eax, %eax
jne 0x8de8
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0x8cc3
testl %eax, %eax
jne 0x8de8
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0x8964
testl %eax, %eax
je 0x8e43
movl 0x4(%rsp), %edx
leaq 0x85ad(%rip), %rdi      # 0x113a0
leaq 0x3a7a(%rip), %rsi      # 0xc874
xorl %eax, %eax
callq 0x2080
leaq 0x8598(%rip), %rdi      # 0x113a0
xorl %ebp, %ebp
movl $0x2, %esi
xorl %eax, %eax
callq 0x2140
testl %eax, %eax
js 0x8e3a
movl 0x4(%rsp), %ecx
movl %ecx, 0x8(%rbx)
movl %eax, %edi
callq 0x22e0
movl $0x1, %ebp
jmp 0x8e31
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl %eax, %edi
callq 0x2300
jmp 0x8e31
leaq 0x3a0d(%rip), %rdi      # 0xc857
leaq 0x854f(%rip), %rsi      # 0x113a0
xorl %eax, %eax
callq 0x2050
jmp 0x8e01
// File: /workspace/github_cpp_makefile_star2_O3/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 0x8edc
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 0x8ee0
leaq 0x8(%rsp), %rdx
movl $0x705, %esi            # imm = 0x705
movl %ebx, %edi
xorl %eax, %eax
callq 0x2220
testl %eax, %eax
js 0x8ef3
movl %ebx, %r15d
jmp 0x8f28
xorl %ebx, %ebx
jmp 0x8f51
leaq 0x3a14(%rip), %rdi      # 0xc8fb
movq %r15, %rsi
xorl %eax, %eax
callq 0x2050
jmp 0x8f4c
leaq 0x39b0(%rip), %rdi      # 0xc8aa
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x2506
callq 0x2040
movl (%rax), %edi
callq 0x20a0
leaq 0x39ae(%rip), %rdi      # 0xc8c5
movq %rax, %rsi
xorl %eax, %eax
callq 0x2506
movl %ebx, %edi
callq 0x22e0
testb $0x1, 0x8(%rsp)
jne 0x8f48
leaq 0x39a4(%rip), %rdi      # 0xc8da
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_O3/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
movl $0x2, %ecx
movq %r15, %r8
movl $0x1e, %r9d
callq 0x9022
testl %eax, %eax
je 0x9006
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 0x9016
leaq 0x3904(%rip), %rdi      # 0xc911
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_O3/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 0x90cc
testq %rdx, %rdx
je 0x90cc
testq %r8, %r8
je 0x90cc
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 0x90e3
leaq 0x3943(%rip), %rdi      # 0xc9de
leaq 0x3968(%rip), %rsi      # 0xca0a
movl %eax, %edx
xorl %eax, %eax
callq 0x2506
callq 0x2040
movl (%rax), %edi
callq 0x20a0
leaq 0x3807(%rip), %rdi      # 0xc8c5
movq %rax, %rsi
xorl %eax, %eax
callq 0x2506
xorl %ebx, %ebx
jmp 0x90e3
leaq 0x38eb(%rip), %rdi      # 0xc9be
leaq 0x3930(%rip), %rsi      # 0xca0a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2506
movl %ebx, %eax
addq $0x30, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x994b
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 0x9962
leaq 0x30c4(%rip), %rdi      # 0xc9de
leaq 0x30b3(%rip), %rsi      # 0xc9d4
movl %eax, %edx
xorl %eax, %eax
callq 0x2506
callq 0x2040
movl (%rax), %edi
callq 0x20a0
leaq 0x2f88(%rip), %rdi      # 0xc8c5
movq %rax, %rsi
xorl %eax, %eax
callq 0x2506
xorl %ebx, %ebx
jmp 0x9962
leaq 0x306c(%rip), %rdi      # 0xc9be
leaq 0x307b(%rip), %rsi      # 0xc9d4
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2506
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x2934(%rip), %rsi      # 0xc55b
callq 0x21d0
testq %rax, %rax
je 0x9cba
movq %rax, %rbx
xorl %r14d, %r14d
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x21c0
movq %rbx, %rdi
callq 0x2030
movl %eax, 0x8(%r15)
movq %rbx, %rdi
callq 0x2070
movl 0x8(%r15), %r12d
movq %r12, %rdi
callq 0x21f0
movq %rax, (%r15)
testq %rax, %rax
je 0x9cb0
movl $0x1, %esi
movq %rax, %rdi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2240
movl 0x8(%r15), %ecx
cmpq %rcx, %rax
jne 0x9cb0
movq (%r15), %rax
cmpl $0x46464952, (%rax)     # imm = 0x46464952
jne 0x9cad
cmpl $0x32464957, 0x8(%rax)  # imm = 0x32464957
jne 0x9cad
movl $0x1, %r14d
cmpl 0x4(%rax), %ecx
je 0x9cb0
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x21a0
jmp 0x9cce
leaq 0x2edc(%rip), %rdi      # 0xcb9d
xorl %r14d, %r14d
movq %r12, %rsi
xorl %eax, %eax
callq 0x2050
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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
movl $0x10, %edi
callq 0x21f0
testq %rax, %rax
je 0x9f01
movq (%rbx), %rcx
movq %r14, (%rax)
movq $0x0, 0x8(%rax)
testq %rcx, %rcx
je 0x9f05
movq %rcx, %rbx
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
jne 0x9eea
addq $0x8, %rbx
movl $0x1, %ecx
jmp 0x9f07
xorl %ecx, %ecx
jmp 0x9f0a
xorl %ecx, %ecx
movq %rax, (%rbx)
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/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:
testq %rdi, %rdi
je 0x9f2c
pushq %rbx
movq 0x8(%rdi), %rbx
callq 0x21e0
movq %rbx, %rdi
testq %rbx, %rbx
jne 0x9f1a
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0xa143
xorl %ebx, %ebx
testl %eax, %eax
je 0xa2b8
movq %r14, %rdi
movq %r15, %rsi
movl $0x4e494246, %edx       # imm = 0x4E494246
callq 0x9cee
testl %eax, %eax
je 0xa2b8
movl $0x1, %ebx
movq %r14, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq *0x2d8(%r14)
leaq 0x2409(%rip), %rdi      # 0xc6b2
callq 0x2270
movl $0x7d0, %edi            # imm = 0x7D0
callq 0x259c
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0xa374
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movl 0x8(%rdi), %ecx
movl $0x1, %eax
cmpl $0xd, %ecx
jb 0xa379
movl $0xc, %ebp
movq (%r14), %r15
movl %ebp, %ebx
movl 0x4(%r15,%rbx), %r13d
cmpl $0x4f464e49, (%r15,%rbx) # imm = 0x4F464E49
jne 0xa363
movq %r13, %rdi
callq 0x21f0
testq %rax, %rax
je 0xa377
movq %rax, %r12
addq %rbx, %r15
movq %rax, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x2150
testl %r13d, %r13d
je 0xa349
xorl %ebx, %ebx
movzbl (%r12,%rbx), %edi
callq 0x2200
incq %rbx
movl 0x4(%r15), %eax
cmpq %rax, %rbx
jb 0xa333
movl $0xa, %edi
callq 0x2200
movl 0x4(%r15), %r13d
movq %r12, %rdi
callq 0x21e0
movl 0x8(%r14), %ecx
addl %r13d, %ebp
addl $0x8, %ebp
cmpl %ecx, %ebp
jb 0xa2f7
movl $0x1, %eax
jmp 0xa379
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_O3/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 0x9c12
testl %eax, %eax
je 0xa3a5
movq %rsp, %rdi
callq 0xa2ca
movl %eax, %ebx
jmp 0xa3a7
xorl %ebx, %ebx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xa3b5
callq 0x21e0
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x9c12
testl %eax, %eax
je 0xa3e6
movq %rsp, %rsi
movq %rbx, %rdi
callq 0xa25d
movl %eax, %ebx
jmp 0xa3e8
xorl %ebx, %ebx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xa3f6
callq 0x21e0
leaq 0x2820(%rip), %rdi      # 0xcc1d
callq 0x2270
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x9c12
testl %eax, %eax
je 0xa43d
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
movl $0x4d555346, %edx       # imm = 0x4D555346
callq 0x9f2d
movl %eax, %ebp
jmp 0xa43f
xorl %ebp, %ebp
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xa44e
callq 0x21e0
movq %rbx, %rdi
callq *0x2a0(%rbx)
leaq 0x27bf(%rip), %rdi      # 0xcc1d
callq 0x2270
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x120, %rsp            # imm = 0x120
movq %rsi, %r14
movq %rdi, %r15
leaq -0x38(%rbp), %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
leaq -0x138(%rbp), %r12
movq %r12, %rdi
callq 0x21a0
movq %r14, %rdi
movl $0x1c0, %esi            # imm = 0x1C0
callq 0x20d0
movq %r15, %rdi
movq %r12, %rsi
callq 0x59ce
movq %rbx, %rdi
callq 0x6b12
xorl %eax, %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x6b12
movq %r14, %rdi
callq 0x2320
// File: /workspace/github_cpp_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq (%rdi), %r12
movq 0x8(%rdi), %r13
cmpq %r13, %r12
je 0x3b00
movq %rsi, %r15
movq %rdi, %rbx
movq %r12, %r14
negq %r14
movq %r15, %rdi
movq %r12, %rsi
callq 0x2240
testl %eax, %eax
je 0x3b0e
addq $0x118, %r12            # imm = 0x118
addq $-0x118, %r14           # imm = 0xFEE8
cmpq %r13, %r12
jne 0x3ade
leaq 0x5992(%rip), %rdi      # 0x9499
callq 0x22c0
jmp 0x3b61
leaq -0x130(%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 0x2330
movq %r12, %rdi
callq 0x2180
leaq 0x5938(%rip), %rdi      # 0x9486
callq 0x22c0
negq %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7e20
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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), %r15
movq 0x8(%rdi), %rax
movq %rax, %r14
subq %r15, %r14
sarq $0x3, %r14
movabsq $-0x5075075075075075, %rcx # imm = 0xAF8AF8AF8AF8AF8B
imulq %rcx, %r14
cmpq %r15, %rax
je 0x3be0
movq %rdi, -0x30(%rbp)
cmpq $0x1, %r14
movq %r14, %r12
adcq $0x0, %r12
xorl %r13d, %r13d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2240
testl %eax, %eax
je 0x3be5
incq %r13
addq $0x118, %r15            # imm = 0x118
cmpq %r13, %r12
jne 0x3bbd
movq %r12, %r13
jmp 0x3c1a
xorl %r13d, %r13d
jmp 0x3c1a
movq -0x30(%rbp), %r12
movl %r13d, 0x18(%r12)
leaq 0x5694(%rip), %rdi      # 0x9289
movq %r15, %rsi
xorl %eax, %eax
callq 0x2050
movq 0x8(%r12), %r14
subq (%r12), %r14
sarq $0x3, %r14
movabsq $-0x5075075075075075, %rax # imm = 0xAF8AF8AF8AF8AF8B
imulq %rax, %r14
cmpq %r13, %r14
jne 0x3c30
leaq 0x567b(%rip), %rdi      # 0x92a1
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2050
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_O3/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 %rbx
callq 0x4818
movq 0x119f7(%rip), %rbx     # 0x15fd0
leaq 0xba4e(%rip), %rsi      # 0x1002e
movl $0x13, %edx
movq %rbx, %rdi
callq 0x4210
cvtss2sd 0x11c13(%rip), %xmm0    # 0x16208
movq %rbx, %rdi
callq 0x42b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x41b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4150
movq %rax, %rbx
leaq 0xba11(%rip), %rsi      # 0x10042
movl $0x11, %edx
movq %rax, %rdi
callq 0x4210
movl 0x11bc0(%rip), %esi     # 0x16204
movq %rbx, %rdi
callq 0x4310
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x41b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4150
movq %rax, %rbx
leaq 0xb9d4(%rip), %rsi      # 0x10054
movl $0x14, %edx
movq %rax, %rdi
callq 0x4210
movq 0x11b7c(%rip), %rsi     # 0x16210
movq 0x11b7d(%rip), %rdx     # 0x16218
movq %rbx, %rdi
callq 0x4210
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x41b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4150
movq %rax, %rbx
leaq 0xb992(%rip), %rsi      # 0x10069
movl $0x16, %edx
movq %rax, %rdi
callq 0x4210
movq 0x11b45(%rip), %rsi     # 0x16230
movq 0x11b46(%rip), %rdx     # 0x16238
movq %rbx, %rdi
callq 0x4210
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x41b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4150
movq %rax, %rbx
leaq 0xb952(%rip), %rsi      # 0x10080
movl $0x14, %edx
movq %rax, %rdi
callq 0x4210
movzbl 0x11aca(%rip), %esi     # 0x1620c
movq %rbx, %rdi
callq 0x42e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x41b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4150
movq %rax, %rbx
leaq 0xb917(%rip), %rsi      # 0x10095
movl $0x14, %edx
movq %rax, %rdi
callq 0x4210
movzbl 0x11a7b(%rip), %esi     # 0x1620d
movq %rbx, %rdi
callq 0x42e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x41b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4150
movq %rax, %rbx
leaq 0xb8dc(%rip), %rsi      # 0x100aa
movl $0x14, %edx
movq %rax, %rdi
callq 0x4210
movzbl 0x11a2c(%rip), %esi     # 0x1620e
movq %rbx, %rdi
callq 0x42e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x41b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4150
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/Blaze2305[P]Compiler-Design-2021-Assignment/src/Parser/Parser.cpp
// Function: Parser::parse()
void Parser::parse(){
	currentToken = scanner->getToken();
	parseProgram();
	if(currentToken.tokenType != EOT){
		std::ostringstream out ;
		out << "Syntax error on line ";
		out << currentToken.lineNumber;
		out << " Redundant chars at the end";
		throw  std::runtime_error(out.str());
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rdi, %rbx
movq 0x30(%rdi), %rsi
leaq -0x1b0(%rbp), %r14
movq %r14, %rdi
callq 0x9a32
movl (%r14), %eax
movl %eax, (%rbx)
leaq 0x8(%rbx), %rdi
leaq -0x1a8(%rbp), %r14
movq %r14, %rsi
callq 0x2260
movl 0x20(%r14), %eax
movl %eax, 0x28(%rbx)
movq (%r14), %rdi
leaq -0x198(%rbp), %rax
cmpq %rax, %rdi
je 0x715d
movq -0x198(%rbp), %rsi
incq %rsi
callq 0x21e0
movq %rbx, %rdi
callq 0x7262
cmpl $0x8, (%rbx)
jne 0x7178
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq -0x1b0(%rbp), %r14
movq %r14, %rdi
callq 0x2290
leaq 0x5022(%rip), %rsi      # 0xc1b0
movl $0x15, %edx
movq %r14, %rdi
callq 0x2210
movl 0x28(%rbx), %esi
leaq -0x1b0(%rbp), %rdi
callq 0x2380
leaq 0x5070(%rip), %rsi      # 0xc221
leaq -0x1b0(%rbp), %rdi
movl $0x1b, %edx
callq 0x2210
movl $0x10, %edi
callq 0x20f0
movq %rax, %rbx
leaq -0x1a8(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x2310
movb $0x1, %r15b
leaq -0x38(%rbp), %rsi
movq %rbx, %rdi
callq 0x2320
xorl %r15d, %r15d
movq 0x8df8(%rip), %rsi      # 0xfff0
movq 0x8dc1(%rip), %rdx      # 0xffc0
movq %rbx, %rdi
callq 0x2370
movq %rax, %r14
leaq -0x28(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7223
movq -0x28(%rbp), %rsi
incq %rsi
callq 0x21e0
testb %r15b, %r15b
jne 0x722d
jmp 0x723a
movq %rax, %r14
movq %rbx, %rdi
callq 0x2160
jmp 0x723a
movq %rax, %r14
movq 0x8d87(%rip), %rsi      # 0xffc8
leaq -0x1b0(%rbp), %rdi
callq 0x2110
leaq -0x140(%rbp), %rdi
callq 0x20a0
movq %r14, %rdi
callq 0x2390
nop
// File: /workspace/github_cpp_makefile_star2_O3/Blaze2305[P]Compiler-Design-2021-Assignment/src/Parser/Parser.cpp
// Function: Parser::parseProgram()
void Parser::parseProgram(){
	tabNum+=1;
	printParseEnters(tabNum,tabChar,"parseProgram");
	accept(Global);
	if(checkToken(Def)){
		parseDeclList();
	}
	identifierCheckFlag = true;
	parseStmtList();
	accept(End);
	tabNum-=1;
	printParseExits(tabNum,tabChar,"parseProgram");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movl 0x8f8f(%rip), %r14d     # 0x1020c
incl %r14d
movl %r14d, 0x8f85(%rip)     # 0x1020c
movsbl 0x8f79(%rip), %r15d     # 0x10208
leaq -0x58(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x4f9f(%rip), %rsi      # 0xc23d
leaq 0x4fa4(%rip), %rdx      # 0xc249
leaq -0x68(%rbp), %r12
movq %r12, %rdi
callq 0x644a
movl %r14d, %edi
movl %r15d, %esi
movq %r12, %rdx
callq 0xb2e1
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0x72d4
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x21e0
movq %rbx, %rdi
movl $0xa, %esi
callq 0x6d1c
cmpl $0xc, (%rbx)
jne 0x72ee
movq %rbx, %rdi
callq 0x739a
movb $0x1, 0x6c(%rbx)
movq %rbx, %rdi
callq 0x74b6
movq %rbx, %rdi
movl $0xb, %esi
callq 0x6d1c
movl 0x8eff(%rip), %ebx      # 0x1020c
decl %ebx
movl %ebx, 0x8ef7(%rip)      # 0x1020c
movsbl 0x8eeb(%rip), %r14d     # 0x10208
leaq -0x38(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x4f11(%rip), %rsi      # 0xc23d
leaq 0x4f16(%rip), %rdx      # 0xc249
leaq -0x48(%rbp), %r15
movq %r15, %rdi
callq 0x644a
movl %ebx, %edi
movl %r14d, %esi
movq %r15, %rdx
callq 0xb2e7
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x7361
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21e0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x48(%rbp), %rdi
jmp 0x7380
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0x7391
movq (%r13), %rsi
incq %rsi
callq 0x21e0
movq %rbx, %rdi
callq 0x2390
nop
// File: /workspace/github_cpp_makefile_star2_O3/Blaze2305[P]Compiler-Design-2021-Assignment/src/Parser/Parser.cpp
// Function: Parser::parseDeclList()
void Parser::parseDeclList(){
	tabNum+=1;
	printParseEnters(tabNum,tabChar,"parseDeclList");
	parseDecl();
	while(checkToken(Def)){
		parseDeclList();
	}
	tabNum-=1;
	printParseExits(tabNum,tabChar,"parseDeclList");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movl 0x8e57(%rip), %r14d     # 0x1020c
incl %r14d
movl %r14d, 0x8e4d(%rip)     # 0x1020c
movsbl 0x8e41(%rip), %r15d     # 0x10208
leaq -0x58(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x4e74(%rip), %rsi      # 0xc24a
leaq 0x4e7a(%rip), %rdx      # 0xc257
leaq -0x68(%rbp), %r12
movq %r12, %rdi
callq 0x644a
movl %r14d, %edi
movl %r15d, %esi
movq %r12, %rdx
callq 0xb2e1
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0x740c
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x21e0
movq %rbx, %rdi
callq 0x75d8
jmp 0x741e
movq %rbx, %rdi
callq 0x739a
cmpl $0xc, (%rbx)
je 0x7416
movl 0x8de3(%rip), %ebx      # 0x1020c
decl %ebx
movl %ebx, 0x8ddb(%rip)      # 0x1020c
movsbl 0x8dcf(%rip), %r14d     # 0x10208
leaq -0x38(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x4e02(%rip), %rsi      # 0xc24a
leaq 0x4e08(%rip), %rdx      # 0xc257
leaq -0x48(%rbp), %r15
movq %r15, %rdi
callq 0x644a
movl %ebx, %edi
movl %r14d, %esi
movq %r15, %rdx
callq 0xb2e7
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x747d
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21e0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x48(%rbp), %rdi
jmp 0x749c
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0x74ad
movq (%r13), %rsi
incq %rsi
callq 0x21e0
movq %rbx, %rdi
callq 0x2390
nop
// File: /workspace/github_cpp_makefile_star2_O3/Blaze2305[P]Compiler-Design-2021-Assignment/src/Parser/Parser.cpp
// Function: Parser::parseStmtList()
void Parser::parseStmtList(){
	tabNum+=1;
	printParseEnters(tabNum,tabChar,"parseStmtList");
	parseStmt();
	accept(SemiColon);
	parseStmtListA();
	tabNum-=1;
	printParseExits(tabNum,tabChar,"parseStmtList");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movl 0x8d3b(%rip), %r14d     # 0x1020c
incl %r14d
movl %r14d, 0x8d31(%rip)     # 0x1020c
movsbl 0x8d25(%rip), %r15d     # 0x10208
leaq -0x58(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x4dad(%rip), %rsi      # 0xc29f
leaq 0x4db3(%rip), %rdx      # 0xc2ac
leaq -0x68(%rbp), %r12
movq %r12, %rdi
callq 0x644a
movl %r14d, %edi
movl %r15d, %esi
movq %r12, %rdx
callq 0xb2e1
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0x7528
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x21e0
movq %rbx, %rdi
callq 0x7ed4
movq %rbx, %rdi
movl $0xf, %esi
callq 0x6d1c
movq %rbx, %rdi
callq 0x810c
movl 0x8cc1(%rip), %ebx      # 0x1020c
decl %ebx
movl %ebx, 0x8cb9(%rip)      # 0x1020c
movsbl 0x8cad(%rip), %r14d     # 0x10208
leaq -0x38(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x4d35(%rip), %rsi      # 0xc29f
leaq 0x4d3b(%rip), %rdx      # 0xc2ac
leaq -0x48(%rbp), %r15
movq %r15, %rdi
callq 0x644a
movl %ebx, %edi
movl %r14d, %esi
movq %r15, %rdx
callq 0xb2e7
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x759f
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21e0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x48(%rbp), %rdi
jmp 0x75be
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0x75cf
movq (%r13), %rsi
incq %rsi
callq 0x21e0
movq %rbx, %rdi
callq 0x2390
nop