// File: /workspace/github_c_makefile_star2_O0/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: rtk_config
static int rtk_config(int fd, int proto, int speed, struct termios *ti)
{
	int final_speed = 0;
	int ret = 0;
	struct btrtl_info *btrtl = &rtk_hw_cfg;

	btrtl->proto = proto;

	/* Get Local Version Information and RTK ROM version */
	if (proto == HCI_UART_3WIRE) {
		RS_INFO("H5 IC");
		rtk_get_lmp_version(fd);
		rtk_get_eversion(fd);
	} else {
		RS_INFO("H4 IC");
		ti->c_cflag &= ~PARENB;
		ti->c_cflag |= CRTSCTS;
		if (tcsetattr(fd, TCSANOW, ti) < 0) {
			RS_ERR("H4 Can't enable RTSCTS");
			return -1;
		}
		usleep(20 * 1000);
		rtk_hci_local_ver(fd);
		rtk_hci_rom_ver(fd);
		if (rtk_hw_cfg.lmp_subver == ROM_LMP_8761btc) {
			rtk_hw_cfg.chip_type = CHIP_8761BTC;
			rtk_hw_cfg.hw_flow_control = 1;
			/* TODO: Change to different uart baud */
			uart_speed_to_rtk_speed(1500000, &rtk_hw_cfg.baudrate);
			goto change_baud;
		} else if (rtk_hw_cfg.lmp_subver == ROM_LMP_8761a) {
			if (rtk_hw_cfg.hci_rev == 0x000b) {
				rtk_hw_cfg.chip_type = CHIP_8761B;
				rtk_hw_cfg.hw_flow_control = 1;
				/* TODO: Change to different uart baud */
				uart_speed_to_rtk_speed(1500000, &rtk_hw_cfg.baudrate);
				goto change_baud;
			} else if (rtk_hw_cfg.hci_rev == 0x000a) {
				if (rtk_hw_cfg.eversion == 3)
					rtk_hw_cfg.chip_type = CHIP_8761ATF;
				else if (rtk_hw_cfg.eversion == 2)
					rtk_hw_cfg.chip_type = CHIP_8761AT;
				else
					rtk_hw_cfg.chip_type = CHIP_UNKNOWN;
			}
		} else if (rtk_hw_cfg.lmp_subver == ROM_LMP_8723b) {
			if (rtk_hw_cfg.hci_ver == 0x08 &&
			    rtk_hw_cfg.hci_rev == 0x000d) {
				rtk_hw_cfg.chip_type = CHIP_8723DS;
			} else if (rtk_hw_cfg.hci_ver == 0x06 &&
				 rtk_hw_cfg.hci_rev == 0x000b) {
				rtk_hw_cfg.chip_type = CHIP_8723BS;
			} else {
				RS_ERR("H4: unknown chip");
				return -1;
			}
		}

	}

	RS_INFO("LMP Subversion 0x%04x", btrtl->lmp_subver);
	RS_INFO("EVersion %d", btrtl->eversion);

	switch (rtk_hw_cfg.lmp_subver) {
	case ROM_LMP_8723a:
		break;
	case ROM_LMP_8723b:
#ifdef RTL_8703A_SUPPORT
		/* Set chip type for matching fw/config entry */
		rtl->chip_type = CHIP_8703AS;
#endif
		break;
	case ROM_LMP_8821a:
		break;
	case ROM_LMP_8761a:
		break;
	case ROM_LMP_8703b:
		rtk_get_chip_type(fd);
		break;
	}

	btrtl->patch_ent = get_patch_entry(btrtl);
	if (btrtl->patch_ent) {
		RS_INFO("IC: %s\n", btrtl->patch_ent->ic_name);
		RS_INFO("Firmware/config: %s, %s\n",
			btrtl->patch_ent->patch_file,
			btrtl->patch_ent->config_file);
	} else {
		RS_ERR("Can not find firmware/config entry\n");
		return -1;
	}

	rtk_hw_cfg.config_len =
	    rtk_get_bt_config(btrtl, &btrtl->config_buf, &btrtl->baudrate);
	if (rtk_hw_cfg.config_len < 0) {
		RS_ERR("Get Config file error, just use efuse settings");
		rtk_hw_cfg.config_len = 0;
	}

	rtk_hw_cfg.fw_len = rtk_get_bt_firmware(btrtl, &btrtl->fw_buf);
	if (rtk_hw_cfg.fw_len < 0) {
		RS_ERR("Get BT firmware error");
		rtk_hw_cfg.fw_len = 0;
		return -1;
	} else {
		rtk_get_final_patch(fd, proto);
	}

	if (rtk_hw_cfg.total_len > RTK_PATCH_LENGTH_MAX) {
		RS_ERR("total length of fw&config larger than allowed");
		return -1;
	}

	RS_INFO("Total len %d for fw/config", rtk_hw_cfg.total_len);

	if (rtk_hw_cfg.chip_type == CHIP_8723DS &&
	    rtk_hw_cfg.proto == HCI_UART_H4) {
		if (rtk_hw_cfg.parity_en) {
			/* set parity */
			ti->c_cflag |= PARENB;
			if (rtk_hw_cfg.parity_even)
				ti->c_cflag &= ~(PARODD);
			else
				ti->c_cflag |= PARODD;
			if (tcsetattr(fd, TCSANOW, ti) < 0) {
				RS_ERR("8723DSH4 Can't set parity");
				return -1;
			}
		}
	}

change_baud:
	/* change baudrate if needed
	 * rtk_hw_cfg.baudrate is a __u32/__u16 vendor-specific variable
	 * parsed from config file
	 * */
	if (rtk_hw_cfg.baudrate == 0) {
		uart_speed_to_rtk_speed(speed, &rtk_hw_cfg.baudrate);
		RS_DBG("No cfg file, set baudrate, : %u, 0x%08x",
		       (unsigned int)speed, (unsigned int)rtk_hw_cfg.baudrate);
		goto SET_FLOW_CONTRL;
	} else
		rtk_speed_to_uart_speed(rtk_hw_cfg.baudrate,
					(RT_U32 *) & (rtk_hw_cfg.final_speed));

	if (proto == HCI_UART_3WIRE)
		rtk_vendor_change_speed_h5(fd, rtk_hw_cfg.baudrate);
	else
		rtk_vendor_change_speed_h4(fd, rtk_hw_cfg.baudrate);

	usleep(50000);
	final_speed = rtk_hw_cfg.final_speed ? rtk_hw_cfg.final_speed : speed;
	RS_DBG("final_speed %d\n", final_speed);
	if (set_speed(fd, ti, final_speed) < 0) {
		RS_ERR("Can't set baud rate:%x, %x, %x", final_speed,
		       rtk_hw_cfg.final_speed, speed);
		return -1;
	}

SET_FLOW_CONTRL:
	if (rtk_hw_cfg.hw_flow_control) {
		RS_DBG("hw flow control enable");
		ti->c_cflag |= CRTSCTS;

		if (tcsetattr(fd, TCSANOW, ti) < 0) {
			RS_ERR("Can't set port settings");
			return -1;
		}
	} else {
		RS_DBG("hw flow control disable");
		ti->c_cflag &= ~CRTSCTS;
	}

	/* wait for while for controller to setup */
	usleep(10000);

	/* For 8761B Test chip, no patch to download */
	if (rtk_hw_cfg.chip_type == CHIP_8761BTC ||
	    rtk_hw_cfg.chip_type == CHIP_8761B)
		goto done;

	if ((rtk_hw_cfg.total_len > 0) && (rtk_hw_cfg.dl_fw_flag)) {
		rtk_hw_cfg.link_estab_state = H5_PATCH;
		rtk_hw_cfg.rx_index = -1;

		ret =
		    rtk_download_fw_config(fd, rtk_hw_cfg.total_buf,
					   rtk_hw_cfg.total_len,
					   rtk_hw_cfg.baudrate, proto, ti);
		free(rtk_hw_cfg.total_buf);

		if (ret < 0)
			return ret;
	}

done:
	RS_DBG("Init Process finished");
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
leaq 0x8ee6(%rip), %rax      # 0x106d0
movq %rax, -0x28(%rbp)
movl -0xc(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x98(%rax)
cmpl $0x2, -0xc(%rbp)
jne 0x7837
jmp 0x7803
movq 0x87ee(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x53c1(%rip), %rsi      # 0xcbd5
leaq 0x3d6e(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
movl -0x8(%rbp), %edi
callq 0x6a80
movl -0x8(%rbp), %edi
callq 0x67f0
jmp 0x7a1f
jmp 0x7839
movq 0x87b8(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x5396(%rip), %rsi      # 0xcbe0
leaq 0x3d38(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
andl $0xfffffeff, %ecx       # imm = 0xFFFFFEFF
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0x8(%rax)
movl -0x8(%rbp), %edi
movq -0x18(%rbp), %rdx
xorl %esi, %esi
callq 0x21e0
cmpl $0x0, %eax
jge 0x78b8
jmp 0x788d
movq 0x8764(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x534d(%rip), %rsi      # 0xcbeb
leaq 0x3ce4(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8012
movl $0x4e20, %edi           # imm = 0x4E20
callq 0x22d0
movl -0x8(%rbp), %edi
callq 0x9760
movl -0x8(%rbp), %edi
callq 0x98e0
movzwl 0x8e21(%rip), %eax      # 0x106fa
cmpl $0x8763, %eax           # imm = 0x8763
jne 0x790b
movb $0x3f, 0x8e1d(%rip)     # 0x10704
movl $0x1, 0x8e23(%rip)      # 0x10714
movl $0x16e360, %edi         # imm = 0x16E360
leaq 0x8dd3(%rip), %rsi      # 0x106d0
addq $0x38, %rsi
callq 0x9a30
jmp 0x7d53
movzwl 0x8de8(%rip), %eax      # 0x106fa
cmpl $0x8761, %eax           # imm = 0x8761
jne 0x7998
movzwl 0x8ddc(%rip), %eax      # 0x106fc
cmpl $0xb, %eax
jne 0x7950
movb $0x4f, 0x8dd8(%rip)     # 0x10704
movl $0x1, 0x8dde(%rip)      # 0x10714
movl $0x16e360, %edi         # imm = 0x16E360
leaq 0x8d8e(%rip), %rsi      # 0x106d0
addq $0x38, %rsi
callq 0x9a30
jmp 0x7d53
movzwl 0x8da5(%rip), %eax      # 0x106fc
cmpl $0xa, %eax
jne 0x7991
movzbl 0x8d9c(%rip), %eax      # 0x106ff
cmpl $0x3, %eax
jne 0x7971
movb $0x2f, 0x8d95(%rip)     # 0x10704
jmp 0x798f
movzbl 0x8d87(%rip), %eax      # 0x106ff
cmpl $0x2, %eax
jne 0x7986
movb $0x1f, 0x8d80(%rip)     # 0x10704
jmp 0x798d
movb $0x0, 0x8d77(%rip)      # 0x10704
jmp 0x798f
jmp 0x7991
jmp 0x7993
jmp 0x7a1b
movzwl 0x8d5b(%rip), %eax      # 0x106fa
cmpl $0x8723, %eax           # imm = 0x8723
jne 0x7a19
movzbl 0x8d51(%rip), %eax      # 0x106fe
cmpl $0x8, %eax
jne 0x79c7
movzwl 0x8d43(%rip), %eax      # 0x106fc
cmpl $0xd, %eax
jne 0x79c7
movb $0x71, 0x8d3f(%rip)     # 0x10704
jmp 0x7a17
movzbl 0x8d30(%rip), %eax      # 0x106fe
cmpl $0x6, %eax
jne 0x79e8
movzwl 0x8d22(%rip), %eax      # 0x106fc
cmpl $0xb, %eax
jne 0x79e8
movb $0x5f, 0x8d1e(%rip)     # 0x10704
jmp 0x7a15
jmp 0x79ea
movq 0x8607(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x5212(%rip), %rsi      # 0xcc0d
leaq 0x3b87(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8012
jmp 0x7a17
jmp 0x7a19
jmp 0x7a1b
jmp 0x7a1d
jmp 0x7a1f
jmp 0x7a21
movq 0x85d0(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq -0x28(%rbp), %rax
movzwl 0x2a(%rax), %ecx
leaq 0x4df4(%rip), %rsi      # 0xc82e
leaq 0x3b48(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
jmp 0x7a4a
movq 0x85a7(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq -0x28(%rbp), %rax
movzbl 0x2f(%rax), %ecx
leaq 0x51c6(%rip), %rsi      # 0xcc29
leaq 0x3b1f(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
movzwl 0x8c82(%rip), %eax      # 0x106fa
movl %eax, -0x2c(%rbp)
subl $0x1200, %eax           # imm = 0x1200
je 0x7ab4
jmp 0x7a84
movl -0x2c(%rbp), %eax
subl $0x8703, %eax           # imm = 0x8703
je 0x7abc
jmp 0x7a90
movl -0x2c(%rbp), %eax
subl $0x8723, %eax           # imm = 0x8723
je 0x7ab6
jmp 0x7a9c
movl -0x2c(%rbp), %eax
subl $0x8761, %eax           # imm = 0x8761
je 0x7aba
jmp 0x7aa8
movl -0x2c(%rbp), %eax
subl $0x8821, %eax           # imm = 0x8821
je 0x7ab8
jmp 0x7ac4
jmp 0x7ac4
jmp 0x7ac4
jmp 0x7ac4
jmp 0x7ac4
movl -0x8(%rbp), %edi
callq 0x6540
movq -0x28(%rbp), %rdi
callq 0x3c00
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x90(%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x90(%rax)
je 0x7b5a
jmp 0x7aeb
movq 0x8506(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x90(%rax), %rax
movq 0x20(%rax), %rcx
leaq 0x512f(%rip), %rsi      # 0xcc3a
leaq 0x3a77(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
jmp 0x7b1b
movq 0x84d6(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x90(%rax), %rax
movq 0x10(%rax), %rcx
movq -0x28(%rbp), %rax
movq 0x90(%rax), %rax
movq 0x18(%rax), %r8
leaq 0x50fd(%rip), %rsi      # 0xcc47
leaq 0x3a38(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
jmp 0x7b87
jmp 0x7b5c
movq 0x8495(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x50f8(%rip), %rsi      # 0xcc65
leaq 0x3a15(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8012
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x70, %rsi
movq -0x28(%rbp), %rdx
addq $0x38, %rdx
callq 0x4bf0
movl %eax, 0x8b8a(%rip)      # 0x10730
cmpl $0x0, 0x8b83(%rip)      # 0x10730
jge 0x7bda
jmp 0x7bb1
movq 0x8440(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x50d2(%rip), %rsi      # 0xcc94
leaq 0x39c0(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
movl $0x0, 0x8b56(%rip)      # 0x10730
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x68, %rsi
callq 0x6300
movl %eax, 0x8b3b(%rip)      # 0x1072c
cmpl $0x0, 0x8b34(%rip)      # 0x1072c
jge 0x7c31
jmp 0x7bfc
movq 0x83f5(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x50c1(%rip), %rsi      # 0xccce
leaq 0x3975(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
movl $0x0, 0x8b07(%rip)      # 0x1072c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8012
movl -0x8(%rbp), %edi
movl -0xc(%rbp), %esi
callq 0x7180
cmpl $0xa000, 0x8aee(%rip)   # imm = 0xA000
jle 0x7c75
jmp 0x7c4a
movq 0x83a7(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x5094(%rip), %rsi      # 0xccef
leaq 0x3927(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8012
jmp 0x7c77
movq 0x837a(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movl 0x8aad(%rip), %ecx      # 0x10734
leaq 0x509a(%rip), %rsi      # 0xcd28
leaq 0x38f4(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
movzbl 0x8a61(%rip), %eax      # 0x10704
cmpl $0x71, %eax
jne 0x7d51
cmpl $0x0, 0x8ab5(%rip)      # 0x10768
jne 0x7d51
movl 0x8a59(%rip), %eax      # 0x10718
andl $0xffff, %eax           # imm = 0xFFFF
cmpl $0x0, %eax
je 0x7d4f
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x8(%rax)
movl 0x8a35(%rip), %eax      # 0x10718
shrl $0x10, %eax
cmpl $0x0, %eax
je 0x7cfd
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
andl $0xfffffdff, %ecx       # imm = 0xFFFFFDFF
movl %ecx, 0x8(%rax)
jmp 0x7d0d
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
orl $0x200, %ecx            # imm = 0x200
movl %ecx, 0x8(%rax)
movl -0x8(%rbp), %edi
movq -0x18(%rbp), %rdx
xorl %esi, %esi
callq 0x21e0
cmpl $0x0, %eax
jge 0x7d4d
jmp 0x7d22
movq 0x82cf(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x5015(%rip), %rsi      # 0xcd48
leaq 0x384f(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8012
jmp 0x7d4f
jmp 0x7d51
jmp 0x7d53
cmpl $0x0, 0x89ae(%rip)      # 0x10708
jne 0x7da8
movl -0x10(%rbp), %edi
leaq 0x896a(%rip), %rsi      # 0x106d0
addq $0x38, %rsi
callq 0x9a30
cmpb $0x0, 0x855a(%rip)      # 0x102d0
je 0x7da1
movq 0x8279(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movl -0x10(%rbp), %ecx
movl 0x897c(%rip), %r8d      # 0x10708
leaq 0x4fda(%rip), %rsi      # 0xcd6d
leaq 0x37ef(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
jmp 0x7da3
jmp 0x7e8a
movl 0x895a(%rip), %edi      # 0x10708
leaq 0x891b(%rip), %rsi      # 0x106d0
addq $0x4c, %rsi
callq 0x9aa0
cmpl $0x2, -0xc(%rbp)
jne 0x7dd4
movl -0x8(%rbp), %edi
movl 0x893b(%rip), %esi      # 0x10708
callq 0x5360
jmp 0x7de2
movl -0x8(%rbp), %edi
movl 0x892b(%rip), %esi      # 0x10708
callq 0x9b10
movl $0xc350, %edi           # imm = 0xC350
callq 0x22d0
cmpl $0x0, 0x8929(%rip)      # 0x1071c
je 0x7e00
movl 0x8921(%rip), %eax      # 0x1071c
movl %eax, -0x30(%rbp)
jmp 0x7e06
movl -0x10(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x1c(%rbp)
cmpb $0x0, 0x84bd(%rip)      # 0x102d0
je 0x7e37
movq 0x81dc(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movl -0x1c(%rbp), %ecx
leaq 0x4f71(%rip), %rsi      # 0xcd9a
leaq 0x3759(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
jmp 0x7e39
movl -0x8(%rbp), %edi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x23e0
cmpl $0x0, %eax
jge 0x7e88
jmp 0x7e4f
movq 0x81a2(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movl -0x1c(%rbp), %ecx
movl 0x88b9(%rip), %r8d      # 0x1071c
movl -0x10(%rbp), %r9d
leaq 0x4f41(%rip), %rsi      # 0xcdaf
leaq 0x3714(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8012
jmp 0x7e8a
cmpl $0x0, 0x8883(%rip)      # 0x10714
je 0x7f11
jmp 0x7e95
cmpb $0x0, 0x8434(%rip)      # 0x102d0
je 0x7ebd
movq 0x8153(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x4f2a(%rip), %rsi      # 0xcdd9
leaq 0x36d3(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
jmp 0x7ebf
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0x8(%rax)
movl -0x8(%rbp), %edi
movq -0x18(%rbp), %rdx
xorl %esi, %esi
callq 0x21e0
cmpl $0x0, %eax
jge 0x7f0f
jmp 0x7ee4
movq 0x810d(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x3ca5(%rip), %rsi      # 0xbb9a
leaq 0x368d(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8012
jmp 0x7f4d
jmp 0x7f13
cmpb $0x0, 0x83b6(%rip)      # 0x102d0
je 0x7f3b
movq 0x80d5(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x4ec8(%rip), %rsi      # 0xcdf5
leaq 0x3655(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
jmp 0x7f3d
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, 0x8(%rax)
movl $0x2710, %edi           # imm = 0x2710
callq 0x22d0
movzbl 0x87a6(%rip), %eax      # 0x10704
cmpl $0x3f, %eax
je 0x7f6f
movzbl 0x879a(%rip), %eax      # 0x10704
cmpl $0x4f, %eax
jne 0x7f71
jmp 0x7fdf
cmpl $0x0, 0x87bc(%rip)      # 0x10734
jle 0x7fdd
movzbl 0x878b(%rip), %eax      # 0x1070c
cmpl $0x0, %eax
je 0x7fdd
movl $0x3, 0x8754(%rip)      # 0x106e4
movl $0xffffffff, 0x878e(%rip) # imm = 0xFFFFFFFF
movl -0x8(%rbp), %edi
movq 0x87a4(%rip), %rsi      # 0x10748
movslq 0x8789(%rip), %rdx      # 0x10734
movl 0x8757(%rip), %ecx      # 0x10708
movl -0xc(%rbp), %r8d
movq -0x18(%rbp), %r9
callq 0x9d10
movl %eax, -0x20(%rbp)
movq 0x8780(%rip), %rdi      # 0x10748
callq 0x2030
cmpl $0x0, -0x20(%rbp)
jge 0x7fdb
movl -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x8012
jmp 0x7fdd
jmp 0x7fdf
jmp 0x7fe1
cmpb $0x0, 0x82e8(%rip)      # 0x102d0
je 0x8009
movq 0x8007(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x4e17(%rip), %rsi      # 0xce12
leaq 0x3587(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
jmp 0x800b
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)