// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]libcperciva/liball/../util/setuidgid.c
// Function: setuidgid
int
setuidgid(const char * user_group_string, int leave_suppgrp)
{
	char * username;
	char * groupname;
	int saved_errno;

	/* Get the username:groupname from ${user_group_string}. */
	if (string_extract_user_group(user_group_string, &username, &groupname))
		goto err0;

	/* If requested, leave supplementary groups. */
	if (leave_suppgrp != SETUIDGID_SGROUP_IGNORE) {
		/* Attempt to leave all supplementary groups. */
		if (setgroups_none()) {
			if (errno != EPERM) {
				warnp("setgroups()");
				goto err1;
			}

			/* We handle EPERM separately; keep it in errno. */
			if (leave_suppgrp == SETUIDGID_SGROUP_LEAVE_ERROR)
				goto err1;
		}

		/* Check that we have actually left all supplementary groups. */
		if (check_supplementary_groups_none()) {
			if (leave_suppgrp == SETUIDGID_SGROUP_LEAVE_ERROR) {
				warn0("Failed to leave supplementary groups");
				goto err1;
			}

			/* Print warning, but don't indicate an error. */
			warn0("Warning: Failed to leave supplementary groups");
		}
	}

	/* Set group; must be changed before user. */
	if (groupname && set_group(groupname))
		goto err1;

	/* Set user. */
	if (username && set_user(username))
		goto err1;

	/* Clean up. */
	free(groupname);
	free(username);

	/* Success! */
	return (0);

err1:
	/* POSIX Issue 7 does not forbid free() from modifying errno. */
	saved_errno = errno;

	/* Clean up. */
	free(groupname);
	free(username);

	/* Restore errno. */
	errno = saved_errno;
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x28(%rbp), %rdx
callq 0x1520
cmpl $0x0, %eax
je 0x13da
jmp 0x1502
cmpl $0x0, -0x14(%rbp)
je 0x148d
callq 0x22a0
cmpl $0x0, %eax
je 0x1441
callq 0x1070
cmpl $0x1, (%rax)
je 0x1434
jmp 0x13fa
callq 0x1070
cmpl $0x0, (%rax)
je 0x141f
leaq 0x1c85(%rip), %rdi      # 0x3090
movb $0x0, %al
callq 0x1e10
callq 0x1070
movl $0x0, (%rax)
jmp 0x142d
leaq 0x1c6a(%rip), %rdi      # 0x3090
movb $0x0, %al
callq 0x2060
jmp 0x142f
jmp 0x14d6
cmpl $0x2, -0x14(%rbp)
jne 0x143f
jmp 0x14d6
jmp 0x1441
callq 0x1740
cmpl $0x0, %eax
je 0x148b
cmpl $0x2, -0x14(%rbp)
jne 0x146e
jmp 0x1453
leaq 0x1c4b(%rip), %rdi      # 0x30a5
movb $0x0, %al
callq 0x2060
callq 0x1070
movl $0x0, (%rax)
jmp 0x14d6
jmp 0x1470
leaq 0x1c25(%rip), %rdi      # 0x309c
movb $0x0, %al
callq 0x2060
callq 0x1070
movl $0x0, (%rax)
jmp 0x148b
jmp 0x148d
cmpq $0x0, -0x28(%rbp)
je 0x14a4
movq -0x28(%rbp), %rdi
callq 0x1820
cmpl $0x0, %eax
je 0x14a4
jmp 0x14d6
cmpq $0x0, -0x20(%rbp)
je 0x14bb
movq -0x20(%rbp), %rdi
callq 0x1a00
cmpl $0x0, %eax
je 0x14bb
jmp 0x14d6
movq -0x28(%rbp), %rdi
callq 0x1030
movq -0x20(%rbp), %rdi
callq 0x1030
movl $0x0, -0x4(%rbp)
jmp 0x1509
callq 0x1070
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rdi
callq 0x1030
movq -0x20(%rbp), %rdi
callq 0x1030
movl -0x2c(%rbp), %eax
movl %eax, -0x30(%rbp)
callq 0x1070
movl -0x30(%rbp), %ecx
movl %ecx, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)