// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]libcperciva/liball/../util/setuidgid.c
// Function: string_extract_user_group
static int
string_extract_user_group(const char * combined, char ** username_p,
    char ** groupname_p)
{
	const char * s;
	size_t username_len;

	/* Sanity check. */
	assert(combined != NULL);

	/* If there's a ':', what follows is the group name. */
	if ((s = strchr(combined, ':')) != NULL) {
		/* Duplicate the group name. */
		if ((*groupname_p = strdup(&s[1])) == NULL) {
			warnp("strdup");
			goto err0;
		}
	} else {
		/* No group name. */
		*groupname_p = NULL;

		/* User name includes everything prior to terminating NUL. */
		s = &combined[strlen(combined)];
	}

	/* Anything prior to the ':' or terminating NUL is the user name. */
	if (s > combined) {
		username_len = (size_t)(s - combined);

		/* Duplicate the user name. */
		if ((*username_p = malloc(username_len + 1)) == NULL) {
			warnp("malloc");
			goto err1;
		}
		memcpy(*username_p, combined, username_len);
		(*username_p)[username_len] = '\0';
	} else {
		/* No user name. */
		*username_p = NULL;
	}

	/* Reject empty group names. */
	if ((*groupname_p != NULL) && (strlen(*groupname_p) == 0)) {
		warn0("Empty group name: \"%s\"", combined);
		goto err2;
	}

	/* Reject strings with neither user nor group. */
	if ((*groupname_p == NULL) && (*username_p == NULL)) {
		warn0("Need to specify user and/or group: \"%s\"", combined);
		goto err2;
	}

	/* Success! */
	return (0);

err2:
	free(*username_p);
err1:
	free(*groupname_p);
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x153d
jmp 0x155c
leaq 0x1b86(%rip), %rdi      # 0x30ca
leaq 0x1b90(%rip), %rsi      # 0x30db
movl $0x95, %edx
leaq 0x1b98(%rip), %rcx      # 0x30ef
callq 0x10c0
movq -0x10(%rbp), %rdi
movl $0x3a, %esi
callq 0x10b0
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x15cc
movq -0x28(%rbp), %rdi
addq $0x1, %rdi
callq 0x11d0
movq -0x20(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x15ca
jmp 0x1590
callq 0x1070
cmpl $0x0, (%rax)
je 0x15b5
leaq 0x1b8c(%rip), %rdi      # 0x312d
movb $0x0, %al
callq 0x1e10
callq 0x1070
movl $0x0, (%rax)
jmp 0x15c3
leaq 0x1b71(%rip), %rdi      # 0x312d
movb $0x0, %al
callq 0x2060
jmp 0x15c5
jmp 0x172c
jmp 0x15f6
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x10a0
movq %rax, %rcx
movq -0x38(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x10(%rbp), %rax
jbe 0x168e
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
addq $0x1, %rdi
callq 0x1140
movq -0x18(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x1669
jmp 0x162f
callq 0x1070
cmpl $0x0, (%rax)
je 0x1654
leaq 0x1af4(%rip), %rdi      # 0x3134
movb $0x0, %al
callq 0x1e10
callq 0x1070
movl $0x0, (%rax)
jmp 0x1662
leaq 0x1ad9(%rip), %rdi      # 0x3134
movb $0x0, %al
callq 0x2060
jmp 0x1664
jmp 0x1720
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x1110
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movb $0x0, (%rax,%rcx)
jmp 0x1699
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0x16d6
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x10a0
cmpq $0x0, %rax
jne 0x16d6
jmp 0x16b7
movq -0x10(%rbp), %rsi
leaq 0x1a79(%rip), %rdi      # 0x313b
movb $0x0, %al
callq 0x2060
callq 0x1070
movl $0x0, (%rax)
jmp 0x1714
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x170b
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x170b
jmp 0x16ec
movq -0x10(%rbp), %rsi
leaq 0x1a5b(%rip), %rdi      # 0x3152
movb $0x0, %al
callq 0x2060
callq 0x1070
movl $0x0, (%rax)
jmp 0x1714
movl $0x0, -0x4(%rbp)
jmp 0x1733
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x1030
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x1030
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)