// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x3530
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x6730
movq (%r14), %rdi
leaq 0x118e(%rip), %rsi      # 0x7768
callq 0x3570
movq 0x8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
movl %eax, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq $0x0
pushq $0x3
callq 0x34d0
addq $0x10, %rsp
movq 0x8(%rsp), %r15
movq 0x18(%r14), %r12
movq %r12, %rdi
callq 0x31a0
leal 0x1(%rax), %edx
movq %r15, %rdi
movl $0x2, %esi
movq %r12, %rcx
callq 0x3390
testl %eax, %eax
js 0x6737
leaq 0x8(%rsp), %r15
movq (%r15), %rsi
movq $0x0, (%r15)
leaq -0x128(%rip), %rdx      # 0x6517
movq %r14, %rdi
movq %r15, %rcx
callq 0x3580
movq (%r15), %rax
testq %rax, %rax
je 0x6730
movq 0x30(%rax), %rax
movl 0x20(%r14), %ecx
addl $0x3, %ecx
andl $-0x4, %ecx
leaq (%rax,%rcx), %rdi
addq $0x10, %rdi
movl (%rax), %esi
subl %ecx, %esi
addl $-0x10, %esi
movl $0x7, %edx
callq 0x32a0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x673c
movq %rax, %r14
addq $0x4, %r14
movzwl (%rax), %esi
addl $-0x4, %esi
movl %esi, 0x4(%rsp)
movq %r14, %rdi
callq 0x3300
testl %eax, %eax
je 0x673c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
leaq 0x10(%rsp), %r15
leaq 0x4(%r14), %rdx
movzwl (%r14), %ecx
addl $-0x4, %ecx
movq %r15, %rdi
movl $0x2, %esi
xorl %r8d, %r8d
callq 0x3310
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %r12
testq %rdi, %rdi
setne %al
testq %r12, %r12
setne %cl
andb %al, %cl
movb $0x1, %r13b
cmpb $0x1, %cl
jne 0x6709
addq $0x4, %rdi
movq %rbx, %rsi
callq 0x3280
testl %eax, %eax
jne 0x6709
movl 0x4(%r12), %ebp
xorl %r13d, %r13d
testb %r13b, %r13b
je 0x673c
movq %r14, %rdi
leaq 0x4(%rsp), %rsi
callq 0x34b0
movq %rax, %r14
movl 0x4(%rsp), %esi
movq %rax, %rdi
callq 0x3300
testl %eax, %eax
jne 0x66b6
jmp 0x673c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x6746
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rdi
callq 0x35a0
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq