// File: /workspace/github_c_makefile_star2_O0/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
subq $0xa0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x54(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
cmpl $0x3, -0x8(%rbp)
jne 0x49ef
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2100
cmpq $0x32, %rax
jbe 0x49ae
leaq 0xb49(%rip), %rdi       # 0x54e1
movl $0x32, %esi
movb $0x0, %al
callq 0x2040
movl $0x1, %edi
callq 0x2250
leaq -0x50(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x21e0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x22d0
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x54(%rbp)
jne 0x49ed
leaq 0xb1f(%rip), %rdi       # 0x54fb
movb $0x0, %al
callq 0x2040
movl $0x1, %edi
callq 0x2250
jmp 0x4a06
movl $0x1f98, -0x54(%rbp)    # imm = 0x1F98
leaq -0x50(%rbp), %rdi
leaq 0xb15(%rip), %rsi       # 0x5516
callq 0x21e0
callq 0x22f0
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x4a18
jmp 0x4a37
leaq 0xb08(%rip), %rdi       # 0x5527
leaq 0xb06(%rip), %rsi       # 0x552c
movl $0x68, %edx
leaq 0xb0b(%rip), %rcx       # 0x553d
callq 0x2160
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movl -0x54(%rbp), %edx
leaq 0xb0b(%rip), %rcx       # 0x5554
leaq 0x130(%rip), %r8        # 0x4b80
xorl %eax, %eax
movl %eax, %r9d
leaq 0x274(%rip), %rax       # 0x4cd0
movq %rax, (%rsp)
movq $0x0, 0x8(%rsp)
callq 0x3ee0
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x4a91
leaq 0xada(%rip), %rdi       # 0x555a
movb $0x0, %al
callq 0x2040
movl $0x1, %edi
callq 0x2250
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %r8
movl $0xe, %esi
movl $0x18, %edx
leaq 0x316(%rip), %rcx       # 0x4dc0
callq 0x21c0
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x70(%rbp)
je 0x4acc
movq -0x70(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x20f0
cmpl $0x0, %eax
je 0x4b2c
jmp 0x4ace
movq 0x250b(%rip), %rax      # 0x6fe0
movq (%rax), %rdi
leaq 0x6bc(%rip), %rsi       # 0x519b
leaq 0xa8d(%rip), %rdx       # 0x5573
leaq 0xa3f(%rip), %rcx       # 0x552c
movl $0x73, %r8d
movb $0x0, %al
callq 0x22a0
movq 0x24df(%rip), %rax      # 0x6fe0
movq (%rax), %rdi
leaq 0xa6d(%rip), %rsi       # 0x5578
movb $0x0, %al
callq 0x22a0
movq 0x24c7(%rip), %rax      # 0x6fe0
movq (%rax), %rdi
leaq 0x7eb(%rip), %rsi       # 0x530e
movb $0x0, %al
callq 0x22a0
jmp 0x4b64
leaq -0x90(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x2130
movq $0x2, -0x90(%rbp)
movq $0x2, -0x80(%rbp)
xorl %edi, %edi
leaq -0x90(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x22b0
movq -0x60(%rbp), %rdi
callq 0x22c0
xorl %eax, %eax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax,%rax)