// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x18f5
movl %esi, %ebp
movq %rdi, %r15
movl $0x3a, %esi
callq 0x1090
testq %rax, %rax
je 0x14f2
movq %rax, %r12
leaq 0x1(%rax), %rdi
callq 0x11e0
testq %rax, %rax
je 0x154e
movq %rax, %rbx
cmpq %r15, %r12
ja 0x150b
xorl %r14d, %r14d
jmp 0x153c
movq %r15, %rdi
callq 0x1080
xorl %ebx, %ebx
testq %rax, %rax
jle 0x15a0
movq %rax, %r12
addq %r15, %r12
subq %r15, %r12
leaq 0x1(%r12), %rdi
callq 0x1140
testq %rax, %rax
je 0x1578
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1110
movb $0x0, (%r14,%r12)
testq %rbx, %rbx
je 0x15d4
cmpb $0x0, (%rbx)
jne 0x15d6
leaq 0xbde(%rip), %rdi       # 0x212a
jmp 0x15aa
callq 0x1060
cmpl $0x0, (%rax)
je 0x1650
movq %rax, %rbx
leaq 0xbb6(%rip), %rdi       # 0x211c
xorl %eax, %eax
callq 0x1994
movl $0x0, (%rbx)
jmp 0x18b4
callq 0x1060
cmpl $0x0, (%rax)
je 0x1663
movq %rax, %r14
leaq 0xb93(%rip), %rdi       # 0x2123
xorl %eax, %eax
callq 0x1994
movl $0x0, (%r14)
jmp 0x15c7
leaq 0xb9a(%rip), %rdi       # 0x2141
xorl %r14d, %r14d
movq %r15, %rsi
xorl %eax, %eax
callq 0x1ab3
callq 0x1060
movl $0x0, (%rax)
movq %r14, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
jmp 0x18b4
xorl %ebx, %ebx
testl %ebp, %ebp
je 0x170d
callq 0x1bd8
testl %eax, %eax
je 0x160b
callq 0x1060
movq %rax, %r15
movl (%rax), %eax
testl %eax, %eax
je 0x169a
cmpl $0x1, %eax
jne 0x16ad
cmpl $0x2, %ebp
je 0x189e
xorl %edi, %edi
xorl %esi, %esi
callq 0x1130
testl %eax, %eax
js 0x1676
cmpl $0x1, %eax
ja 0x16ce
jne 0x170d
movq %rsp, %rsi
movl $0x1, %edi
callq 0x1130
cmpl $0x1, %eax
jne 0x1676
movl (%rsp), %r15d
callq 0x1160
cmpl %eax, %r15d
jne 0x16ce
jmp 0x170d
leaq 0xac5(%rip), %rdi       # 0x211c
xorl %eax, %eax
callq 0x1ab3
jmp 0x18b4
leaq 0xab9(%rip), %rdi       # 0x2123
xorl %eax, %eax
callq 0x1ab3
jmp 0x15c7
callq 0x1060
cmpl $0x0, (%rax)
je 0x16c0
movq %rax, %r15
leaq 0xadf(%rip), %rdi       # 0x2169
xorl %eax, %eax
callq 0x1994
movl $0x0, (%r15)
jmp 0x16ce
leaq 0x9de(%rip), %rdi       # 0x207f
xorl %eax, %eax
callq 0x1ab3
jmp 0x189e
leaq 0x9cb(%rip), %rdi       # 0x207f
xorl %eax, %eax
callq 0x1994
jmp 0x1897
leaq 0xaa2(%rip), %rdi       # 0x2169
xorl %eax, %eax
callq 0x1ab3
cmpl $0x2, %ebp
jne 0x16f4
leaq 0x9ba(%rip), %rdi       # 0x2094
xorl %eax, %eax
callq 0x1ab3
callq 0x1060
movq %rax, %r15
movl $0x0, (%rax)
jmp 0x189e
leaq 0x990(%rip), %rdi       # 0x208b
xorl %eax, %eax
callq 0x1ab3
callq 0x1060
movl $0x0, (%rax)
testq %rbx, %rbx
je 0x1764
callq 0x1060
movq %rax, %r15
movl $0x0, (%rax)
movq %rbx, %rdi
callq 0x1120
testq %rax, %rax
je 0x17cb
movl 0x10(%rax), %r12d
movl %r12d, %edi
callq 0x1170
testl %eax, %eax
je 0x1764
movl (%r15), %eax
testl %eax, %eax
je 0x1840
cmpl $0x1, %eax
je 0x189e
movl %r12d, %esi
leaq 0xa35(%rip), %rdi       # 0x2194
jmp 0x17ed
testq %r14, %r14
je 0x17b4
callq 0x1060
movq %rax, %r15
movl $0x0, (%rax)
movq %r14, %rdi
callq 0x10f0
testq %rax, %rax
je 0x17dd
movl 0x10(%rax), %r12d
movl %r12d, %edi
callq 0x11d0
testl %eax, %eax
je 0x17b4
movl (%r15), %eax
testl %eax, %eax
je 0x18c8
cmpl $0x1, %eax
je 0x189e
movl %r12d, %esi
leaq 0xa0c(%rip), %rdi       # 0x21be
jmp 0x17ed
movq %rbx, %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
xorl %eax, %eax
jmp 0x18b9
cmpl $0x0, (%r15)
je 0x17f9
leaq 0x99d(%rip), %rdi       # 0x2175
movq %rbx, %rsi
jmp 0x17ed
cmpl $0x0, (%r15)
je 0x184f
leaq 0x9b6(%rip), %rdi       # 0x21a0
movq %r14, %rsi
xorl %eax, %eax
callq 0x1994
jmp 0x1897
movq %rsp, %r13
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x1180
movq %rax, %r12
movq (%r13), %rcx
movl $0x16, %eax
cmpq %rbx, %rcx
je 0x1831
cmpb $0x0, (%rcx)
jne 0x1831
movq %r12, %rax
shrq $0x20, %rax
movl $0x22, %eax
je 0x18db
movl %eax, (%r15)
leaq 0x947(%rip), %rdi       # 0x2182
movq %rbx, %rsi
jmp 0x1890
movl %r12d, %esi
leaq 0x94a(%rip), %rdi       # 0x2194
jmp 0x18d2
movq %rsp, %r13
movq %r14, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x1180
movq %rax, %r12
movq (%r13), %rcx
movl $0x16, %eax
cmpq %r14, %rcx
je 0x1883
cmpb $0x0, (%rcx)
jne 0x1883
movq %r12, %rax
shrq $0x20, %rax
movl $0x22, %eax
je 0x18ea
movl %eax, (%r15)
leaq 0x920(%rip), %rdi       # 0x21ad
movq %r14, %rsi
xorl %eax, %eax
callq 0x1ab3
movl $0x0, (%r15)
movl (%r15), %ebp
movq %rbx, %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
movl %ebp, (%r15)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r12d, %esi
leaq 0x8ec(%rip), %rdi       # 0x21be
xorl %eax, %eax
callq 0x1ab3
jmp 0x189e
cmpl $0x0, (%r15)
jne 0x1834
jmp 0x1735
cmpl $0x0, (%r15)
jne 0x1886
jmp 0x1788
leaq 0x7bd(%rip), %rdi       # 0x20b9
leaq 0x7c7(%rip), %rsi       # 0x20ca
leaq 0x7d4(%rip), %rcx       # 0x20de
movl $0x95, %edx
callq 0x10a0