// File: /workspace/github_c_makefile_star2_O3/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 $0x38, %rsp
movq %rcx, %r14
movq %rdx, %r15
callq 0x3590
movq %rax, %rbx
testq %rax, %rax
je 0x5e76
movq 0x20(%r15), %rax
movq 0x10(%rax), %rsi
movl $0xfffffff2, %ebp       # imm = 0xFFFFFFF2
testq %rsi, %rsi
je 0x5e7b
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x5e7b
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, %ecx
orl $0x3, %ecx
movl %ecx, 0x30(%rbx)
movq 0x20(%r15), %rax
movq 0x18(%rax), %rdx
testq %rdx, %rdx
je 0x5ce3
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 0x5cf8
movl 0x4(%rdx), %edx
movl %edx, 0x4c(%rbx)
orl $0x8, %ecx
movl %ecx, 0x30(%rbx)
movq %r14, 0x30(%rsp)
movq 0x28(%rax), %rdx
testq %rdx, %rdx
je 0x5d12
movl 0x4(%rdx), %edx
movl %edx, 0x50(%rbx)
orl $0x10, %ecx
movl %ecx, 0x30(%rbx)
movq 0x30(%rax), %r12
testq %r12, %r12
je 0x5dc6
movzwl (%r12), %esi
addq $0x4, %r12
addl $-0x4, %esi
movl %esi, 0xc(%rsp)
movq %r12, %rdi
callq 0x3300
testl %eax, %eax
je 0x5dc2
leaq 0x580a(%rip), %r13      # 0xb550
leaq 0x10(%rsp), %r14
leaq 0x4(%r12), %rdx
movzwl (%r12), %ecx
addl $-0x4, %ecx
movq %r14, %rdi
movl $0x2, %esi
movq %r13, %r8
callq 0x3310
testl %eax, %eax
js 0x5e72
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x5e94
movq 0x20(%rsp), %rcx
testq %rcx, %rcx
je 0x5d8d
movl 0x4(%rcx), %edx
jmp 0x5d8f
xorl %edx, %edx
movl 0x4(%rax), %esi
movq %rbx, %rdi
callq 0x31f0
testl %eax, %eax
js 0x5e72
movq %r12, %rdi
leaq 0xc(%rsp), %rsi
callq 0x34b0
movq %rax, %r12
movl 0xc(%rsp), %esi
movq %rax, %rdi
callq 0x3300
testl %eax, %eax
jne 0x5d4b
movq 0x20(%r15), %rax
movq 0x38(%rax), %r15
testq %r15, %r15
je 0x5e68
movzwl (%r15), %esi
addq $0x4, %r15
addl $-0x4, %esi
movl %esi, 0xc(%rsp)
movq %r15, %rdi
callq 0x3300
testl %eax, %eax
je 0x5e68
leaq 0x577b(%rip), %r14      # 0xb570
leaq 0x10(%rsp), %r12
leaq 0xc(%rsp), %r13
leaq 0x4(%r15), %rdx
movzwl (%r15), %ecx
addl $-0x4, %ecx
movq %r12, %rdi
movl $0x2, %esi
movq %r14, %r8
callq 0x3310
testl %eax, %eax
js 0x5e72
movq 0x20(%rsp), %rax
movl $0xfffffff2, %ebp       # imm = 0xFFFFFFF2
testq %rax, %rax
je 0x5e7b
movq 0x18(%rsp), %rdx
testq %rdx, %rdx
je 0x5e7b
movl 0x4(%rax), %esi
addq $0x4, %rdx
movq %rbx, %rdi
callq 0x3360
testl %eax, %eax
js 0x5e72
movq %r15, %rdi
movq %r13, %rsi
callq 0x34b0
movq %rax, %r15
movl 0xc(%rsp), %esi
movq %rax, %rdi
callq 0x3300
testl %eax, %eax
jne 0x5dff
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
callq *(%rsi)
movl %eax, %ebp
jmp 0x5e7b
movl $0xfffffffb, %ebp       # imm = 0xFFFFFFFB
movq %rbx, %rdi
callq 0x3100
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xfffffff2, %ebp       # imm = 0xFFFFFFF2
jmp 0x5e7b
nop