// File: goodix[P]gdix_hid_firmware_update/gtx3/gtx3_update.cpp
// Function: GTx3Update::cfg_update()
int GTx3Update::cfg_update()
{
	int retry;
	int ret = -1, i;
	unsigned char temp_buf[65];
	unsigned char *fw_data = NULL;
	unsigned char cfg_ver_after[3];
	unsigned char cfg_ver_before[3];
	unsigned char cfg_ver_infile;
	bool findMatchCfg = false;
	unsigned char *cfg = NULL;

	int sub_cfg_num = image->GetConfigSubCfgNum();
	unsigned char sub_cfg_id;
	unsigned int sub_cfg_len;
	unsigned int sub_cfg_info_pos = image->GetConfigSubCfgInfoOffset();
	unsigned int cfg_offset = image->GetConfigSubCfgDataOffset();

	if (sub_cfg_num == 0)
		return -5;

	// before update config,read curr config version
	dev->Read(0x8050, cfg_ver_before, 3);
	gdix_dbg("Before update,cfg version is 0x%02x 0x%02x 0x%02x\n",
			 cfg_ver_before[0], cfg_ver_before[1], cfg_ver_before[2]);
	unsigned char cks =
		cfg_ver_before[0] + cfg_ver_before[1] + cfg_ver_before[2];
	if (cks != 0)
		gdix_err("Warning : cfg before cks err!\n");

	/* Start load config */
	fw_data = image->GetFirmwareData();
	if (!fw_data) {
		gdix_err("No valid fw data \n");
		ret = -4;
		goto update_err;
	}

	// fw_data[FW_IMAGE_SUB_FWNUM_OFFSET];
	gdix_dbg("load sub config, sub_cfg_num=%d\n", sub_cfg_num);
	for (i = 0; i < sub_cfg_num; i++) {
		sub_cfg_id = fw_data[sub_cfg_info_pos];
		gdix_dbg("load sub config, sub_cfg_id=0x%x\n", sub_cfg_id);

		sub_cfg_len = (fw_data[sub_cfg_info_pos + 1] << 8) |
					  fw_data[sub_cfg_info_pos + 2];

		if (dev->GetSensorID() == sub_cfg_id) {
			findMatchCfg = true;
			cfg = &fw_data[cfg_offset];
			cfg_ver_infile = cfg[0];
			gdix_info("Find a cfg match sensorID:ID=%d,cfg version=%d\n",
					  dev->GetSensorID(), cfg_ver_infile);
			break;
		}
		cfg_offset += sub_cfg_len;
		sub_cfg_info_pos += 3;
	}

	if (findMatchCfg) {
		// tell ic i want to send cfg
		temp_buf[0] = 0x80;
		temp_buf[1] = 0;
		temp_buf[2] = 0x80;
		ret = dev->Write(0x8040, temp_buf, 3);
		if (ret < 0) {
			gdix_err("Failed write send cfg cmd\n");
			return ret;
		}

		// wait ic to comfirm
		usleep(250000);
		retry = GDIX_RETRY_TIMES;
		do {
			ret = dev->Read(0x8040, temp_buf, 1);
			gdix_dbg("Wait 0x8040 == 0x82...\n");
			if (ret < 0) {
				gdix_err("Failed read 0x%x, ret = %d\n", 0x8040, ret);
			}
			if (temp_buf[0] == 0x82)
				break;
			gdix_info("0x%x value is 0x%x != 0x82, retry\n", 0x8040,
					  temp_buf[0]);
			usleep(30000);
		} while (--retry);

		if (!retry) {
			gdix_err("Reg 0x%x != 0x82\n", 0x8040);
			ret = -2;
			goto update_err;
		}
		gdix_dbg("Wait 0x8040 == 0x82 success.\n");

		/* Start load config */
		ret = dev->Write(0x8050, &fw_data[cfg_offset], sub_cfg_len);
		if (ret < 0) {
			gdix_err("Failed write cfg to xdata, ret=%d\n", ret);
			goto update_err;
		}
		usleep(100000);

		// tell ic cfg is ready in xdata
		temp_buf[0] = 0x83;
		ret = dev->Write(0x8040, temp_buf, 1);
		if (ret < 0) {
			gdix_err("Failed write send cfg finish cmd\n");
			return ret;
		}

		// check if ic is ok with the cfg
		usleep(80000);
		retry = GDIX_RETRY_TIMES;
		do {
			ret = dev->Read(0x8040, temp_buf, 1);
			gdix_dbg("Wait 0x8040 == 0xFF...\n");
			if (ret < 0) {
				gdix_err("Failed read 0x%x, ret = %d\n", 0x8040, ret);
			}
			if (temp_buf[0] == 0xff)
				break;
			gdix_info("0x%x value is 0x%x != 0xFF, retry\n", 0x8040,
					  temp_buf[0]);
			usleep(30000);
		} while (--retry);

		if (!retry) {
			gdix_err("Reg 0x%x != 0xFF\n", 0x8040);
			ret = -2;
			goto update_err;
		}
		gdix_dbg("Wait 0x8040 == 0xFF success.\n");

		// before update config,read curr config version
		dev->Read(0x8050, cfg_ver_after, 3);
		gdix_dbg("After update,cfg version is 0x%02x 0x%02x 0x%02x\n",
				 cfg_ver_after[0], cfg_ver_after[1], cfg_ver_after[2]);
		unsigned char cks =
			cfg_ver_after[0] + cfg_ver_after[1] + cfg_ver_after[2];
		if (cks != 0) {
			gdix_err("Error : cfg after cks err!\n");
			return -6;
		}

		return 0;
	}
update_err:
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
movl $0xffffffff, -0x18(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x68(%rbp)
movb $0x0, -0x70(%rbp)
movq $0x0, -0x78(%rbp)
movq 0x10(%rax), %rdi
movq (%rdi), %rax
callq *0x78(%rax)
movl %eax, %ecx
movq -0x98(%rbp), %rax
movl %ecx, -0x7c(%rbp)
movq 0x10(%rax), %rdi
movq (%rdi), %rax
callq *0x80(%rax)
movl %eax, %ecx
movq -0x98(%rbp), %rax
movl %ecx, -0x88(%rbp)
movq 0x10(%rax), %rdi
movq (%rdi), %rax
callq *0x88(%rax)
movl %eax, -0x8c(%rbp)
cmpl $0x0, -0x7c(%rbp)
jne 0xe11c
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0xe919
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x6e(%rbp), %rdx
movq (%rdi), %rax
movl $0x8050, %esi           # imm = 0x8050
movl $0x3, %ecx
callq *0x20(%rax)
leaq 0x18157(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe17c
movq 0x17e6a(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movzbl -0x6e(%rbp), %r8d
movzbl -0x6d(%rbp), %r9d
movzbl -0x6c(%rbp), %eax
leaq 0xf58e(%rip), %rsi      # 0x1d6f4
leaq 0xf57c(%rip), %rdx      # 0x1d6e9
movl $0x18d, %ecx            # imm = 0x18D
movl %eax, (%rsp)
movb $0x0, %al
callq 0x5190
jmp 0xe17e
movzbl -0x6e(%rbp), %eax
movzbl -0x6d(%rbp), %ecx
addl %ecx, %eax
movzbl -0x6c(%rbp), %ecx
addl %ecx, %eax
movb %al, -0x8d(%rbp)
movzbl -0x8d(%rbp), %eax
cmpl $0x0, %eax
je 0xe1d6
jmp 0xe1a2
leaq 0x180f0(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe1d2
movq 0x17e23(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0x1003c(%rip), %rsi     # 0x1e1fb
leaq 0xf523(%rip), %rdx      # 0x1d6e9
movl $0x191, %ecx            # imm = 0x191
movb $0x0, %al
callq 0x5190
jmp 0xe1d4
jmp 0xe1d6
movq -0x98(%rbp), %rax
movq 0x10(%rax), %rdi
movq (%rdi), %rax
callq *0x38(%rax)
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0xe232
jmp 0xe1f4
leaq 0x1809e(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe224
movq 0x17dd1(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xf104(%rip), %rsi      # 0x1d315
leaq 0xf4d1(%rip), %rdx      # 0x1d6e9
movl $0x196, %ecx            # imm = 0x196
movb $0x0, %al
callq 0x5190
jmp 0xe226
movl $0xfffffffc, -0x18(%rbp) # imm = 0xFFFFFFFC
jmp 0xe913
jmp 0xe234
leaq 0x1805e(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe268
movq 0x17d71(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movl -0x7c(%rbp), %r8d
leaq 0xf310(%rip), %rsi      # 0x1d565
leaq 0xf48d(%rip), %rdx      # 0x1d6e9
movl $0x19c, %ecx            # imm = 0x19C
movb $0x0, %al
callq 0x5190
jmp 0xe26a
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jge 0xe3c0
movq -0x68(%rbp), %rax
movl -0x88(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x7d(%rbp)
leaq 0x18005(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe2c2
movq 0x17d18(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movzbl -0x7d(%rbp), %r8d
leaq 0xf2e8(%rip), %rsi      # 0x1d597
leaq 0xf433(%rip), %rdx      # 0x1d6e9
movl $0x19f, %ecx            # imm = 0x19F
movb $0x0, %al
callq 0x5190
jmp 0xe2c4
movq -0x98(%rbp), %rax
movq -0x68(%rbp), %rcx
movl -0x88(%rbp), %edx
addl $0x1, %edx
movl %edx, %edx
movzbl (%rcx,%rdx), %ecx
shll $0x8, %ecx
movq -0x68(%rbp), %rdx
movl -0x88(%rbp), %esi
addl $0x2, %esi
movl %esi, %esi
movzbl (%rdx,%rsi), %edx
orl %edx, %ecx
movl %ecx, -0x84(%rbp)
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x80(%rax)
movzbl %al, %eax
movzbl -0x7d(%rbp), %ecx
cmpl %ecx, %eax
jne 0xe391
movb $0x1, -0x70(%rbp)
movq -0x68(%rbp), %rax
movl -0x8c(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movb (%rax), %al
movb %al, -0x6f(%rbp)
leaq 0x17f60(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe38d
movq -0x98(%rbp), %rax
movq 0x17c6c(%rip), %rcx     # 0x25fb8
movq (%rcx), %rcx
movq %rcx, -0xa0(%rbp)
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x80(%rax)
movq -0xa0(%rbp), %rdi
movzbl %al, %r8d
movzbl -0x6f(%rbp), %r9d
leaq 0xf3be(%rip), %rsi      # 0x1d738
leaq 0xf368(%rip), %rdx      # 0x1d6e9
movl $0x1a9, %ecx            # imm = 0x1A9
movb $0x0, %al
callq 0x5190
jmp 0xe38f
jmp 0xe3c0
movl -0x84(%rbp), %eax
addl -0x8c(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x88(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x88(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xe271
testb $0x1, -0x70(%rbp)
je 0xe911
movq -0x98(%rbp), %rax
movb $-0x80, -0x60(%rbp)
movb $0x0, -0x5f(%rbp)
movb $-0x80, -0x5e(%rbp)
movq 0x8(%rax), %rdi
leaq -0x60(%rbp), %rdx
movq (%rdi), %rax
movl $0x8040, %esi           # imm = 0x8040
movl $0x3, %ecx
callq *0x30(%rax)
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jge 0xe43d
jmp 0xe400
leaq 0x17e92(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe430
movq 0x17bc5(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xf3e3(%rip), %rsi      # 0x1d800
leaq 0xf2c5(%rip), %rdx      # 0x1d6e9
movl $0x1b7, %ecx            # imm = 0x1B7
movb $0x0, %al
callq 0x5190
jmp 0xe432
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe919
movl $0x3d090, %edi          # imm = 0x3D090
callq 0x5180
movl $0x6, -0x14(%rbp)
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x60(%rbp), %rdx
movq (%rdi), %rax
movl $0x8040, %esi           # imm = 0x8040
movl $0x1, %ecx
callq *0x20(%rax)
movl %eax, -0x18(%rbp)
leaq 0x17e22(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe4a0
movq 0x17b35(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xfd9e(%rip), %rsi      # 0x1e22b
leaq 0xf255(%rip), %rdx      # 0x1d6e9
movl $0x1c0, %ecx            # imm = 0x1C0
movb $0x0, %al
callq 0x5190
jmp 0xe4a2
cmpl $0x0, -0x18(%rbp)
jge 0xe4e8
jmp 0xe4aa
leaq 0x17de8(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe4e4
movq 0x17b1b(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
movl -0x18(%rbp), %r9d
leaq 0xed98(%rip), %rsi      # 0x1d263
leaq 0xf217(%rip), %rdx      # 0x1d6e9
movl $0x1c2, %ecx            # imm = 0x1C2
movl $0x8040, %r8d           # imm = 0x8040
movb $0x0, %al
callq 0x5190
jmp 0xe4e6
jmp 0xe4e8
movzbl -0x60(%rbp), %eax
cmpl $0x82, %eax
jne 0xe4f5
jmp 0xe550
jmp 0xe4f7
leaq 0x17d9b(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe532
movq 0x17aae(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movzbl -0x60(%rbp), %r9d
leaq 0xf33e(%rip), %rsi      # 0x1d857
leaq 0xf1c9(%rip), %rdx      # 0x1d6e9
movl $0x1c7, %ecx            # imm = 0x1C7
movl $0x8040, %r8d           # imm = 0x8040
movb $0x0, %al
callq 0x5190
jmp 0xe534
movl $0x7530, %edi           # imm = 0x7530
callq 0x5180
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jne 0xe44e
cmpl $0x0, -0x14(%rbp)
jne 0xe59c
jmp 0xe558
leaq 0x17d3a(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe58e
movq 0x17a6d(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xf316(%rip), %rsi      # 0x1d88b
leaq 0xf16d(%rip), %rdx      # 0x1d6e9
movl $0x1cc, %ecx            # imm = 0x1CC
movl $0x8040, %r8d           # imm = 0x8040
movb $0x0, %al
callq 0x5190
jmp 0xe590
movl $0xfffffffe, -0x18(%rbp) # imm = 0xFFFFFFFE
jmp 0xe913
jmp 0xe59e
leaq 0x17cf4(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe5ce
movq 0x17a07(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xfc99(%rip), %rsi      # 0x1e254
leaq 0xf127(%rip), %rdx      # 0x1d6e9
movl $0x1d0, %ecx            # imm = 0x1D0
movb $0x0, %al
callq 0x5190
jmp 0xe5d0
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x68(%rbp), %rdx
movl -0x8c(%rbp), %eax
addq %rax, %rdx
movl -0x84(%rbp), %ecx
movq (%rdi), %rax
movl $0x8050, %esi           # imm = 0x8050
callq *0x30(%rax)
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jge 0xe63f
jmp 0xe604
leaq 0x17c8e(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe638
movq 0x179c1(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
movl -0x18(%rbp), %r8d
leaq 0xf2ba(%rip), %rsi      # 0x1d8df
leaq 0xf0bd(%rip), %rdx      # 0x1d6e9
movl $0x1d5, %ecx            # imm = 0x1D5
movb $0x0, %al
callq 0x5190
jmp 0xe63a
jmp 0xe913
movl $0x186a0, %edi          # imm = 0x186A0
callq 0x5180
movq -0x98(%rbp), %rax
movb $-0x7d, -0x60(%rbp)
movq 0x8(%rax), %rdi
leaq -0x60(%rbp), %rdx
movq (%rdi), %rax
movl $0x8040, %esi           # imm = 0x8040
movl $0x1, %ecx
callq *0x30(%rax)
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jge 0xe6b4
jmp 0xe677
leaq 0x17c1b(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe6a7
movq 0x1794e(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xf27f(%rip), %rsi      # 0x1d913
leaq 0xf04e(%rip), %rdx      # 0x1d6e9
movl $0x1de, %ecx            # imm = 0x1DE
movb $0x0, %al
callq 0x5190
jmp 0xe6a9
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe919
movl $0x13880, %edi          # imm = 0x13880
callq 0x5180
movl $0x6, -0x14(%rbp)
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x60(%rbp), %rdx
movq (%rdi), %rax
movl $0x8040, %esi           # imm = 0x8040
movl $0x1, %ecx
callq *0x20(%rax)
movl %eax, -0x18(%rbp)
leaq 0x17bab(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe717
movq 0x178be(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xfb7f(%rip), %rsi      # 0x1e283
leaq 0xefde(%rip), %rdx      # 0x1d6e9
movl $0x1e7, %ecx            # imm = 0x1E7
movb $0x0, %al
callq 0x5190
jmp 0xe719
cmpl $0x0, -0x18(%rbp)
jge 0xe75f
jmp 0xe721
leaq 0x17b71(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe75b
movq 0x178a4(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
movl -0x18(%rbp), %r9d
leaq 0xeb21(%rip), %rsi      # 0x1d263
leaq 0xefa0(%rip), %rdx      # 0x1d6e9
movl $0x1e9, %ecx            # imm = 0x1E9
movl $0x8040, %r8d           # imm = 0x8040
movb $0x0, %al
callq 0x5190
jmp 0xe75d
jmp 0xe75f
movzbl -0x60(%rbp), %eax
cmpl $0xff, %eax
jne 0xe76c
jmp 0xe7c7
jmp 0xe76e
leaq 0x17b24(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe7a9
movq 0x17837(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movzbl -0x60(%rbp), %r9d
leaq 0xfb1c(%rip), %rsi      # 0x1e2ac
leaq 0xef52(%rip), %rdx      # 0x1d6e9
movl $0x1ee, %ecx            # imm = 0x1EE
movl $0x8040, %r8d           # imm = 0x8040
movb $0x0, %al
callq 0x5190
jmp 0xe7ab
movl $0x7530, %edi           # imm = 0x7530
callq 0x5180
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jne 0xe6c5
cmpl $0x0, -0x14(%rbp)
jne 0xe813
jmp 0xe7cf
leaq 0x17ac3(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe805
movq 0x177f6(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xfaf4(%rip), %rsi      # 0x1e2e0
leaq 0xeef6(%rip), %rdx      # 0x1d6e9
movl $0x1f3, %ecx            # imm = 0x1F3
movl $0x8040, %r8d           # imm = 0x8040
movb $0x0, %al
callq 0x5190
jmp 0xe807
movl $0xfffffffe, -0x18(%rbp) # imm = 0xFFFFFFFE
jmp 0xe913
jmp 0xe815
leaq 0x17a7d(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe845
movq 0x17790(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xfad1(%rip), %rsi      # 0x1e303
leaq 0xeeb0(%rip), %rdx      # 0x1d6e9
movl $0x1f7, %ecx            # imm = 0x1F7
movb $0x0, %al
callq 0x5190
jmp 0xe847
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x6b(%rbp), %rdx
movq (%rdi), %rax
movl $0x8050, %esi           # imm = 0x8050
movl $0x3, %ecx
callq *0x20(%rax)
leaq 0x17a2c(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe8a7
movq 0x1773f(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movzbl -0x6b(%rbp), %r8d
movzbl -0x6a(%rbp), %r9d
movzbl -0x69(%rbp), %eax
leaq 0xf233(%rip), %rsi      # 0x1dac4
leaq 0xee51(%rip), %rdx      # 0x1d6e9
movl $0x1fc, %ecx            # imm = 0x1FC
movl %eax, (%rsp)
movb $0x0, %al
callq 0x5190
jmp 0xe8a9
movzbl -0x6b(%rbp), %eax
movzbl -0x6a(%rbp), %ecx
addl %ecx, %eax
movzbl -0x69(%rbp), %ecx
addl %ecx, %eax
movb %al, -0x8e(%rbp)
movzbl -0x8e(%rbp), %eax
cmpl $0x0, %eax
je 0xe908
jmp 0xe8cd
leaq 0x179c5(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xe8fd
movq 0x176f8(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xfa48(%rip), %rsi      # 0x1e332
leaq 0xedf8(%rip), %rdx      # 0x1d6e9
movl $0x200, %ecx            # imm = 0x200
movb $0x0, %al
callq 0x5190
jmp 0xe8ff
movl $0xfffffffa, -0x4(%rbp) # imm = 0xFFFFFFFA
jmp 0xe919
movl $0x0, -0x4(%rbp)
jmp 0xe919
jmp 0xe913
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop