// File: /workspace/github_c_makefile_star2_O0/sabotage-linux[P]libnl-tiny/unl.c
// Function: unl_genl_multicast_id
int unl_genl_multicast_id(struct unl *unl, const char *name)
{
	struct nlattr *tb[CTRL_ATTR_MCAST_GRP_MAX + 1];
	struct nlattr *groups, *group;
	struct nl_msg *msg;
	int ctrlid;
	int ret = -1;
	int rem;

	msg = nlmsg_alloc();
	if (!msg)
		return -1;

	ctrlid = genl_ctrl_resolve(unl->sock, "nlctrl");
	genlmsg_put(msg, 0, 0, ctrlid, 0, 0, CTRL_CMD_GETFAMILY, 0);
	NLA_PUT_STRING(msg, CTRL_ATTR_FAMILY_NAME, unl->family_name);
	unl_request_single(unl, msg, &msg);
	if (!msg)
		return -1;

	groups = unl_find_attr(unl, msg, CTRL_ATTR_MCAST_GROUPS);
	if (!groups)
		goto nla_put_failure;

	nla_for_each_nested(group, groups, rem) {
		const char *gn;

		nla_parse(tb, CTRL_ATTR_MCAST_GRP_MAX, nla_data(group),
			  nla_len(group), NULL);

		if (!tb[CTRL_ATTR_MCAST_GRP_NAME] ||
		    !tb[CTRL_ATTR_MCAST_GRP_ID])
			continue;

		gn = nla_data(tb[CTRL_ATTR_MCAST_GRP_NAME]);
		if (strcmp(gn, name) != 0)
			continue;

		ret = nla_get_u32(tb[CTRL_ATTR_MCAST_GRP_ID]);
		break;
	}

nla_put_failure:
	nlmsg_free(msg);
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0xffffffff, -0x50(%rbp) # imm = 0xFFFFFFFF
callq 0x35e0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x93f6
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9581
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x13f4(%rip), %rsi      # 0xa7f8
callq 0x3610
movl %eax, -0x4c(%rbp)
movq -0x48(%rbp), %rdi
movl -0x4c(%rbp), %ecx
xorl %r9d, %r9d
movl %r9d, %esi
movl %r9d, %edx
movl %r9d, %r8d
movl $0x3, (%rsp)
movl $0x0, 0x8(%rsp)
callq 0x3580
movq -0x48(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x31c0
movq -0x68(%rbp), %rdi
addq $0x1, %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
movl $0x2, %esi
callq 0x33f0
cmpl $0x0, %eax
jge 0x946e
jmp 0x9572
jmp 0x9470
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x3340
cmpq $0x0, -0x48(%rbp)
jne 0x9494
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x9581
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl $0x7, %edx
callq 0x9590
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x94b6
jmp 0x9572
movq -0x38(%rbp), %rdi
callq 0x95d0
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
callq 0x95f0
movl %eax, -0x54(%rbp)
movq -0x40(%rbp), %rdi
movl -0x54(%rbp), %esi
callq 0x3360
cmpl $0x0, %eax
je 0x9570
leaq -0x30(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x40(%rbp), %rdi
callq 0x95d0
movq %rax, -0x70(%rbp)
movq -0x40(%rbp), %rdi
callq 0x95f0
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rdx
movl %eax, %ecx
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %r8d
callq 0x3370
cmpq $0x0, -0x28(%rbp)
je 0x9529
cmpq $0x0, -0x20(%rbp)
jne 0x952b
jmp 0x955a
movq -0x28(%rbp), %rdi
callq 0x95d0
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x32d0
cmpl $0x0, %eax
je 0x954c
jmp 0x955a
movq -0x20(%rbp), %rdi
callq 0x9610
movl %eax, -0x50(%rbp)
jmp 0x9570
movq -0x40(%rbp), %rdi
leaq -0x54(%rbp), %rsi
callq 0x3540
movq %rax, -0x40(%rbp)
jmp 0x94cf
jmp 0x9572
movq -0x48(%rbp), %rdi
callq 0x3640
movl -0x50(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)