// File: /workspace/github_c_makefile_star2_O1/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 0x1902
movl %esi, %r15d
movq %rdi, %r12
movl $0x3a, %esi
callq 0x1090
testq %rax, %rax
je 0x1519
movq %rax, %r13
movq %rax, %rdi
incq %rdi
callq 0x11e0
movq %rax, %rbx
testq %rax, %rax
jne 0x1529
callq 0x1060
cmpl $0x0, (%rax)
je 0x15c1
movq %rax, %r14
leaq 0xc19(%rip), %rdi       # 0x211c
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x19a4
movl $0x0, (%r14)
jmp 0x15d2
movq %r12, %rdi
callq 0x1080
movq %rax, %r13
addq %r12, %r13
xorl %ebx, %ebx
subq %r12, %r13
jbe 0x1554
leaq 0x1(%r13), %rdi
callq 0x1140
movq %rax, %r14
testq %rax, %rax
je 0x159c
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x1110
movb $0x0, (%r14,%r13)
jmp 0x1557
xorl %r14d, %r14d
movb $0x1, %r13b
testq %rbx, %rbx
je 0x1571
cmpb $0x0, (%rbx)
jne 0x15ed
leaq 0xbbb(%rip), %rdi       # 0x212a
jmp 0x157d
testq %r14, %r14
jne 0x15ed
leaq 0xbc4(%rip), %rdi       # 0x2141
movq %r12, %rsi
xorl %eax, %eax
callq 0x1ac3
callq 0x1060
movl $0x0, (%rax)
movq %r14, %rdi
callq 0x1030
jmp 0x15e2
callq 0x1060
cmpl $0x0, (%rax)
je 0x15d4
movq %rax, %r12
leaq 0xb73(%rip), %rdi       # 0x2123
xorl %eax, %eax
callq 0x19a4
movl $0x0, (%r12)
jmp 0x15e2
leaq 0xb54(%rip), %rdi       # 0x211c
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x1ac3
jmp 0x15ed
leaq 0xb48(%rip), %rdi       # 0x2123
xorl %eax, %eax
callq 0x1ac3
movq %rbx, %rdi
callq 0x1030
xorl %r13d, %r13d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %r13b, %r13b
je 0x1893
testl %r15d, %r15d
je 0x170d
callq 0x1be8
testl %eax, %eax
je 0x162e
callq 0x1060
movq %rax, %r12
movl (%rax), %eax
testl %eax, %eax
je 0x1694
cmpl $0x1, %eax
jne 0x16a7
cmpl $0x2, %r15d
je 0x1875
xorl %edi, %edi
xorl %esi, %esi
callq 0x1130
testl %eax, %eax
js 0x166f
cmpl $0x1, %eax
jg 0x16d0
jne 0x170d
movq %rsp, %rsi
movl $0x1, %edi
callq 0x1130
cmpl $0x1, %eax
jne 0x166f
movl (%rsp), %r12d
callq 0x1160
cmpl %eax, %r12d
jne 0x16d0
jmp 0x170d
callq 0x1060
cmpl $0x0, (%rax)
je 0x16c2
movq %rax, %r12
leaq 0xae6(%rip), %rdi       # 0x2169
xorl %eax, %eax
callq 0x19a4
movl $0x0, (%r12)
jmp 0x16d0
leaq 0x9e4(%rip), %rdi       # 0x207f
xorl %eax, %eax
callq 0x1ac3
jmp 0x1875
leaq 0x9d1(%rip), %rdi       # 0x207f
xorl %eax, %eax
callq 0x19a4
movl $0x0, (%r12)
jmp 0x1875
leaq 0xaa0(%rip), %rdi       # 0x2169
xorl %eax, %eax
callq 0x1ac3
cmpl $0x2, %r15d
jne 0x16f4
leaq 0x9b7(%rip), %rdi       # 0x2094
xorl %eax, %eax
callq 0x1ac3
callq 0x1060
movl $0x0, (%rax)
jmp 0x1875
leaq 0x990(%rip), %rdi       # 0x208b
xorl %eax, %eax
callq 0x1ac3
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 0x1801
cmpl $0x1, %eax
je 0x1875
movl %r12d, %esi
leaq 0xa35(%rip), %rdi       # 0x2194
jmp 0x17f1
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 0x1864
cmpl $0x1, %eax
je 0x1875
movl %r12d, %esi
leaq 0xa0c(%rip), %rdi       # 0x21be
jmp 0x17f1
movq %rbx, %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
xorl %ebp, %ebp
jmp 0x1893
cmpl $0x0, (%r15)
je 0x180d
leaq 0x99d(%rip), %rdi       # 0x2175
movq %rbx, %rsi
jmp 0x17f1
cmpl $0x0, (%r15)
je 0x18a4
leaq 0x9b2(%rip), %rdi       # 0x21a0
movq %r14, %rsi
xorl %eax, %eax
callq 0x19a4
movl $0x0, (%r15)
jmp 0x1875
movl %r12d, %esi
leaq 0x989(%rip), %rdi       # 0x2194
jmp 0x186e
movl $0x0, (%r15)
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 0x1848
cmpb $0x0, (%rcx)
jne 0x1848
movq %r12, %rax
shrq $0x20, %rax
movl $0x22, %eax
je 0x184b
movl %eax, (%r15)
cmpl $0x0, (%r15)
je 0x1735
leaq 0x926(%rip), %rdi       # 0x2182
movq %rbx, %rsi
jmp 0x18f6
movl %r12d, %esi
leaq 0x950(%rip), %rdi       # 0x21be
xorl %eax, %eax
callq 0x1ac3
callq 0x1060
movq %rax, %r15
movl (%rax), %r12d
movq %rbx, %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
movl %r12d, (%r15)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x0, (%r15)
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 0x18df
cmpb $0x0, (%rcx)
jne 0x18df
movq %r12, %rax
shrq $0x20, %rax
movl $0x22, %eax
je 0x18e2
movl %eax, (%r15)
cmpl $0x0, (%r15)
je 0x1788
leaq 0x8ba(%rip), %rdi       # 0x21ad
movq %r14, %rsi
xorl %eax, %eax
callq 0x1ac3
jmp 0x17f8
leaq 0x7b0(%rip), %rdi       # 0x20b9
leaq 0x7ba(%rip), %rsi       # 0x20ca
leaq 0x7c7(%rip), %rcx       # 0x20de
movl $0x95, %edx
callq 0x10a0
nopl (%rax)