// File: /workspace/github_c_makefile_star2_O0/howerj[P]eweb/unix.c
// Function: eweb_thread_new
static long eweb_thread_new(eweb_os_t *w, eweb_os_hit_args_t *args) {
	assert(w);
	assert(args);
	if (w->threading_mode == EWEB_TM_SINGLE_THREAD_E) { /**@todo allow configurable mode selection */
		return eweb_hit(w, args);
	} else if (w->threading_mode == EWEB_TM_MULTI_PROCESS_E) {
		errno = 0;
		const int pid = fork();
		if (pid < 0)
			return w->log(w, EWEB_ERROR, "failed to fork(): %d", strerror(errno));
		if (pid == 0) { /* child */
			close(args->listenfd);
			return eweb_hit(w, args); /* never returns */
		}
		close(args->socketfd);
	} else if (w->threading_mode == EWEB_TM_MULTI_THREADS_E) {
		pthread_t thread_id; /** ??? */
		if (pthread_create(&thread_id, NULL, eweb_thread_main, args) != 0)
			return w->log(w, EWEB_ERROR, "failed to create thread");
	} else {
		w->log(w, EWEB_ERROR, "invalid threading MODE: %u", w->threading_mode);
		abort();
	}
	return EWEB_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x5fe9
jmp 0x6008
leaq 0x1545(%rip), %rdi      # 0x7535
leaq 0x23cb(%rip), %rsi      # 0x83c2
movl $0xd2, %edx
leaq 0x25f1(%rip), %rcx      # 0x85f4
callq 0x2100
cmpq $0x0, -0x18(%rbp)
je 0x6011
jmp 0x6030
leaq 0x19e1(%rip), %rdi      # 0x79f9
leaq 0x23a3(%rip), %rsi      # 0x83c2
movl $0xd3, %edx
leaq 0x25c9(%rip), %rcx      # 0x85f4
callq 0x2100
movq -0x10(%rbp), %rax
movb 0x98(%rax), %al
shrb %al
andb $0x3, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x605e
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3c90
cltq
movq %rax, -0x8(%rbp)
jmp 0x61a7
movq -0x10(%rbp), %rax
movb 0x98(%rax), %al
shrb %al
andb $0x3, %al
movzbl %al, %eax
cmpl $0x2, %eax
jne 0x6111
callq 0x2050
movl $0x0, (%rax)
callq 0x2310
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0x60d6
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
callq 0x2050
movl (%rax), %edi
callq 0x22f0
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %r8
movq %rax, %rcx
movl $0x1, %esi
leaq 0x2564(%rip), %rdx      # 0x862c
movb $0x0, %al
callq *%r8
movq %rax, -0x8(%rbp)
jmp 0x61a7
cmpl $0x0, -0x1c(%rbp)
jne 0x6100
movq -0x18(%rbp), %rax
movl 0x44(%rax), %edi
callq 0x2140
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3c90
cltq
movq %rax, -0x8(%rbp)
jmp 0x61a7
movq -0x18(%rbp), %rax
movl 0x40(%rax), %edi
callq 0x2140
jmp 0x619d
movq -0x10(%rbp), %rax
movb 0x98(%rax), %al
shrb %al
andb $0x3, %al
movzbl %al, %eax
cmpl $0x3, %eax
jne 0x6168
movq -0x18(%rbp), %rcx
leaq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0x336(%rip), %rdx       # 0x6470
callq 0x2270
cmpl $0x0, %eax
je 0x6166
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rdi
movl $0x1, %esi
leaq 0x24e5(%rip), %rdx      # 0x8641
movb $0x0, %al
callq *%rcx
movq %rax, -0x8(%rbp)
jmp 0x61a7
jmp 0x619b
movq -0x10(%rbp), %rax
movq 0x50(%rax), %r8
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movb 0x98(%rax), %al
shrb %al
andb $0x3, %al
movzbl %al, %ecx
movl $0x1, %esi
leaq 0x24c8(%rip), %rdx      # 0x8659
movb $0x0, %al
callq *%r8
callq 0x2040
jmp 0x619d
jmp 0x619f
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)