// File: goodix[P]gdix_hid_firmware_update/gtx3/gtx3_update.cpp
// Function: GTx3Update::fw_update(unsigned int)
int GTx3Update::fw_update(unsigned int firmware_flag)
{
	int retry;
	int ret, i;
	unsigned char temp_buf[65];
	unsigned char *fw_data = NULL;
	unsigned char buf_switch_to_patch[] = {0x00, 0x10, 0x00, 0x00, 0x01, 0x01};
	unsigned char buf_start_update[] = {0x00, 0x11, 0x00, 0x00, 0x01, 0x01};
	unsigned char buf_restart[] = {0x0E, 0x13, 0x00, 0x00, 0x01, 0x01};

	int sub_fw_num = 0;
	unsigned char sub_fw_type;
	unsigned int sub_fw_len;
	unsigned int sub_fw_flash_addr;
	unsigned int sub_fw_info_pos =
		image->GetFirmwareSubFwInfoOffset(); // SUB_FW_INFO_OFFSET;
	unsigned int fw_image_offset =
		image->GetFirmwareSubFwDataOffset(); // SUB_FW_DATA_OFFSET;

	ret = dev->Write(buf_switch_to_patch, sizeof(buf_switch_to_patch));
	if (ret < 0) {
		gdix_err("Failed switch to patch\n");
		goto update_err;
	}

	usleep(250000);
	retry = GDIX_RETRY_TIMES;
	do {
		ret = dev->Read(BL_STATE_ADDR, temp_buf, 1);
		gdix_dbg("BL_STATE_ADDR:0x%x\n", BL_STATE_ADDR);
		if (ret < 0) {
			gdix_err("Failed read 0x%x, ret = %d\n", BL_STATE_ADDR, ret);
			goto update_err;
		}
		if (temp_buf[0] == 0xDD)
			break;
		gdix_info("0x%x value is 0x%x != 0xDD, retry\n", BL_STATE_ADDR,
				  temp_buf[0]);
		usleep(30000);
	} while (--retry);

	if (!retry) {
		gdix_err("Reg 0x%x != 0xDD\n", BL_STATE_ADDR);
		ret = -2;
		goto update_err;
	}

	/* Start update */
	ret = dev->Write(buf_start_update, sizeof(buf_start_update));
	if (ret < 0) {
		gdix_err("Failed start update, ret=%d\n", ret);
		goto update_err;
	}
	usleep(100000);

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

	sub_fw_num =
		image->GetFirmwareSubFwNum(); // fw_data[FW_IMAGE_SUB_FWNUM_OFFSET];
	// sub_fw_info_pos = image->GetFirmwareSubFwInfoOffset();//
	// SUB_FW_INFO_OFFSET; fw_image_offset = image->GetFirmwareSubFwDataOffset()
	// ; //SUB_FW_DATA_OFFSET;
	gdix_dbg("load sub firmware, sub_fw_num=%d\n", sub_fw_num);
	if (sub_fw_num == 0)
		return -5;

	/* flash HID subsystem */
	if (need_upgrade_hid_subsystem(dev, image)) {
		firmware_flag |= (0x1 << HID_SUBSYSTEM_TYPE_ID);
		gdix_dbg("hid subsystem updata flag setted\n");
	}

	/* load normal firmware package */
	for (i = 0; i < sub_fw_num; i++) {
		sub_fw_type = fw_data[sub_fw_info_pos];
		gdix_dbg("load sub firmware, sub_fw_type=0x%x\n", sub_fw_type);
		sub_fw_len = (fw_data[sub_fw_info_pos + 1] << 24) |
					 (fw_data[sub_fw_info_pos + 2] << 16) |
					 (fw_data[sub_fw_info_pos + 3] << 8) |
					 fw_data[sub_fw_info_pos + 4];

		sub_fw_flash_addr =
			(fw_data[sub_fw_info_pos + 5] << 8) | fw_data[sub_fw_info_pos + 6];
		sub_fw_flash_addr = sub_fw_flash_addr << 8;
		if (!(firmware_flag & (0x01 << sub_fw_type))) {
			gdix_info("Sub firmware type does not math:type=%d\n", sub_fw_type);
			fw_image_offset += sub_fw_len;
			sub_fw_info_pos += 8;
			continue;
		}

		/* if sub fw type is HID subsystem we need compare version before update
		 */
		// TODO update hid subsystem
		gdix_dbg("load sub firmware addr:0x%x,len:0x%x\n", sub_fw_flash_addr,
				 sub_fw_len);
		ret = load_sub_firmware(sub_fw_flash_addr, &fw_data[fw_image_offset],
								sub_fw_len);
		if (ret < 0) {
			gdix_dbg("Failed load sub firmware, ret=%d\n", ret);
			goto update_err;
		}
		fw_image_offset += sub_fw_len;
		sub_fw_info_pos += 8;
	}

	/* flash config with isp if NEED_UPDATE_CONFIG_WITH_ISP flag is setted or
	 * hid subsystem updated.
	 */
	if (image->GetUpdateFlag() & NEED_UPDATE_CONFIG_WITH_ISP ||
		firmware_flag & (0x1 << HID_SUBSYSTEM_TYPE_ID)) {
		this->is_cfg_flashed_with_isp = true;
		ret = flash_cfg_with_isp();
		if (ret < 0) {
			gdix_err("failed flash config with isp, ret %d\n", ret);
			goto update_err;
		}
	}

	/* reset IC */
	gdix_dbg("reset ic\n");
	retry = 3;
	do {
		ret = dev->Write(buf_restart, sizeof(buf_restart));
		if (ret < 0)
			gdix_dbg("Failed write restart command, ret=%d\n", ret);
		usleep(20000);
	} while (--retry);
	usleep(300000);
	return 0;

update_err:
	/* reset IC */
	gdix_dbg("reset ic\n");
	retry = 3;
	do {
		if (dev->Write(buf_restart, sizeof(buf_restart)) < 0)
			gdix_dbg("Failed write restart command\n");
		usleep(20000);
	} while (--retry);

	usleep(300000);
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq $0x0, -0x78(%rbp)
movl 0x10ed4(%rip), %ecx     # 0x1e35f
movl %ecx, -0x7e(%rbp)
movw 0x10ece(%rip), %cx      # 0x1e363
movw %cx, -0x7a(%rbp)
movl 0x10ec6(%rip), %ecx     # 0x1e365
movl %ecx, -0x84(%rbp)
movw 0x10ebd(%rip), %cx      # 0x1e369
movw %cx, -0x80(%rbp)
movl 0x10eb5(%rip), %ecx     # 0x1e36b
movl %ecx, -0x8a(%rbp)
movw 0x10eac(%rip), %cx      # 0x1e36f
movw %cx, -0x86(%rbp)
movl $0x0, -0x90(%rbp)
movq 0x10(%rax), %rdi
movq (%rdi), %rax
callq *0x60(%rax)
movl %eax, %ecx
movq -0xb0(%rbp), %rax
movl %ecx, -0xa0(%rbp)
movq 0x10(%rax), %rdi
movq (%rdi), %rax
callq *0x68(%rax)
movl %eax, %ecx
movq -0xb0(%rbp), %rax
movl %ecx, -0xa4(%rbp)
movq 0x8(%rax), %rdi
leaq -0x7e(%rbp), %rsi
movq (%rdi), %rax
movl $0x6, %edx
callq *0x38(%rax)
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0xd55b
jmp 0xd524
leaq 0x18d6e(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xd554
movq 0x18aa1(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xfcae(%rip), %rsi      # 0x1d1ef
leaq 0x11cb4(%rip), %rdx     # 0x1f1fc
movl $0xaf, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xd556
jmp 0xdbee
movl $0x3d090, %edi          # imm = 0x3D090
callq 0x5180
movl $0x6, -0x18(%rbp)
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x70(%rbp), %rdx
movq (%rdi), %rax
movl $0x5095, %esi           # imm = 0x5095
movl $0x1, %ecx
callq *0x20(%rax)
movl %eax, -0x1c(%rbp)
leaq 0x18d04(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xd5c4
movq 0x18a17(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xfc93(%rip), %rsi      # 0x1d23e
leaq 0x11c4a(%rip), %rdx     # 0x1f1fc
movl $0xb7, %ecx
movl $0x5095, %r8d           # imm = 0x5095
movb $0x0, %al
callq 0x5190
jmp 0xd5c6
cmpl $0x0, -0x1c(%rbp)
jge 0xd60f
jmp 0xd5ce
leaq 0x18cc4(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xd608
movq 0x189f7(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
movl -0x1c(%rbp), %r9d
leaq 0xfc74(%rip), %rsi      # 0x1d263
leaq 0x11c06(%rip), %rdx     # 0x1f1fc
movl $0xb9, %ecx
movl $0x5095, %r8d           # imm = 0x5095
movb $0x0, %al
callq 0x5190
jmp 0xd60a
jmp 0xdbee
movzbl -0x70(%rbp), %eax
cmpl $0xdd, %eax
jne 0xd61c
jmp 0xd677
jmp 0xd61e
leaq 0x18c74(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xd659
movq 0x18987(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movzbl -0x70(%rbp), %r9d
leaq 0xfc50(%rip), %rsi      # 0x1d290
leaq 0x11bb5(%rip), %rdx     # 0x1f1fc
movl $0xbf, %ecx
movl $0x5095, %r8d           # imm = 0x5095
movb $0x0, %al
callq 0x5190
jmp 0xd65b
movl $0x7530, %edi           # imm = 0x7530
callq 0x5180
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, %eax
jne 0xd56c
cmpl $0x0, -0x18(%rbp)
jne 0xd6c3
jmp 0xd67f
leaq 0x18c13(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xd6b5
movq 0x18946(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xfc28(%rip), %rsi      # 0x1d2c4
leaq 0x11b59(%rip), %rdx     # 0x1f1fc
movl $0xc4, %ecx
movl $0x5095, %r8d           # imm = 0x5095
movb $0x0, %al
callq 0x5190
jmp 0xd6b7
movl $0xfffffffe, -0x1c(%rbp) # imm = 0xFFFFFFFE
jmp 0xdbee
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x84(%rbp), %rsi
movq (%rdi), %rax
movl $0x6, %edx
callq *0x38(%rax)
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0xd726
jmp 0xd6eb
leaq 0x18ba7(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xd71f
movq 0x188da(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
movl -0x1c(%rbp), %r8d
leaq 0xfbdb(%rip), %rsi      # 0x1d2e7
leaq 0x11ae9(%rip), %rdx     # 0x1f1fc
movl $0xcc, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xd721
jmp 0xdbee
movl $0x186a0, %edi          # imm = 0x186A0
callq 0x5180
movq -0xb0(%rbp), %rax
movq 0x10(%rax), %rdi
movq (%rdi), %rax
callq *0x38(%rax)
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
jne 0xd78c
jmp 0xd74e
leaq 0x18b44(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xd77e
movq 0x18877(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xfbaa(%rip), %rsi      # 0x1d315
leaq 0x11a8a(%rip), %rdx     # 0x1f1fc
movl $0xd4, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xd780
movl $0xfffffffc, -0x1c(%rbp) # imm = 0xFFFFFFFC
jmp 0xdbee
movq -0xb0(%rbp), %rax
movq 0x10(%rax), %rdi
movq (%rdi), %rax
callq *0x58(%rax)
movl %eax, -0x90(%rbp)
leaq 0x18aef(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xd7da
movq 0x18802(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movl -0x90(%rbp), %r8d
leaq 0xfb72(%rip), %rsi      # 0x1d339
leaq 0x11a2e(%rip), %rdx     # 0x1f1fc
movl $0xde, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xd7dc
cmpl $0x0, -0x90(%rbp)
jne 0xd7f1
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0xdca9
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rdi
movq 0x10(%rax), %rsi
callq 0xd2d0
testb $0x1, %al
jne 0xd80b
jmp 0xd848
movl -0x14(%rbp), %eax
orl $0x20, %eax
movl %eax, -0x14(%rbp)
leaq 0x18a7e(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xd844
movq 0x18791(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x10997(%rip), %rsi     # 0x1e1c8
leaq 0x119c4(%rip), %rdx     # 0x1f1fc
movl $0xe5, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xd846
jmp 0xd848
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x90(%rbp), %eax
jge 0xdaa5
movq -0x78(%rbp), %rax
movl -0xa0(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x91(%rbp)
leaq 0x18a21(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xd8a9
movq 0x18734(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movzbl -0x91(%rbp), %r8d
leaq 0xfad6(%rip), %rsi      # 0x1d36c
leaq 0x1195f(%rip), %rdx     # 0x1f1fc
movl $0xeb, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xd8ab
movq -0x78(%rbp), %rax
movl -0xa0(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
shll $0x18, %eax
movq -0x78(%rbp), %rcx
movl -0xa0(%rbp), %edx
addl $0x2, %edx
movl %edx, %edx
movzbl (%rcx,%rdx), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movq -0x78(%rbp), %rcx
movl -0xa0(%rbp), %edx
addl $0x3, %edx
movl %edx, %edx
movzbl (%rcx,%rdx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movq -0x78(%rbp), %rcx
movl -0xa0(%rbp), %edx
addl $0x4, %edx
movl %edx, %edx
movzbl (%rcx,%rdx), %ecx
orl %ecx, %eax
movl %eax, -0x98(%rbp)
movq -0x78(%rbp), %rax
movl -0xa0(%rbp), %ecx
addl $0x5, %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
shll $0x8, %eax
movq -0x78(%rbp), %rcx
movl -0xa0(%rbp), %edx
addl $0x6, %edx
movl %edx, %edx
movzbl (%rcx,%rdx), %ecx
orl %ecx, %eax
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
shll $0x8, %eax
movl %eax, -0x9c(%rbp)
movl -0x14(%rbp), %eax
movzbl -0x91(%rbp), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
jne 0xd9c8
jmp 0xd968
leaq 0x1892a(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xd9a0
movq 0x1863d(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movzbl -0x91(%rbp), %r8d
leaq 0xfa15(%rip), %rsi      # 0x1d3a2
leaq 0x11868(%rip), %rdx     # 0x1f1fc
movl $0xf5, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xd9a2
movl -0x98(%rbp), %eax
addl -0xa4(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa0(%rbp), %eax
addl $0x8, %eax
movl %eax, -0xa0(%rbp)
jmp 0xda97
jmp 0xd9ca
leaq 0x188c8(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xda08
movq 0x185db(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movl -0x9c(%rbp), %r8d
movl -0x98(%rbp), %r9d
leaq 0xf9e7(%rip), %rsi      # 0x1d3dc
leaq 0x11800(%rip), %rdx     # 0x1f1fc
movl $0xff, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xda0a
movq -0xb0(%rbp), %rdi
movl -0x9c(%rbp), %esi
movq -0x78(%rbp), %rdx
movl -0xa4(%rbp), %eax
addq %rax, %rdx
movl -0x98(%rbp), %ecx
movq (%rdi), %rax
callq *0x28(%rax)
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0xda76
jmp 0xda3b
leaq 0x18857(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xda6f
movq 0x1856a(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movl -0x1c(%rbp), %r8d
leaq 0xf9b7(%rip), %rsi      # 0x1d413
leaq 0x11799(%rip), %rdx     # 0x1f1fc
movl $0x103, %ecx            # imm = 0x103
movb $0x0, %al
callq 0x5190
jmp 0xda71
jmp 0xdbee
movl -0x98(%rbp), %eax
addl -0xa4(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa0(%rbp), %eax
addl $0x8, %eax
movl %eax, -0xa0(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xd84f
movq -0xb0(%rbp), %rax
movq 0x10(%rax), %rdi
movq (%rdi), %rax
callq *0xa8(%rax)
andl $0x10, %eax
cmpl $0x0, %eax
jne 0xdacc
movl -0x14(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0xdb25
movq -0xb0(%rbp), %rdi
movb $0x1, 0x19(%rdi)
movq (%rdi), %rax
callq *0x40(%rax)
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0xdb23
jmp 0xdae8
leaq 0x187aa(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xdb1c
movq 0x184dd(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
movl -0x1c(%rbp), %r8d
leaq 0xf93d(%rip), %rsi      # 0x1d446
leaq 0x116ec(%rip), %rdx     # 0x1f1fc
movl $0x112, %ecx            # imm = 0x112
movb $0x0, %al
callq 0x5190
jmp 0xdb1e
jmp 0xdbee
jmp 0xdb25
jmp 0xdb27
leaq 0x1876b(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xdb57
movq 0x1847e(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xf965(%rip), %rsi      # 0x1d4a9
leaq 0x116b1(%rip), %rdx     # 0x1f1fc
movl $0x118, %ecx            # imm = 0x118
movb $0x0, %al
callq 0x5190
jmp 0xdb59
movl $0x3, -0x18(%rbp)
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x8a(%rbp), %rsi
movq (%rdi), %rax
movl $0x6, %edx
callq *0x38(%rax)
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0xdbc0
jmp 0xdb88
leaq 0x1870a(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xdbbc
movq 0x1841d(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movl -0x1c(%rbp), %r8d
leaq 0xf91b(%rip), %rsi      # 0x1d4c4
leaq 0x1164c(%rip), %rdx     # 0x1f1fc
movl $0x11d, %ecx            # imm = 0x11D
movb $0x0, %al
callq 0x5190
jmp 0xdbbe
jmp 0xdbc0
movl $0x4e20, %edi           # imm = 0x4E20
callq 0x5180
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, %eax
jne 0xdb60
movl $0x493e0, %edi          # imm = 0x493E0
callq 0x5180
movl $0x0, -0x4(%rbp)
jmp 0xdca9
jmp 0xdbf0
leaq 0x186a2(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xdc20
movq 0x183b5(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xf89c(%rip), %rsi      # 0x1d4a9
leaq 0x115e8(%rip), %rdx     # 0x1f1fc
movl $0x125, %ecx            # imm = 0x125
movb $0x0, %al
callq 0x5190
jmp 0xdc22
movl $0x3, -0x18(%rbp)
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x8a(%rbp), %rsi
movq (%rdi), %rax
movl $0x6, %edx
callq *0x38(%rax)
cmpl $0x0, %eax
jge 0xdc81
jmp 0xdc4d
leaq 0x18645(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xdc7d
movq 0x18358(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x10193(%rip), %rsi     # 0x1ddfd
leaq 0x1158b(%rip), %rdx     # 0x1f1fc
movl $0x129, %ecx            # imm = 0x129
movb $0x0, %al
callq 0x5190
jmp 0xdc7f
jmp 0xdc81
movl $0x4e20, %edi           # imm = 0x4E20
callq 0x5180
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, %eax
jne 0xdc29
movl $0x493e0, %edi          # imm = 0x493E0
callq 0x5180
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)