// File: /workspace/github_c_makefile_star2_O2/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 0x58(%rdi), %r14
leaq 0xc0(%rdi), %r13
leaq 0xb0(%rdi), %rax
movq %rax, 0x20(%rsp)
leaq 0x5c(%rdi), %rbp
leaq 0x64(%rdi), %rax
movq %rax, 0x18(%rsp)
leaq 0xa8(%rdi), %rax
movq %rax, 0x8(%rsp)
leaq 0x60(%rdi), %rax
movq %rax, 0x38(%rsp)
leaq 0x68(%rdi), %rax
movq %rax, 0x30(%rsp)
xorl %r12d, %r12d
movq %rbx, %rdi
callq 0x212a3
cmpl $0x800, %eax            # imm = 0x800
je 0x216c6
cmpl $0x4, %eax
je 0x21413
cmpl $0x8, %eax
je 0x213e2
cmpl $0x10, %eax
je 0x2172e
cmpl $0x20, %eax
je 0x2148f
cmpl $0x40, %eax
je 0x215f8
cmpl $0x80, %eax
je 0x21400
cmpl $0x100, %eax            # imm = 0x100
je 0x2147c
cmpl $0x200, %eax            # imm = 0x200
je 0x215c2
cmpl $0x400, %eax            # imm = 0x400
je 0x2177c
cmpl $0x2, %eax
jne 0x21a80
cmpq $0x0, 0x50(%rbx)
je 0x21a85
andw $0x0, 0xb0(%rbx)
movq 0xa8(%rbx), %rdi
callq 0xffc0
andq $0x0, 0xa8(%rbx)
movq 0x50(%rbx), %rsi
movq 0x8(%rsp), %rdi
callq 0xfd60
testl %eax, %eax
jne 0x21a61
orb $0x2, 0xb4(%rbx)
jmp 0x21324
testb $0x10, 0xb8(%rbx)
jne 0x2153b
movq (%rbx), %rsi
testq %rsi, %rsi
jne 0x2154c
jmp 0x217b9
orb $0x1, 0xb0(%rbx)
orb $-0x80, 0xb4(%rbx)
jmp 0x21324
movq 0x8(%rsp), %rax
cmpq $0x0, (%rax)
je 0x21563
movq %r14, %rdi
movq %rbx, %rsi
callq 0xf2c0
movq 0xa8(%rbx), %rax
movl 0x4(%rax), %edi
movl 0x8(%rax), %esi
movq %rbx, %rdx
leaq 0x40(%rsp), %rcx
callq 0xffb0
movl %eax, 0x58(%rbx)
cmpl $-0x1, %eax
je 0x2156b
movl %eax, %edi
movq %rbp, %rsi
movq 0x38(%rsp), %rdx
movq 0x18(%rsp), %rcx
movq 0x30(%rsp), %r8
callq 0x2110f
movl %eax, %r12d
testl %eax, %eax
jne 0x215a2
jmp 0x217ec
orb $0x4, 0xb0(%rbx)
orb $0x1, 0xb5(%rbx)
jmp 0x21324
movq 0x20(%rsp), %rax
andb $-0x5, (%rax)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movl (%r14), %r15d
testq %rax, %rax
je 0x2157a
movq 0x18(%rax), %rsi
movl 0x10(%rax), %edx
movl %r15d, %edi
callq 0xfb10
testl %eax, %eax
je 0x217c5
callq 0xf0a0
movl (%rax), %r12d
cmpl $0x4, %r12d
je 0x21497
leal -0x72(%r12), %eax
cmpl $0x2, %eax
jb 0x21a40
cmpl $0x6a, %r12d
je 0x217c5
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq %rbp, %r15
movq %r13, %rbp
movl (%r14), %r13d
movl %r12d, %edi
callq 0xfc60
xorl %edi, %edi
movl %r13d, %esi
movq %rbp, %r13
movq %r15, %rbp
movq 0x10(%rsp), %rdx
leaq 0xfa30(%rip), %rcx      # 0x30f4d
movq %rax, %r8
xorl %eax, %eax
callq 0x221bb
testl %r12d, %r12d
je 0x217e0
cmpl $0xb, %r12d
jne 0x215a2
jmp 0x21a4c
movq 0x8(%rsp), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x21563
movq 0x18(%rax), %rsi
movl 0x58(%rbx), %edi
movq %rbx, %rdx
callq 0xfe10
movl %eax, %r12d
testl %eax, %eax
jne 0x215a2
jmp 0x217b9
movl $0x8c9c94cb, %r12d      # imm = 0x8C9C94CB
jmp 0x215a2
movl 0x40(%rsp), %r12d
testl %r12d, %r12d
jne 0x215a2
jmp 0x217fa
movl $0x8c9c94cb, %r12d      # imm = 0x8C9C94CB
movl $0x8c9c94cb, %edi       # imm = 0x8C9C94CB
callq 0xfc60
xorl %edi, %edi
movl %r15d, %esi
xorl %edx, %edx
leaq 0xf9b5(%rip), %rcx      # 0x30f4d
movq %rax, %r8
xorl %eax, %eax
callq 0x221bb
testb $0x2, 0xb8(%rbx)
je 0x21a4c
andl $0x0, 0xb4(%rbx)
movl %r12d, 0xbc(%rbx)
jmp 0x21324
movl (%r14), %edi
pushq $0x1
popq %rsi
pushq $0x12
popq %rdx
movq %r13, %rcx
pushq $0x4
popq %r8
callq 0x108f0
testl %eax, %eax
je 0x215ec
callq 0xf0a0
movl (%rax), %r12d
testl %r12d, %r12d
jne 0x21a4c
andb $-0x3, 0xb9(%rbx)
jmp 0x21321
movl 0xd0(%rbx), %r12d
testl %r12d, %r12d
jne 0x21a4c
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x22031
callq 0x101c0
movl 0xd4(%rbx), %eax
cmpq $0x3, %rax
ja 0x219d0
leaq 0xff3f(%rip), %rdx      # 0x31570
movslq (%rdx,%rax,4), %rcx
addq %rdx, %rcx
pushq $0x4
popq %rax
jmpq *%rcx
movl (%rbp), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
cmpl $0xc000, %eax           # imm = 0xC000
jne 0x21806
movq 0x18(%rsp), %rax
cmpl $0x2, (%rax)
jne 0x21806
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 (%r14), %edi
movl $0x80, 0x4(%rsp)
leaq 0x40(%rsp), %rsi
leaq 0x4(%rsp), %rdx
callq 0xf9c0
testl %eax, %eax
je 0x219eb
callq 0xf0a0
movl (%rax), %r15d
jmp 0x21970
movl (%r14), %edi
cmpl $-0x1, %edi
je 0x2171b
xorl %esi, %esi
callq 0x10220
testl %eax, %eax
je 0x2171b
callq 0xf0a0
movl (%rax), %r12d
testl %r12d, %r12d
je 0x21722
cmpl $0x6b, %r12d
jne 0x21a4c
movq %rax, %r15
movl (%r14), %edi
movl $0x10, 0x4(%rsp)
leaq 0x40(%rsp), %rsi
leaq 0x4(%rsp), %rdx
callq 0xf9c0
testl %eax, %eax
je 0x2171b
cmpl $0x6b, (%r15)
je 0x21aa4
movb $0x1, 0xa0(%rbx)
orb $0x8, 0xb5(%rbx)
jmp 0x21321
movl (%rbp), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
cmpl $0xc000, %eax           # imm = 0xC000
jne 0x21770
movq 0x18(%rsp), %rax
movl (%rax), %eax
orl $0x4, %eax
cmpl $0x5, %eax
jne 0x21770
movl (%r14), %edi
movl $0x1000, %esi           # imm = 0x1000
callq 0xff40
testl %eax, %eax
je 0x21770
callq 0xf0a0
movl (%rax), %r12d
testl %r12d, %r12d
jne 0x21a4c
orb $0x10, 0xb4(%rbx)
jmp 0x21321
movl (%r14), %edi
cmpl $-0x1, %edi
je 0x217a2
pushq $0x1
popq %rsi
callq 0x10220
testl %eax, %eax
je 0x217a2
callq 0xf0a0
movl (%rax), %r12d
testl %r12d, %r12d
je 0x217ad
jmp 0x21a4c
movb $0x1, %al
movb %al, 0xa1(%rbx)
movb %al, 0x78(%rbx)
orb $0x4, 0xb5(%rbx)
jmp 0x21321
orb $0x8, 0xb4(%rbx)
jmp 0x21321
movl (%r14), %esi
movq 0x8(%rsp), %rax
movq (%rax), %rdx
xorl %edi, %edi
leaq 0x1017b(%rip), %rcx     # 0x31954
xorl %eax, %eax
callq 0x221bb
orb $0x20, 0xb4(%rbx)
jmp 0x21321
movl 0x58(%rbx), %edi
pushq $-0x1
popq %rsi
callq 0x109a0
movl %eax, 0x6c(%rbx)
orb $0x4, 0xb4(%rbx)
jmp 0x21321
movq 0x24ea3(%rip), %rdi     # 0x466b0
testq %rdi, %rdi
jne 0x21835
leaq 0x24e9f(%rip), %rdi     # 0x466b8
leaq 0x15d0(%rip), %rsi      # 0x22df0
callq 0xfaf0
movq 0x24e84(%rip), %rdi     # 0x466b0
testq %rdi, %rdi
je 0x218bd
callq 0x107c0
testq %rax, %rax
je 0x218bd
movq %rax, %r15
movq %rax, %rdi
pushq $0x1
popq %rsi
callq 0xf860
movq %r15, %rdi
movq %rbx, %rsi
callq 0xfea0
movq 0xe0(%rbx), %rdi
testq %rdi, %rdi
je 0x21885
xorl %esi, %esi
callq 0xf860
movq 0xe0(%rbx), %rdi
xorl %esi, %esi
callq 0xfea0
movq 0xe0(%rbx), %rdi
callq 0xfe20
movq %r15, %rdi
callq 0x10660
movq %r15, 0xe0(%rbx)
movq 0xc8(%rbx), %rdi
movq %r15, %rsi
movq %r15, %rdx
callq 0xfde0
movq 0xc8(%rbx), %rdi
cmpb $0x1, 0xd8(%rbx)
jne 0x218c8
callq 0xf740
jmp 0x218cd
movl $0x8c9c94c7, %r15d      # imm = 0x8C9C94C7
jmp 0x2197c
callq 0xf4d0
incl 0xd4(%rbx)
movq 0xc8(%rbx), %rdi
callq 0x10320
testl %eax, %eax
jle 0x21953
incl 0xd4(%rbx)
movq 0xc8(%rbx), %rdi
callq 0x109c0
testq %rax, %rax
je 0x2191d
movq %rax, %r15
movq 0xc8(%rbx), %rdi
callq 0xf520
testq %rax, %rax
sete 0xd9(%rbx)
movq %r15, %rdi
callq 0xf710
jmp 0x21924
movb $0x0, 0xd9(%rbx)
movl 0xd4(%rbx), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0xd4(%rbx)
addl $0x2, %eax
cmpb $0x1, 0x38(%rbx)
jne 0x2194b
movl $0x8c9c94c9, %r15d      # imm = 0x8C9C94C9
cmpb $0x1, 0xd9(%rbx)
jne 0x2197c
movl %eax, 0xd4(%rbx)
jmp 0x219d0
andb $-0x6, 0xb0(%rbx)
movq 0xc8(%rbx), %rdi
movl %eax, %esi
movq 0x20(%rsp), %rdx
callq 0x220bf
movl %eax, %r15d
pushq $0xb
popq %rax
movl %eax, %r12d
cmpl $0xb, %r15d
je 0x219d0
movl 0x58(%rbx), %r12d
movq %r13, 0x28(%rsp)
movq 0xa8(%rbx), %r13
movq %r14, 0x10(%rsp)
movq %rbp, %r14
movq 0xc8(%rbx), %rbp
movl %r15d, %edi
callq 0xfc60
pushq $0x1
popq %rdi
movl %r12d, %esi
movq %r13, %rdx
movq 0x28(%rsp), %r13
movq %rbp, %rcx
movq %r14, %rbp
movq 0x10(%rsp), %r14
leaq 0xf58a(%rip), %r8       # 0x30f4d
movq %rax, %r9
xorl %eax, %eax
callq 0x221bb
movl %r15d, %r12d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x22633
testl %r12d, %r12d
jne 0x21a4c
orb $0x40, 0xb4(%rbx)
jmp 0x21321
movl (%r14), %edi
xorl %esi, %esi
callq 0xf940
testq %rax, %rax
je 0x21a35
movq %rax, %r15
movq %rax, %rdi
pushq $0x20
popq %rsi
xorl %edx, %edx
leaq 0x40(%rsp), %rcx
callq 0xf340
movq 0xc8(%rbx), %rdi
movq %r15, %rsi
movq %r15, %rdx
callq 0xfde0
movq 0xc8(%rbx), %rdi
pushq $0x1
popq %rsi
callq 0x10630
jmp 0x218a6
movl $0x8c9c94c7, %r15d      # imm = 0x8C9C94C7
jmp 0x21970
movq 0x20(%rsp), %rax
orb $0x4, (%rax)
pushq $0xb
popq %r12
movl %r12d, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x2, %eax
je 0x21a8d
movl %eax, %r12d
cmpl $0xb, %eax
jne 0x21a4c
movq 0x50(%rbx), %rdi
callq 0x10880
movw %ax, 0xb0(%rbx)
jmp 0x21a48
xorl %r12d, %r12d
jmp 0x21a4c
movl $0x8c9c94cb, %r12d      # imm = 0x8C9C94CB
jmp 0x21a4c
testl %r12d, %r12d
jne 0x21a4c
movl 0xbc(%rbx), %eax
testl %eax, %eax
pushq $0x2
popq %r12
cmovnel %eax, %r12d
jmp 0x21a4c
pushq $0x6b
popq %rax
movl %eax, %r12d
jmp 0x21a4c