// File: /workspace/github_c_makefile_star2_O0/seuscq[P]rtk_hciattach/hciattach_rtk.c
// Function: line_proc
static void line_proc(char *buff, int len)
{
	char *argv[32];
	int nargs = 0;
	RS_INFO("%s", buff);

	while (nargs < 32) {
		/* skip any white space */
		while ((*buff == ' ') || (*buff == '\t') ||
			*buff == ',') {
			++buff;
		}

		if (*buff == '\0') {
			/* end of line, no more args */
			argv[nargs] = NULL;
			break;
		}

		/* begin of argument string */
		argv[nargs++] = buff;

		/* find end of string */
		while (*buff && (*buff != ' ') && (*buff != '\t')) {
			++buff;
		}

		if (*buff == '\r' || *buff == '\n')
			++buff;

		if (*buff == '\0') {
			/* end of line, no more args */
			argv[nargs] = NULL;
			break;
		}

		*buff++ = '\0';	/* terminate current arg */
	}

	/* valid config */
	if (nargs >= 4) {
		unsigned long int offset;
		uint8_t l;
		uint8_t i = 0;

		offset = strtoul(argv[0], NULL, 16);
		offset = offset | (strtoul(argv[1], NULL, 16) << 8);
		RS_INFO("extra config offset %04lx", offset);
		l = strtoul(argv[2], NULL, 16);
		if (l != (uint8_t)(nargs - 3)) {
			RS_ERR("invalid len %u", l);
			return;
		}

		if (offset == 0x015b && l <= 4) {
			/* Tx power */
			for (i = 0; i < l; i++)
				txpower_cfg[i] = (uint8_t)strtoul(argv[3 + i], NULL, 16);
			txpower_len = l;
			config_flags |= CONFIG_TXPOWER;
		} else if (offset == 0x01e6) {
			/* XTAL for 8822B, 8821C 8723D */
			xtal_cfg = (uint8_t)strtoul(argv[3], NULL, 16);
			config_flags |= CONFIG_XTAL;
		} else {
			RS_ERR("extra config %04lx is not supported", offset);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x0, -0x114(%rbp)
movq 0x7e85(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq -0x8(%rbp), %rcx
leaq 0x3400(%rip), %rsi      # 0xb581
leaq 0x3401(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
jmp 0x8191
cmpl $0x20, -0x114(%rbp)
jge 0x82e9
jmp 0x81a0
movq -0x8(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x20, %ecx
movb %al, -0x123(%rbp)
je 0x81db
movq -0x8(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x9, %ecx
movb %al, -0x123(%rbp)
je 0x81db
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
sete %al
movb %al, -0x123(%rbp)
movb -0x123(%rbp), %al
testb $0x1, %al
jne 0x81e7
jmp 0x81f5
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x81a0
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x8219
movslq -0x114(%rbp), %rax
movq $0x0, -0x110(%rbp,%rax,8)
jmp 0x82e9
movq -0x8(%rbp), %rcx
movl -0x114(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x114(%rbp)
cltq
movq %rcx, -0x110(%rbp,%rax,8)
movq -0x8(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x124(%rbp)
je 0x8273
movq -0x8(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x20, %ecx
movb %al, -0x124(%rbp)
je 0x8273
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
setne %al
movb %al, -0x124(%rbp)
movb -0x124(%rbp), %al
testb $0x1, %al
jne 0x827f
jmp 0x828d
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x8238
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
je 0x82a5
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x82b1
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x82d2
movslq -0x114(%rbp), %rax
movq $0x0, -0x110(%rbp,%rax,8)
jmp 0x82e9
movq -0x8(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x8(%rbp)
movb $0x0, (%rax)
jmp 0x8191
cmpl $0x4, -0x114(%rbp)
jl 0x84da
movb $0x0, -0x122(%rbp)
movq -0x110(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x10, %edx
callq 0x2240
movq %rax, -0x120(%rbp)
movq -0x120(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x108(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x10, %edx
callq 0x2240
movq %rax, %rcx
movq -0x130(%rbp), %rax
shlq $0x8, %rcx
orq %rcx, %rax
movq %rax, -0x120(%rbp)
movq 0x7c9d(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq -0x120(%rbp), %rcx
leaq 0x3fe7(%rip), %rsi      # 0xc353
leaq 0x3216(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
movq -0x100(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x10, %edx
callq 0x2240
movb %al, -0x121(%rbp)
movzbl -0x121(%rbp), %eax
movl -0x114(%rbp), %ecx
subl $0x3, %ecx
movzbl %cl, %ecx
cmpl %ecx, %eax
je 0x83d9
jmp 0x83ae
movq 0x7c43(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movzbl -0x121(%rbp), %ecx
leaq 0x3fac(%rip), %rsi      # 0xc372
leaq 0x31bc(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
jmp 0x84da
cmpq $0x15b, -0x120(%rbp) # imm = 0x15B
jne 0x8473
movzbl -0x121(%rbp), %eax
cmpl $0x4, %eax
jg 0x8473
movb $0x0, -0x122(%rbp)
movzbl -0x122(%rbp), %eax
movzbl -0x121(%rbp), %ecx
cmpl %ecx, %eax
jge 0x8456
movzbl -0x122(%rbp), %eax
addl $0x3, %eax
cltq
movq -0x110(%rbp,%rax,8), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x10, %edx
callq 0x2240
movb %al, %dl
movzbl -0x122(%rbp), %eax
movl %eax, %ecx
leaq 0x8333(%rip), %rax      # 0x10776
movb %dl, (%rax,%rcx)
movb -0x122(%rbp), %al
addb $0x1, %al
movb %al, -0x122(%rbp)
jmp 0x83fd
movb -0x121(%rbp), %al
movb %al, 0x8313(%rip)       # 0x10775
movl 0x8308(%rip), %eax      # 0x10770
orl $0x1, %eax
movl %eax, 0x82ff(%rip)      # 0x10770
jmp 0x84d8
cmpq $0x1e6, -0x120(%rbp) # imm = 0x1E6
jne 0x84ac
movq -0xf8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x10, %edx
callq 0x2240
movb %al, 0x82df(%rip)       # 0x1077a
movl 0x82cf(%rip), %eax      # 0x10770
orl $0x2, %eax
movl %eax, 0x82c6(%rip)      # 0x10770
jmp 0x84d6
jmp 0x84ae
movq 0x7b43(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq -0x120(%rbp), %rcx
leaq 0x3ec6(%rip), %rsi      # 0xc38c
leaq 0x30bc(%rip), %rdx      # 0xb589
movb $0x0, %al
callq 0x2150
jmp 0x84d6
jmp 0x84d8
jmp 0x84da
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopw %cs:(%rax,%rax)