// File: /workspace/github_c_makefile_star2_O0/orestonce[P]udphole/clientA.c
// Function: clientA
void clientA()
{
    int fd ;

    fd = socket(AF_INET, SOCK_DGRAM, 0);
    struct sockaddr_in remoteAddr;
    socklen_t remoteAddrLen = sizeof(struct sockaddr_in);
    char bufferRecive[BUFSIZ]="";
    char bufferSend[BUFSIZ]="Hello , this is a test package.";

    remoteAddr.sin_family = AF_INET;
    int ret ;

    ret = inet_aton(SERVER_ADDR, &remoteAddr.sin_addr);
    assert(ret !=0);

    remoteAddr.sin_port = htons(SERVER_PORT);

    ssize_t sz = sendto(fd, bufferSend, BUFSIZ, 0,
             (struct sockaddr *)&remoteAddr,remoteAddrLen);
    assert(sz >0);
    sleep(5);

    while ( 1 )
    {
        fd_set fds;
        FD_ZERO(&fds);
        FD_SET(STDIN_FILENO, &fds);
        FD_SET(fd, &fds);

        ret = select(fd+1, &fds, 0, 0, 0);

        assert(ret >=0 );

        if ( FD_ISSET(fd, &fds) ) {
            sz = recvfrom(fd, bufferRecive, BUFSIZ, 0,
                  (struct sockaddr *)&remoteAddr,&remoteAddrLen);
            assert(sz >0);
            sz = write(STDIN_FILENO, bufferRecive, sz);
            assert(sz >0);
        }
        if ( FD_ISSET(STDIN_FILENO, &fds) ) {
            sz = read(STDIN_FILENO, &bufferSend, BUFSIZ);
            assert(sz >0);
            sz = sendto(fd, bufferSend, sz, 0,
                   (const struct sockaddr *)&remoteAddr, remoteAddrLen);
            assert(sz >0);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40d0, %rsp           # imm = 0x40D0
movl $0x2, %esi
xorl %edx, %edx
movl %esi, %edi
callq 0x1130
movl %eax, -0x4(%rbp)
movl $0x10, -0x18(%rbp)
leaq -0x2020(%rbp), %rdi
xorl %esi, %esi
movl $0x2000, %edx           # imm = 0x2000
callq 0x1070
leaq -0x4020(%rbp), %rdi
leaq 0xbfc(%rip), %rsi       # 0x2080
movl $0x2000, %edx           # imm = 0x2000
callq 0x10a0
movw $0x2, -0x14(%rbp)
leaq -0x14(%rbp), %rsi
addq $0x4, %rsi
leaq 0xb9e(%rip), %rdi       # 0x2041
callq 0x10c0
movl %eax, -0x4024(%rbp)
cmpl $0x0, -0x4024(%rbp)
je 0x14b9
jmp 0x14d8
leaq 0xb8b(%rip), %rdi       # 0x204b
leaq 0xb45(%rip), %rsi       # 0x200c
movl $0x3c, %edx
leaq 0xb80(%rip), %rcx       # 0x2053
callq 0x1060
movl $0x6f7, %edi            # imm = 0x6F7
callq 0x1050
movw %ax, -0x12(%rbp)
movl -0x4(%rbp), %edi
leaq -0x4020(%rbp), %rsi
movl -0x18(%rbp), %r9d
movl $0x2000, %edx           # imm = 0x2000
xorl %ecx, %ecx
leaq -0x14(%rbp), %r8
callq 0x1080
movq %rax, -0x4030(%rbp)
cmpq $0x0, -0x4030(%rbp)
jle 0x1517
jmp 0x1536
leaq 0xb1d(%rip), %rdi       # 0x203b
leaq 0xae7(%rip), %rsi       # 0x200c
movl $0x42, %edx
leaq 0xb22(%rip), %rcx       # 0x2053
callq 0x1060
movl $0x5, %edi
callq 0x1120
jmp 0x1542
leaq -0x40b0(%rbp), %rax
movq %rax, -0x40c0(%rbp)
movl $0x0, -0x40b4(%rbp)
movl -0x40b4(%rbp), %eax
cmpq $0x10, %rax
jae 0x158c
movq -0x40c0(%rbp), %rax
movl -0x40b4(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0x40b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40b4(%rbp)
jmp 0x155a
jmp 0x158e
movq -0x40b0(%rbp), %rax
orq $0x1, %rax
movq %rax, -0x40b0(%rbp)
movl -0x4(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x4(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0x40b0(%rbp,%rax,8), %rcx
movq %rcx, -0x40b0(%rbp,%rax,8)
movl -0x4(%rbp), %edi
addl $0x1, %edi
leaq -0x40b0(%rbp), %rsi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rdx
movq %r8, %rcx
callq 0x10b0
movl %eax, -0x4024(%rbp)
cmpl $0x0, -0x4024(%rbp)
jl 0x1605
jmp 0x1624
leaq 0xa56(%rip), %rdi       # 0x2062
leaq 0x9f9(%rip), %rsi       # 0x200c
movl $0x4e, %edx
leaq 0xa34(%rip), %rcx       # 0x2053
callq 0x1060
movl -0x4(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
cltq
movq -0x40b0(%rbp,%rax,8), %rax
movq %rax, -0x40c8(%rbp)
movl -0x4(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x40c8(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x1705
movl -0x4(%rbp), %edi
leaq -0x2020(%rbp), %rsi
movl $0x2000, %edx           # imm = 0x2000
xorl %ecx, %ecx
leaq -0x14(%rbp), %r8
leaq -0x18(%rbp), %r9
callq 0x10e0
movq %rax, -0x4030(%rbp)
cmpq $0x0, -0x4030(%rbp)
jle 0x169d
jmp 0x16bc
leaq 0x997(%rip), %rdi       # 0x203b
leaq 0x961(%rip), %rsi       # 0x200c
movl $0x53, %edx
leaq 0x99c(%rip), %rcx       # 0x2053
callq 0x1060
leaq -0x2020(%rbp), %rsi
movq -0x4030(%rbp), %rdx
xorl %edi, %edi
callq 0x1030
movq %rax, -0x4030(%rbp)
cmpq $0x0, -0x4030(%rbp)
jle 0x16e4
jmp 0x1703
leaq 0x950(%rip), %rdi       # 0x203b
leaq 0x91a(%rip), %rsi       # 0x200c
movl $0x55, %edx
leaq 0x955(%rip), %rcx       # 0x2053
callq 0x1060
jmp 0x1705
movq -0x40b0(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x17b3
xorl %edi, %edi
leaq -0x4020(%rbp), %rsi
movl $0x2000, %edx           # imm = 0x2000
callq 0x1090
movq %rax, -0x4030(%rbp)
cmpq $0x0, -0x4030(%rbp)
jle 0x1740
jmp 0x175f
leaq 0x8f4(%rip), %rdi       # 0x203b
leaq 0x8be(%rip), %rsi       # 0x200c
movl $0x59, %edx
leaq 0x8f9(%rip), %rcx       # 0x2053
callq 0x1060
movl -0x4(%rbp), %edi
leaq -0x4020(%rbp), %rsi
movq -0x4030(%rbp), %rdx
movl -0x18(%rbp), %r9d
xorl %ecx, %ecx
leaq -0x14(%rbp), %r8
callq 0x1080
movq %rax, -0x4030(%rbp)
cmpq $0x0, -0x4030(%rbp)
jle 0x1792
jmp 0x17b1
leaq 0x8a2(%rip), %rdi       # 0x203b
leaq 0x86c(%rip), %rsi       # 0x200c
movl $0x5c, %edx
leaq 0x8a7(%rip), %rcx       # 0x2053
callq 0x1060
jmp 0x17b3
jmp 0x1540
nopl (%rax,%rax)