// File: /workspace/github_c_makefile_star2_O2/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, %r14
movq %rdx, %r15
callq 0x35e0
movq %rax, %rbx
testq %rax, %rax
je 0x5aa8
movq 0x20(%r15), %rax
movq 0x10(%rax), %rsi
pushq $-0xe
popq %rbp
testq %rsi, %rsi
je 0x5b51
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x5b51
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
pushq $0xf
popq %rdx
callq 0x30b0
movb $0x0, 0x45(%rbx)
movl %ebp, %ecx
orl $0x3, %ecx
movl %ecx, 0x30(%rbx)
movq 0x20(%r15), %rax
movq 0x18(%rax), %rdx
testq %rdx, %rdx
je 0x59e3
movzbl 0x4(%rdx), %ecx
movl %ecx, 0x48(%rbx)
orl $0x7, %ebp
movl %ebp, 0x30(%rbx)
movl %ebp, %ecx
movq 0x20(%rax), %rdx
testq %rdx, %rdx
je 0x59f8
movl 0x4(%rdx), %edx
movl %edx, 0x4c(%rbx)
orl $0x8, %ecx
movl %ecx, 0x30(%rbx)
movq 0x28(%rax), %rdx
testq %rdx, %rdx
je 0x5a0d
movl 0x4(%rdx), %edx
movl %edx, 0x50(%rbx)
orl $0x10, %ecx
movl %ecx, 0x30(%rbx)
movq 0x30(%rax), %r12
testq %r12, %r12
movq %r14, 0x8(%rsp)
je 0x5ab9
movzwl (%r12), %esi
addq $0x4, %r12
addl $-0x4, %esi
leaq 0x4(%rsp), %r13
movl %esi, (%r13)
leaq 0x10(%rsp), %r14
pushq $-0xe
popq %rbp
movq %r12, %rdi
callq 0x3340
testl %eax, %eax
je 0x5ab0
movq %r14, %rdi
movq %r12, %rsi
leaq 0x5b2b(%rip), %rdx      # 0xb580
callq 0x5b6a
testl %eax, %eax
js 0x5b4f
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x5b51
movq 0x20(%rsp), %rcx
testq %rcx, %rcx
je 0x5a7f
movl 0x4(%rcx), %edx
jmp 0x5a81
xorl %edx, %edx
movl 0x4(%rax), %esi
movq %rbx, %rdi
callq 0x3220
testl %eax, %eax
js 0x5b4f
movq %r12, %rdi
movq %r13, %rsi
callq 0x34f0
movq %rax, %r12
movl 0x4(%rsp), %esi
jmp 0x5a3c
pushq $-0x5
popq %rbp
jmp 0x5b51
movq 0x20(%r15), %rax
movq 0x8(%rsp), %r14
movq 0x38(%rax), %r15
testq %r15, %r15
je 0x5b46
movzwl (%r15), %esi
addq $0x4, %r15
addl $-0x4, %esi
leaq 0x4(%rsp), %r14
movl %esi, (%r14)
leaq 0x5ac0(%rip), %r12      # 0xb5a0
leaq 0x10(%rsp), %r13
pushq $-0xe
popq %rbp
movq %r15, %rdi
callq 0x3340
testl %eax, %eax
je 0x5b41
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x5b6a
testl %eax, %eax
js 0x5b4f
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x5b51
movq 0x18(%rsp), %rdx
testq %rdx, %rdx
je 0x5b51
movl 0x4(%rax), %esi
addq $0x4, %rdx
movq %rbx, %rdi
callq 0x33a0
testl %eax, %eax
js 0x5b4f
movq %r15, %rdi
movq %r14, %rsi
callq 0x34f0
movq %rax, %r15
movl 0x4(%rsp), %esi
jmp 0x5ae8
movq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *(%r14)
movl %eax, %ebp
movq %rbx, %rdi
callq 0x3110
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq