// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2db00
movl %eax, -0x14(%rbp)
movl %eax, %ecx
movl %ecx, -0x20(%rbp)
subl $0x1, %eax
je 0x2dc86
jmp 0x2dbdf
movl -0x20(%rbp), %eax
subl $0x2, %eax
je 0x2dc8b
jmp 0x2dbed
movl -0x20(%rbp), %eax
subl $0x4, %eax
je 0x2dcfd
jmp 0x2dbfb
movl -0x20(%rbp), %eax
subl $0x8, %eax
je 0x2dd2b
jmp 0x2dc09
movl -0x20(%rbp), %eax
subl $0x10, %eax
je 0x2dd59
jmp 0x2dc17
movl -0x20(%rbp), %eax
subl $0x20, %eax
je 0x2dd8d
jmp 0x2dc25
movl -0x20(%rbp), %eax
subl $0x40, %eax
je 0x2ddca
jmp 0x2dc33
movl -0x20(%rbp), %eax
subl $0x80, %eax
je 0x2ddf8
jmp 0x2dc43
movl -0x20(%rbp), %eax
subl $0x100, %eax            # imm = 0x100
je 0x2de25
jmp 0x2dc53
movl -0x20(%rbp), %eax
subl $0x200, %eax            # imm = 0x200
je 0x2de52
jmp 0x2dc63
movl -0x20(%rbp), %eax
subl $0x400, %eax            # imm = 0x400
je 0x2de83
jmp 0x2dc73
movl -0x20(%rbp), %eax
subl $0x800, %eax            # imm = 0x800
je 0x2deb1
jmp 0x2dedc
jmp 0x2dedc
movq -0x10(%rbp), %rdi
callq 0x303e0
movl %eax, -0x18(%rbp)
movl %eax, %ecx
movl %ecx, -0x24(%rbp)
testl %eax, %eax
je 0x2dcac
jmp 0x2dca2
movl -0x24(%rbp), %eax
subl $0x2, %eax
je 0x2dcae
jmp 0x2dcda
jmp 0x2dce5
cmpl $0x0, -0x1c(%rbp)
je 0x2dcbc
movl -0x1c(%rbp), %eax
movl %eax, -0x18(%rbp)
jmp 0x2dcd8
movq -0x10(%rbp), %rax
cmpl $0x0, 0xbc(%rax)
je 0x2dcd6
movq -0x10(%rbp), %rax
movl 0xbc(%rax), %eax
movl %eax, -0x18(%rbp)
jmp 0x2dcd8
jmp 0x2dcda
movl -0x18(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x2df19
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
orl 0xb4(%rax), %ecx
movl %ecx, 0xb4(%rax)
jmp 0x2dbc3
movq -0x10(%rbp), %rdi
callq 0x30490
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x2dd13
jmp 0x2dee5
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
orl 0xb4(%rax), %ecx
movl %ecx, 0xb4(%rax)
jmp 0x2dbc3
movq -0x10(%rbp), %rdi
callq 0x30570
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x2dd41
jmp 0x2dee5
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
orl 0xb4(%rax), %ecx
movl %ecx, 0xb4(%rax)
jmp 0x2dbc3
movq -0x10(%rbp), %rdi
callq 0x30610
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x2dd75
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2df1f
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
orl 0xb4(%rax), %ecx
movl %ecx, 0xb4(%rax)
jmp 0x2dbc3
movq -0x10(%rbp), %rdi
callq 0x30690
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x2ddb2
movl -0x1c(%rbp), %eax
subl $0xb, %eax
jne 0x2ddad
jmp 0x2dda8
jmp 0x2df19
jmp 0x2dee5
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
orl 0xb4(%rax), %ecx
movl %ecx, 0xb4(%rax)
jmp 0x2dbc3
movq -0x10(%rbp), %rdi
callq 0x307d0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x2dde0
jmp 0x2df19
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
orl 0xb4(%rax), %ecx
movl %ecx, 0xb4(%rax)
jmp 0x2dbc3
movq -0x10(%rbp), %rax
movswl 0xb0(%rax), %ecx
orl $0x1, %ecx
movw %cx, 0xb0(%rax)
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
orl 0xb4(%rax), %ecx
movl %ecx, 0xb4(%rax)
jmp 0x2dbc3
movq -0x10(%rbp), %rax
movswl 0xb0(%rax), %ecx
orl $0x4, %ecx
movw %cx, 0xb0(%rax)
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
orl 0xb4(%rax), %ecx
movl %ecx, 0xb4(%rax)
jmp 0x2dbc3
movq -0x10(%rbp), %rdi
callq 0x30b60
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x2de68
jmp 0x2df19
movl -0x14(%rbp), %ecx
xorl $-0x1, %ecx
movq -0x10(%rbp), %rax
andl 0xb8(%rax), %ecx
movl %ecx, 0xb8(%rax)
jmp 0x2dbc3
movq -0x10(%rbp), %rdi
callq 0x30bc0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x2de99
jmp 0x2df19
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
orl 0xb4(%rax), %ecx
movl %ecx, 0xb4(%rax)
jmp 0x2dbc3
movq -0x10(%rbp), %rdi
callq 0x30c20
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x2dec4
jmp 0x2df19
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
orl 0xb4(%rax), %ecx
movl %ecx, 0xb4(%rax)
jmp 0x2dbc3
movl $0x0, -0x4(%rbp)
jmp 0x2df1f
movq -0x10(%rbp), %rax
movl 0xb8(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x2df17
movq -0x10(%rbp), %rax
movl $0x0, 0xb4(%rax)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xbc(%rax)
jmp 0x2dbc3
jmp 0x2df19
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)