// File: /workspace/github_c_makefile_star2_O0/wahern[P]cqueues/src/lib/socket.c
// Function: so_bind
int (so_bind)(int fd, sockaddr_arg_t arg, const struct so_options *opts) {
#if SA_UNIX
	if (*sa_family(arg) == AF_UNIX) {
		char *path = strncpy((char [sizeof sockaddr_ref(arg).sun->sun_path + 1]){ 0 }, sockaddr_ref(arg).sun->sun_path, sizeof sockaddr_ref(arg).sun->sun_path);
		_Bool nochmod = 0;
		int error;

		if (opts->sun_unlink && *path)
			(void)unlink(path);

		if (opts->sun_mode) {
			if (0 == fchmod(fd, (opts->sun_mode & 0777)))
				nochmod = 1;
			else if (errno != EINVAL) /* BSDs return EINVAL */
				return errno;
		}

		if (opts->sun_mask) {
			mode_t omask = umask(opts->sun_mask & 0777);
			error = (0 == bind(fd, sockaddr_ref(arg).sa, sa_len(arg)))? 0 : errno;
			umask(omask);
		} else {
			error = (0 == bind(fd, sockaddr_ref(arg).sa, sa_len(arg)))? 0 : errno;
		}

		if (error)
			return error;

		if (opts->sun_mode && !nochmod && *path) {
			if (0 != chmod(path, (opts->sun_mode & 0777)))
				return errno;
		}

		return 0;
	}
#endif

	if (0 != bind(fd, sockaddr_ref(arg).sa, sa_len(arg)))
		return so_soerr();

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rsi, -0x10(%rbp)
movl %edi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2bd10
movzwl (%rax), %eax
cmpl $0x1, %eax
jne 0x2c9fb
leaq -0x95(%rbp), %rdi
xorl %esi, %esi
movl $0x6d, %edx
callq 0xf7d0
leaq -0x95(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2c450
movq -0xe8(%rbp), %rdi
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rsi
addq $0x2, %rsi
movl $0x6c, %edx
callq 0xf700
movq %rax, -0x28(%rbp)
movb $0x0, -0xa1(%rbp)
movq -0x20(%rbp), %rax
testb $0x1, 0x10(%rax)
je 0x2c832
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x2c832
movq -0x28(%rbp), %rdi
callq 0xf630
movq -0x20(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x2c87f
movl -0x14(%rbp), %edi
movq -0x20(%rbp), %rax
movl 0x8(%rax), %esi
andl $0x1ff, %esi            # imm = 0x1FF
callq 0xf620
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x2c862
movb $0x1, -0xa1(%rbp)
jmp 0x2c87d
callq 0xf0a0
cmpl $0x16, (%rax)
je 0x2c87b
callq 0xf0a0
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2ca5a
jmp 0x2c87d
jmp 0x2c87f
movq -0x20(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x2c921
movq -0x20(%rbp), %rax
movl 0xc(%rax), %edi
andl $0x1ff, %edi            # imm = 0x1FF
callq 0x109e0
movl %eax, -0xac(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0xec(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2c450
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2c000
movl -0xec(%rbp), %edi
movl %eax, %edx
movq -0xb8(%rbp), %rsi
callq 0xf1a0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x2c8fb
xorl %eax, %eax
movl %eax, -0xf0(%rbp)
jmp 0x2c908
callq 0xf0a0
movl (%rax), %eax
movl %eax, -0xf0(%rbp)
movl -0xf0(%rbp), %eax
movl %eax, -0xa8(%rbp)
movl -0xac(%rbp), %edi
callq 0x109e0
jmp 0x2c990
movl -0x14(%rbp), %eax
movl %eax, -0xf4(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2c450
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2c000
movl -0xf4(%rbp), %edi
movl %eax, %edx
movq -0xc8(%rbp), %rsi
callq 0xf1a0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x2c977
xorl %eax, %eax
movl %eax, -0xf8(%rbp)
jmp 0x2c984
callq 0xf0a0
movl (%rax), %eax
movl %eax, -0xf8(%rbp)
movl -0xf8(%rbp), %eax
movl %eax, -0xa8(%rbp)
cmpl $0x0, -0xa8(%rbp)
je 0x2c9a7
movl -0xa8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2ca5a
movq -0x20(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x2c9f2
testb $0x1, -0xa1(%rbp)
jne 0x2c9f2
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x2c9f2
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movl 0x8(%rax), %esi
andl $0x1ff, %esi            # imm = 0x1FF
callq 0xfd00
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x2c9f0
callq 0xf0a0
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2ca5a
jmp 0x2c9f2
movl $0x0, -0x4(%rbp)
jmp 0x2ca5a
movl -0x14(%rbp), %eax
movl %eax, -0xfc(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2c450
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2c000
movl -0xfc(%rbp), %edi
movl %eax, %edx
movq -0xd8(%rbp), %rsi
callq 0xf1a0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x2ca53
callq 0xf0a0
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2ca5a
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)