// File: goodix[P]gdix_hid_firmware_update/gtx8/gtx8_update.cpp
// Function: GTx8Update::cfg_update()
int GTx8Update::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(CFG_START_ADDR, 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]);

	/* 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) {
		// wait untill ic is free
		retry = 10;
		do {
			ret = dev->Read(CMD_ADDR, temp_buf, 1);
			if (ret < 0) {
				gdix_err("Failed read cfg cmd, ret = %d\n", ret);
				return ret;
			}
			if (temp_buf[0] == 0xff)
				break;
			gdix_info("0x%x value is 0x%x != 0xff, retry\n", CMD_ADDR,
					  temp_buf[0]);
			usleep(10000);
		} while (--retry);
		if (!retry) {
			gdix_err("Reg 0x%x != 0xff\n", CMD_ADDR);
			ret = -2;
			goto update_err;
		}

		// tell ic i want to send cfg
		temp_buf[0] = 0x80;
		temp_buf[1] = 0;
		temp_buf[2] = 0x80;
		ret = dev->Write(CMD_ADDR, 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(CMD_ADDR, temp_buf, 1);
			gdix_dbg("Wait CMD_ADDR == 0x82...\n");
			if (ret < 0) {
				gdix_err("Failed read 0x%x, ret = %d\n", CMD_ADDR, ret);
			}
			if (temp_buf[0] == 0x82)
				break;
			gdix_info("0x%x value is 0x%x != 0x82, retry\n", CMD_ADDR,
					  temp_buf[0]);
			usleep(30000);
		} while (--retry);

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

		/* Start load config */
		ret = dev->Write(CFG_START_ADDR, &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(CMD_ADDR, 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(CMD_ADDR, temp_buf, 1);
			gdix_dbg("Wait CMD_ADDR == 0xFF...\n");
			if (ret < 0) {
				gdix_err("Failed read 0x%x, ret = %d\n", CMD_ADDR, ret);
			}
			if (temp_buf[0] == 0xff)
				break;
			gdix_info("0x%x value is 0x%x != 0xFF, retry\n", CMD_ADDR,
					  temp_buf[0]);
			usleep(30000);
		} while (--retry);

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

		// before update config,read curr config version
		dev->Read(CFG_START_ADDR, 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]);

		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 0x128ec
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0x13158
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x6e(%rbp), %rdx
movq (%rdi), %rax
movl $0x60dc, %esi           # imm = 0x60DC
movl $0x3, %ecx
callq *0x20(%rax)
leaq 0x13987(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x1294c
movq 0x1369a(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movzbl -0x6e(%rbp), %r8d
movzbl -0x6d(%rbp), %r9d
movzbl -0x6c(%rbp), %eax
leaq 0xadbe(%rip), %rsi      # 0x1d6f4
leaq 0xadac(%rip), %rdx      # 0x1d6e9
movl $0x1a7, %ecx            # imm = 0x1A7
movl %eax, (%rsp)
movb $0x0, %al
callq 0x5190
jmp 0x1294e
movq -0x98(%rbp), %rax
movq 0x10(%rax), %rdi
movq (%rdi), %rax
callq *0x38(%rax)
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x129aa
jmp 0x1296c
leaq 0x13926(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x1299c
movq 0x13659(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xa98c(%rip), %rsi      # 0x1d315
leaq 0xad59(%rip), %rdx      # 0x1d6e9
movl $0x1ac, %ecx            # imm = 0x1AC
movb $0x0, %al
callq 0x5190
jmp 0x1299e
movl $0xfffffffc, -0x18(%rbp) # imm = 0xFFFFFFFC
jmp 0x13152
jmp 0x129ac
leaq 0x138e6(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x129e0
movq 0x135f9(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movl -0x7c(%rbp), %r8d
leaq 0xab98(%rip), %rsi      # 0x1d565
leaq 0xad15(%rip), %rdx      # 0x1d6e9
movl $0x1b2, %ecx            # imm = 0x1B2
movb $0x0, %al
callq 0x5190
jmp 0x129e2
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jge 0x12b38
movq -0x68(%rbp), %rax
movl -0x88(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x7d(%rbp)
leaq 0x1388d(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x12a3a
movq 0x135a0(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movzbl -0x7d(%rbp), %r8d
leaq 0xab70(%rip), %rsi      # 0x1d597
leaq 0xacbb(%rip), %rdx      # 0x1d6e9
movl $0x1b5, %ecx            # imm = 0x1B5
movb $0x0, %al
callq 0x5190
jmp 0x12a3c
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 0x12b09
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 0x137e8(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x12b05
movq -0x98(%rbp), %rax
movq 0x134f4(%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 0xbeb4(%rip), %rsi      # 0x1e9a6
leaq 0xabf0(%rip), %rdx      # 0x1d6e9
movl $0x1bf, %ecx            # imm = 0x1BF
movb $0x0, %al
callq 0x5190
jmp 0x12b07
jmp 0x12b38
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 0x129e9
testb $0x1, -0x70(%rbp)
je 0x13150
movl $0xa, -0x14(%rbp)
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x60(%rbp), %rdx
movq (%rdi), %rax
movl $0x60cc, %esi           # imm = 0x60CC
movl $0x1, %ecx
callq *0x20(%rax)
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jge 0x12bb4
jmp 0x12b73
leaq 0x1371f(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x12ba7
movq 0x13452(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
movl -0x18(%rbp), %r8d
leaq 0xabe5(%rip), %rsi      # 0x1d779
leaq 0xab4e(%rip), %rdx      # 0x1d6e9
movl $0x1cc, %ecx            # imm = 0x1CC
movb $0x0, %al
callq 0x5190
jmp 0x12ba9
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x13158
movzbl -0x60(%rbp), %eax
cmpl $0xff, %eax
jne 0x12bc1
jmp 0x12c1c
jmp 0x12bc3
leaq 0x136cf(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x12bfe
movq 0x133e2(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movzbl -0x60(%rbp), %r9d
leaq 0xabc4(%rip), %rsi      # 0x1d7a9
leaq 0xaafd(%rip), %rdx      # 0x1d6e9
movl $0x1d2, %ecx            # imm = 0x1D2
movl $0x60cc, %r8d           # imm = 0x60CC
movb $0x0, %al
callq 0x5190
jmp 0x12c00
movl $0x2710, %edi           # imm = 0x2710
callq 0x5180
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jne 0x12b49
cmpl $0x0, -0x14(%rbp)
jne 0x12c68
jmp 0x12c24
leaq 0x1366e(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x12c5a
movq 0x133a1(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xab9c(%rip), %rsi      # 0x1d7dd
leaq 0xaaa1(%rip), %rdx      # 0x1d6e9
movl $0x1d6, %ecx            # imm = 0x1D6
movl $0x60cc, %r8d           # imm = 0x60CC
movb $0x0, %al
callq 0x5190
jmp 0x12c5c
movl $0xfffffffe, -0x18(%rbp) # imm = 0xFFFFFFFE
jmp 0x13152
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 $0x60cc, %esi           # imm = 0x60CC
movl $0x3, %ecx
callq *0x30(%rax)
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jge 0x12cdb
jmp 0x12c9e
leaq 0x135f4(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x12cce
movq 0x13327(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xab45(%rip), %rsi      # 0x1d800
leaq 0xaa27(%rip), %rdx      # 0x1d6e9
movl $0x1e1, %ecx            # imm = 0x1E1
movb $0x0, %al
callq 0x5190
jmp 0x12cd0
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x13158
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 $0x60cc, %esi           # imm = 0x60CC
movl $0x1, %ecx
callq *0x20(%rax)
movl %eax, -0x18(%rbp)
leaq 0x13584(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x12d3e
movq 0x13297(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xab01(%rip), %rsi      # 0x1d82c
leaq 0xa9b7(%rip), %rdx      # 0x1d6e9
movl $0x1ea, %ecx            # imm = 0x1EA
movb $0x0, %al
callq 0x5190
jmp 0x12d40
cmpl $0x0, -0x18(%rbp)
jge 0x12d86
jmp 0x12d48
leaq 0x1354a(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x12d82
movq 0x1327d(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
movl -0x18(%rbp), %r9d
leaq 0xa4fa(%rip), %rsi      # 0x1d263
leaq 0xa979(%rip), %rdx      # 0x1d6e9
movl $0x1ec, %ecx            # imm = 0x1EC
movl $0x60cc, %r8d           # imm = 0x60CC
movb $0x0, %al
callq 0x5190
jmp 0x12d84
jmp 0x12d86
movzbl -0x60(%rbp), %eax
cmpl $0x82, %eax
jne 0x12d93
jmp 0x12dee
jmp 0x12d95
leaq 0x134fd(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x12dd0
movq 0x13210(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movzbl -0x60(%rbp), %r9d
leaq 0xaaa0(%rip), %rsi      # 0x1d857
leaq 0xa92b(%rip), %rdx      # 0x1d6e9
movl $0x1f1, %ecx            # imm = 0x1F1
movl $0x60cc, %r8d           # imm = 0x60CC
movb $0x0, %al
callq 0x5190
jmp 0x12dd2
movl $0x7530, %edi           # imm = 0x7530
callq 0x5180
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jne 0x12cec
cmpl $0x0, -0x14(%rbp)
jne 0x12e3a
jmp 0x12df6
leaq 0x1349c(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x12e2c
movq 0x131cf(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xaa78(%rip), %rsi      # 0x1d88b
leaq 0xa8cf(%rip), %rdx      # 0x1d6e9
movl $0x1f6, %ecx            # imm = 0x1F6
movl $0x60cc, %r8d           # imm = 0x60CC
movb $0x0, %al
callq 0x5190
jmp 0x12e2e
movl $0xfffffffe, -0x18(%rbp) # imm = 0xFFFFFFFE
jmp 0x13152
jmp 0x12e3c
leaq 0x13456(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x12e6c
movq 0x13169(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xaa55(%rip), %rsi      # 0x1d8ae
leaq 0xa889(%rip), %rdx      # 0x1d6e9
movl $0x1fa, %ecx            # imm = 0x1FA
movb $0x0, %al
callq 0x5190
jmp 0x12e6e
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 $0x60dc, %esi           # imm = 0x60DC
callq *0x30(%rax)
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jge 0x12edd
jmp 0x12ea2
leaq 0x133f0(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x12ed6
movq 0x13123(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
movl -0x18(%rbp), %r8d
leaq 0xaa1c(%rip), %rsi      # 0x1d8df
leaq 0xa81f(%rip), %rdx      # 0x1d6e9
movl $0x1ff, %ecx            # imm = 0x1FF
movb $0x0, %al
callq 0x5190
jmp 0x12ed8
jmp 0x13152
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 $0x60cc, %esi           # imm = 0x60CC
movl $0x1, %ecx
callq *0x30(%rax)
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jge 0x12f52
jmp 0x12f15
leaq 0x1337d(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x12f45
movq 0x130b0(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xa9e1(%rip), %rsi      # 0x1d913
leaq 0xa7b0(%rip), %rdx      # 0x1d6e9
movl $0x208, %ecx            # imm = 0x208
movb $0x0, %al
callq 0x5190
jmp 0x12f47
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x13158
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 $0x60cc, %esi           # imm = 0x60CC
movl $0x1, %ecx
callq *0x20(%rax)
movl %eax, -0x18(%rbp)
leaq 0x1330d(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x12fb5
movq 0x13020(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xba46(%rip), %rsi      # 0x1e9e8
leaq 0xa740(%rip), %rdx      # 0x1d6e9
movl $0x211, %ecx            # imm = 0x211
movb $0x0, %al
callq 0x5190
jmp 0x12fb7
cmpl $0x0, -0x18(%rbp)
jge 0x12ffd
jmp 0x12fbf
leaq 0x132d3(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x12ff9
movq 0x13006(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
movl -0x18(%rbp), %r9d
leaq 0xa283(%rip), %rsi      # 0x1d263
leaq 0xa702(%rip), %rdx      # 0x1d6e9
movl $0x213, %ecx            # imm = 0x213
movl $0x60cc, %r8d           # imm = 0x60CC
movb $0x0, %al
callq 0x5190
jmp 0x12ffb
jmp 0x12ffd
movzbl -0x60(%rbp), %eax
cmpl $0xff, %eax
jne 0x1300a
jmp 0x13065
jmp 0x1300c
leaq 0x13286(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x13047
movq 0x12f99(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movzbl -0x60(%rbp), %r9d
leaq 0xb27e(%rip), %rsi      # 0x1e2ac
leaq 0xa6b4(%rip), %rdx      # 0x1d6e9
movl $0x218, %ecx            # imm = 0x218
movl $0x60cc, %r8d           # imm = 0x60CC
movb $0x0, %al
callq 0x5190
jmp 0x13049
movl $0x7530, %edi           # imm = 0x7530
callq 0x5180
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jne 0x12f63
cmpl $0x0, -0x14(%rbp)
jne 0x130b1
jmp 0x1306d
leaq 0x13225(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x130a3
movq 0x12f58(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xb256(%rip), %rsi      # 0x1e2e0
leaq 0xa658(%rip), %rdx      # 0x1d6e9
movl $0x21d, %ecx            # imm = 0x21D
movl $0x60cc, %r8d           # imm = 0x60CC
movb $0x0, %al
callq 0x5190
jmp 0x130a5
movl $0xfffffffe, -0x18(%rbp) # imm = 0xFFFFFFFE
jmp 0x13152
jmp 0x130b3
leaq 0x131df(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x130e3
movq 0x12ef2(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xb943(%rip), %rsi      # 0x1ea13
leaq 0xa612(%rip), %rdx      # 0x1d6e9
movl $0x221, %ecx            # imm = 0x221
movb $0x0, %al
callq 0x5190
jmp 0x130e5
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x6b(%rbp), %rdx
movq (%rdi), %rax
movl $0x60dc, %esi           # imm = 0x60DC
movl $0x3, %ecx
callq *0x20(%rax)
leaq 0x1318e(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x13145
movq 0x12ea1(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movzbl -0x6b(%rbp), %r8d
movzbl -0x6a(%rbp), %r9d
movzbl -0x69(%rbp), %eax
leaq 0xa995(%rip), %rsi      # 0x1dac4
leaq 0xa5b3(%rip), %rdx      # 0x1d6e9
movl $0x226, %ecx            # imm = 0x226
movl %eax, (%rsp)
movb $0x0, %al
callq 0x5190
jmp 0x13147
movl $0x0, -0x4(%rbp)
jmp 0x13158
jmp 0x13152
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop