// File: /workspace/github_c_makefile_star2_O1/sabotage-linux[P]libnl-tiny/genl_ctrl.c
// Function: ctrl_msg_parser
static int ctrl_msg_parser(struct nl_cache_ops *ops, struct genl_cmd *cmd,
			   struct genl_info *info, void *arg)
{
	struct genl_family *family;
	struct nl_parser_param *pp = arg;
	int err;

	family = genl_family_alloc();
	if (family == NULL) {
		err = -NLE_NOMEM;
		goto errout;
	}

	if (info->attrs[CTRL_ATTR_FAMILY_NAME] == NULL) {
		err = -NLE_MISSING_ATTR;
		goto errout;
	}

	if (info->attrs[CTRL_ATTR_FAMILY_ID] == NULL) {
		err = -NLE_MISSING_ATTR;
		goto errout;
	}

	family->ce_msgtype = info->nlh->nlmsg_type;
	genl_family_set_id(family,
			   nla_get_u16(info->attrs[CTRL_ATTR_FAMILY_ID]));
	genl_family_set_name(family,
		     nla_get_string(info->attrs[CTRL_ATTR_FAMILY_NAME]));

	if (info->attrs[CTRL_ATTR_VERSION]) {
		uint32_t version = nla_get_u32(info->attrs[CTRL_ATTR_VERSION]);
		genl_family_set_version(family, version);
	}

	if (info->attrs[CTRL_ATTR_HDRSIZE]) {
		uint32_t hdrsize = nla_get_u32(info->attrs[CTRL_ATTR_HDRSIZE]);
		genl_family_set_hdrsize(family, hdrsize);
	}

	if (info->attrs[CTRL_ATTR_MAXATTR]) {
		uint32_t maxattr = nla_get_u32(info->attrs[CTRL_ATTR_MAXATTR]);
		genl_family_set_maxattr(family, maxattr);
	}

	if (info->attrs[CTRL_ATTR_OPS]) {
		struct nlattr *nla, *nla_ops;
		int remaining;

		nla_ops = info->attrs[CTRL_ATTR_OPS];
		nla_for_each_nested(nla, nla_ops, remaining) {
			struct nlattr *tb[CTRL_ATTR_OP_MAX+1];
			int flags = 0, id;

			err = nla_parse_nested(tb, CTRL_ATTR_OP_MAX, nla,
					       family_op_policy);
			if (err < 0)
				goto errout;

			if (tb[CTRL_ATTR_OP_ID] == NULL) {
				err = -NLE_MISSING_ATTR;
				goto errout;
			}
			
			id = nla_get_u32(tb[CTRL_ATTR_OP_ID]);

			if (tb[CTRL_ATTR_OP_FLAGS])
				flags = nla_get_u32(tb[CTRL_ATTR_OP_FLAGS]);

			err = genl_family_add_op(family, id, flags);
			if (err < 0)
				goto errout;

		}
	}

	if (info->attrs[CTRL_ATTR_MCAST_GROUPS]) {
		struct nlattr *nla, *nla_grps;
		int remaining;

		nla_grps = info->attrs[CTRL_ATTR_MCAST_GROUPS];
		nla_for_each_nested(nla, nla_grps, remaining) {
			struct nlattr *tb[CTRL_ATTR_MCAST_GRP_MAX+1];
			int id;
			const char * name;

			err = nla_parse_nested(tb, CTRL_ATTR_MCAST_GRP_MAX, nla,
					       family_grp_policy);
			if (err < 0)
				goto errout;

			if (tb[CTRL_ATTR_MCAST_GRP_ID] == NULL) {
				err = -NLE_MISSING_ATTR;
				goto errout;
			}
			id = nla_get_u32(tb[CTRL_ATTR_MCAST_GRP_ID]);

			if (tb[CTRL_ATTR_MCAST_GRP_NAME] == NULL) {
				err = -NLE_MISSING_ATTR;
				goto errout;
			}
			name = nla_get_string(tb[CTRL_ATTR_MCAST_GRP_NAME]);

			err = genl_family_add_grp(family, id, name);
			if (err < 0)
				goto errout;
		}

	}

	err = pp->pp_cb((struct nl_object *) family, pp);
errout:
	genl_family_put(family);
	return err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r13
movq %rdx, %r15
callq 0x3590
movq %rax, %rbx
testq %rax, %rax
je 0x5f91
movq 0x20(%r15), %rax
movq 0x10(%rax), %rsi
movl $0xfffffff2, %r14d      # imm = 0xFFFFFFF2
testq %rsi, %rsi
je 0x5f97
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x5f97
movq 0x8(%r15), %rcx
movzwl 0x4(%rcx), %ecx
movl %ecx, 0x28(%rbx)
movzwl 0x4(%rax), %eax
movw %ax, 0x34(%rbx)
movl 0x30(%rbx), %ebp
movl %ebp, %eax
orl $0x1, %eax
movl %eax, 0x30(%rbx)
addq $0x4, %rsi
movq %rbx, %rdi
addq $0x36, %rdi
movl $0xf, %edx
callq 0x30a0
movb $0x0, 0x45(%rbx)
movl %ebp, %eax
orl $0x3, %eax
movl %eax, 0x30(%rbx)
movq 0x20(%r15), %rax
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x5e96
movzbl 0x4(%rcx), %ecx
movl %ecx, 0x48(%rbx)
orl $0x7, %ebp
movl %ebp, 0x30(%rbx)
movq 0x20(%rax), %rcx
testq %rcx, %rcx
je 0x5ea9
movl 0x4(%rcx), %ecx
movl %ecx, 0x4c(%rbx)
orb $0x8, 0x30(%rbx)
movq 0x28(%rax), %rcx
testq %rcx, %rcx
je 0x5ebc
movl 0x4(%rcx), %ecx
movl %ecx, 0x50(%rbx)
orb $0x10, 0x30(%rbx)
movq 0x30(%rax), %r12
testq %r12, %r12
je 0x5fb1
movzwl (%r12), %esi
addq $0x4, %r12
addl $-0x4, %esi
movl %esi, 0x4(%rsp)
movq %r12, %rdi
callq 0x3300
testl %eax, %eax
je 0x5fb3
movq %r13, 0x8(%rsp)
leaq 0x10(%rsp), %r13
leaq 0x4(%r12), %rdx
movzwl (%r12), %ecx
addl $-0x4, %ecx
movl $0x2, %ebp
movq %r13, %rdi
movl $0x2, %esi
leaq 0x563c(%rip), %r8       # 0xb550
callq 0x3310
testl %eax, %eax
js 0x5f53
movq 0x18(%rsp), %rax
xorl %edx, %edx
testq %rax, %rax
je 0x5f5a
movq 0x20(%rsp), %rcx
testq %rcx, %rcx
je 0x5f36
movl 0x4(%rcx), %edx
movl 0x4(%rax), %esi
movq %rbx, %rdi
callq 0x31f0
movl %eax, %r14d
testl %eax, %eax
setns %dl
movl %eax, %ebp
shrl $0x1e, %ebp
andl $-0x2, %ebp
jmp 0x5f60
movl %eax, %r14d
xorl %edx, %edx
jmp 0x5f60
movl $0xfffffff2, %r14d      # imm = 0xFFFFFFF2
testb %dl, %dl
je 0x5f8a
movq %r12, %rdi
leaq 0x4(%rsp), %rsi
callq 0x34b0
movq %rax, %r12
movl 0x4(%rsp), %esi
movq %rax, %rdi
callq 0x3300
testl %eax, %eax
jne 0x5ef3
xorl %ebp, %ebp
movq 0x8(%rsp), %r13
jmp 0x5fb5
movl $0xfffffffb, %r14d      # imm = 0xFFFFFFFB
movq %rbx, %rdi
callq 0x3100
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5fbe
xorl %ebp, %ebp
cmpl $0x2, %ebp
je 0x5f97
testl %ebp, %ebp
jne 0x5f9f
movq 0x20(%r15), %rax
movq 0x38(%rax), %r15
testq %r15, %r15
je 0x60a8
movzwl (%r15), %esi
addq $0x4, %r15
addl $-0x4, %esi
movl %esi, 0x4(%rsp)
movq %r15, %rdi
callq 0x3300
testl %eax, %eax
je 0x6095
movq %r13, 0x8(%rsp)
leaq 0x5576(%rip), %r12      # 0xb570
leaq 0x10(%rsp), %r13
leaq 0x4(%r15), %rdx
movzwl (%r15), %ecx
addl $-0x4, %ecx
movl $0x2, %ebp
movq %r13, %rdi
movl $0x2, %esi
movq %r12, %r8
callq 0x3310
testl %eax, %eax
js 0x605f
movq 0x20(%rsp), %rax
movl $0xfffffff2, %r14d      # imm = 0xFFFFFFF2
testq %rax, %rax
je 0x6062
movq 0x18(%rsp), %rdx
testq %rdx, %rdx
je 0x6062
movl 0x4(%rax), %esi
addq $0x4, %rdx
movq %rbx, %rdi
callq 0x3360
movl %eax, %r14d
testl %eax, %eax
setns %al
movl %r14d, %ebp
shrl $0x1e, %ebp
andl $-0x2, %ebp
jmp 0x6064
movl %eax, %r14d
xorl %eax, %eax
testb %al, %al
je 0x608e
movq %r15, %rdi
leaq 0x4(%rsp), %rsi
callq 0x34b0
movq %rax, %r15
movl 0x4(%rsp), %esi
movq %rax, %rdi
callq 0x3300
testl %eax, %eax
jne 0x5fff
xorl %ebp, %ebp
movq 0x8(%rsp), %r13
jmp 0x6097
xorl %ebp, %ebp
cmpl $0x2, %ebp
je 0x5f97
testl %ebp, %ebp
jne 0x5f9f
movq %rbx, %rdi
movq %r13, %rsi
callq *(%r13)
movl %eax, %r14d
jmp 0x5f97
nop