// File: /workspace/github_c_makefile_star2_O3/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
movl 0xb4(%rdi), %eax
movl 0xb8(%rdi), %ecx
movl %eax, %edx
notl %edx
andl %ecx, %edx
je 0x247d9
movq %rdi, %rbx
leaq 0x58(%rdi), %r14
leaq 0xc0(%rdi), %rsi
movq %rsi, 0x38(%rsp)
leaq 0xb0(%rdi), %r13
leaq 0x5c(%rdi), %rsi
movq %rsi, 0x18(%rsp)
leaq 0x64(%rdi), %rsi
movq %rsi, 0x10(%rsp)
leaq 0xa8(%rdi), %r12
leaq 0x60(%rdi), %rsi
movq %rsi, 0x30(%rsp)
leaq 0x68(%rdi), %rsi
movq %rsi, 0x28(%rsp)
xorl %r15d, %r15d
movl $0x1, %esi
testl %edx, %esi
jne 0x2407d
addl %esi, %esi
cmpl $0x801, %esi            # imm = 0x801
jl 0x2406a
jmp 0x247d9
xorl %ebp, %ebp
cmpl $0x3f, %esi
jle 0x240c2
cmpl $0x1ff, %esi            # imm = 0x1FF
jg 0x24154
cmpl $0x40, %esi
je 0x24368
cmpl $0x80, %esi
je 0x242d5
cmpl $0x100, %esi            # imm = 0x100
jne 0x247db
orb $0x4, 0xb0(%rbx)
orl $0x100, %eax            # imm = 0x100
jmp 0x2435d
cmpl $0x7, %esi
jle 0x241e1
cmpl $0x8, %esi
je 0x242bb
cmpl $0x10, %esi
je 0x24269
cmpl $0x20, %esi
jne 0x247db
andb $-0x5, (%r13)
movq (%r12), %rax
movl (%r14), %r15d
testq %rax, %rax
je 0x244ee
movq 0x18(%rax), %rsi
movl 0x10(%rax), %edx
movl %r15d, %edi
callq 0xfaa0
testl %eax, %eax
je 0x2412f
callq 0xf0a0
movl (%rax), %ebp
cmpl $0x4, %ebp
je 0x240eb
leal -0x72(%rbp), %eax
cmpl $0x2, %eax
jb 0x247ef
cmpl $0x6a, %ebp
jne 0x24517
movl (%r14), %esi
movq (%r12), %rdx
xorl %edi, %edi
leaq 0x12815(%rip), %rcx     # 0x36954
xorl %eax, %eax
callq 0x25004
movl 0xb4(%rbx), %eax
orl $0x20, %eax
jmp 0x2475f
cmpl $0x200, %esi            # imm = 0x200
je 0x24431
cmpl $0x400, %esi            # imm = 0x400
je 0x242e3
cmpl $0x800, %esi            # imm = 0x800
jne 0x247db
movl (%r14), %edi
cmpl $-0x1, %edi
je 0x241ca
xorl %esi, %esi
callq 0x10190
testl %eax, %eax
je 0x241ca
callq 0xf0a0
movl (%rax), %ebp
testl %ebp, %ebp
je 0x241d1
cmpl $0x6b, %ebp
jne 0x247db
movq %rax, %r15
movl (%r14), %edi
movl $0x10, 0x4(%rsp)
leaq 0x40(%rsp), %rsi
leaq 0x4(%rsp), %rdx
callq 0xf970
testl %eax, %eax
je 0x241ca
cmpl $0x6b, (%r15)
je 0x24846
movb $0x1, 0xa0(%rbx)
movl 0xb4(%rbx), %eax
movl $0x800, %ecx            # imm = 0x800
jmp 0x24489
cmpl $0x2, %esi
je 0x24315
cmpl $0x4, %esi
jne 0x247db
cmpq $0x0, (%r12)
je 0x244c0
movq %r14, %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 0x244ca
movl %eax, %edi
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x10(%rsp), %rcx
movq 0x28(%rsp), %r8
callq 0x23e30
movl %eax, %ebp
testl %eax, %eax
jne 0x24556
movl 0x58(%rbx), %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x108c0
movl %eax, 0x6c(%rbx)
jmp 0x244d6
movq 0x18(%rsp), %rax
movl (%rax), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
cmpl $0xc000, %eax           # imm = 0xC000
jne 0x242ad
movq 0x10(%rsp), %rax
movl (%rax), %eax
orl $0x4, %eax
cmpl $0x5, %eax
jne 0x242ad
movl (%r14), %edi
movl $0x1000, %esi           # imm = 0x1000
callq 0xfeb0
testl %eax, %eax
je 0x242ad
callq 0xf0a0
movl (%rax), %ebp
testl %ebp, %ebp
jne 0x247db
movl 0xb4(%rbx), %eax
orl $0x10, %eax
jmp 0x2475f
testb $0x10, %cl
jne 0x24490
movq (%rbx), %rsi
testq %rsi, %rsi
jne 0x2449d
jmp 0x244b8
orb $0x1, 0xb0(%rbx)
orl $0x80, %eax
jmp 0x2435d
movl (%r14), %edi
cmpl $-0x1, %edi
je 0x24473
movl $0x1, %esi
callq 0x10190
testl %eax, %eax
je 0x24473
callq 0xf0a0
movl (%rax), %ebp
testl %ebp, %ebp
je 0x2447e
jmp 0x247db
cmpq $0x0, 0x50(%rbx)
je 0x24819
movw $0x0, 0xb0(%rbx)
movq 0xa8(%rbx), %rdi
callq 0xff30
movq $0x0, 0xa8(%rbx)
movq 0x50(%rbx), %rsi
movq %r12, %rdi
callq 0xfcd0
testl %eax, %eax
jne 0x247fb
movl 0xb4(%rbx), %eax
orl $0x2, %eax
movl %eax, 0xb4(%rbx)
jmp 0x24768
movl 0xd0(%rbx), %ebp
testl %ebp, %ebp
jne 0x247db
movq %rbx, %rdi
xorl %esi, %esi
callq 0x24e27
callq 0x10130
movl 0xd4(%rbx), %eax
cmpq $0x3, %rax
ja 0x246cc
leaq 0x121d4(%rip), %rcx     # 0x36570
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x18(%rsp), %rax
movl (%rax), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
cmpl $0xc000, %eax           # imm = 0xC000
jne 0x2457d
movq 0x10(%rsp), %rax
cmpl $0x2, (%rax)
jne 0x2457d
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 0xf970
testl %eax, %eax
je 0x24781
callq 0xf0a0
movl (%rax), %ebp
jmp 0x246f2
movl (%r14), %edi
movl $0x1, %esi
movl $0x12, %edx
movq 0x38(%rsp), %rcx
movl $0x4, %r8d
callq 0x10820
testl %eax, %eax
je 0x24461
callq 0xf0a0
movl (%rax), %ebp
testl %ebp, %ebp
jne 0x247db
andb $-0x3, 0xb9(%rbx)
movl 0xb4(%rbx), %eax
jmp 0x24765
movb $0x1, %al
movb %al, 0xa1(%rbx)
movb %al, 0x78(%rbx)
movl 0xb4(%rbx), %eax
movl $0x400, %ecx            # imm = 0x400
orl %ecx, %eax
jmp 0x2475f
movq (%r12), %rax
testq %rax, %rax
je 0x244c0
movq 0x18(%rax), %rsi
movl 0x58(%rbx), %edi
movq %rbx, %rdx
callq 0xfd80
movl %eax, %ebp
testl %eax, %eax
jne 0x24556
movl 0xb4(%rbx), %eax
orl $0x8, %eax
jmp 0x2475f
movl $0x8c9c94cb, %ebp       # imm = 0x8C9C94CB
jmp 0x24556
movl 0x40(%rsp), %ebp
testl %ebp, %ebp
jne 0x24556
movl 0xb4(%rbx), %eax
orl $0x4, %eax
jmp 0x2475f
movl $0x4, %eax
jmp 0x246b2
movl $0x8c9c94cb, %ebp       # imm = 0x8C9C94CB
movl $0x8c9c94cb, %edi       # imm = 0x8C9C94CB
callq 0xfbe0
xorl %edi, %edi
movl %r15d, %esi
xorl %edx, %edx
leaq 0x11a42(%rip), %rcx     # 0x35f4d
movq %rax, %r8
xorl %eax, %eax
callq 0x25004
jmp 0x24556
movq (%r12), %rax
movq %rax, 0x8(%rsp)
movl (%r14), %r15d
movl %ebp, %edi
callq 0xfbe0
xorl %edi, %edi
movl %r15d, %esi
movq 0x8(%rsp), %rdx
leaq 0x11a12(%rip), %rcx     # 0x35f4d
movq %rax, %r8
xorl %eax, %eax
callq 0x25004
testl %ebp, %ebp
je 0x24146
cmpl $0xb, %ebp
je 0x247db
testb $0x2, 0xb8(%rbx)
je 0x247db
movl $0x0, 0xb4(%rbx)
movl %ebp, 0xbc(%rbx)
xorl %eax, %eax
movl %ebp, %r15d
jmp 0x24768
movq 0x240bc(%rip), %rdi     # 0x48640
testq %rdi, %rdi
jne 0x245ac
leaq 0x240b8(%rip), %rdi     # 0x48648
leaq 0x1617(%rip), %rsi      # 0x25bae
callq 0xfa80
movq 0x2409d(%rip), %rdi     # 0x48640
testq %rdi, %rdi
je 0x2463a
callq 0x10700
testq %rax, %rax
je 0x2463a
movq %rax, %rbp
movq %rax, %rdi
movl $0x1, %esi
callq 0xf820
movq %rbp, %rdi
movq %rbx, %rsi
callq 0xfe10
movq 0xe0(%rbx), %rdi
testq %rdi, %rdi
je 0x24602
xorl %esi, %esi
callq 0xf820
movq 0xe0(%rbx), %rdi
xorl %esi, %esi
callq 0xfe10
movq 0xe0(%rbx), %rdi
callq 0xfd90
movq %rbp, %rdi
callq 0x105b0
movq %rbp, 0xe0(%rbx)
movq 0xc8(%rbx), %rdi
movq %rbp, %rsi
movq %rbp, %rdx
callq 0xfd50
movq 0xc8(%rbx), %rdi
cmpb $0x1, 0xd8(%rbx)
jne 0x24644
callq 0xf700
jmp 0x24649
movl $0x8c9c94c7, %ebp       # imm = 0x8C9C94C7
jmp 0x246fb
callq 0xf4b0
incl 0xd4(%rbx)
movq 0xc8(%rbx), %rdi
callq 0x10290
testl %eax, %eax
jle 0x246d8
incl 0xd4(%rbx)
movq 0xc8(%rbx), %rdi
callq 0x108e0
testq %rax, %rax
je 0x24699
movq %rax, %r15
movq 0xc8(%rbx), %rdi
callq 0xf500
testq %rax, %rax
sete 0xd9(%rbx)
movq %r15, %rdi
callq 0xf6d0
jmp 0x246a0
movb $0x0, 0xd9(%rbx)
movl 0xd4(%rbx), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0xd4(%rbx)
addl $0x2, %eax
cmpb $0x1, 0x38(%rbx)
jne 0x246c6
movl $0x8c9c94c9, %ebp       # imm = 0x8C9C94C9
cmpb $0x1, 0xd9(%rbx)
jne 0x246fb
movl %eax, 0xd4(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x252cb
jmp 0x24756
andb $-0x6, 0xb0(%rbx)
movq 0xc8(%rbx), %rdi
movl %eax, %esi
movq %r13, %rdx
callq 0x24f03
movl %eax, %ebp
cmpl $0xb, %ebp
je 0x2483a
movl 0x58(%rbx), %r15d
movq %r13, 0x8(%rsp)
movq 0xa8(%rbx), %r13
movq 0xc8(%rbx), %rax
movq %rax, 0x20(%rsp)
movl %ebp, %edi
callq 0xfbe0
movl $0x1, %edi
movl %r15d, %esi
movq %r13, %rdx
movq 0x8(%rsp), %r13
movq 0x20(%rsp), %rcx
leaq 0x11813(%rip), %r8      # 0x35f4d
movq %rax, %r9
xorl %eax, %eax
callq 0x25004
movq %rbx, %rdi
xorl %esi, %esi
callq 0x252cb
testl %ebp, %ebp
jne 0x247db
movl 0xb4(%rbx), %eax
orl $0x40, %eax
movl %eax, 0xb4(%rbx)
xorl %r15d, %r15d
movl 0xb8(%rbx), %ecx
movl %eax, %edx
notl %edx
movl $0x0, %ebp
andl %ecx, %edx
jne 0x24065
jmp 0x247db
movl (%r14), %edi
xorl %esi, %esi
callq 0xf8f0
testq %rax, %rax
je 0x247cf
movq %rax, %r15
movq %rax, %rdi
movl $0x20, %esi
xorl %edx, %edx
leaq 0x40(%rsp), %rcx
callq 0xf330
movq 0xc8(%rbx), %rdi
movq %r15, %rsi
movq %r15, %rdx
callq 0xfd50
movq 0xc8(%rbx), %rdi
movl $0x1, %esi
callq 0x10580
jmp 0x24623
movl $0x8c9c94c7, %ebp       # imm = 0x8C9C94C7
jmp 0x246f2
xorl %ebp, %ebp
movl %ebp, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
orb $0x4, (%r13)
movl $0xb, %ebp
jmp 0x247db
movl %eax, %ebp
cmpl $0x2, %eax
je 0x24820
cmpl $0xb, %ebp
jne 0x247db
movq 0x50(%rbx), %rdi
callq 0x107b0
movw %ax, 0xb0(%rbx)
jmp 0x247f4
movl $0x8c9c94cb, %ebp       # imm = 0x8C9C94CB
jmp 0x247db
movl %r15d, %ebp
testl %r15d, %r15d
jne 0x247db
movl 0xbc(%rbx), %eax
testl %eax, %eax
movl $0x2, %ebp
cmovnel %eax, %ebp
jmp 0x247db
movq %rbx, %rdi
xorl %esi, %esi
callq 0x252cb
jmp 0x247f4
movl $0x6b, %ebp
jmp 0x247db