// File: /workspace/github_c_makefile_star2_O2/sszllzss[P]webSocket_Libevent_ThreadPool/ev_client_main.c
// Function: main
int main(int argc, char *argv[])
{
    char inAddr[INADDR_LEN];
    int port = 0;
    struct event_base *base=NULL;
    struct bufferevent *bev=NULL;
    struct event * sig=NULL;
    struct itimerval timer_out;
    if(argc==3)
    {
        if(strlen(argv[1])>INADDR_LEN)
        {
            printf("输入长度要少于%d\r\n", INADDR_LEN);
            exit(1);
        }
        strcpy(inAddr, argv[1]);
        port =  atoi(argv[2]);
        if(port==0)
        {
            printf("端口输入错误！！\r\n");
            exit(1);
        }
    }
    else
    {
        port = SERVER_PORT;
        strcpy(inAddr, SERVERR_IP);
    }
    base = event_base_new();
    assert(base);

    bev = ev_webSocket_clientLinkToServer(base, inAddr, port,(char *)"/null",bev_read_cd,NULL,bev_event_cd,NULL);
    if(!bev)
    {
        printf("连接服务器错误!\r\n");
        exit(1);
    }
    sig =  evsignal_new(base, SIGALRM, sig_cb, bev);
    if(!sig || event_add(sig, NULL))
    {
        De_fprintf(stderr, "cold not create/add a signal event!");
    }
    else
    {
        memset(&timer_out, 0, sizeof(timer_out));
        timer_out.it_interval.tv_sec = 2;
        timer_out.it_value.tv_sec = 2;
        setitimer(ITIMER_REAL, &timer_out, NULL);
    }
    event_base_dispatch(base);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x68, %rsp
cmpl $0x3, %edi
jne 0x3c3f
movq %rsi, %rbx
movq 0x8(%rsi), %r14
movq %r14, %rdi
callq 0x20f0
cmpq $0x33, %rax
jae 0x3d87
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
callq 0x21c0
movq 0x10(%rbx), %rdi
callq 0x22c0
movl %eax, %r14d
testl %eax, %eax
jne 0x3c54
leaq 0x1a21(%rip), %rdi      # 0x565b
jmp 0x3d80
movups 0x18e4(%rip), %xmm0     # 0x552a
movaps %xmm0, -0x50(%rbp)
movb $0x0, -0x40(%rbp)
movl $0x1f98, %r14d          # imm = 0x1F98
callq 0x22e0
testq %rax, %rax
je 0x3d5c
movq %rax, %rbx
leaq 0x221(%rip), %rax       # 0x3e8d
movq %rax, (%rsp)
andq $0x0, 0x8(%rsp)
leaq 0x18eb(%rip), %rcx      # 0x5568
leaq 0x11c(%rip), %r8        # 0x3da0
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
movl %r14d, %edx
xorl %r9d, %r9d
callq 0x33fd
testq %rax, %rax
je 0x3d79
leaq 0x290(%rip), %rcx       # 0x3f36
pushq $0xe
popq %rsi
pushq $0x18
popq %rdx
movq %rbx, %rdi
movq %rax, %r8
callq 0x21a0
testq %rax, %rax
je 0x3d02
movq %rax, %rdi
xorl %esi, %esi
callq 0x20e0
testl %eax, %eax
jne 0x3d02
xorps %xmm0, %xmm0
leaq -0x70(%rbp), %rsi
andq $0x0, 0x18(%rsi)
movups %xmm0, 0x8(%rsi)
pushq $0x2
popq %rax
movq %rax, (%rsi)
movq %rax, 0x10(%rsi)
xorl %edi, %edi
xorl %edx, %edx
callq 0x2290
movq %rbx, %rdi
callq 0x22a0
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x32d7(%rip), %r15      # 0x6fe0
movq (%r15), %rdi
leaq 0x1498(%rip), %rsi      # 0x51ab
leaq 0x1854(%rip), %rdx      # 0x556e
leaq 0x181f(%rip), %rcx      # 0x5540
pushq $0x73
popq %r8
xorl %eax, %eax
callq 0x2280
movq (%r15), %rcx
leaq 0x183d(%rip), %rdi      # 0x5573
pushq $0x23
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
callq 0x2330
movq (%r15), %rcx
leaq 0x159d(%rip), %rdi      # 0x52ec
pushq $0x2
popq %rsi
movq %r14, %rdx
callq 0x2330
jmp 0x3ced
leaq 0x17d8(%rip), %rdi      # 0x553b
leaq 0x17d6(%rip), %rsi      # 0x5540
leaq 0x17e0(%rip), %rcx      # 0x5551
pushq $0x68
popq %rdx
callq 0x2140
leaq 0x18c3(%rip), %rdi      # 0x5643
callq 0x22b0
jmp 0x3d98
leaq 0x1782(%rip), %rdi      # 0x5510
pushq $0x32
popq %rsi
xorl %eax, %eax
callq 0x2040
pushq $0x1
popq %rdi
callq 0x2230