// File: /workspace/github_c_makefile_star2_O1/wahern[P]cqueues/src/lib/socket.c
// Function: so_exec
static int so_exec(struct socket *so) {
	int state, error_, error = 0;

exec:

	switch (state = so_state(so)) {
	case SO_S_INIT:
		break;
	case SO_S_GETADDR:
		switch ((error_ = so_getaddr_(so))) {
		case 0:
			break;
		case ENOENT:
			/* NOTE: Return the last error if possible. */
			if (error)
				error_ = error;
			else if (so->lerror)
				error_ = so->lerror;

			/* FALL THROUGH */
		default:
			error = error_;

			goto error;
		}

		so->done |= state;

		goto exec;
	case SO_S_SOCKET:
		if ((error = so_socket_(so)))
			goto retry;

		so->done |= state;

		goto exec;
	case SO_S_BIND:
		if ((error = so_bind_(so)))
			goto retry;

		so->done |= state;

		goto exec;
	case SO_S_LISTEN:
		if ((error = so_listen_(so)))
			return error;

		so->done |= state;

		goto exec;
	case SO_S_CONNECT:
		if ((error = so_connect_(so))) {
			switch (error) {
			case SO_EAGAIN:
				goto error;
			default:
				goto retry;
			} /* switch() */
		}

		so->done |= state;

		goto exec;
	case SO_S_STARTTLS:
		if ((error = so_starttls_(so)))
			goto error;

		so->done |= state;

		goto exec;
	case SO_S_SETREAD:
		so->events |= POLLIN;
		so->done   |= state;

		goto exec;
	case SO_S_SETWRITE:
		so->events |= POLLOUT;
		so->done   |= state;

		goto exec;
	case SO_S_RSTLOWAT:
		if ((error = so_rstlowat_(so)))
			goto error;

		so->todo &= ~state;

		goto exec;
	case SO_S_SHUTWR:
		if ((error = so_shutwr_(so)))
			goto error;

		so->done |= state;

		goto exec;
	case SO_S_SHUTRD:
		if ((error = so_shutrd_(so)))
			goto error;

		so->done |= state;

		goto exec;
	} /* so_exec() */

	return 0;
retry:
	/*
	 * Jump back to the SO_S_GETADDR iterator if enabled. Otherwise,
	 * this is a terminal error.
	 */
	if (so->todo & SO_S_GETADDR) {
		so->done = 0;
		so->lerror = error;

		goto exec;
	}

	/* FALL THROUGH */
error:
	return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
leaq 0xc0(%rdi), %r14
leaq 0xb0(%rdi), %rax
movq %rax, 0x8(%rsp)
leaq 0x58(%rdi), %rax
movq %rax, 0x38(%rsp)
leaq 0x5c(%rdi), %rax
movq %rax, 0x28(%rsp)
leaq 0x60(%rdi), %rax
movq %rax, 0x20(%rsp)
leaq 0x64(%rdi), %rax
movq %rax, 0x18(%rsp)
leaq 0x68(%rdi), %rax
movq %rax, 0x10(%rsp)
leaq 0xa8(%rdi), %rax
movq %rax, 0x30(%rsp)
xorl %ebp, %ebp
movl 0xb4(%rbx), %ecx
movl 0xb8(%rbx), %edx
movl %ecx, %esi
notl %esi
movl $0x0, %eax
andl %edx, %esi
je 0x241f1
movl $0x1, %eax
testl %esi, %eax
jne 0x241f1
addl %eax, %eax
cmpl $0x801, %eax            # imm = 0x801
jl 0x241e2
xorl %eax, %eax
xorl %r15d, %r15d
cmpl $0x3f, %eax
jle 0x24238
cmpl $0x1ff, %eax            # imm = 0x1FF
jg 0x244c3
cmpl $0x40, %eax
je 0x245fa
cmpl $0x80, %eax
je 0x24365
cmpl $0x100, %eax            # imm = 0x100
jne 0x2498b
orb $0x4, 0xb0(%rbx)
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0xb4(%rbx)
jmp 0x241c4
cmpl $0x7, %eax
jle 0x242b7
cmpl $0x8, %eax
je 0x2434c
cmpl $0x10, %eax
je 0x24552
cmpl $0x20, %eax
jne 0x2498b
andb $-0x5, 0xb0(%rbx)
movq 0xa8(%rbx), %rax
testq %rax, %rax
je 0x2428c
movl 0x58(%rbx), %edi
movq 0x18(%rax), %rsi
movl 0x10(%rax), %edx
callq 0xfaa0
testl %eax, %eax
je 0x243fd
callq 0xf0a0
movl (%rax), %r15d
jmp 0x24292
movl $0x8c9c94cb, %r15d      # imm = 0x8C9C94CB
cmpl $0x4, %r15d
je 0x2425f
leal -0x72(%r15), %eax
cmpl $0x2, %eax
jae 0x243f7
orb $0x4, 0xb0(%rbx)
movl $0xb, %r15d
jmp 0x2447a
cmpl $0x2, %eax
je 0x2437d
cmpl $0x4, %eax
jne 0x2498b
cmpq $0x0, 0xa8(%rbx)
je 0x24437
movq 0x38(%rsp), %rdi
movq %rbx, %rsi
callq 0xf2b0
movq 0xa8(%rbx), %rax
movl 0x4(%rax), %edi
movl 0x8(%rax), %esi
movq %rbx, %rdx
leaq 0x40(%rsp), %rcx
callq 0xff20
movl %eax, 0x58(%rbx)
cmpl $-0x1, %eax
je 0x2443f
movl %eax, %edi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
movq 0x10(%rsp), %r8
callq 0x23f9c
movl %eax, %r15d
movl %eax, 0x40(%rsp)
testl %eax, %eax
jne 0x24444
movl 0x58(%rbx), %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x108c0
movl %eax, 0x6c(%rbx)
xorl %r15d, %r15d
jmp 0x24444
testb $0x10, %dl
jne 0x243d0
movq (%rbx), %rsi
testq %rsi, %rsi
jne 0x243e4
xorl %r15d, %r15d
jmp 0x24494
orb $0x1, 0xb0(%rbx)
orl $0x80, %ecx
movl %ecx, 0xb4(%rbx)
jmp 0x241c4
cmpq $0x0, 0x50(%rbx)
je 0x2441c
movw $0x0, 0xb0(%rbx)
movq 0xa8(%rbx), %rdi
callq 0xff30
movq $0x0, 0xa8(%rbx)
movq 0x50(%rbx), %rsi
movq 0x30(%rsp), %rdi
callq 0xfcd0
movl %eax, %r15d
cmpl $0xb, %eax
jne 0x24422
movq 0x50(%rbx), %rdi
callq 0x107b0
movw %ax, 0xb0(%rbx)
jmp 0x24422
movq 0xa8(%rbx), %rax
testq %rax, %rax
je 0x2448e
movq 0x18(%rax), %rsi
movl 0x58(%rbx), %edi
movq %rbx, %rdx
callq 0xfd80
movl %eax, %r15d
jmp 0x24494
cmpl $0x6a, %r15d
jne 0x2444e
movl 0x58(%rbx), %esi
movq 0xa8(%rbx), %rdx
xorl %r15d, %r15d
xorl %edi, %edi
leaq 0x12571(%rip), %rcx     # 0x36984
xorl %eax, %eax
callq 0x251a8
jmp 0x2447a
movl $0x8c9c94cb, %r15d      # imm = 0x8C9C94CB
testl %r15d, %r15d
jne 0x2496c
orb $0x2, 0xb4(%rbx)
jmp 0x241c4
movl $0x8c9c94cb, %r15d      # imm = 0x8C9C94CB
jmp 0x24444
movl 0x40(%rsp), %r15d
testl %r15d, %r15d
jne 0x2449d
jmp 0x2471a
movl 0x58(%rbx), %r13d
movq 0xa8(%rbx), %r12
movl %r15d, %edi
callq 0xfbe0
xorl %edi, %edi
movl %r13d, %esi
movq %r12, %rdx
leaq 0x11b05(%rip), %rcx     # 0x35f75
movq %rax, %r8
xorl %eax, %eax
callq 0x251a8
testl %r15d, %r15d
je 0x246ea
cmpl $0xb, %r15d
jne 0x2449d
jmp 0x2498b
movl $0x8c9c94cb, %r15d      # imm = 0x8C9C94CB
testl %r15d, %r15d
je 0x2470e
testb $0x2, 0xb8(%rbx)
je 0x2498b
movl $0x0, 0xb4(%rbx)
movl %r15d, 0xbc(%rbx)
movl %r15d, %ebp
jmp 0x241c4
cmpl $0x200, %eax            # imm = 0x200
je 0x245ca
cmpl $0x400, %eax            # imm = 0x400
je 0x2459f
cmpl $0x800, %eax            # imm = 0x800
jne 0x2498b
movl 0x58(%rbx), %edi
cmpl $-0x1, %edi
je 0x24533
xorl %esi, %esi
callq 0x10190
testl %eax, %eax
je 0x24533
callq 0xf0a0
movl (%rax), %r15d
cmpl $0x6b, %r15d
jne 0x2453d
movq %rax, %r13
movl 0x58(%rbx), %edi
movl $0x10, 0x4(%rsp)
leaq 0x40(%rsp), %rsi
leaq 0x4(%rsp), %rdx
callq 0xf970
testl %eax, %eax
je 0x24533
cmpl $0x6b, (%r13)
movl $0x6b, %r15d
je 0x2453d
movb $0x1, 0xa0(%rbx)
xorl %r15d, %r15d
testl %r15d, %r15d
jne 0x2498b
orb $0x8, 0xb5(%rbx)
jmp 0x241c2
movl 0x5c(%rbx), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
xorl %r15d, %r15d
cmpl $0xc000, %eax           # imm = 0xC000
jne 0x2458a
movl 0x64(%rbx), %eax
orl $0x4, %eax
cmpl $0x5, %eax
jne 0x2458a
movl 0x58(%rbx), %edi
movl $0x1000, %esi           # imm = 0x1000
callq 0xfeb0
testl %eax, %eax
je 0x2458a
callq 0xf0a0
movl (%rax), %r15d
testl %r15d, %r15d
jne 0x2498b
orb $0x10, 0xb4(%rbx)
jmp 0x241c2
movl 0x58(%rbx), %edi
cmpl $-0x1, %edi
je 0x246c7
movl $0x1, %esi
callq 0x10190
testl %eax, %eax
je 0x246c7
callq 0xf0a0
movl (%rax), %r15d
jmp 0x246d5
movl 0x58(%rbx), %edi
movl $0x1, %esi
movl $0x12, %edx
movq %r14, %rcx
movl $0x4, %r8d
callq 0x10820
testl %eax, %eax
je 0x246f6
callq 0xf0a0
movl (%rax), %r15d
jmp 0x246f9
movl 0xd0(%rbx), %r15d
testl %r15d, %r15d
jne 0x2495b
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x24fd1
callq 0x10130
movl 0xd4(%rbx), %eax
cmpq $0x3, %rax
ja 0x24951
leaq 0x11f6d(%rip), %rcx     # 0x365a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x5c(%rbx), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
cmpl $0xc000, %eax           # imm = 0xC000
jne 0x24726
cmpl $0x2, 0x64(%rbx)
jne 0x24726
xorps %xmm0, %xmm0
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movl 0x58(%rbx), %edi
movl $0x80, 0x4(%rsp)
leaq 0x40(%rsp), %rsi
leaq 0x4(%rsp), %rdx
callq 0xf970
testl %eax, %eax
je 0x247ee
callq 0xf0a0
movl (%rax), %r13d
movl $0x3, %r12d
jmp 0x24848
movb $0x1, %al
movb %al, 0xa1(%rbx)
movb %al, 0x78(%rbx)
xorl %r15d, %r15d
testl %r15d, %r15d
jne 0x2498b
orb $0x4, 0xb5(%rbx)
jmp 0x241c2
orb $0x20, 0xb4(%rbx)
jmp 0x241c2
xorl %r15d, %r15d
testl %r15d, %r15d
jne 0x2498b
andb $-0x3, 0xb9(%rbx)
jmp 0x241c2
orb $0x8, 0xb4(%rbx)
jmp 0x241c2
orb $0x4, 0xb4(%rbx)
jmp 0x241c2
cmpq $0x0, 0x23f12(%rip)     # 0x48640
jne 0x24743
leaq 0x23f11(%rip), %rdi     # 0x48648
leaq 0x1645(%rip), %rsi      # 0x25d83
callq 0xfa80
movq 0x23ef6(%rip), %rdi     # 0x48640
testq %rdi, %rdi
je 0x247b2
callq 0x10700
testq %rax, %rax
je 0x247b2
movq %rax, %r13
movq %rax, %rdi
movl $0x1, %esi
callq 0xf820
movq %r13, %rdi
movq %rbx, %rsi
callq 0xfe10
movq 0xe0(%rbx), %rdi
testq %rdi, %rdi
je 0x247a1
xorl %esi, %esi
callq 0xf820
movq 0xe0(%rbx), %rdi
xorl %esi, %esi
callq 0xfe10
movq 0xe0(%rbx), %rdi
callq 0xfd90
movq %r13, %rdi
callq 0x105b0
movq %r13, 0xe0(%rbx)
jmp 0x247b5
xorl %r13d, %r13d
testq %r13, %r13
je 0x247d0
movq 0xc8(%rbx), %rdi
movq %r13, %rsi
movq %r13, %rdx
callq 0xfd50
xorl %eax, %eax
jmp 0x247d5
movl $0x3, %eax
cmpl $0x3, %eax
je 0x247e3
testl %eax, %eax
je 0x2485c
jmp 0x2495b
movl $0x8c9c94c7, %r13d      # imm = 0x8C9C94C7
jmp 0x2490f
movl 0x58(%rbx), %edi
xorl %esi, %esi
callq 0xf8f0
testq %rax, %rax
je 0x2483c
movq %rax, %r13
xorl %r12d, %r12d
movq %rax, %rdi
movl $0x20, %esi
xorl %edx, %edx
leaq 0x40(%rsp), %rcx
callq 0xf330
movq 0xc8(%rbx), %rdi
movq %r13, %rsi
movq %r13, %rdx
callq 0xfd50
movq 0xc8(%rbx), %rdi
movl $0x1, %esi
callq 0x10580
jmp 0x24848
movl $0x3, %r12d
movl $0x8c9c94c7, %r13d      # imm = 0x8C9C94C7
testl %r12d, %r12d
je 0x2485c
cmpl $0x3, %r12d
je 0x2490f
jmp 0x2495b
movq 0xc8(%rbx), %rdi
cmpb $0x1, 0xd8(%rbx)
jne 0x24873
callq 0xf700
jmp 0x24878
callq 0xf4b0
incl 0xd4(%rbx)
movq 0xc8(%rbx), %rdi
callq 0x10290
testl %eax, %eax
jle 0x248f2
incl 0xd4(%rbx)
movq 0xc8(%rbx), %rdi
callq 0x108e0
testq %rax, %rax
je 0x248c8
movq %rax, %r13
movq 0xc8(%rbx), %rdi
callq 0xf500
testq %rax, %rax
sete 0xd9(%rbx)
movq %r13, %rdi
callq 0xf6d0
jmp 0x248cf
movb $0x0, 0xd9(%rbx)
incl 0xd4(%rbx)
cmpb $0x1, 0x38(%rbx)
jne 0x248ea
movl $0x8c9c94c9, %r13d      # imm = 0x8C9C94C9
cmpb $0x1, 0xd9(%rbx)
jne 0x2490f
incl 0xd4(%rbx)
jmp 0x24951
andb $-0x6, 0xb0(%rbx)
movq 0xc8(%rbx), %rdi
movl %eax, %esi
movq 0x8(%rsp), %rdx
callq 0x250a7
movl %eax, %r13d
cmpl $0xb, %r13d
je 0x2494e
movl 0x58(%rbx), %r15d
movq 0xa8(%rbx), %r12
movq 0xc8(%rbx), %rbp
movl %r13d, %edi
callq 0xfbe0
movl $0x1, %edi
movl %r15d, %esi
movq %r12, %rdx
movq %rbp, %rcx
leaq 0x11631(%rip), %r8      # 0x35f75
movq %rax, %r9
xorl %eax, %eax
callq 0x251a8
movl %r13d, %r15d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2546f
testl %r15d, %r15d
jne 0x2498b
orb $0x40, 0xb4(%rbx)
jmp 0x241c2
cmpl $0x2, %r15d
jne 0x2498b
movl %ebp, %r15d
testl %ebp, %ebp
jne 0x2498b
movl 0xbc(%rbx), %eax
testl %eax, %eax
movl $0x2, %r15d
cmovnel %eax, %r15d
movl %r15d, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq