LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach.c
// Function: read_check
static int read_check(int fd, void *buf, int count)
{
	int res;

	do {
		res = read(fd, buf, count);
		if (res != -1) {
			buf += res; 
			count -= res;
		}
	} while (count && (errno == 0 || errno == EINTR));

	if (count)
		return -1;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movl %edi, %r15d
xorl %r13d, %r13d
movslq %ebx, %rbx
movl %r15d, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2110
movq %rax, %r12
cmpl $-0x1, %r12d
cmovel %r13d, %eax
subl %eax, %ebx
je 0x31f3
callq 0x2040
testl $0xfffffffb, (%rax)     # imm = 0xFFFFFFFB
jne 0x31f3
cmpl $-0x1, %r12d
movslq %r12d, %rax
movl $0x0, %ecx
cmovneq %rax, %rcx
addq %rcx, %r14
jmp 0x31b1
xorl %eax, %eax
negl %ebx
sbbl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach.c
// Function: bcsp_tconf_sig_alarm
static void bcsp_tconf_sig_alarm(int sig)
{
	unsigned char bcsp_conf_pkt[10] = {0xc0,0x00,0x41,0x00,0xbe,0xad,0xef,0xac,0xed,0xc0};
	static int retries = 0;

	if (retries < bcsp_max_retries){
		retries++;
		if (write(serial_fd, &bcsp_conf_pkt, 10) < 0)
			return;
		alarm(1);
		return;
	}

	tcflush(serial_fd, TCIOFLUSH);
	fprintf(stderr, "BCSP initialization timed out\n");
	exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x943e(%rip), %eax      # 0xc650
cmpl 0x90b8(%rip), %eax      # 0xc2d0
jge 0x3247
incl %eax
movl %eax, 0x942e(%rip)      # 0xc650
movl 0x9420(%rip), %edi      # 0xc648
leaq 0x4e2f(%rip), %rsi      # 0x805e
pushq $0xa
popq %rdx
callq 0x2070
testq %rax, %rax
js 0x3245
pushq $0x1
popq %rdi
popq %rbp
jmp 0x20f0
popq %rbp
retq
movl 0x93fb(%rip), %edi      # 0xc648
pushq $0x2
popq %rsi
callq 0x20a0
movq 0x8d9c(%rip), %rax      # 0xbff8
movq (%rax), %rcx
leaq 0x4ee2(%rip), %rdi      # 0x8148
pushq $0x1e
popq %rsi
pushq $0x1
popq %rdx
callq 0x22a0
pushq $0x1
popq %rdi
callq 0x2290
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: util_hexdump
void util_hexdump(const uint8_t *buf, size_t len)
{
	static const char hexdigits[] = "0123456789abcdef";
	char str[16 * 3];
	size_t i;

	if (!buf || !len)
		return;

	for (i = 0; i < len; i++) {
		str[((i % 16) * 3)] = hexdigits[buf[i] >> 4];
		str[((i % 16) * 3) + 1] = hexdigits[buf[i] & 0xf];
		str[((i % 16) * 3) + 2] = ' ';
		if ((i + 1) % 16 == 0) {
			str[16 * 3 - 1] = '\0';
			RS_INFO("%s", str);
		}
	}

	if (i % 16 > 0) {
		str[(i % 16) * 3 - 1] = '\0';
		RS_INFO("%s", str);
	}
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x332b
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x5272(%rip), %r15      # 0x8520
leaq -0x60(%rbp), %r13
xorl %r12d, %r12d
cmpq %r12, %rbx
je 0x3317
movzbl (%r14,%r12), %eax
movl %eax, %ecx
shrl $0x4, %ecx
movb (%rcx,%r15), %cl
movl %r12d, %edx
andl $0xf, %edx
leaq (%rdx,%rdx,2), %rdx
movb %cl, -0x60(%rbp,%rdx)
andl $0xf, %eax
movb (%rax,%r15), %al
movb %al, -0x5f(%rbp,%rdx)
movb $0x20, -0x5e(%rbp,%rdx)
incq %r12
testb $0xf, %r12b
jne 0x32b5
movb $0x0, -0x31(%rbp)
movq 0x8cfe(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x522d(%rip), %rsi      # 0x8531
leaq 0x522e(%rip), %rdx      # 0x8539
movq %r13, %rcx
xorl %eax, %eax
callq 0x2150
jmp 0x32b5
andq $0xf, %rbx
jne 0x332c
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq (%rbx,%rbx,2), %rax
movb $0x0, -0x61(%rbp,%rax)
movq 0x8cbc(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x51eb(%rip), %rsi      # 0x8531
leaq 0x51ec(%rip), %rdx      # 0x8539
leaq -0x60(%rbp), %rcx
xorl %eax, %eax
callq 0x2150
jmp 0x331d
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: get_patch_entry
struct patch_info *get_patch_entry(struct btrtl_info *btrtl)
{
	struct patch_info *n = NULL;

	if (btrtl->proto == HCI_UART_3WIRE)
		n = patch_table;
	else
		n = h4_patch_table;
	for (; n->lmp_subver; n++) {
		if ((n->match_flags & RTL_FW_MATCH_CHIP_TYPE) &&
		    n->chip_type != btrtl->chip_type)
			continue;
		if ((n->match_flags & RTL_FW_MATCH_HCI_VER) &&
		    n->hci_ver != btrtl->hci_ver)
			continue;
		if ((n->match_flags & RTL_FW_MATCH_HCI_REV) &&
		    n->hci_rev != btrtl->hci_rev)
			continue;
		if (n->lmp_subver != btrtl->lmp_subver)
			continue;

		break;
	}

	return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x2, 0x98(%rdi)
leaq 0x8fa4(%rip), %rcx      # 0xc310
leaq 0x917d(%rip), %rax      # 0xc4f0
cmoveq %rcx, %rax
movzwl 0x6(%rax), %ecx
testw %cx, %cx
je 0x33bb
movl (%rax), %edx
testb $0x1, %dl
je 0x3391
movb 0x4(%rax), %sil
cmpb 0x34(%rdi), %sil
jne 0x33b5
testb $0x2, %dl
je 0x33a0
movb 0xa(%rax), %sil
cmpb 0x2e(%rdi), %sil
jne 0x33b5
testb $0x4, %dl
je 0x33af
movzwl 0xc(%rax), %edx
cmpw 0x2c(%rdi), %dx
jne 0x33b5
cmpw 0x2a(%rdi), %cx
je 0x33bb
addq $0x28, %rax
jmp 0x3377
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: os_read
int os_read(int fd, uint8_t * buff, int len)
{
	int n;
	int i;
	int try = 0;

	i = 0;
	n = 0;
	while (n < len) {
		i = read(fd, buff + n, len - n);
		if (i > 0)
			n += i;
		else if (i == 0) {
			RS_DBG("read nothing.");
			continue;
		} else {
			RS_ERR("read error, %s\n", strerror(errno));
			try++;
			if (try > READ_TRY_MAX) {
				RS_ERR("read reaches max try number.\n");
				return -1;
			}
			continue;
		}
	}

	return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebx
movq %rsi, -0x40(%rbp)
movl %edi, %r12d
xorl %r14d, %r14d
movq $0x0, -0x30(%rbp)
movl %ebx, %eax
subl %r14d, %eax
jle 0x34ac
movl %r14d, %r13d
addq -0x40(%rbp), %r13
movslq %eax, %r15
movl %r12d, %edi
movq %r13, %rsi
movq %r15, %rdx
callq 0x2110
testl %eax, %eax
jg 0x3481
jne 0x3435
cmpb $0x0, 0x8ece(%rip)      # 0xc2e0
je 0x33f7
movq 0x8bdd(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x5126(%rip), %rsi      # 0x854b
leaq 0x510d(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
jmp 0x33f7
movq 0x8bbc(%rip), %rax      # 0xbff8
movq (%rax), %rax
movq %rax, -0x38(%rbp)
callq 0x2040
movl (%rax), %edi
callq 0x22b0
movq -0x38(%rbp), %rdi
leaq 0x5104(%rip), %rsi      # 0x855e
leaq 0x50d8(%rip), %rdx      # 0x8539
movq %rax, %rcx
xorl %eax, %eax
callq 0x2150
movq -0x30(%rbp), %rcx
leal 0x1(%rcx), %eax
cmpl $0x6, %ecx
movq %rax, -0x30(%rbp)
jl 0x33f7
jmp 0x3489
addl %eax, %r14d
jmp 0x33e2
movq 0x8b68(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x50df(%rip), %rsi      # 0x8579
leaq 0x5098(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
pushq $-0x1
popq %r14
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: hci_dump_evt
void hci_dump_evt(uint8_t * buf, uint16_t len)
{
	int n;
	int i;

	if (!buf || !len) {
		RS_ERR("Invalid parameters %p, %u.\n", buf, len);
		return;
	}

	n = 0;
	for (i = 0; i < len; i++) {
		n += sprintf(hci_dump_buf + n, "%02x ", buf[i]);
		if ((i + 1) % 16 == 0) {
			RS_DBG(" %s\n", hci_dump_buf);
			n = 0;
		}
	}

	if (i % 16)
		RS_DBG(" %s\n", hci_dump_buf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rdi, %rdi
je 0x357e
testw %si, %si
je 0x357e
movl %esi, -0x2c(%rbp)
movzwl %si, %r13d
negq %r13
pushq $0x1
popq %r14
leaq 0x916a(%rip), %r15      # 0xc660
xorl %r12d, %r12d
leaq (%r14,%r13), %rax
cmpq $0x1, %rax
je 0x3560
movslq %r12d, %rdi
addq %r15, %rdi
movzbl -0x1(%rbx,%r14), %edx
leaq 0x50b3(%rip), %rsi      # 0x85c9
xorl %eax, %eax
callq 0x2280
testb $0xf, %r14b
je 0x3528
addl %eax, %r12d
jmp 0x3534
xorl %r12d, %r12d
cmpb $0x0, 0x8dae(%rip)      # 0xc2e0
jne 0x3539
incq %r14
jmp 0x34f9
movq 0x8ab8(%rip), %rax      # 0xbff8
movq (%rax), %rdi
xorl %r12d, %r12d
leaq 0x5082(%rip), %rsi      # 0x85cf
leaq 0x4fe5(%rip), %rdx      # 0x8539
movq %r15, %rcx
xorl %eax, %eax
callq 0x2150
jmp 0x3534
testb $0xf, -0x2c(%rbp)
je 0x356f
cmpb $0x0, 0x8d73(%rip)      # 0xc2e0
jne 0x35b2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8a73(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movzwl %si, %r8d
leaq 0x500f(%rip), %rsi      # 0x85a2
leaq 0x4f9f(%rip), %rdx      # 0x8539
movq %rbx, %rcx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2150
movq 0x8a3f(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x500c(%rip), %rsi      # 0x85cf
leaq 0x4f6f(%rip), %rdx      # 0x8539
leaq 0x908f(%rip), %rcx      # 0xc660
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2150
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: bachk
int bachk(const char *str)
{
	if (!str)
		return -1;

	if (strlen(str) != 17)
		return -1;

	while (*str) {
		if (!isxdigit(*str++))
			return -1;

		if (!isxdigit(*str++))
			return -1;

		if (*str == 0)
			break;

		if (*str++ != ':')
			return -1;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq $-0x1
popq %r15
testq %rdi, %rdi
je 0x3e21
movq %rdi, %rbx
callq 0x2090
cmpq $0x11, %rax
jne 0x3e21
xorl %r14d, %r14d
movsbq (%rbx), %r12
testq %r12, %r12
je 0x3e24
callq 0x22e0
movq (%rax), %rax
testb $0x10, 0x1(%rax,%r12,2)
je 0x3e21
movsbq 0x1(%rbx), %rcx
testb $0x10, 0x1(%rax,%rcx,2)
je 0x3e21
movb 0x2(%rbx), %al
testb %al, %al
je 0x3e24
addq $0x3, %rbx
cmpb $0x3a, %al
je 0x3ded
movl %r15d, %r14d
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: rtk_vendor_change_speed_h5
int rtk_vendor_change_speed_h5(int fd, RT_U32 baudrate)
{
	struct sk_buff *cmd_change_bdrate = NULL;
	unsigned char cmd[7] = { 0 };
	int retlen;
	unsigned char bytes[READ_DATA_SIZE];
	struct sigaction sa;

	sa.sa_handler = h5_tinit_sig_alarm;
	sigaction(SIGALRM, &sa, NULL);

	cmd[0] = 0x17;	//ocf
	cmd[1] = 0xfc;	//ogf, vendor specified

	cmd[2] = 4;	//length;

	baudrate = cpu_to_le32(baudrate);
#ifdef BAUDRATE_4BYTES
	memcpy((RT_U16 *) & cmd[3], &baudrate, 4);
#else
	memcpy((RT_U16 *) & cmd[3], &baudrate, 2);

	cmd[5] = 0;
	cmd[6] = 0;
#endif

	RS_DBG("baudrate in change speed command: 0x%x 0x%x 0x%x 0x%x \n",
	       cmd[3], cmd[4], cmd[5], cmd[6]);

	cmd_change_bdrate =
	    h5_prepare_pkt(&rtk_hw_cfg, cmd, 7, HCI_COMMAND_PKT);
	if (!cmd_change_bdrate) {
		RS_ERR("Prepare command packet for change speed fail");
		return -1;
	}

	rtk_hw_cfg.host_last_cmd = cmd_change_bdrate;
	alarm(1);
	write(fd, cmd_change_bdrate->data, cmd_change_bdrate->data_len);

	while (rtk_hw_cfg.link_estab_state == H5_INIT) {
		if ((retlen = read_check_rtk(fd, &bytes, READ_DATA_SIZE)) == -1) {
			perror("read fail");
			return -1;
		}
		//add pure ack check
		h5_recv(&rtk_hw_cfg, &bytes, retlen);
	}

	alarm(0);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xc0, %rsp
movl %esi, %r14d
movl %edi, %ebx
leaq 0x12b(%rip), %rax       # 0x46ce
leaq -0xc8(%rbp), %rsi
movq %rax, (%rsi)
pushq $0xe
popq %rdi
xorl %edx, %edx
callq 0x2060
movw $0xfc17, -0x17(%rbp)    # imm = 0xFC17
movb $0x4, -0x15(%rbp)
movl %r14d, -0x14(%rbp)
cmpb $0x0, 0x7d14(%rip)      # 0xc2e0
jne 0x464d
leaq -0x17(%rbp), %rdi
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
callq 0x47a2
testq %rax, %rax
je 0x4699
movq %rax, %r14
movq %rax, 0x8110(%rip)      # 0xc700
pushq $0x1
popq %rdi
callq 0x20f0
movq %r14, %rsi
addq $0x8, %rsi
movl 0x4(%r14), %edx
movl %ebx, %edi
callq 0x2070
leaq -0x30(%rbp), %r14
cmpl $0x2, 0x80df(%rip)      # 0xc6f4
jne 0x4636
movl %ebx, %edi
movq %r14, %rsi
callq 0x4948
cmpl $-0x1, %eax
je 0x46ba
movq %r14, %rdi
movl %eax, %esi
callq 0x498d
jmp 0x460e
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x20f0
movl %ebx, %eax
addq $0xc0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl %r14d, %eax
shrl $0x18, %eax
movl %r14d, %r9d
shrl $0x10, %r9d
movl %r14d, %r8d
shrl $0x8, %r8d
movq 0x7990(%rip), %rcx      # 0xbff8
movq (%rcx), %rdi
movl $0xff, %ecx
andl %ecx, %r14d
andl %ecx, %r8d
andl %ecx, %r9d
movl %eax, (%rsp)
leaq 0x444f(%rip), %rsi      # 0x8ad2
leaq 0x3eaf(%rip), %rdx      # 0x8539
movl %r14d, %ecx
xorl %eax, %eax
callq 0x2150
jmp 0x45ce
movq 0x7958(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x4465(%rip), %rsi      # 0x8b0f
leaq 0x3e88(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
jmp 0x46c6
leaq 0x45ed(%rip), %rdi      # 0x8cae
callq 0x2230
pushq $-0x1
popq %rbx
jmp 0x463f
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: h5_tinit_sig_alarm
static void h5_tinit_sig_alarm(int sig)
{
	static int retries = 0;
	if (retries < rtk_hw_cfg.h5_max_retries) {
		retries++;
		if (rtk_hw_cfg.host_last_cmd) {
			int len =
			    write(rtk_hw_cfg.serial_fd,
				  rtk_hw_cfg.host_last_cmd->data,
				  rtk_hw_cfg.host_last_cmd->data_len);
			RS_DBG("3-wire change baudrate re send:%d, len:%d",
			       retries, len);
			alarm(1);
			return;
		} else {
			RS_DBG
			    ("3-wire init timeout without last command stored\n");
		}
	}

	tcflush(rtk_hw_cfg.serial_fd, TCIOFLUSH);
	RS_ERR("H5 init process timed out");
	exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x90b8(%rip), %eax      # 0xd790
cmpl 0x8032(%rip), %eax      # 0xc710
jge 0x4740
incl %eax
movl %eax, 0x90a8(%rip)      # 0xd790
movq 0x8011(%rip), %rsi      # 0xc700
testq %rsi, %rsi
je 0x4718
movl 0x8026(%rip), %edi      # 0xc720
movl 0x4(%rsi), %edx
addq $0x8, %rsi
callq 0x2070
cmpb $0x0, 0x7bd3(%rip)      # 0xc2e0
jne 0x4775
pushq $0x1
popq %rdi
popq %rbp
jmp 0x20f0
cmpb $0x0, 0x7bc1(%rip)      # 0xc2e0
je 0x4740
movq 0x78d0(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x4c65(%rip), %rsi      # 0x9397
leaq 0x3e00(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
movl 0x7fda(%rip), %edi      # 0xc720
pushq $0x2
popq %rsi
callq 0x20a0
movq 0x78a3(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x4c6e(%rip), %rsi      # 0x93cd
leaq 0x3dd3(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
pushq $0x1
popq %rdi
callq 0x2290
movq 0x787c(%rip), %rcx      # 0xbff8
movq (%rcx), %rdi
movl 0x900b(%rip), %ecx      # 0xd790
leaq 0x4bdc(%rip), %rsi      # 0x9368
leaq 0x3da6(%rip), %rdx      # 0x8539
movl %eax, %r8d
xorl %eax, %eax
callq 0x2150
jmp 0x470f
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: h5_tsync_sig_alarm
static void h5_tsync_sig_alarm(int sig)
{
	unsigned char h5sync[2] = { 0x01, 0x7E };
	static int retries = 0;
	struct itimerval value;

	if (retries < rtk_hw_cfg.h5_max_retries) {
		retries++;
		struct sk_buff *nskb =
		    h5_prepare_pkt(&rtk_hw_cfg, h5sync, sizeof(h5sync),
				   H5_LINK_CTL_PKT);
		int len =
		    write(rtk_hw_cfg.serial_fd, nskb->data, nskb->data_len);
		RS_DBG("3-wire sync pattern resend : %d, len: %d\n", retries,
		       len);

		skb_free(nskb);
		//gordon add 2013-6-7 retry per 250ms
		value.it_value.tv_sec = 0;
		value.it_value.tv_usec = 250000;
		value.it_interval.tv_sec = 0;
		value.it_interval.tv_usec = 250000;
		setitimer(ITIMER_REAL, &value, NULL);
		//gordon end

		return;
	}

	tcflush(rtk_hw_cfg.serial_fd, TCIOFLUSH);
	RS_ERR("H5 sync timed out\n");
	exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x28, %rsp
movw $0x7e01, -0xa(%rbp)     # imm = 0x7E01
movl 0x8768(%rip), %eax      # 0xd794
cmpl 0x76de(%rip), %eax      # 0xc710
jge 0x50c9
incl %eax
movl %eax, 0x8754(%rip)      # 0xd794
leaq -0xa(%rbp), %rdi
pushq $0x2
popq %rsi
pushq $0xf
popq %rdx
callq 0x47a2
movq %rax, %rbx
movl 0x76c8(%rip), %edi      # 0xc720
movl 0x4(%rax), %edx
leaq 0x8(%rax), %rsi
callq 0x2070
cmpb $0x0, 0x7275(%rip)      # 0xc2e0
jne 0x509f
movq %rbx, %rdi
callq 0x2030
leaq -0x30(%rbp), %rsi
andq $0x0, 0x10(%rsi)
movl $0x3d090, %eax          # imm = 0x3D090
movq %rax, 0x18(%rsi)
andq $0x0, (%rsi)
movq %rax, 0x8(%rsi)
xorl %edi, %edi
xorl %edx, %edx
callq 0x21b0
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
movq 0x6f52(%rip), %rcx      # 0xbff8
movq (%rcx), %rdi
movl 0x86e5(%rip), %ecx      # 0xd794
leaq 0x4806(%rip), %rsi      # 0x98bc
leaq 0x347c(%rip), %rdx      # 0x8539
movl %eax, %r8d
xorl %eax, %eax
callq 0x2150
jmp 0x506d
movl 0x7651(%rip), %edi      # 0xc720
pushq $0x2
popq %rsi
callq 0x20a0
movq 0x6f1a(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x4803(%rip), %rsi      # 0x98eb
leaq 0x344a(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
pushq $0x1
popq %rdi
callq 0x2290
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: h5_tconf_sig_alarm
static void h5_tconf_sig_alarm(int sig)
{
	unsigned char h5conf[3] = { 0x03, 0xFC, 0x14 };
	static int retries = 0;
	struct itimerval value;

	if (retries < rtk_hw_cfg.h5_max_retries) {
		retries++;
		struct sk_buff *nskb =
		    h5_prepare_pkt(&rtk_hw_cfg, h5conf, 3, H5_LINK_CTL_PKT);
		int len =
		    write(rtk_hw_cfg.serial_fd, nskb->data, nskb->data_len);
		RS_DBG("3-wire config pattern resend : %d , len: %d", retries,
		       len);
		skb_free(nskb);

		//gordon add 2013-6-7 retry per 250ms
		value.it_value.tv_sec = 0;
		value.it_value.tv_usec = 250000;
		value.it_interval.tv_sec = 0;
		value.it_interval.tv_usec = 250000;
		setitimer(ITIMER_REAL, &value, NULL);

		return;
	}

	tcflush(rtk_hw_cfg.serial_fd, TCIOFLUSH);
	RS_ERR("H5 config timed out\n");
	exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x28, %rsp
movl 0x868b(%rip), %eax      # 0xd798
cmpl 0x75fd(%rip), %eax      # 0xc710
jge 0x51ad
incl %eax
movl %eax, 0x8677(%rip)      # 0xd798
leaq 0x33e8(%rip), %rdi      # 0x8510
pushq $0x3
popq %rsi
pushq $0xf
popq %rdx
callq 0x47a2
movq %rax, %rbx
movl 0x75e4(%rip), %edi      # 0xc720
movl 0x4(%rax), %edx
leaq 0x8(%rax), %rsi
callq 0x2070
cmpb $0x0, 0x7191(%rip)      # 0xc2e0
jne 0x5183
movq %rbx, %rdi
callq 0x2030
leaq -0x28(%rbp), %rsi
andq $0x0, 0x10(%rsi)
movl $0x3d090, %eax          # imm = 0x3D090
movq %rax, 0x18(%rsi)
andq $0x0, (%rsi)
movq %rax, 0x8(%rsi)
xorl %edi, %edi
xorl %edx, %edx
callq 0x21b0
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
movq 0x6e6e(%rip), %rcx      # 0xbff8
movq (%rcx), %rdi
movl 0x8605(%rip), %ecx      # 0xd798
leaq 0x476f(%rip), %rsi      # 0x9909
leaq 0x3398(%rip), %rdx      # 0x8539
movl %eax, %r8d
xorl %eax, %eax
callq 0x2150
jmp 0x5151
movl 0x756d(%rip), %edi      # 0xc720
pushq $0x2
popq %rsi
callq 0x20a0
movq 0x6e36(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x476e(%rip), %rsi      # 0x993a
leaq 0x3366(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
pushq $0x1
popq %rdi
callq 0x2290
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: rtk_get_bt_firmware
int rtk_get_bt_firmware(struct btrtl_info *btrtl, RT_U8 **fw_buf)
{
	const char *filename;
	struct stat st;
	int fd = -1;
	size_t fwsize;
	static char firmware_file_name[PATH_MAX] = { 0 };
	int ret = 0;

	sprintf(firmware_file_name, "%s", FIRMWARE_DIRECTORY);
	strcat(firmware_file_name, btrtl->patch_ent->patch_file);
	filename = firmware_file_name;

	if (stat(filename, &st) < 0) {
		RS_ERR("Can't access firmware %s, %s", filename,
		       strerror(errno));
		return -1;
	}

	fwsize = st.st_size;

	if ((fd = open(filename, O_RDONLY)) < 0) {
		RS_ERR("Can't open firmware, errno:%d", errno);
		return -1;
	}

	if (!(*fw_buf = malloc(fwsize))) {
		RS_ERR("Can't alloc memory for fw&config, errno:%d", errno);
		close(fd);
		return -1;
	}

	if (read(fd, *fw_buf, fwsize) < (ssize_t) fwsize) {
		free(*fw_buf);
		*fw_buf = NULL;
		close(fd);
		return -1;
	}
	RS_DBG("Load FW OK");
	close(fd);
	return fwsize;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r15
movups 0x37a3(%rip), %xmm0     # 0x89d0
movaps %xmm0, 0x755c(%rip)     # 0xc790
movabsq $0x2f74626c74722f, %rax # imm = 0x2F74626C74722F
movq %rax, 0x7558(%rip)      # 0xc79d
leaq 0x7544(%rip), %rbx      # 0xc790
movq 0x90(%rdi), %rax
movq 0x10(%rax), %rsi
movq %rbx, %rdi
callq 0x2270
leaq -0xa8(%rbp), %rsi
movq %rbx, %rdi
callq 0x2160
testl %eax, %eax
js 0x52f8
movq -0x78(%rbp), %r14
leaq 0x750f(%rip), %rdi      # 0xc790
xorl %esi, %esi
xorl %eax, %eax
callq 0x2200
testl %eax, %eax
js 0x5332
movl %eax, %ebx
movq %r14, %rdi
callq 0x2190
movq %rax, (%r15)
testq %rax, %rax
je 0x5360
movl %ebx, %edi
movq %rax, %rsi
movq %r14, %rdx
callq 0x2110
cmpq %r14, %rax
jge 0x52d3
movq (%r15), %rdi
callq 0x2030
andq $0x0, (%r15)
movl %ebx, %edi
callq 0x2100
pushq $-0x1
popq %r14
jmp 0x52e7
cmpb $0x0, 0x7006(%rip)      # 0xc2e0
jne 0x538e
movl %ebx, %edi
callq 0x2100
movl %r14d, %eax
addq $0x98, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x6cf9(%rip), %rax      # 0xbff8
movq (%rax), %rbx
callq 0x2040
movl (%rax), %edi
callq 0x22b0
leaq 0x38be(%rip), %rsi      # 0x8bd3
leaq 0x321d(%rip), %rdx      # 0x8539
leaq 0x746d(%rip), %rcx      # 0xc790
movq %rbx, %rdi
movq %rax, %r8
xorl %eax, %eax
callq 0x2150
jmp 0x52cd
movq 0x6cbf(%rip), %rax      # 0xbff8
movq (%rax), %rbx
callq 0x2040
movl (%rax), %ecx
leaq 0x38b1(%rip), %rsi      # 0x8bfb
leaq 0x31e8(%rip), %rdx      # 0x8539
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2150
jmp 0x52cd
movq 0x6c91(%rip), %rax      # 0xbff8
movq (%rax), %r14
callq 0x2040
movl (%rax), %ecx
leaq 0x38ac(%rip), %rsi      # 0x8c24
leaq 0x31ba(%rip), %rdx      # 0x8539
movq %r14, %rdi
xorl %eax, %eax
callq 0x2150
jmp 0x52c6
movq 0x6c63(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x38bb(%rip), %rsi      # 0x8c5a
leaq 0x3193(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
jmp 0x52e0
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: rtk_get_chip_type
void rtk_get_chip_type(int dd)
{
	unsigned char bytes[READ_DATA_SIZE];
	int retlen;
	struct sigaction sa;
	/* 0xB000A094 */
	unsigned char cmd_buff[] = {0x61, 0xfc,
		0x05, 0x00, 0x94, 0xa0, 0x00, 0xb0};
	struct sk_buff *nskb;
	struct btrtl_info *btrtl = &rtk_hw_cfg;

	nskb = h5_prepare_pkt(btrtl, cmd_buff, sizeof(cmd_buff),
			HCI_COMMAND_PKT);
	if (btrtl->host_last_cmd){
		skb_free(btrtl->host_last_cmd);
		btrtl->host_last_cmd = NULL;
	}

	btrtl->host_last_cmd = nskb;

	write(dd, nskb->data, nskb->data_len);
	RS_INFO("RTK send HCI_VENDOR_READ_CHIP_TYPE_Command\n");

	alarm(0);
	memset(&sa, 0, sizeof(sa));
	sa.sa_flags = SA_NOCLDSTOP;
	sa.sa_handler = rtk_get_chip_type_timeout;
	sigaction(SIGALRM, &sa, NULL);

	alarm(3);
	while (btrtl->chip_type_cmd_state != event_received) {
		if ((retlen = read_check_rtk(dd, &bytes, READ_DATA_SIZE)) == -1) {
			perror("rtk get chip type: read fail");
			return;
		}
		h5_recv(btrtl, &bytes, retlen);
	}
	alarm(0);
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xc0, %rsp
movl %edi, %ebx
movabsq $-0x4fff5f6bfffa039f, %rax # imm = 0xB000A0940005FC61
leaq -0x18(%rbp), %rdi
movq %rax, (%rdi)
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
callq 0x47a2
movq %rax, %r14
movq 0x7318(%rip), %rdi      # 0xc700
callq 0x2030
movq %r14, 0x730c(%rip)      # 0xc700
movl 0x4(%r14), %edx
addq $0x8, %r14
movl %ebx, %edi
movq %r14, %rsi
callq 0x2070
movq 0x6beb(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x3853(%rip), %rsi      # 0x8c6a
leaq 0x311b(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
xorl %edi, %edi
callq 0x20f0
leaq -0xc0(%rbp), %r14
movl $0x90, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x20d0
movl $0x1, 0x80(%r14)
leaq 0x66(%rip), %rax        # 0x54ba
movq %rax, -0x8(%r14)
pushq $0xe
popq %rdi
leaq -0xc8(%rbp), %rsi
xorl %edx, %edx
callq 0x2060
pushq $0x3
popq %rdi
callq 0x20f0
leaq -0x30(%rbp), %r14
cmpl $0x2, 0x72ec(%rip)      # 0xc768
je 0x5499
movl %ebx, %edi
movq %r14, %rsi
callq 0x4948
cmpl $-0x1, %eax
je 0x54ac
movq %r14, %rdi
movl %eax, %esi
callq 0x498d
jmp 0x5475
xorl %edi, %edi
callq 0x20f0
addq $0xc0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x37e8(%rip), %rdi      # 0x8c9b
callq 0x2230
jmp 0x54a0
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: rtk_get_chip_type_timeout
static void rtk_get_chip_type_timeout(int sig)
{
	static int retries = 0;
	int len = 0;
	struct btrtl_info *btrtl = &rtk_hw_cfg;

	RS_INFO("RTK get HCI_VENDOR_READ_RTK_CHIP_TYPE_Command\n");
	if (retries < btrtl->h5_max_retries) {
		RS_DBG("rtk get chip type timerout, retry:%d\n", retries);
		if (btrtl->host_last_cmd) {
			len = write(btrtl->serial_fd,
				    btrtl->host_last_cmd->data,
				    btrtl->host_last_cmd->data_len);
		}
		retries++;
		alarm(3);
		return;
	}
	tcflush(btrtl->serial_fd, TCIOFLUSH);
	RS_ERR("rtk get chip type cmd complete event timed out\n");
	exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x6b31(%rip), %rbx      # 0xbff8
movq (%rbx), %rdi
leaq 0x4489(%rip), %rsi      # 0x995a
leaq 0x3061(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
movl 0x82b7(%rip), %ecx      # 0xd79c
cmpl 0x7225(%rip), %ecx      # 0xc710
jge 0x5542
cmpb $0x0, 0x6dec(%rip)      # 0xc2e0
jne 0x5528
movq 0x7203(%rip), %rsi      # 0xc700
testq %rsi, %rsi
je 0x5514
movl 0x7218(%rip), %edi      # 0xc720
movl 0x4(%rsi), %edx
addq $0x8, %rsi
callq 0x2070
incl 0x8282(%rip)            # 0xd79c
pushq $0x3
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x20f0
movq (%rbx), %rdi
leaq 0x445c(%rip), %rsi      # 0x998e
leaq 0x3000(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
jmp 0x54f6
movl 0x71d8(%rip), %edi      # 0xc720
pushq $0x2
popq %rsi
callq 0x20a0
movq (%rbx), %rdi
leaq 0x445f(%rip), %rsi      # 0x99b9
leaq 0x2fd8(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
pushq $0x1
popq %rdi
callq 0x2290
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: rtk_get_eversion
void rtk_get_eversion(int dd)
{
	unsigned char bytes[READ_DATA_SIZE];
	int retlen;
	struct sigaction sa;
	unsigned char read_rom_patch_cmd[3] = { 0x6d, 0xfc, 00 };
	struct sk_buff *nskb =
	    h5_prepare_pkt(&rtk_hw_cfg, read_rom_patch_cmd, 3, HCI_COMMAND_PKT);

	if (rtk_hw_cfg.host_last_cmd) {
		skb_free(rtk_hw_cfg.host_last_cmd);
		rtk_hw_cfg.host_last_cmd = NULL;
	}

	rtk_hw_cfg.host_last_cmd = nskb;

	write(dd, nskb->data, nskb->data_len);
	rtk_hw_cfg.rom_version_cmd_state = cmd_has_sent;
	RS_DBG("RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command\n");

	alarm(0);
	memset(&sa, 0, sizeof(sa));
	sa.sa_flags = SA_NOCLDSTOP;
	sa.sa_handler = rtk_get_eversion_timeout;
	sigaction(SIGALRM, &sa, NULL);

	alarm(3);
	while (rtk_hw_cfg.rom_version_cmd_state != event_received) {
		if ((retlen = read_check_rtk(dd, &bytes, READ_DATA_SIZE)) == -1) {
			perror("rtk get eversion: read fail");
			return;
		}
		h5_recv(&rtk_hw_cfg, &bytes, retlen);
	}
	alarm(0);
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xb0, %rsp
movl %edi, %ebx
leaq 0x489a(%rip), %rdi      # 0x9e21
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
callq 0x47a2
movq %rax, %r14
movq 0x7164(%rip), %rdi      # 0xc700
callq 0x2030
movq %r14, 0x7158(%rip)      # 0xc700
movl 0x4(%r14), %edx
addq $0x8, %r14
movl %ebx, %edi
movq %r14, %rsi
callq 0x2070
movl $0x1, 0x719c(%rip)      # 0xc760
cmpb $0x0, 0x6d15(%rip)      # 0xc2e0
jne 0x5658
xorl %edi, %edi
callq 0x20f0
leaq -0xb0(%rbp), %r14
movl $0x90, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x20d0
movl $0x1, 0x80(%r14)
leaq 0x8a(%rip), %rax        # 0x568a
movq %rax, -0x8(%r14)
pushq $0xe
popq %rdi
leaq -0xb8(%rbp), %rsi
xorl %edx, %edx
callq 0x2060
pushq $0x3
popq %rdi
callq 0x20f0
leaq -0x20(%rbp), %r14
cmpl $0x2, 0x7138(%rip)      # 0xc760
je 0x5645
movl %ebx, %edi
movq %r14, %rsi
callq 0x4948
cmpl $-0x1, %eax
je 0x567c
movq %r14, %rdi
movl %eax, %esi
callq 0x498d
jmp 0x5621
xorl %edi, %edi
callq 0x20f0
addq $0xb0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0x6999(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x364f(%rip), %rsi      # 0x8cb8
leaq 0x2ec9(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
jmp 0x55d1
leaq 0x366d(%rip), %rdi      # 0x8cf0
callq 0x2230
jmp 0x564c
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: rtk_get_eversion_timeout
static void rtk_get_eversion_timeout(int sig)
{
	static int retries = 0;
	int len = 0;

	RS_DBG("RTK get HCI_VENDOR_READ_RTK_ROM_VERISION_Command\n");
	if (retries < rtk_hw_cfg.h5_max_retries) {
		RS_DBG("rtk get eversion timerout, retry:%d\n", retries);
		if (rtk_hw_cfg.host_last_cmd) {
			len = write(rtk_hw_cfg.serial_fd,
				    rtk_hw_cfg.host_last_cmd->data,
				    rtk_hw_cfg.host_last_cmd->data_len);
		}
		retries++;
		alarm(3);
		return;
	}
	tcflush(rtk_hw_cfg.serial_fd, TCIOFLUSH);
	RS_ERR("rtk get eversion cmd complete event timed out\n");
	exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpb $0x0, 0x6c4b(%rip)      # 0xc2e0
jne 0x56db
movl 0x8103(%rip), %ecx      # 0xd7a0
cmpl 0x706d(%rip), %ecx      # 0xc710
jge 0x571d
cmpb $0x0, 0x6c34(%rip)      # 0xc2e0
jne 0x56fc
movq 0x704b(%rip), %rsi      # 0xc700
testq %rsi, %rsi
je 0x56cc
movl 0x7060(%rip), %edi      # 0xc720
movl 0x4(%rsi), %edx
addq $0x8, %rsi
callq 0x2070
incl 0x80ce(%rip)            # 0xd7a0
pushq $0x3
popq %rdi
popq %rbp
jmp 0x20f0
movq 0x6916(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x4308(%rip), %rsi      # 0x99f4
leaq 0x2e46(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
jmp 0x5697
movq 0x68f5(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x431e(%rip), %rsi      # 0x9a2b
leaq 0x2e25(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
jmp 0x56ae
movl 0x6ffd(%rip), %edi      # 0xc720
pushq $0x2
popq %rsi
callq 0x20a0
movq 0x68c6(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x4319(%rip), %rsi      # 0x9a55
leaq 0x2df6(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
pushq $0x1
popq %rdi
callq 0x2290
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: rtk_get_lmp_version
void rtk_get_lmp_version(int dd)
{
	unsigned char bytes[READ_DATA_SIZE];
	int retlen;
	struct sigaction sa;
	unsigned char read_rom_patch_cmd[3] = { 0x01, 0x10, 00 };
	struct sk_buff *nskb = h5_prepare_pkt(&rtk_hw_cfg, read_rom_patch_cmd, 3, HCI_COMMAND_PKT);	//data:len+head:4

	if (rtk_hw_cfg.host_last_cmd) {
		skb_free(rtk_hw_cfg.host_last_cmd);
		rtk_hw_cfg.host_last_cmd = NULL;
	}

	rtk_hw_cfg.host_last_cmd = nskb;

	write(dd, nskb->data, nskb->data_len);
	rtk_hw_cfg.hci_version_cmd_state = cmd_has_sent;
	RS_DBG("RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command\n");

	alarm(0);
	memset(&sa, 0, sizeof(sa));
	sa.sa_flags = SA_NOCLDSTOP;
	sa.sa_handler = rtk_get_lmp_version_timeout;
	sigaction(SIGALRM, &sa, NULL);

	alarm(3);
	while (rtk_hw_cfg.hci_version_cmd_state != event_received) {
		if ((retlen = read_check_rtk(dd, &bytes, READ_DATA_SIZE)) == -1) {
			perror("read fail");
			return;
		}
		h5_recv(&rtk_hw_cfg, &bytes, retlen);
	}
	alarm(0);
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xb0, %rsp
movl %edi, %ebx
leaq 0x4674(%rip), %rdi      # 0x9ddd
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
callq 0x47a2
movq %rax, %r14
movq 0x6f82(%rip), %rdi      # 0xc700
callq 0x2030
movq %r14, 0x6f76(%rip)      # 0xc700
movl 0x4(%r14), %edx
addq $0x8, %r14
movl %ebx, %edi
movq %r14, %rsi
callq 0x2070
movl $0x1, 0x6fbe(%rip)      # 0xc764
cmpb $0x0, 0x6b33(%rip)      # 0xc2e0
jne 0x583a
xorl %edi, %edi
callq 0x20f0
leaq -0xb0(%rbp), %r14
movl $0x90, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x20d0
movl $0x1, 0x80(%r14)
leaq 0x8a(%rip), %rax        # 0x586c
movq %rax, -0x8(%r14)
pushq $0xe
popq %rdi
leaq -0xb8(%rbp), %rsi
xorl %edx, %edx
callq 0x2060
pushq $0x3
popq %rdi
callq 0x20f0
leaq -0x20(%rbp), %r14
cmpl $0x2, 0x6f5a(%rip)      # 0xc764
je 0x5827
movl %ebx, %edi
movq %r14, %rsi
callq 0x4948
cmpl $-0x1, %eax
je 0x585e
movq %r14, %rdi
movl %eax, %esi
callq 0x498d
jmp 0x5803
xorl %edi, %edi
callq 0x20f0
addq $0xb0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0x67b7(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x346d(%rip), %rsi      # 0x8cb8
leaq 0x2ce7(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
jmp 0x57b3
leaq 0x3449(%rip), %rdi      # 0x8cae
callq 0x2230
jmp 0x582e
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: rtk_get_lmp_version_timeout
static void rtk_get_lmp_version_timeout(int sig)
{
	static int retries = 0;
	RS_DBG("RTK get HCI_VENDOR_READ_RTK_LMP_VERISION_Command\n");
	if (retries < rtk_hw_cfg.h5_max_retries) {
		RS_DBG("rtk get lmp version timeout, retry: %d\n", retries);
		if (rtk_hw_cfg.host_last_cmd) {
			int len = write(rtk_hw_cfg.serial_fd,
					rtk_hw_cfg.host_last_cmd->data,
					rtk_hw_cfg.host_last_cmd->data_len);
		}
		retries++;
		alarm(3);
		return;
	}
	tcflush(rtk_hw_cfg.serial_fd, TCIOFLUSH);
	RS_ERR("rtk get lmp version cmd complete event timed out\n");
	exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpb $0x0, 0x6a69(%rip)      # 0xc2e0
jne 0x58bd
movl 0x7f25(%rip), %ecx      # 0xd7a4
cmpl 0x6e8b(%rip), %ecx      # 0xc710
jge 0x58ff
cmpb $0x0, 0x6a52(%rip)      # 0xc2e0
jne 0x58de
movq 0x6e69(%rip), %rsi      # 0xc700
testq %rsi, %rsi
je 0x58ae
movl 0x6e7e(%rip), %edi      # 0xc720
movl 0x4(%rsi), %edx
addq $0x8, %rsi
callq 0x2070
incl 0x7ef0(%rip)            # 0xd7a4
pushq $0x3
popq %rdi
popq %rbp
jmp 0x20f0
movq 0x6734(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x41c1(%rip), %rsi      # 0x9a8f
leaq 0x2c64(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
jmp 0x5879
movq 0x6713(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x41d7(%rip), %rsi      # 0x9ac6
leaq 0x2c43(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
jmp 0x5890
movl 0x6e1b(%rip), %edi      # 0xc720
pushq $0x2
popq %rsi
callq 0x20a0
movq 0x66e4(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x41d5(%rip), %rsi      # 0x9af3
leaq 0x2c14(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
pushq $0x1
popq %rdi
callq 0x2290
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: rtk_get_fw_project_id
uint8_t rtk_get_fw_project_id(uint8_t * p_buf)
{
	uint8_t opcode;
	uint8_t len;
	uint8_t data = 0;

	do {
		opcode = *p_buf;
		len = *(p_buf - 1);
		if (opcode == 0x00) {
			if (len == 1) {
				data = *(p_buf - 2);
				RS_DBG
				    ("rtk_get_fw_project_id: opcode %d, len %d, data %d",
				     opcode, len, data);
				break;
			} else {
				RS_ERR("rtk_get_fw_project_id: invalid len %d",
				       len);
			}
		}
		p_buf -= len + 2;
	} while (*p_buf != 0xFF);

	return data;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb (%rdi), %al
movq 0x66aa(%rip), %r13      # 0xbff8
leaq 0x33ee(%rip), %r14      # 0x8d43
leaq 0x2bdd(%rip), %r15      # 0x8539
movzbl -0x1(%rbx), %r12d
testb %al, %al
jne 0x597f
cmpl $0x1, %r12d
je 0x5994
movq (%r13), %rdi
movq %r14, %rsi
movq %r15, %rdx
movl %r12d, %ecx
xorl %eax, %eax
callq 0x2150
movl %r12d, %eax
subq %rax, %rbx
movb -0x2(%rbx), %al
addq $-0x2, %rbx
cmpb $-0x1, %al
jne 0x595c
xorl %ebx, %ebx
jmp 0x59a0
movb -0x2(%rbx), %bl
cmpb $0x0, 0x6942(%rip)      # 0xc2e0
jne 0x59b1
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movzbl %bl, %r9d
movq (%r13), %rdi
leaq 0x334c(%rip), %rsi      # 0x8d0c
leaq 0x2b72(%rip), %rdx      # 0x8539
pushq $0x1
popq %r8
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x2150
jmp 0x59a0
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: skb_alloc
static __inline struct sk_buff *skb_alloc(unsigned int len)
{
	struct sk_buff *skb = NULL;
	if ((skb = malloc(len + 8))) {
		skb->max_len = len;
		skb->data_len = 0;
	} else {
		RS_ERR("Allocate skb fails!!!");
		skb = NULL;
	}
	memset(skb->data, 0, len);
	return skb;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edi, %r14d
leal 0x8(%r14), %edi
callq 0x2190
movq %rax, %rbx
testq %rax, %rax
je 0x714a
movl %r14d, (%rbx)
andl $0x0, 0x4(%rbx)
movq %rbx, %rdi
addq $0x8, %rdi
movl %r14d, %edx
xorl %esi, %esi
callq 0x20d0
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
movq 0x4ea7(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x22b6(%rip), %rsi      # 0x9411
leaq 0x13d7(%rip), %rdx      # 0x8539
xorl %eax, %eax
callq 0x2150
jmp 0x7131
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: h5_slip_one_byte
static void h5_slip_one_byte(struct sk_buff *skb, RT_U8 c)
{
	const RT_S8 esc_c0[2] = { 0xdb, 0xdc };
	const RT_S8 esc_db[2] = { 0xdb, 0xdd };
	const RT_S8 esc_11[2] = { 0xdb, 0xde };
	const RT_S8 esc_13[2] = { 0xdb, 0xdf };

	switch (c) {
	case 0xc0:
		memcpy(skb_put(skb, 2), &esc_c0, 2);
		break;

	case 0xdb:
		memcpy(skb_put(skb, 2), &esc_db, 2);
		break;

	case 0x11:
		memcpy(skb_put(skb, 2), &esc_11, 2);
		break;

	case 0x13:
		memcpy(skb_put(skb, 2), &esc_13, 2);
		break;

	default:
		memcpy(skb_put(skb, 1), &c, 1);
		break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
cmpl $0x11, %esi
je 0x71cb
movl %esi, %ebx
cmpl $0x13, %esi
je 0x71ad
cmpl $0xdb, %ebx
je 0x71bc
cmpl $0xc0, %ebx
jne 0x71da
pushq $0x2
popq %rsi
callq 0x723f
movw $0xdcdb, (%rax)         # imm = 0xDCDB
jmp 0x71e4
pushq $0x2
popq %rsi
callq 0x723f
movw $0xdfdb, (%rax)         # imm = 0xDFDB
jmp 0x71e4
pushq $0x2
popq %rsi
callq 0x723f
movw $0xdddb, (%rax)         # imm = 0xDDDB
jmp 0x71e4
pushq $0x2
popq %rsi
callq 0x723f
movw $0xdedb, (%rax)         # imm = 0xDEDB
jmp 0x71e4
pushq $0x1
popq %rsi
callq 0x723f
movb %bl, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: skb_put
static RT_U8 *skb_put(struct sk_buff *skb, RT_U32 len)
{
	RT_U32 old_len = skb->data_len;
	if ((skb->data_len + len) > (skb->max_len)) {
		RS_ERR("Buffer too small");
		return NULL;
	}
	skb->data_len += len;
	return (skb->data + old_len);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl 0x4(%rdi), %eax
addl %eax, %esi
cmpl (%rdi), %esi
ja 0x7263
movl %esi, 0x4(%rdi)
leaq (%rdi,%rax), %rbx
addq $0x8, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq 0x4d8e(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x21be(%rip), %rsi      # 0x9432
leaq 0x12be(%rip), %rdx      # 0x8539
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2150
jmp 0x7259
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: uart_speed_to_rtk_speed
static inline void uart_speed_to_rtk_speed(int uart_speed, RT_U32 * rtk_speed)
{
	*rtk_speed = 0x701D;

	unsigned int i;
	for (i = 0; i < sizeof(baudrates) / sizeof(baudrate_ex); i++) {
		if (baudrates[i].uart_speed == uart_speed) {
			*rtk_speed = baudrates[i].rtk_speed;
			return;
		}
	}

	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x701d, 0x4cdd(%rip)   # imm = 0x701D
movabsq $-0x1, %rcx
leaq 0x4b94(%rip), %rax      # 0xc5e0
cmpq $0xa, %rcx
je 0x7a68
leaq 0x1(%rcx), %rdx
cmpl %edi, 0xc(%rax,%rcx,8)
movq %rdx, %rcx
jne 0x7a4c
movl (%rax,%rdx,8), %eax
movl %eax, 0x4cb0(%rip)      # 0xc718
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: rtk_local_ver_sig_alarm
static void rtk_local_ver_sig_alarm(int sig)
{
	uint8_t cmd[4] = { 0x01, 0x01, 0x10, 0x00 };
	static int retries;

	if (retries < rtk_max_retries) {
		retries++;
		if (write(rtk_hw_cfg.serial_fd, cmd, sizeof(cmd)) < 0)
			return;
		alarm(1);
		return;
	}

	tcflush(rtk_hw_cfg.serial_fd, TCIOFLUSH);
	RS_ERR("init timed out, read local ver fails");
	exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x5d34(%rip), %eax      # 0xd7a8
cmpl $0x4, %eax
jg 0x7aa6
incl %eax
movl %eax, 0x5d27(%rip)      # 0xd7a8
movl 0x4c99(%rip), %edi      # 0xc720
leaq 0x234e(%rip), %rsi      # 0x9ddc
pushq $0x4
popq %rdx
callq 0x2070
testq %rax, %rax
js 0x7aa4
pushq $0x1
popq %rdi
popq %rbp
jmp 0x20f0
popq %rbp
retq
movl 0x4c74(%rip), %edi      # 0xc720
pushq $0x2
popq %rsi
callq 0x20a0
movq 0x453d(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x231b(%rip), %rsi      # 0x9de0
leaq 0xa6d(%rip), %rdx       # 0x8539
xorl %eax, %eax
callq 0x2150
pushq $0x1
popq %rdi
callq 0x2290
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: rtk_rom_ver_sig_alarm
static void rtk_rom_ver_sig_alarm(int sig)
{
	uint8_t cmd[4] = { 0x01, 0x6d, 0xfc, 0x00 };
	static int retries;

	if (retries < rtk_max_retries) {
		retries++;
		if (write(rtk_hw_cfg.serial_fd, cmd, sizeof(cmd)) < 0)
			return;
		alarm(1);
		return;
	}

	tcflush(rtk_hw_cfg.serial_fd, TCIOFLUSH);
	RS_ERR("init timed out, read rom ver fails");
	exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x5cc7(%rip), %eax      # 0xd7ac
cmpl $0x4, %eax
jg 0x7b17
incl %eax
movl %eax, 0x5cba(%rip)      # 0xd7ac
movl 0x4c28(%rip), %edi      # 0xc720
leaq 0x2321(%rip), %rsi      # 0x9e20
pushq $0x4
popq %rdx
callq 0x2070
testq %rax, %rax
js 0x7b15
pushq $0x1
popq %rdi
popq %rbp
jmp 0x20f0
popq %rbp
retq
movl 0x4c03(%rip), %edi      # 0xc720
pushq $0x2
popq %rsi
callq 0x20a0
movq 0x44cc(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x22ee(%rip), %rsi      # 0x9e24
leaq 0x9fc(%rip), %rdx       # 0x8539
xorl %eax, %eax
callq 0x2150
pushq $0x1
popq %rdi
callq 0x2290
// File: /workspace/github_c_makefile_star2_O2/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: h5_tpatch_sig_alarm
static void h5_tpatch_sig_alarm(int sig)
{
	static int retries = 0;
	if (retries < rtk_hw_cfg.h5_max_retries) {
		RS_ERR("patch timerout, retry:\n");
		if (rtk_hw_cfg.host_last_cmd) {
			int len =
			    write(rtk_hw_cfg.serial_fd,
				  rtk_hw_cfg.host_last_cmd->data,
				  rtk_hw_cfg.host_last_cmd->data_len);
			RS_DBG("3-wire download patch re send:%d", retries);
		}
		retries++;
		alarm(3);
		return;
	}
	RS_ERR("H5 patch timed out\n");
	exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl 0x5c58(%rip), %eax      # 0xd7b0
movq 0x4499(%rip), %rbx      # 0xbff8
movq (%rbx), %rdi
cmpl 0x4ba8(%rip), %eax      # 0xc710
jge 0x7bda
leaq 0x25c3(%rip), %rsi      # 0xa134
leaq 0x9c1(%rip), %rdx       # 0x8539
xorl %eax, %eax
callq 0x2150
movq 0x4b7a(%rip), %rsi      # 0xc700
testq %rsi, %rsi
je 0x7ba6
movl 0x4b8f(%rip), %edi      # 0xc720
movl 0x4(%rsi), %edx
addq $0x8, %rsi
callq 0x2070
cmpb $0x0, 0x473c(%rip)      # 0xc2e0
jne 0x7bba
incl 0x5c04(%rip)            # 0xd7b0
pushq $0x3
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x20f0
movq (%rbx), %rdi
movl 0x5bed(%rip), %ecx      # 0xd7b0
leaq 0x258d(%rip), %rsi      # 0xa157
leaq 0x968(%rip), %rdx       # 0x8539
xorl %eax, %eax
callq 0x2150
jmp 0x7ba6
leaq 0x259c(%rip), %rsi      # 0xa17d
leaq 0x951(%rip), %rdx       # 0x8539
xorl %eax, %eax
callq 0x2150
pushq $0x1
popq %rdi
callq 0x2290
// File: /workspace/github_c_makefile_star2_O2/xtanitfy[P]Murphy/test/test_conv.c
// Function: print_src
int print_src(void)
{
	for (int i = 0;i < 4;i++) {
		for (int j = 0;j < 4;j++) {
			printf("%d ",arr[i][j]);
		}
		printf("\n");
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0x2ed4(%rip), %r15      # 0x4040
pushq $0xa
popq %rbx
leaq 0xe8e(%rip), %r14       # 0x2004
xorl %r12d, %r12d
cmpq $0x4, %r12
je 0x11ab
xorl %r13d, %r13d
cmpq $0x4, %r13
je 0x119b
movl (%r15,%r13,4), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1030
incq %r13
jmp 0x1182
movl %ebx, %edi
callq 0x1040
incq %r12
addq $0x10, %r15
jmp 0x1179
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/xtanitfy[P]Murphy/test/test_conv.c
// Function: print_dst
int print_dst(void)
{
	for (int i = 0;i < 3;i++) {
		for (int j = 0;j < 3;j++) {
			printf("%d ",dst[i][j]);
		}
		printf("\n");
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0x2ed9(%rip), %r15      # 0x40a0
pushq $0xa
popq %rbx
leaq 0xe33(%rip), %r14       # 0x2004
xorl %r12d, %r12d
cmpq $0x3, %r12
je 0x1206
xorl %r13d, %r13d
cmpq $0x3, %r13
je 0x11f6
movl (%r15,%r13,4), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1030
incq %r13
jmp 0x11dd
movl %ebx, %edi
callq 0x1040
incq %r12
addq $0xc, %r15
jmp 0x11d4
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/xtanitfy[P]Murphy/test/test_conv.c
// Function: conv_slow
int conv_slow(void)
{
	int tmp = 0;
	for (int i = 0;i < 3;i++) {
		for (int j = 0;j < 3;j++) {
			tmp = 0;
			for (int m = i;m < (i + 2);m++) {
				for (int n = j;n < (j + 2);n++) {
					tmp +=  arr[m][n] * k [1-m+i][1-n+j];
				}
			}
			dst[i][j] = tmp;
		}
	}
	
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movabsq $0x2, %rax
leaq 0x2e13(%rip), %rcx      # 0x4040
xorl %r8d, %r8d
leaq 0x2e49(%rip), %rdx      # 0x4080
movabsq $0x3, %r9
cmpq $0x3, %r8
je 0x12d2
leaq 0x1(%r8), %rsi
movq %rsi, -0x10(%rsp)
imulq $0xc, %r8, %r10
leaq 0x2e41(%rip), %rsi      # 0x40a0
addq %rsi, %r10
movq %rcx, -0x8(%rsp)
xorl %ebx, %ebx
cmpq $0x3, %rbx
je 0x12bc
leaq 0x1(%rbx), %r14
xorl %ebp, %ebp
movq %rcx, %r11
movq %rdx, %r12
movq %r8, %r13
cmpq %rax, %r13
je 0x12af
movq %r11, %r15
movq %r9, %rdi
cmpq $0x1, %rdi
je 0x12a2
movl (%r12,%rdi,4), %esi
imull (%r15), %esi
addl %esi, %ebp
decq %rdi
addq $0x4, %r15
jmp 0x1289
incq %r13
addq $-0x8, %r12
addq $0x10, %r11
jmp 0x127e
movl %ebp, (%r10,%rbx,4)
addq $0x4, %rcx
movq %r14, %rbx
jmp 0x1269
incq %rax
movq -0x8(%rsp), %rcx
addq $0x10, %rcx
movq -0x10(%rsp), %r8
jmp 0x1241
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/xtanitfy[P]Murphy/test/test_conv.c
// Function: main
int main(void)
{
	printf("Before conv:\n");
	print_src();
	conv_slow();
	printf("After conv:\n");
	print_dst();
	
	return 0;
}

// Assembly:
pushq %rax
leaq 0xcf5(%rip), %rdi       # 0x2008
callq 0x1050
callq 0x115c
callq 0x1212
leaq 0xcec(%rip), %rdi       # 0x2015
callq 0x1050
callq 0x11b7
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/marcespie[P]unix-samples/lab/pollsig3.c
// Function: main
int
main()
{
	struct pollfd pfd[1];

	int pip[2];
	errwrap(pipe(pip));

	int pid;

	errwrap(pid = fork());
	if (pid == 0) {
		sleep(5);
		fprintf(stderr, "Okay thxbye\n");
		exit(0);
	}
	struct sigaction sa;
	sa.sa_handler = reaper;
	sa.sa_flags = SA_RESTART;
	errwrap(sigaction(SIGCHLD, &sa, NULL));

	// now we "wait"

	pfd[0].fd = pip[0];
	pfd[0].events = POLLIN;
	int n = poll(pfd, 1, INFTIM);
	if (n == -1 && errno == EINTR) {
		fprintf(stderr, "Everything is okay\n");
	}
}

// Assembly:
subq $0xa8, %rsp
movq %rsp, %rdi
callq 0x1050
cmpl $-0x1, %eax
je 0x1269
callq 0x10b0
testl %eax, %eax
je 0x1272
cmpl $-0x1, %eax
je 0x129d
leaq -0x36(%rip), %rax       # 0x11bc
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
movl $0x10000000, 0x88(%rsi) # imm = 0x10000000
pushq $0x11
popq %rdi
xorl %edx, %edx
callq 0x1040
cmpl $-0x1, %eax
je 0x12a6
movl (%rsp), %eax
leaq 0x8(%rsp), %rdi
movl %eax, (%rdi)
movw $0x1, 0x4(%rdi)
pushq $0x1
popq %rsi
pushq $-0x1
popq %rdx
callq 0x1070
cmpl $-0x1, %eax
jne 0x1241
callq 0x1030
cmpl $0x4, (%rax)
je 0x124b
xorl %eax, %eax
addq $0xa8, %rsp
retq
movq 0x2da6(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0xdea(%rip), %rdi       # 0x2046
pushq $0x13
popq %rsi
pushq $0x1
popq %rdx
callq 0x1090
jmp 0x1241
leaq 0xd94(%rip), %rsi       # 0x2004
jmp 0x12ad
pushq $0x5
popq %rdi
callq 0x10a0
movq 0x2d77(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0xd90(%rip), %rdi       # 0x201b
pushq $0xc
popq %rsi
pushq $0x1
popq %rdx
callq 0x1090
xorl %edi, %edi
callq 0x1080
leaq 0xd6a(%rip), %rsi       # 0x200e
jmp 0x12ad
leaq 0xd7b(%rip), %rsi       # 0x2028
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x1060
// File: /workspace/github_c_makefile_star2_O2/USArmyResearchLab[P]ARL_OpenSHMEM/src/autogen/shmem_int_atomic_inc.c
// Function: shmem_int_atomic_inc
void shmem_int_atomic_inc( int* ptr, int pe)
{ 
	int* remote_ptr = (int*)shmem_ptr((void*)ptr, pe );
	long* x = (long*)shmem_ptr((void*)&__shmem.lock_atomic_int, pe);
	__set_spin_lock(x);
	*remote_ptr += 1;
	__clear_spin_lock(x);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
callq 0x1b9c
movq %rax, %r14
leaq 0x33cf(%rip), %rdi      # 0x61f0
addq $0x10, %rdi
movl %ebx, %esi
callq 0x1b9c
movq %rax, %rbx
movq %rax, %rdi
callq 0x30b0
incl (%r14)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x30a0
nopl (%rax)