LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: dyninit
static void
dyninit(void)
{
    if (sock_cloexec == 1) {    // initial state, ie neither 0 nor SOCK_CLOEXEC
#ifdef WIN32
        WSADATA wsaData;
        WSAStartup(WINSOCK_VERSION, &wsaData);
#endif
       #ifdef SOCK_CLOEXEC
        sock_cloexec = SOCK_CLOEXEC;    // Safely re-enter dyninit from sock_bind
        int fd = sock_bind("", 0);
        if (fd < 0) {
            sock_cloexec = 0;
            cmsg_cloexec = 0;
        } else {
           #if defined(linux) && defined(_GNU_SOURCE)
            // Test whether glibc.accept4 really works:
            IN4ADDR sin;
            socklen_t len = sizeof(sin);
            listen(fd, 1);
            getsockname(fd, (SOADDR*)&sin, &len);
            int con = sock_connect("127.0.0.1", ntohs(sin.sin_port), 1);
            int ret = accept4(fd, NULL, NULL, SOCK_CLOEXEC);
            has_accept4 = ret >= 0 && fcntl(ret, F_GETFD, 0) & FD_CLOEXEC;
            close(ret);
            close(con);
           #endif
            close(fd);
        }
       #else
        sock_cloexec = 0;
       #endif
    }
    errno = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
cmpl $0x1, 0x6b87(%rip)      # 0xc880
jne 0x5dbe
movl $0x80000, 0x6b77(%rip)  # imm = 0x80000
leaq 0x30ee(%rip), %rdi      # 0x8dfe
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x5dd3
testl %eax, %eax
js 0x5db7
movl %eax, %ebx
leaq 0xc(%rsp), %r15
movl $0x10, (%r15)
pushq $0x1
popq %rbp
movl %eax, %edi
movl %ebp, %esi
callq 0x3380
leaq 0x10(%rsp), %r12
movl %ebx, %edi
movq %r12, %rsi
movq %r15, %rdx
callq 0x32d0
movzwl 0x2(%r12), %eax
rolw $0x8, %ax
movzwl %ax, %esi
leaq 0x22ab(%rip), %rdi      # 0x800d
movl %ebp, %edx
callq 0x61bd
movl %eax, %ebp
movl %ebx, %edi
xorl %esi, %esi
xorl %edx, %edx
movl $0x80000, %ecx          # imm = 0x80000
callq 0x3180
movl %eax, %r15d
testl %eax, %eax
js 0x5d98
pushq $0x1
popq %rsi
movl %r15d, %edi
xorl %edx, %edx
xorl %eax, %eax
callq 0x31d0
movl %eax, %r14d
andl $0x1, %r14d
movl %r14d, 0x6b01(%rip)     # 0xc8a0
movl %r15d, %edi
callq 0x3560
movl %ebp, %edi
callq 0x3560
movl %ebx, %edi
callq 0x3560
jmp 0x5dbe
andl $0x0, 0x6ac2(%rip)      # 0xc880
callq 0x3040
andl $0x0, (%rax)
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: sock_bind
int
sock_bind(IPSTR const ip, int port)
{
    dyninit();

    INxADDR addr;
    int addrlen = ininit(&addr, ip, port);
    if (addrlen < 0)
        return -1;

    int fd = sockit(addr.inx_family);
    if (fd < 0)
        return -1;
    #ifdef IPV6_V6ONLY
    if (addr.inx_family == AF_INET6) {
        int     no = 0;
        if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &no, sizeof(no)))
            return eclose(fd);
    }
    #endif
    //XXX support bindresvport(), i.e. ask for an arb port in 512..1023?
    return setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&fd, sizeof fd)
            || bind(fd, (SOADDR*)&addr, addrlen)
            || listen(fd, 5)
         ? eclose(fd) : fd;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
movl %esi, %ebx
movq %rdi, %r14
callq 0x5ce6
leaq 0x14(%rsp), %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x5e9b
testl %eax, %eax
js 0x5e3d
movl %eax, %ebp
movzwl 0x14(%rsp), %edi
callq 0x5f0b
movl %eax, 0xc(%rsp)
pushq $-0x1
popq %rbx
testl %eax, %eax
js 0x5e8a
movl %eax, %r14d
cmpw $0xa, 0x14(%rsp)
jne 0x5e42
leaq 0x10(%rsp), %rcx
andl $0x0, (%rcx)
pushq $0x29
popq %rsi
pushq $0x1a
popq %rdx
pushq $0x4
popq %r8
movl %r14d, %edi
callq 0x34f0
testl %eax, %eax
je 0x5e42
movl %r14d, %edi
jmp 0x5e85
pushq $-0x1
popq %rbx
jmp 0x5e8a
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
leaq 0xc(%rsp), %rcx
pushq $0x4
popq %r8
movl %r14d, %edi
callq 0x34f0
testl %eax, %eax
jne 0x5e81
movl 0xc(%rsp), %edi
leaq 0x14(%rsp), %rsi
movl %ebp, %edx
callq 0x3070
testl %eax, %eax
jne 0x5e81
movl 0xc(%rsp), %edi
pushq $0x5
popq %rsi
callq 0x3380
testl %eax, %eax
je 0x5e95
movl 0xc(%rsp), %edi
callq 0x5f57
movl %ebx, %eax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl 0xc(%rsp), %ebx
jmp 0x5e8a
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: ininit
static int
ininit(INxADDR *xp, IPSTR const ip, int port)
{
   #if defined(__FreeBSD__) || defined(__APPLE__)
       #define SETLEN(x) (int)(xp->in4.sin_len = (x))
   #else
       #define SETLEN(x) (int)(x)
   #endif
    // We rely on INADDR_ANY == 0x00000000
    memset(xp, 0, sizeof(*xp));
    xp->inx_port   = (uint16_t)htons((uint16_t)port);
    xp->inx_family = AF_INET;
    return !ip || !*ip ||
              1 == inet_pton(AF_INET, ip, &xp->in4.sin_addr)
            ? SETLEN(sizeof(IN4ADDR))
            : 1 == inet_pton(xp->inx_family = AF_INET6, ip, &xp->in6.sin6_addr)
            ? SETLEN(sizeof(IN6ADDR))
            : -1;
   #undef SETLEN
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
andq $0x0, 0x14(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%rdi)
rolw $0x8, %dx
movw %dx, 0x2(%rdi)
movw $0x2, (%rdi)
pushq $0x10
popq %rbp
testq %rsi, %rsi
je 0x5f04
movq %rsi, %r14
cmpb $0x0, (%rsi)
je 0x5f04
movq %rdi, %rbx
leaq 0x4(%rdi), %rdx
pushq $0x2
popq %rdi
movq %r14, %rsi
callq 0x3530
cmpl $0x1, %eax
je 0x5f04
movw $0xa, (%rbx)
addq $0x8, %rbx
pushq $0xa
popq %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3530
xorl %ebp, %ebp
cmpl $0x1, %eax
setne %bpl
negl %ebp
orl $0x1c, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: sockit
static int
sockit(int domain)
{
    int fd = socket(domain, SOCK_STREAM | sock_cloexec, 0);
    if (fd < 0) return -1;

#ifdef SO_NOSIGPIPE
    // If the connection breaks. the client finds out because SEND fails (RECV just waits).
    //  On Darwin, by default, writing to a broken connection throws SIGPIPE.
    int on = 1;
    if (setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, (const void *) &on, sizeof on))
        return eclose(fd);
#endif
    return fd >= 0 && !sock_cloexec && fcntl(fd, F_SETFD, FD_CLOEXEC) ? eclose(fd) : fd;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl 0x696c(%rip), %esi      # 0xc880
orl $0x1, %esi
xorl %edx, %edx
callq 0x30a0
pushq $-0x1
popq %rbx
testl %eax, %eax
js 0x5f4e
movl %eax, %ebp
cmpl $0x0, 0x6952(%rip)      # 0xc880
je 0x5f34
movl %ebp, %ebx
jmp 0x5f4e
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movl %ebp, %edi
xorl %eax, %eax
callq 0x31d0
testl %eax, %eax
je 0x5f30
movl %ebp, %edi
callq 0x5f57
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: sock_accept
int
sock_accept(int skt)
{
    dyninit();

    int fd;
    do fd =
           #if 0 && defined(linux) && defined(_GNU_SOURCE)
            has_accept4 ? accept4(skt, NULL, NULL, sock_cloexec) :
           #endif
            accept(skt, NULL, NULL);
    while (fd < 0 && errno == EINTR);

    return fd >= 0 && !has_accept4 && fcntl(fd, F_SETFD, FD_CLOEXEC)
         ? eclose(fd) : fd;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %ebp
callq 0x5ce6
movl %ebp, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x30e0
movl %eax, %ebx
testl %eax, %eax
jns 0x5f9d
callq 0x3040
cmpl $0x4, (%rax)
je 0x5f80
jmp 0x5fc3
cmpl $0x0, 0x68fc(%rip)      # 0xc8a0
jne 0x5fc3
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
testl %eax, %eax
je 0x5fc3
movl %ebx, %edi
callq 0x5f57
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: sock_create
int
sock_create(char const *path)
{
    dyninit();

#ifdef WIN32
    //CreateNamedPipe...  http://msdn.microsoft.com/en-us/library/windows/desktop/aa365601%28v=vs.85%29.aspx
    return INVALID_SOCKET;
#else
    UNADDR sun;
    int fd, len = uninit(&sun, path);
    if (!len) return errno = EINVAL, -1;
    if (unlink(path) && errno != ENOENT) return -1;
    if (0 > (fd = sockit(AF_UNIX))) return -1;

    return setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &fd, sizeof fd)
           || bind(fd, (SOADDR*)&sun, sizeof sun.sun_family + len)
           || listen(fd, 5)
         ? eclose(fd) : fd;
#endif
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
callq 0x5ce6
leaq 0xa(%rsp), %rdi
movq %rbx, %rsi
callq 0x607f
testl %eax, %eax
je 0x6062
movl %eax, %ebp
movq %rbx, %rdi
callq 0x3160
pushq $-0x1
popq %rbx
testl %eax, %eax
je 0x6006
callq 0x3040
cmpl $0x2, (%rax)
jne 0x6070
pushq $0x1
popq %rdi
callq 0x5f0b
movl %eax, 0x4(%rsp)
testl %eax, %eax
js 0x6070
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
leaq 0x4(%rsp), %rcx
pushq $0x4
popq %r8
movl %eax, %edi
callq 0x34f0
testl %eax, %eax
jne 0x6057
movl 0x4(%rsp), %edi
addl $0x2, %ebp
leaq 0xa(%rsp), %rsi
movl %ebp, %edx
callq 0x3070
testl %eax, %eax
jne 0x6057
movl 0x4(%rsp), %edi
pushq $0x5
popq %rsi
callq 0x3380
testl %eax, %eax
je 0x6079
movl 0x4(%rsp), %edi
callq 0x5f57
jmp 0x6070
callq 0x3040
movl $0x16, (%rax)
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %rbp
retq
movl 0x4(%rsp), %ebx
jmp 0x6070
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: uninit
static int
uninit(UNADDR * uap, char const *path)
{
    int len = strlen(path);
    if (len > (int) sizeof uap->sun_path) return 0;

    memset(uap, 0, sizeof(UNADDR));
   #ifdef __FreeBSD__
    uap->sun_len = len;
   #endif
    uap->sun_family = AF_UNIX;
    memcpy(uap->sun_path, path, len);
    return SUN_LEN(uap);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x3140
xorl %ecx, %ecx
cmpl $0x6c, %eax
jg 0x60e5
leaq 0x2(%r14), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x5e(%r14)
movups %xmm0, 0x52(%r14)
movups %xmm0, 0x42(%r14)
movups %xmm0, 0x32(%r14)
movups %xmm0, 0x22(%r14)
movups %xmm0, 0x12(%r14)
movups %xmm0, 0x2(%r14)
movw $0x1, (%r14)
movslq %eax, %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3260
movq %r15, %rdi
callq 0x3140
movq %rax, %rcx
addl $0x2, %ecx
movl %ecx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: sock_open
int
sock_open(char const *path)
{
    dyninit();

#ifdef WIN32
    // WaitNamedPipe, CreateFile 
    return INVALID_SOCKET;
#else
    struct stat st;
    UNADDR sun;
    int fd, ret, len = uninit(&sun, path);
    if (!len || stat(path, &st) || !S_ISSOCK(st.st_mode))
        return errno = EINVAL, -1;

    if (0 > (fd = sockit(AF_UNIX))) return -1;

    do errno = 0, ret = connect(fd, (SOADDR*)&sun, SUN_LEN(&sun));
    while (ret < 0 && errno == EINTR);

    return ret < 0 && errno != EAGAIN ? eclose(fd) : fd;
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rdi, %rbx
callq 0x5ce6
leaq 0x2(%rsp), %rdi
movq %rbx, %rsi
callq 0x607f
testl %eax, %eax
je 0x618a
leaq 0x70(%rsp), %rsi
movq %rbx, %rdi
callq 0x32b0
testl %eax, %eax
jne 0x618a
movl $0xf000, %eax           # imm = 0xF000
andl 0x88(%rsp), %eax
cmpl $0xc000, %eax           # imm = 0xC000
jne 0x618a
pushq $0x1
popq %rdi
callq 0x5f0b
pushq $-0x1
popq %rbx
testl %eax, %eax
js 0x6198
movl %eax, %ebp
callq 0x3040
movq %rax, %r14
leaq 0x4(%rsp), %r15
leaq 0x2(%rsp), %r12
andl $0x0, (%r14)
movq %r15, %rdi
callq 0x3140
leal 0x2(%rax), %edx
movl %ebp, %edi
movq %r12, %rsi
callq 0x3280
testl %eax, %eax
jns 0x6186
movl (%r14), %eax
cmpl $0x4, %eax
je 0x615c
cmpl $0xb, %eax
jne 0x61aa
movl %ebp, %ebx
jmp 0x6198
callq 0x3040
movl $0x16, (%rax)
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %ebp, %edi
callq 0x5f57
jmp 0x6198
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: sock_connect
int
sock_connect(const char *host, int port, int nowait)
{
    dyninit();

    char sport[7];
    sprintf(sport, "%hu", (uint16_t)port);
    ADRINFO *aip, hint = {
        AI_NUMERICSERV, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP,
        /*addrlen */0, /*addr */0, /*canonname */0, /*next */0
    };

    if (getaddrinfo(host, sport, &hint, &aip)) return -1;

    // "ai_family" usable here because PF_INET=AF_INET, PF_INET6=AF_INET6.
    int fd = sockit(aip->ai_family), ret = -1;
    if (fd >= 0
        && !(nowait && sock_setopt(fd, SOCK_NOWAIT, 1))
        && !setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&fd, sizeof fd)) {

        do errno = 0, ret = connect(fd, aip->ai_addr, aip->ai_addrlen);
        while (ret < 0 && errno == EINTR);
    }

    freeaddrinfo(aip);
    return ret < 0 && errno != EINPROGRESS ? eclose(fd) : fd;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x58, %rsp
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
callq 0x5ce6
movzwl %bp, %edx
leaq 0x29c3(%rip), %rsi      # 0x8ba0
leaq 0x19(%rsp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x3080
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x20(%rdx)
movaps %xmm0, 0x10(%rdx)
movl $0x400, (%rdx)          # imm = 0x400
movabsq $0x600000001, %rax      # imm = 0x600000001
movq %rax, 0x8(%rdx)
leaq 0x10(%rsp), %rcx
movq %r14, %rdi
movq %r15, %rsi
callq 0x33f0
testl %eax, %eax
jne 0x62bd
movq 0x10(%rsp), %rax
movl 0x4(%rax), %edi
callq 0x5f0b
movl %eax, 0xc(%rsp)
testl %eax, %eax
js 0x629a
movl %eax, %ebp
testl %ebx, %ebx
je 0x6257
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movl %ebp, %edi
callq 0x62d7
testl %eax, %eax
jne 0x629a
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
leaq 0xc(%rsp), %rcx
pushq $0x4
popq %r8
movl %ebp, %edi
callq 0x34f0
testl %eax, %eax
jne 0x629a
callq 0x3040
movq %rax, %rbx
andl $0x0, (%rbx)
movl 0xc(%rsp), %edi
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rsi
movl 0x10(%rax), %edx
callq 0x3280
testl %eax, %eax
jns 0x62cb
cmpl $0x4, (%rbx)
je 0x6279
movq 0x10(%rsp), %rdi
callq 0x3400
callq 0x3040
cmpl $0x73, (%rax)
jne 0x62b4
movl 0xc(%rsp), %eax
jmp 0x62c0
movl 0xc(%rsp), %edi
callq 0x5f57
pushq $-0x1
popq %rax
addq $0x58, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rsp), %rdi
callq 0x3400
jmp 0x62ae
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: sock_setopt
int
sock_setopt(int skt, SOCK_OPT opt, int val)
{
    dyninit();

    if (opt >= SOCK_OPTS) return errno = EINVAL, -1;
#ifdef TCP_KEEPALIVE    // Darwin,FreeBSD
    if (opt == SOCK_KEEPALIVE && setsockopt(skt, SOL_SOCKET, SO_KEEPALIVE, (char const*)&val, sizeof val))
        return -1;
#endif

    struct linger lng = { val > 0, val }; //XXX why winwarn?
    return opt == SOCK_LINGER      ? setsockopt(skt, SOL_SOCKET, SO_LINGER, &lng, sizeof lng)
        : opts[opt].lvl == F_GETFL ? fcntl(skt, F_SETFL, BIT(fcntl(skt, F_GETFL, 0), opts[opt].opt, val))
                                   : setsockopt(skt, opts[opt].lvl, opts[opt].opt, (char*)&val, sizeof val);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movl %esi, %r14d
movl %edi, %ebx
movl %edx, 0xc(%rsp)
callq 0x5ce6
cmpl $0x8, %r14d
jb 0x6307
callq 0x3040
movl $0x16, (%rax)
pushq $-0x1
popq %rax
jmp 0x6381
xorl %eax, %eax
testl %ebp, %ebp
setg %al
movl %eax, 0x10(%rsp)
movl %ebp, 0x14(%rsp)
cmpl $0x6, %r14d
jne 0x632b
pushq $0x1
popq %rsi
pushq $0xd
popq %rdx
leaq 0x10(%rsp), %rcx
pushq $0x8
jmp 0x6378
movl %r14d, %r14d
leaq 0x28ab(%rip), %r15      # 0x8be0
movl (%r15,%r14,8), %esi
cmpl $0x3, %esi
jne 0x636c
pushq $0x3
popq %rsi
movl %ebx, %edi
xorl %edx, %edx
xorl %eax, %eax
callq 0x31d0
movl 0x4(%r15,%r14,8), %edx
movl %edx, %ecx
orl %eax, %ecx
notl %edx
andl %eax, %edx
testl %ebp, %ebp
cmovnel %ecx, %edx
pushq $0x4
popq %rsi
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
jmp 0x6381
movl 0x4(%r15,%r14,8), %edx
leaq 0xc(%rsp), %rcx
pushq $0x4
popq %r8
movl %ebx, %edi
callq 0x34f0
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: sock_ready
int
sock_ready(int skt, int mode, int waitsecs)
{
    dyninit();

    int ret, err;
#ifdef USE_POLL
    struct pollfd sockpoll = { skt, mode ? POLLOUT : POLLIN,  0 };

    do errno = 0, ret = poll(&sockpoll, 1, waitsecs);
    while (ret < 0 && errno == EINTR);

    err = sockpoll.revents & POLLERR;
#else//USE_POLL
    fd_set rwfds, erfds;
    FD_ZERO(&rwfds);
    FD_ZERO(&erfds);
    do {
        struct timeval to = { waitsecs, 0 }, *top = waitsecs == WAIT_FOREVER ? NULL : &to;
        FD_SET(skt, &rwfds);
        FD_SET(skt, &erfds);

        errno = 0;
        ret = mode  ? select(skt + 1, NULL, &rwfds, &erfds, top)
                    : select(skt + 1, &rwfds, NULL, &erfds, top);
    } while (ret < 0 && errno == EINTR);

    err = FD_ISSET(skt, &erfds);
#endif//USE_POLL

    return err && ret > 0 ? -2 : ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movl %edx, %r14d
movl %esi, 0x4(%rsp)
movl %edi, %ebp
callq 0x5ce6
xorl %eax, %eax
cmpq $0x10, %rax
je 0x63c1
andq $0x0, 0x98(%rsp,%rax,8)
incq %rax
jmp 0x63ad
xorl %eax, %eax
cmpq $0x10, %rax
je 0x63d4
andq $0x0, 0x18(%rsp,%rax,8)
incq %rax
jmp 0x63c3
movslq %r14d, %r12
xorl %eax, %eax
cmpl $-0x1, %r12d
leaq 0x8(%rsp), %r14
cmoveq %rax, %r14
pushq $0x40
popq %rcx
movl %ebp, %eax
cltd
idivl %ecx
movslq %eax, %r13
shll $0x6, %eax
movl %ebp, %ecx
subl %eax, %ecx
pushq $0x1
popq %rbx
shlq %cl, %rbx
callq 0x3040
movq %rax, %r15
incl %ebp
movq %r12, 0x8(%rsp)
andq $0x0, 0x10(%rsp)
orq %rbx, 0x98(%rsp,%r13,8)
orq %rbx, 0x18(%rsp,%r13,8)
andl $0x0, (%r15)
cmpl $0x0, 0x4(%rsp)
je 0x6439
movl %ebp, %edi
xorl %esi, %esi
leaq 0x98(%rsp), %rdx
jmp 0x6445
movl %ebp, %edi
leaq 0x98(%rsp), %rsi
xorl %edx, %edx
leaq 0x18(%rsp), %rcx
movq %r14, %r8
callq 0x32f0
testl %eax, %eax
jns 0x645c
cmpl $0x4, (%r15)
je 0x6408
testq %rbx, 0x18(%rsp,%r13,8)
pushq $-0x2
popq %rcx
cmovel %eax, %ecx
testl %eax, %eax
cmovlel %eax, %ecx
movl %ecx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: sock_recv
int
sock_recv(int skt, char *buf, int size)
{
    dyninit();

    int ret;
    do errno = 0, ret = recv(skt, buf, size, 0);
    while (ret < 0 && errno == EINTR);
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %rbx
movl %edi, %ebp
callq 0x5ce6
callq 0x3040
movq %rax, %r14
movslq %r15d, %r15
andl $0x0, (%r14)
movl %ebp, %edi
movq %rbx, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x30f0
testl %eax, %eax
jns 0x666c
cmpl $0x4, (%r14)
je 0x664f
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: sock_send
int
sock_send(int skt, char const *buf, int size)
{
    dyninit();

    int ret;
    do errno = 0, ret = send(skt, buf, size, 0);
    while (ret < 0 && errno == EINTR);
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %rbx
movl %edi, %ebp
callq 0x5ce6
callq 0x3040
movq %rax, %r14
movslq %r15d, %r15
andl $0x0, (%r14)
movl %ebp, %edi
movq %rbx, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x3190
testl %eax, %eax
jns 0x66b3
cmpl $0x4, (%r14)
je 0x6696
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: sock_recvfd
int
sock_recvfd(int skt, int *pfd, char *buf, int size)
{
    dyninit();

    int ret;
    char x;
    FDCMSG ctl = { {sizeof ctl, 0, 0} , -1 };
    struct iovec iov[2] = { {&x, sizeof x} , {buf, size} };
    struct msghdr msg = { 0, 0, iov, 1 + (buf && size), &ctl, sizeof ctl, 0 };

    do errno = 0, ret = recvmsg(skt, &msg, cmsg_cloexec);
    while (ret < 0 && errno == EINTR);

    if (ret >= 0 && !cmsg_cloexec && fcntl(ctl.fd, F_SETFD, FD_CLOEXEC))
        return close(ctl.fd), -1;

    if (pfd)
        *pfd = ctl.fd;

    return ret < 0 ? ret
        : memcmp(&ctl.c, &fdc_hdr, sizeof fdc_hdr) ? errno = ENOMSG, -1
        : ret - (int) sizeof(x) * (ret > 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x90, %rsp
movl %ecx, %r14d
movq %rdx, %r15
movq %rsi, %rbx
movl %edi, %ebp
callq 0x5ce6
movdqu 0x24cb(%rip), %xmm0     # 0x8bb0
leaq 0x10(%rsp), %rax
movdqa %xmm0, (%rax)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %rcx, 0x10(%rax)
leaq 0xf(%rsp), %rcx
leaq 0x30(%rsp), %rdx
movq %rcx, (%rdx)
movq $0x1, 0x8(%rdx)
leaq 0x58(%rsp), %r12
andq $0x0, (%r12)
movq %r15, 0x10(%rdx)
andl $0x0, 0x8(%r12)
movslq %r14d, %rcx
movq %rcx, 0x18(%rdx)
movq %rdx, 0x10(%r12)
testq %r15, %r15
setne %dl
testl %ecx, %ecx
setne %cl
andb %dl, %cl
movzbl %cl, %ecx
incq %rcx
movq %rcx, 0x18(%r12)
movq %rax, 0x20(%r12)
movq $0x18, 0x28(%r12)
andl $0x0, 0x30(%r12)
callq 0x3040
movq %rax, %r15
andl $0x0, (%r15)
movl %ebp, %edi
movq %r12, %rsi
xorl %edx, %edx
callq 0x30c0
movq %rax, %r14
testl %r14d, %r14d
jns 0x6780
cmpl $0x4, (%r15)
je 0x6760
jmp 0x67a0
movl 0x20(%rsp), %edi
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
xorl %eax, %eax
callq 0x31d0
testl %eax, %eax
je 0x67a0
movl 0x20(%rsp), %edi
callq 0x3560
jmp 0x67d0
testq %rbx, %rbx
je 0x67ab
movl 0x20(%rsp), %eax
movl %eax, (%rbx)
testl %r14d, %r14d
js 0x67de
movdqa 0x10(%rsp), %xmm0
pcmpeqb 0x23d2(%rip), %xmm0     # 0x8b90
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x67d6
movl $0x2a, (%r15)
pushq $-0x1
popq %r14
jmp 0x67de
cmpl $0x1, %r14d
adcl $-0x1, %r14d
movl %r14d, %eax
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: sock_sendfd
int
sock_sendfd(int skt, int fd, char const *buf, int size)
{
    dyninit();

    char          x = 0;
    FDCMSG        ctl = { fdc_hdr, fd };
    struct iovec  iov[2] = { {&x, sizeof x}, {(void *) (intptr_t) buf, size} };
    struct msghdr msg = { 0, 0, iov, 1 + (buf && size), &ctl, sizeof ctl, 0 };
    int           ret;

    do errno = 0, ret = sendmsg(skt, &msg, 0);
    while (ret < 0 && errno == EINTR);

    return ret - sizeof(x) * (ret > 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x88, %rsp
movl %ecx, %ebp
movq %rdx, %r15
movl %esi, %r14d
movl %edi, %ebx
callq 0x5ce6
leaq 0xf(%rsp), %rax
movb $0x0, (%rax)
movups 0x23ac(%rip), %xmm0     # 0x8bc8
leaq 0x10(%rsp), %rcx
movaps %xmm0, (%rcx)
movl %r14d, 0x10(%rcx)
leaq 0x30(%rsp), %rdx
movq %rax, (%rdx)
movq $0x1, 0x8(%rdx)
leaq 0x50(%rsp), %r14
andq $0x0, (%r14)
movq %r15, 0x10(%rdx)
andl $0x0, 0x8(%r14)
movslq %ebp, %rax
movq %rax, 0x18(%rdx)
movq %rdx, 0x10(%r14)
testq %r15, %r15
setne %dl
testl %eax, %eax
setne %al
andb %dl, %al
movzbl %al, %eax
incq %rax
movq %rax, 0x18(%r14)
movq %rcx, 0x20(%r14)
movq $0x18, 0x28(%r14)
andl $0x0, 0x30(%r14)
callq 0x3040
movq %rax, %r15
andl $0x0, (%r15)
movl %ebx, %edi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3250
testl %eax, %eax
jns 0x689f
cmpl $0x4, (%r15)
je 0x6885
xorl %ecx, %ecx
testl %eax, %eax
setg %cl
subl %ecx, %eax
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: sock_getopt
int
sock_getopt(int skt, SOCK_OPT opt)
{
    dyninit();

    int         ret, val;
    socklen_t   len;

    if (opt >= SOCK_OPTS) return errno = EINVAL, -1;

    if (opt == SOCK_LINGER) {
        struct linger lng;
        len = sizeof lng;
        ret = getsockopt(skt, SOL_SOCKET, SO_LINGER, (char*)&lng, &len);
        return ret ? ret : lng.l_onoff ? lng.l_linger : 0;
    } else if (opts[opt].lvl == F_GETFL) {
        return !!(fcntl(skt, F_GETFL, 0) & opts[opt].opt);
    } else {
        len = sizeof val;
        ret = getsockopt(skt, opts[opt].lvl, opts[opt].opt, (char*)&val, &len);
        return ret ? ret : val;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebp
movl %edi, %ebx
callq 0x5ce6
cmpl $0x8, %ebp
jb 0x68e1
callq 0x3040
movl $0x16, (%rax)
pushq $-0x1
popq %rax
jmp 0x696f
cmpl $0x6, %ebp
jne 0x691b
leaq 0x14(%rsp), %r8
movl $0x8, (%r8)
pushq $0x1
popq %rsi
pushq $0xd
popq %rdx
leaq 0xc(%rsp), %r14
movl %ebx, %edi
movq %r14, %rcx
callq 0x3230
movl %eax, %ecx
movl (%r14), %eax
testl %eax, %eax
je 0x6914
movl 0x10(%rsp), %eax
testl %ecx, %ecx
cmovnel %ecx, %eax
jmp 0x696f
movl %ebp, %r14d
leaq 0x22bb(%rip), %r15      # 0x8be0
movl (%r15,%r14,8), %esi
cmpl $0x3, %esi
jne 0x694a
pushq $0x3
popq %rsi
movl %ebx, %edi
xorl %edx, %edx
xorl %eax, %eax
callq 0x31d0
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, 0x4(%r15,%r14,8)
setne %al
jmp 0x696f
leaq 0x14(%rsp), %r8
movl $0x4, (%r8)
movl 0x4(%r15,%r14,8), %edx
leaq 0xc(%rsp), %rcx
movl %ebx, %edi
callq 0x3230
testl %eax, %eax
jne 0x696f
movl 0xc(%rsp), %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: sock_addr
int
sock_addr(int skt, IPSTR ip, int *pport, char *name, int size)
{
    dyninit();

    INxADDR sin;
    socklen_t len = sizeof(sin);
    if (0 > getsockname(skt, (SOADDR*)&sin, &len))
        return -1;

    ininfo(&sin, ip, pport);
    return -(name && size
             && getnameinfo((SOADDR*) &sin, len, name, size, NULL, 0, 0));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movl %r8d, %ebx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movl %edi, %ebp
callq 0x5ce6
leaq 0x10(%rsp), %rdx
movl $0x1c, (%rdx)
leaq 0x14(%rsp), %rsi
movl %ebp, %edi
callq 0x32d0
testl %eax, %eax
js 0x69fd
leaq 0x14(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x6a11
testq %r14, %r14
sete %al
testl %ebx, %ebx
sete %cl
xorl %r15d, %r15d
orb %al, %cl
jne 0x6a01
movl 0x10(%rsp), %esi
andl $0x0, (%rsp)
xorl %r15d, %r15d
leaq 0x14(%rsp), %rdi
movq %r14, %rdx
movl %ebx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x31e0
negl %eax
sbbl %r15d, %r15d
jmp 0x6a01
pushq $-0x1
popq %r15
movl %r15d, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: ininfo
static void
ininfo(INxADDR const*xp, IPSTR ip, int *pport)
{
    if (pport) *pport = ntohs(xp->inx_port);
    if (ip) inet_ntop(AF_INET,
                      xp->inx_family == AF_INET ? (void const*)&xp->in4.sin_addr
                                                : (void const*)&xp->in6.sin6_addr,
                      ip, sizeof(IPSTR));
}

// Assembly:
movq %rsi, %rax
testq %rdx, %rdx
je 0x6a26
movzwl 0x2(%rdi), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
movl %ecx, (%rdx)
testq %rax, %rax
je 0x6a4a
xorl %ecx, %ecx
cmpw $0x2, (%rdi)
setne %cl
leaq (%rdi,%rcx,4), %rsi
addq $0x4, %rsi
pushq $0x2
popq %rdi
pushq $0x2e
popq %rcx
movq %rax, %rdx
jmp 0x3320
retq
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: sock_peer
int
sock_peer(int skt, IPSTR ip, int *pport, char *name, int size)
{
    dyninit();

    INxADDR sin;
    socklen_t len = sizeof(sin);
    if (0 > getpeername(skt, (SOADDR*)&sin, &len)) return -1;

    ininfo(&sin, ip, pport);
    return -(name && size &&
             getnameinfo((SOADDR*)&sin, len, name, size, NULL, 0,
                          NI_NAMEREQD + NI_NOFQDN));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movl %r8d, %ebx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movl %edi, %ebp
callq 0x5ce6
leaq 0x10(%rsp), %rdx
movl $0x1c, (%rdx)
leaq 0x14(%rsp), %rsi
movl %ebp, %edi
callq 0x3210
testl %eax, %eax
js 0x6ad1
leaq 0x14(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x6a11
testq %r14, %r14
sete %al
testl %ebx, %ebx
sete %cl
xorl %r15d, %r15d
orb %al, %cl
jne 0x6ad5
movl 0x10(%rsp), %esi
movl $0xc, (%rsp)
xorl %r15d, %r15d
leaq 0x14(%rsp), %rdi
movq %r14, %rdx
movl %ebx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x31e0
negl %eax
sbbl %r15d, %r15d
jmp 0x6ad5
pushq $-0x1
popq %r15
movl %r15d, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: udp_open
int
udp_open(IPSTR const ip, int port)
{
    dyninit();

    if (port & -65536) return errno = EINVAL, -1;

    INxADDR addr;
    int addrlen = ininit(&addr, ip, port);
    if (addrlen < 0) return addrlen;

    int fd = socket(addr.inx_family, SOCK_DGRAM | sock_cloexec, IPPROTO_UDP);
    return fd >= 0 && ((!sock_cloexec && fcntl(fd, F_SETFD, FD_CLOEXEC))
                       || (port && bind(fd, (SOADDR*)&addr, addrlen))
                      ) ? eclose(fd) : fd;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebp
movq %rdi, %rbx
callq 0x5ce6
cmpl $0x10000, %ebp          # imm = 0x10000
jae 0x6b5d
leaq 0xc(%rsp), %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x5e9b
pushq $-0x1
popq %rbx
testl %eax, %eax
js 0x6b6b
movl %eax, %r14d
movzwl 0xc(%rsp), %edi
movl 0x5d5b(%rip), %esi      # 0xc880
orl $0x2, %esi
pushq $0x11
popq %rdx
callq 0x30a0
movl %eax, %r15d
testl %eax, %eax
js 0x6b58
cmpl $0x0, 0x5d42(%rip)      # 0xc880
je 0x6b78
testl %ebp, %ebp
je 0x6b58
leaq 0xc(%rsp), %rsi
movl %r15d, %edi
movl %r14d, %edx
callq 0x3070
testl %eax, %eax
jne 0x6b8c
movl %r15d, %ebx
jmp 0x6b6b
callq 0x3040
movl $0x16, (%rax)
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movl %r15d, %edi
xorl %eax, %eax
callq 0x31d0
testl %eax, %eax
je 0x6b40
movl %r15d, %edi
callq 0x5f57
jmp 0x6b6b
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: udp_recv
int
udp_recv(int fd, char *buf, int size, IPSTR ip, int *port)
{
    dyninit();

    INxADDR     addr;
    socklen_t   addrlen = sizeof(addr);
    int         len;

    do len = recvfrom(fd, buf, size, /*flags*/0, (SOADDR*)&addr, &addrlen);
    while (len < 0 && errno == EINTR);
    if (len >= 0) ininfo(&addr, ip, port);
    return len;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movl %edx, %ebx
movq %rsi, %r15
movl %edi, %ebp
callq 0x5ce6
leaq 0x18(%rsp), %r12
movl $0x1c, (%r12)
movslq %ebx, %r13
leaq 0x1c(%rsp), %rbx
movl %ebp, %edi
movq %r15, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
movq %rbx, %r8
movq %r12, %r9
callq 0x3240
movq %rax, %r14
testl %r14d, %r14d
jns 0x6bf8
callq 0x3040
cmpl $0x4, (%rax)
je 0x6bcf
jmp 0x6c0c
leaq 0x1c(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x6a11
movl %r14d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/sock.c
// Function: udp_send
int
udp_send(int fd, char const *buf, int size, IPSTR const ip, int port)
{
    dyninit();

    INxADDR addr;
    int ret, addrlen = ininit(&addr, ip, port);
    do errno = 0, ret = sendto(fd, buf, size, /*flags*/0, (SOADDR const*) &addr, addrlen);
    while (ret < 0 && errno == EINTR);

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %r15d
movq %rcx, %r12
movl %edx, %r13d
movq %rsi, %rbx
movl %edi, %ebp
callq 0x5ce6
leaq 0xc(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movl %r15d, %edx
callq 0x5e9b
movl %eax, %r15d
callq 0x3040
movq %rax, %r12
movslq %r13d, %r13
andl $0x0, (%r12)
movl %ebp, %edi
movq %rbx, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
movq %r14, %r8
movl %r15d, %r9d
callq 0x3050
testl %eax, %eax
jns 0x6c85
cmpl $0x4, (%r12)
je 0x6c60
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint128_t.cpp
// Function: uint128_t::init(char const*)
void uint128_t::init(const char *s) {
    if (s == NULL || s[0] == 0) { uint128_t(); return; }
    if (s[1] == 'x')
        s += 2;
    else if (*s == 'x')
        s++;

    UPPER = ConvertToUint64(s);
    LOWER = ConvertToUint64(s + 16);
}

// Assembly:
testq %rsi, %rsi
je 0x2511
movb (%rsi), %al
testb %al, %al
je 0x2511
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1(%rsi), %r14
leaq 0x2(%rsi), %rcx
cmpb $0x78, %al
cmovneq %rsi, %r14
cmpb $0x78, 0x1(%rsi)
cmoveq %rcx, %r14
movq %r14, %rsi
callq 0x2524
movq %rax, 0x8(%rbx)
addq $0x10, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2524
movq %rax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint128_t.cpp
// Function: uint128_t::ConvertToUint64(char const*) const
uint64_t uint128_t::ConvertToUint64(const char *s) const {
    int count = 0;
    uint64_t val = 0;
    while (count < 16) {
        uint8_t hv = HexToInt(&s[count++]);
        if (hv == 0xFF)
            break;

        val = (val << 4) | hv;
    }
    return val;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
xorl %r15d, %r15d
xorl %eax, %eax
movq %rax, %r14
cmpq $0x10, %r15
je 0x255b
leaq (%rbx,%r15), %rsi
incq %r15
callq 0x2564
movq %r14, %rcx
shlq $0x4, %rcx
movzbl %al, %edx
movq %rdx, %rax
orq %rcx, %rax
cmpb $-0x1, %dl
jne 0x2531
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint128_t.cpp
// Function: uint128_t::HexToInt(char const*) const
uint8_t uint128_t::HexToInt(const char *s) const {
    uint8_t ret = 0xFF;
    if (*s >= '0' && *s <= '9') {
        ret = uint8_t(*s - '0');
    }
    else if (*s >= 'a' && *s <= 'f') {
        ret = uint8_t(*s - 'a' + 10);
    }
    else if (*s >= 'A' && *s <= 'F') {
        ret = uint8_t(*s - 'A' + 10);
    }
    return ret;
}

// Assembly:
movb (%rsi), %cl
leal -0x30(%rcx), %eax
cmpb $0xa, %al
jb 0x2579
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x257a
addb $-0x57, %cl
movl %ecx, %eax
retq
leal -0x41(%rcx), %eax
addb $-0x37, %cl
cmpb $0x6, %al
movzbl %cl, %ecx
movl $0xff, %eax
cmovbl %ecx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint128_t.cpp
// Function: uint128_t::operator<<(uint128_t const&) const
uint128_t uint128_t::operator<<(const uint128_t & rhs) const{
    const uint64_t shift = rhs.LOWER;
    if (((bool) rhs.UPPER) || (shift >= 128)){
        return uint128_0;
    }
    else if (shift == 64){
        return uint128_t(LOWER, 0);
    }
    else if (shift == 0){
        return *this;
    }
    else if (shift < 64){
        return uint128_t((UPPER << shift) + (LOWER >> (64 - shift)), LOWER << shift);
    }
    else if ((128 > shift) && (shift > 64)){
        return uint128_t(LOWER << (shift - 64), 0);
    }
    else{
        return uint128_0;
    }
}

// Assembly:
movq (%rsi), %r8
cmpq $0x0, 0x8(%rsi)
setne %al
cmpq $0x7f, %r8
seta %cl
orb %al, %cl
je 0x2643
xorl %eax, %eax
xorl %edx, %edx
retq
testq %r8, %r8
je 0x2653
cmpq $0x40, %r8
jne 0x265b
movq (%rdi), %rdx
jmp 0x2685
movq (%rdi), %rax
movq 0x8(%rdi), %rdx
retq
jae 0x267c
movq (%rdi), %rax
movq 0x8(%rdi), %rsi
movl %r8d, %ecx
shlq %cl, %rsi
negb %cl
movq %rax, %rdx
shrq %cl, %rdx
addq %rsi, %rdx
movl %r8d, %ecx
shlq %cl, %rax
retq
movq (%rdi), %rdx
movl %r8d, %ecx
shlq %cl, %rdx
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint128_t.cpp
// Function: uint128_t::operator>>(uint128_t const&) const
uint128_t uint128_t::operator>>(const uint128_t & rhs) const{
    const uint64_t shift = rhs.LOWER;
    if (((bool) rhs.UPPER) || (shift >= 128)){
        return uint128_0;
    }
    else if (shift == 64){
        return uint128_t(0, UPPER);
    }
    else if (shift == 0){
        return *this;
    }
    else if (shift < 64){
        return uint128_t(UPPER >> shift, (UPPER << (64 - shift)) + (LOWER >> shift));
    }
    else if ((128 > shift) && (shift > 64)){
        return uint128_t(0, (UPPER >> (shift - 64)));
    }
    else{
        return uint128_0;
    }
}

// Assembly:
movq (%rsi), %r8
cmpq $0x0, 0x8(%rsi)
setne %al
cmpq $0x7f, %r8
seta %cl
orb %al, %cl
je 0x26b8
xorl %eax, %eax
jmp 0x26c7
testq %r8, %r8
je 0x26ca
cmpq $0x40, %r8
jne 0x26d2
movq 0x8(%rdi), %rax
xorl %edx, %edx
retq
movq (%rdi), %rax
movq 0x8(%rdi), %rdx
retq
movq 0x8(%rdi), %rsi
jae 0x26f3
movq %rsi, %rdx
movl %r8d, %ecx
shrq %cl, %rdx
negb %cl
shlq %cl, %rsi
movq (%rdi), %rax
movl %r8d, %ecx
shrq %cl, %rax
addq %rsi, %rax
retq
movl %r8d, %ecx
shrq %cl, %rsi
xorl %edx, %edx
movq %rsi, %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint128_t.cpp
// Function: uint128_t::ConvertToVector(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long const&) const
void uint128_t::ConvertToVector(std::vector<uint8_t> & ret, const uint64_t & val) const {
    ret.push_back(static_cast<uint8_t>(val >> 56));
    ret.push_back(static_cast<uint8_t>(val >> 48));
    ret.push_back(static_cast<uint8_t>(val >> 40));
    ret.push_back(static_cast<uint8_t>(val >> 32));
    ret.push_back(static_cast<uint8_t>(val >> 24));
    ret.push_back(static_cast<uint8_t>(val >> 16));
    ret.push_back(static_cast<uint8_t>(val >> 8));
    ret.push_back(static_cast<uint8_t>(val));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movb 0x7(%rdx), %al
leaq 0x7(%rsp), %rsi
movb %al, (%rsi)
movq %rbx, %rdi
callq 0x3264
movb 0x6(%r14), %al
leaq 0x6(%rsp), %rsi
movb %al, (%rsi)
movq %rbx, %rdi
callq 0x3264
movb 0x5(%r14), %al
leaq 0x5(%rsp), %rsi
movb %al, (%rsi)
movq %rbx, %rdi
callq 0x3264
movb 0x4(%r14), %al
leaq 0x4(%rsp), %rsi
movb %al, (%rsi)
movq %rbx, %rdi
callq 0x3264
movb 0x3(%r14), %al
leaq 0x3(%rsp), %rsi
movb %al, (%rsi)
movq %rbx, %rdi
callq 0x3264
movb 0x2(%r14), %al
leaq 0x2(%rsp), %rsi
movb %al, (%rsi)
movq %rbx, %rdi
callq 0x3264
movb 0x1(%r14), %al
leaq 0x1(%rsp), %rsi
movb %al, (%rsi)
movq %rbx, %rdi
callq 0x3264
movb (%r14), %al
movq %rsp, %rsi
movb %al, (%rsi)
movq %rbx, %rdi
callq 0x3264
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint128_t.cpp
// Function: uint128_t::divmod(uint128_t const&, uint128_t const&) const
std::pair <uint128_t, uint128_t> uint128_t::divmod(const uint128_t & lhs, const uint128_t & rhs) const{
    // Save some calculations /////////////////////
    if (rhs == uint128_0){
        throw std::domain_error("Error: division or modulus by 0");
    }
    else if (rhs == uint128_1){
        return std::pair <uint128_t, uint128_t> (lhs, uint128_0);
    }
    else if (lhs == rhs){
        return std::pair <uint128_t, uint128_t> (uint128_1, uint128_0);
    }
    else if ((lhs == uint128_0) || (lhs < rhs)){
        return std::pair <uint128_t, uint128_t> (uint128_0, lhs);
    }

    std::pair <uint128_t, uint128_t> qr (uint128_0, uint128_0);
    for(uint8_t x = lhs.bits(); x > 0; x--){
        qr.first  <<= uint128_1;
        qr.second <<= uint128_1;

        if ((lhs >> (x - 1U)) & 1){
            ++qr.second;
        }

        if (qr.second >= rhs){
            qr.second -= rhs;
            ++qr.first;
        }
    }
    return qr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %r14
movq (%rcx), %rcx
movq 0x8(%r15), %rax
movq %rax, %rdx
orq %rcx, %rdx
je 0x2b68
movq %rdi, %rbx
movq %rcx, %rdx
xorq $0x1, %rdx
orq %rax, %rdx
jne 0x2a6f
movups (%r14), %xmm0
jmp 0x2a8e
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rdx, %rdi
xorq %rax, %rdi
movq %rsi, %r8
xorq %rcx, %r8
orq %rdi, %r8
jne 0x2aaa
movups 0x458a(%rip), %xmm0     # 0x7018
movups %xmm0, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %rdi
orq %rsi, %rdi
je 0x2acb
xorl %edi, %edi
cmpq %rcx, %rsi
setb %dil
xorl %ecx, %ecx
cmpq %rax, %rdx
setb %cl
cmovel %edi, %ecx
cmpb $0x1, %cl
jne 0x2ad7
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movups (%r14), %xmm0
jmp 0x2a94
leaq 0x10(%rbx), %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
movq %r14, %rdi
callq 0x2bac
movzbl %al, %ebp
decl %ebp
leaq 0x451f(%rip), %r13      # 0x7018
cmpl $-0x1, %ebp
je 0x2a98
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2688
movq %r12, %rdi
movq %r13, %rsi
callq 0x2688
movl %ebp, 0x4(%rsp)
movq %r14, %rdi
leaq 0x4(%rsp), %rsi
callq 0x318e
testb $0x1, %al
je 0x2b31
movq %r12, %rdi
callq 0x2bd6
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rcx
xorl %edx, %edx
cmpq (%r15), %rax
setae %dl
xorl %eax, %eax
cmpq 0x8(%r15), %rcx
seta %al
cmovel %edx, %eax
testb %al, %al
je 0x2b64
movq %r12, %rdi
movq %r15, %rsi
callq 0x281e
movq %rbx, %rdi
callq 0x2bd6
decl %ebp
jmp 0x2af9
pushq $0x10
popq %rdi
callq 0x20b0
movq %rax, %rbx
leaq 0x44ae(%rip), %rsi      # 0x7028
movq %rax, %rdi
callq 0x20e0
movq 0x9407(%rip), %rsi      # 0xbf90
movq 0x9410(%rip), %rdx      # 0xbfa0
movq %rbx, %rdi
callq 0x2260
movq %rax, %r14
movq %rbx, %rdi
callq 0x2100
movq %r14, %rdi
callq 0x2270
nop
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint128_t.cpp
// Function: uint128_t::bits() const
uint8_t uint128_t::bits() const{
    uint8_t out = 0;
    if (UPPER){
        out = 64;
        uint64_t up = UPPER;
        while (up){
            up >>= 1;
            out++;
        }
    }
    else{
        uint64_t low = LOWER;
        while (low){
            low >>= 1;
            out++;
        }
    }
    return out;
}

// Assembly:
movq 0x8(%rdi), %rcx
testq %rcx, %rcx
je 0x2bc3
movb $0x40, %al
testq %rcx, %rcx
je 0x2bd4
shrq %rcx
incb %al
jmp 0x2bb7
movq (%rdi), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x2bd4
shrq %rcx
incb %al
jmp 0x2bc8
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint128_t.cpp
// Function: uint128_t::str[abi:cxx11](unsigned char, unsigned int const&) const
std::string uint128_t::str(uint8_t base, const unsigned int & len) const{
    if ((base < 2) || (base > 16)){
        throw std::invalid_argument("Base must be in the range [2, 16]");
    }
    std::string out = "";
    if (!(*this)){
        out = "0";
    }
    else{
        std::pair <uint128_t, uint128_t> qr(*this, uint128_0);
        do{
            qr = divmod(qr.first, base);
            out = "0123456789abcdef"[(uint8_t) qr.second] + out;
        } while (qr.first);
    }
    if (out.size() < len){
        out = std::string(len - out.size(), '0') + out;
    }
    return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %edx, %r15d
leal -0x11(%r15), %eax
cmpb $-0x10, %al
jbe 0x2e28
movq %rcx, %r14
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x4479(%rip), %rsi      # 0x717e
movq %rsp, %rdx
callq 0x31ac
movq (%r12), %rax
orq 0x8(%r12), %rax
je 0x2db8
movq %r14, 0x20(%rsp)
movups (%r12), %xmm0
leaq 0x10(%rsp), %rax
movaps %xmm0, -0x10(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movzbl %r15b, %r14d
leaq 0x28(%rsp), %r15
movq %rsp, %r12
leaq 0x48(%rsp), %r13
leaq 0x431d(%rip), %rbp      # 0x706a
movq %r14, 0x48(%rsp)
andq $0x0, 0x50(%rsp)
movq %r15, %rdi
movq %r12, %rdx
movq %r13, %rcx
callq 0x2a36
movups 0x28(%rsp), %xmm0
movaps %xmm0, (%rsp)
leaq 0x38(%rsp), %rax
movups (%rax), %xmm0
leaq 0x10(%rsp), %rax
movups %xmm0, (%rax)
movzbl 0x10(%rsp), %eax
movsbl (%rax,%rbp), %esi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x31e7
movq %rbx, %rdi
movq %r15, %rsi
callq 0x21a0
movq %r15, %rdi
callq 0x20a0
movq (%rsp), %rax
orq 0x8(%rsp), %rax
jne 0x2d4d
movq 0x20(%rsp), %r14
jmp 0x2dc7
leaq 0x4287(%rip), %rsi      # 0x7046
movq %rbx, %rdi
callq 0x22a0
movl (%r14), %esi
subq 0x8(%rbx), %rsi
jbe 0x2e16
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x28(%rsp), %rdi
pushq $0x30
popq %rdx
callq 0x2190
movq %rsp, %rdi
leaq 0x28(%rsp), %rsi
movq %rbx, %rdx
callq 0x3244
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x21a0
movq %r14, %rdi
callq 0x20a0
leaq 0x28(%rsp), %rdi
callq 0x20a0
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x20b0
movq %rax, %rbx
leaq 0x420e(%rip), %rsi      # 0x7048
movq %rax, %rdi
callq 0x2290
movq 0x9187(%rip), %rsi      # 0xbfd0
movq 0x9170(%rip), %rdx      # 0xbfc0
movq %rbx, %rdi
callq 0x2260
jmp 0x2e7a
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x20a0
jmp 0x2e7d
jmp 0x2e7a
movq %rax, %r14
movq %rbx, %rdi
callq 0x2100
jmp 0x2e85
jmp 0x2e7a
movq %rax, %r14
movq %rbx, %rdi
callq 0x20a0
movq %r14, %rdi
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint128_t.cpp
// Function: operator<<(std::ostream&, uint128_t const&)
std::ostream & operator<<(std::ostream & stream, const uint128_t & rhs){
    if (stream.flags() & stream.oct){
        stream << rhs.str(8);
    }
    else if (stream.flags() & stream.dec){
        stream << rhs.str(10);
    }
    else if (stream.flags() & stream.hex){
        stream << rhs.str(16);
    }
    return stream;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
movq -0x18(%rax), %rax
movl 0x18(%rdi,%rax), %eax
testb $0x40, %al
jne 0x3117
testb $0x2, %al
jne 0x313c
testb $0x8, %al
je 0x3169
leaq 0x4(%rsp), %rcx
andl $0x0, (%rcx)
leaq 0x8(%rsp), %r14
pushq $0x10
popq %rdx
movq %r14, %rdi
callq 0x2cd8
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2140
jmp 0x315f
leaq 0x4(%rsp), %rcx
andl $0x0, (%rcx)
leaq 0x8(%rsp), %r14
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x2cd8
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2140
jmp 0x315f
leaq 0x4(%rsp), %rcx
andl $0x0, (%rcx)
leaq 0x8(%rsp), %r14
pushq $0xa
popq %rdx
movq %r14, %rdi
callq 0x2cd8
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2140
leaq 0x8(%rsp), %rdi
callq 0x20a0
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
jmp 0x3178
jmp 0x3178
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2270
nop
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint256_t.cpp
// Function: uint256_t::init(char const*)
void uint256_t::init(const char * s) {
    //create from string
    char buffer[64];
    if (s == NULL) { uint256_t(); return; }
    if (s[1] == 'x')
        s += 2;
    else if (*s == 'x')
        s++;

    int len = strlen(s);
    int padLength = 0;
    if (len < 64) {
        padLength = 64 - len;
        memset(buffer, '0', padLength);
    }

    memcpy(buffer + padLength, s, len);

    UPPER = uint128_t(buffer);
    LOWER = uint128_t(buffer + 32);
}

// Assembly:
testq %rsi, %rsi
je 0x3518
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r14
movq %rdi, %rbx
cmpb $0x78, 0x1(%rsi)
jne 0x3492
addq $0x2, %r14
jmp 0x349e
leaq 0x1(%r14), %rax
cmpb $0x78, (%r14)
cmoveq %rax, %r14
movq %r14, %rdi
callq 0x2090
movq %rax, %r15
cmpl $0x3f, %r15d
jg 0x34c8
pushq $0x40
popq %r12
subl %r15d, %r12d
leaq 0x10(%rsp), %rdi
pushq $0x30
popq %rsi
movq %r12, %rdx
callq 0x20d0
jmp 0x34cb
xorl %r12d, %r12d
leaq (%rsp,%r12), %rdi
addq $0x10, %rdi
movslq %r15d, %rdx
movq %r14, %rsi
callq 0x2120
movq %rsp, %r14
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x2512
movups (%r14), %xmm0
movups %xmm0, 0x10(%rbx)
leaq 0x30(%rsp), %rsi
movq %rsp, %r14
movq %r14, %rdi
callq 0x2512
movups (%r14), %xmm0
movups %xmm0, (%rbx)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop