// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/chnroute.c
// Function: parse_netmask6
static int parse_netmask6(net_mask6_t* netmask, char* line)
{
	char* sp_pos;
	struct in6_addr ip;
	int i, cidr;
	int quotient, remainder;
	sp_pos = strchr(line, '/');
	if (sp_pos) {
		*sp_pos = 0;
		cidr = atoi(sp_pos + 1);
	}
	else {
		cidr = 128;
	}
	if (inet_pton(AF_INET6, line, &ip) == 0) {
		if (sp_pos)* sp_pos = '/';
		loge("invalid addr %s, errno=%d, %s\n",
			line, errno, strerror(errno));
		return -1;
	}
	memcpy(netmask->net, ip.s6_addr, 16);
	for (i = 0; i < 4; i++) {
		netmask->net[i] = ntohl(netmask->net[i]);
	}
	memset(netmask->mask, 0, sizeof(netmask->mask));
	quotient = cidr / 32;
	remainder = cidr % 32;
	for (i = 0; i < quotient; i++)
		netmask->mask[i] = UINT32_MAX;
	if (remainder > 0) {
		netmask->mask[quotient] = (((uint32_t)1 << (32 - remainder)) - 1) ^ UINT32_MAX;
	}
	if (sp_pos)* sp_pos = '/';
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movl $0x2f, %esi
callq 0x3160
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1c362
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
movq -0x20(%rbp), %rdi
addq $0x1, %rdi
callq 0x3580
movl %eax, -0x38(%rbp)
jmp 0x1c369
movl $0x80, -0x38(%rbp)
movq -0x18(%rbp), %rsi
movl $0xa, %edi
leaq -0x30(%rbp), %rdx
callq 0x3640
cmpl $0x0, %eax
jne 0x1c3ff
cmpq $0x0, -0x20(%rbp)
je 0x1c38e
movq -0x20(%rbp), %rax
movb $0x2f, (%rax)
jmp 0x1c390
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x1c3f1
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
callq 0x3040
movl (%rax), %eax
movl %eax, -0x44(%rbp)
callq 0x3040
movl (%rax), %edi
callq 0x3150
movq -0x50(%rbp), %r9
movl -0x44(%rbp), %r10d
movl $0x3, %edi
leaq 0x1aa8c(%rip), %rsi     # 0x36e5a
leaq 0x1aae3(%rip), %rdx     # 0x36eb8
movl $0xdf, %ecx
leaq 0x1aae6(%rip), %r8      # 0x36ec7
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x243b0
jmp 0x1c3f3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1c4dd
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x0, -0x34(%rbp)
cmpl $0x4, -0x34(%rbp)
jge 0x1c447
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %edi
callq 0x3490
movl %eax, %edx
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1c419
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x3200
movl -0x38(%rbp), %eax
movl $0x20, %ecx
cltd
idivl %ecx
movl %eax, -0x3c(%rbp)
movl -0x38(%rbp), %eax
movl $0x20, %ecx
cltd
idivl %ecx
movl %edx, -0x40(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x1c4a1
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl $0xffffffff, 0x10(%rax,%rcx,4) # imm = 0xFFFFFFFF
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1c47e
cmpl $0x0, -0x40(%rbp)
jle 0x1c4c8
movl $0x20, %ecx
subl -0x40(%rbp), %ecx
movl $0x1, %edx
shll %cl, %edx
subl $0x1, %edx
xorl $-0x1, %edx
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl %edx, 0x10(%rax,%rcx,4)
cmpq $0x0, -0x20(%rbp)
je 0x1c4d6
movq -0x20(%rbp), %rax
movb $0x2f, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)