// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x10, %rsp
testq %rdi, %rdi
je 0x1735
movl %esi, %ebp
movq %rdi, %r15
pushq $0x3a
popq %rsi
callq 0x1090
testq %rax, %rax
je 0x13bd
movq %rax, %r12
leaq 0x1(%rax), %rdi
callq 0x11e0
testq %rax, %rax
je 0x1419
movq %rax, %rbx
cmpq %r15, %r12
ja 0x13d6
xorl %r14d, %r14d
jmp 0x1407
movq %r15, %rdi
callq 0x1080
xorl %ebx, %ebx
testq %rax, %rax
jle 0x1465
movq %rax, %r12
addq %r15, %r12
subq %r15, %r12
leaq 0x1(%r12), %rdi
callq 0x1140
testq %rax, %rax
je 0x1440
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1110
movb $0x0, (%r14,%r12)
testq %rbx, %rbx
je 0x1496
cmpb $0x0, (%rbx)
jne 0x1498
leaq 0xd13(%rip), %rdi       # 0x212a
jmp 0x146f
callq 0x1060
cmpl $0x0, (%rax)
je 0x1513
movq %rax, %rbx
leaq 0xceb(%rip), %rdi       # 0x211c
xorl %eax, %eax
callq 0x181d
andl $0x0, (%rbx)
jmp 0x16b8
callq 0x1060
cmpl $0x0, (%rax)
je 0x1526
movq %rax, %r14
leaq 0xccb(%rip), %rdi       # 0x2123
xorl %eax, %eax
callq 0x181d
andl $0x0, (%r14)
jmp 0x1489
leaq 0xcd5(%rip), %rdi       # 0x2141
xorl %r14d, %r14d
movq %r15, %rsi
xorl %eax, %eax
callq 0x19ac
callq 0x1060
andl $0x0, (%rax)
movq %r14, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
jmp 0x16b8
xorl %ebx, %ebx
testl %ebp, %ebp
je 0x15c7
callq 0x1b30
testl %eax, %eax
je 0x14cd
callq 0x1060
movq %rax, %r15
movl (%rax), %eax
testl %eax, %eax
je 0x155a
cmpl $0x1, %eax
jne 0x156d
cmpl $0x2, %ebp
je 0x16a2
xorl %edi, %edi
xorl %esi, %esi
callq 0x1130
testl %eax, %eax
js 0x1539
cmpl $0x1, %eax
ja 0x158e
jne 0x15c7
pushq $0x1
popq %rdi
leaq 0xc(%rsp), %rsi
callq 0x1130
cmpl $0x1, %eax
jne 0x1539
movl 0xc(%rsp), %r15d
callq 0x1160
cmpl %eax, %r15d
jne 0x158e
jmp 0x15c7
leaq 0xc02(%rip), %rdi       # 0x211c
xorl %eax, %eax
callq 0x19ac
jmp 0x16b8
leaq 0xbf6(%rip), %rdi       # 0x2123
xorl %eax, %eax
callq 0x19ac
jmp 0x1489
callq 0x1060
cmpl $0x0, (%rax)
je 0x1580
movq %rax, %r15
leaq 0xc1c(%rip), %rdi       # 0x2169
xorl %eax, %eax
callq 0x181d
andl $0x0, (%r15)
jmp 0x158e
leaq 0xb1e(%rip), %rdi       # 0x207f
xorl %eax, %eax
callq 0x19ac
jmp 0x16a2
leaq 0xb0b(%rip), %rdi       # 0x207f
xorl %eax, %eax
callq 0x181d
jmp 0x169e
leaq 0xbe2(%rip), %rdi       # 0x2169
xorl %eax, %eax
callq 0x19ac
cmpl $0x2, %ebp
jne 0x15b1
leaq 0xafa(%rip), %rdi       # 0x2094
xorl %eax, %eax
callq 0x19ac
callq 0x1060
movq %rax, %r15
andl $0x0, (%rax)
jmp 0x16a2
leaq 0xad3(%rip), %rdi       # 0x208b
xorl %eax, %eax
callq 0x19ac
callq 0x1060
andl $0x0, (%rax)
testq %rbx, %rbx
je 0x1618
callq 0x1060
movq %rax, %r15
andl $0x0, (%rax)
movq %rbx, %rdi
callq 0x1120
testq %rax, %rax
je 0x1675
movl 0x10(%rax), %r12d
movl %r12d, %edi
callq 0x1170
testl %eax, %eax
je 0x1618
movl (%r15), %eax
testl %eax, %eax
je 0x16c8
cmpl $0x1, %eax
je 0x16a2
movl %r12d, %esi
leaq 0xb7e(%rip), %rdi       # 0x2194
jmp 0x1697
testq %r14, %r14
je 0x1661
callq 0x1060
movq %rax, %r15
andl $0x0, (%rax)
movq %r14, %rdi
callq 0x10f0
testq %rax, %rax
je 0x1687
movl 0x10(%rax), %r12d
movl %r12d, %edi
callq 0x11d0
testl %eax, %eax
je 0x1661
movl (%r15), %eax
testl %eax, %eax
je 0x16ee
cmpl $0x1, %eax
je 0x16a2
movl %r12d, %esi
leaq 0xb5f(%rip), %rdi       # 0x21be
jmp 0x1697
movq %rbx, %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
xorl %eax, %eax
jmp 0x16bb
cmpl $0x0, (%r15)
je 0x16d4
leaq 0xaf3(%rip), %rdi       # 0x2175
movq %rbx, %rsi
jmp 0x1697
cmpl $0x0, (%r15)
je 0x1701
leaq 0xb0c(%rip), %rdi       # 0x21a0
movq %r14, %rsi
xorl %eax, %eax
callq 0x181d
andl $0x0, (%r15)
movl (%r15), %ebp
movq %rbx, %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
movl %ebp, (%r15)
pushq $-0x1
popq %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %r12d, %esi
leaq 0xac2(%rip), %rdi       # 0x2194
jmp 0x16f8
movq %rbx, %rdi
callq 0x1754
cmpl $0x0, (%r15)
je 0x1725
leaq 0xa99(%rip), %rdi       # 0x2182
movq %rbx, %rsi
jmp 0x1719
movl %r12d, %esi
leaq 0xac6(%rip), %rdi       # 0x21be
xorl %eax, %eax
callq 0x19ac
jmp 0x16a2
movq %r14, %rdi
callq 0x1754
cmpl $0x0, (%r15)
je 0x172d
leaq 0xa97(%rip), %rdi       # 0x21ad
movq %r14, %rsi
xorl %eax, %eax
callq 0x19ac
jmp 0x169e
movq %rax, %r12
jmp 0x15ec
movq %rax, %r12
jmp 0x1639
leaq 0x97d(%rip), %rdi       # 0x20b9
leaq 0x987(%rip), %rsi       # 0x20ca
leaq 0x994(%rip), %rcx       # 0x20de
movl $0x95, %edx
callq 0x10a0