// File: /workspace/github_c_makefile_star2_O3/xiaowenhuyuehu[P]remote_access/src/connectivity/ws_nopoll.c
// Function: ws_nopoll_listener
noPollConn *ws_nopoll_listener(const int debug_on, const char *host, const char *port, const int tls_on, const char *server_crt, const char *private_key)
{
    noPollCtx  *ctx = NULL;
	noPollConn *listener = NULL;
    nopoll_bool debug = (nopoll_bool)debug_on;

    if (NULL == host || NULL == port) {
        log_debug("host or port is NULL ");
        return NULL;
    }

    /* create context */
    ctx = nopoll_ctx_new ();
    nopoll_log_enable (ctx, debug);
    nopoll_log_color_enable (ctx, debug);

    if (1 == tls_on) {
    	/* now start a TLS version */
    	listener = nopoll_listener_tls_new (ctx, host, port);
    	if (!nopoll_conn_is_ok (listener)) {
    		log_debug("ERROR: Expected to find proper listener TLS connection status, but found.. ");
    		nopoll_ctx_unref(ctx);
    		return NULL;
    	}

    	/* configure certificates to be used by this listener */
    	if (!nopoll_listener_set_certificate (listener, server_crt, private_key, NULL)) {
    		log_debug("ERROR: unable to configure certificates for TLS websocket.. ");
            nopoll_conn_close (listener);
            nopoll_ctx_unref(ctx);
    		return NULL;
    	}

    	/* register certificates at context level */
    	if (! nopoll_ctx_set_certificate (ctx, NULL, server_crt, private_key, NULL)) {
    		log_debug("ERROR: unable to setup certificates at context level.. ");
            nopoll_conn_close (listener);
            nopoll_ctx_unref(ctx);
    		return NULL;
    	}
	} else {
        listener = nopoll_listener_new (ctx, host, port);
        if (!nopoll_conn_is_ok (listener)) {
            log_debug ("ERROR: Expected to find proper listener connection status, but found.. ");
    		nopoll_ctx_unref(ctx);
            return NULL;
        }
	}

    return listener;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
testq %rsi, %rsi
setne %al
testq %rdx, %rdx
setne %cl
testb %cl, %al
jne 0x2f04
leaq 0x6124(%rip), %rsi      # 0x9004
leaq 0x6159(%rip), %rdx      # 0x9040
leaq 0x61bb(%rip), %r8       # 0x90a9
xorl %r14d, %r14d
xorl %edi, %edi
movl $0xa5, %ecx
xorl %eax, %eax
callq 0x42c5
jmp 0x304f
movq %r8, %r12
movq %rdx, %r14
movq %rsi, %r13
movl %edi, %r15d
movq %r9, (%rsp)
callq 0x24e0
movq %rax, %rbx
movq %rax, %rdi
movl %r15d, %esi
callq 0x22e0
movq %rbx, %rdi
movl %r15d, %esi
callq 0x2390
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
cmpl $0x1, %ebp
jne 0x2fb0
callq 0x2600
movq %rax, %r14
movq %rax, %rdi
callq 0x2320
testl %eax, %eax
je 0x2fe9
movq %r14, %rdi
movq %r12, %rsi
movq (%rsp), %r15
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x2420
testl %eax, %eax
je 0x3019
movq %rbx, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x2220
testl %eax, %eax
jne 0x304f
leaq 0x606e(%rip), %rsi      # 0x9004
leaq 0x60a3(%rip), %rdx      # 0x9040
leaq 0x62ac(%rip), %r8       # 0x9250
xorl %edi, %edi
movl $0xc1, %ecx
jmp 0x3035
callq 0x2450
movq %rax, %r14
movq %rax, %rdi
callq 0x2320
testl %eax, %eax
jne 0x304f
leaq 0x6035(%rip), %rsi      # 0x9004
leaq 0x606a(%rip), %rdx      # 0x9040
leaq 0x62ab(%rip), %r8       # 0x9288
xorl %r14d, %r14d
xorl %edi, %edi
movl $0xc9, %ecx
jmp 0x3008
leaq 0x6014(%rip), %rsi      # 0x9004
leaq 0x6049(%rip), %rdx      # 0x9040
leaq 0x61c9(%rip), %r8       # 0x91c7
xorl %r14d, %r14d
xorl %edi, %edi
movl $0xb2, %ecx
xorl %eax, %eax
callq 0x42c5
movq %rbx, %rdi
callq 0x25e0
jmp 0x304f
leaq 0x5fe4(%rip), %rsi      # 0x9004
leaq 0x6019(%rip), %rdx      # 0x9040
leaq 0x61e5(%rip), %r8       # 0x9213
xorl %edi, %edi
movl $0xb9, %ecx
xorl %eax, %eax
callq 0x42c5
movq %r14, %rdi
callq 0x2060
movq %rbx, %rdi
callq 0x25e0
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq