// File: /workspace/github_c_makefile_star2_O0/jech[P]dht/dht.c
// Function: send_nodes_peers
int
send_nodes_peers(const struct sockaddr *sa, int salen,
                 const unsigned char *tid, int tid_len,
                 const unsigned char *nodes, int nodes_len,
                 const unsigned char *nodes6, int nodes6_len,
                 int af, struct storage *st,
                 const unsigned char *token, int token_len)
{
    char buf[2048];
    int i = 0, rc, j0, j, k, len;

    rc = snprintf(buf + i, 2048 - i, "d1:rd2:id20:"); INC(i, rc, 2048);
    COPY(buf, i, myid, 20, 2048);
    if(nodes_len > 0) {
        rc = snprintf(buf + i, 2048 - i, "5:nodes%d:", nodes_len);
        INC(i, rc, 2048);
        COPY(buf, i, nodes, nodes_len, 2048);
    }
    if(nodes6_len > 0) {
         rc = snprintf(buf + i, 2048 - i, "6:nodes6%d:", nodes6_len);
         INC(i, rc, 2048);
         COPY(buf, i, nodes6, nodes6_len, 2048);
    }
    if(token_len > 0) {
        rc = snprintf(buf + i, 2048 - i, "5:token%d:", token_len);
        INC(i, rc, 2048);
        COPY(buf, i, token, token_len, 2048);
    }

    if(st && st->numpeers > 0) {
        /* We treat the storage as a circular list, and serve a randomly
           chosen slice.  In order to make sure we fit within 1024 octets,
           we limit ourselves to 50 peers. */

        len = af == AF_INET ? 4 : 16;
        j0 = random() % st->numpeers;
        j = j0;
        k = 0;

        rc = snprintf(buf + i, 2048 - i, "6:valuesl"); INC(i, rc, 2048);
        do {
            if(st->peers[j].len == len) {
                unsigned short swapped;
                swapped = htons(st->peers[j].port);
                rc = snprintf(buf + i, 2048 - i, "%d:", len + 2);
                INC(i, rc, 2048);
                COPY(buf, i, st->peers[j].ip, len, 2048);
                COPY(buf, i, &swapped, 2, 2048);
                k++;
            }
            j = (j + 1) % st->numpeers;
        } while(j != j0 && k < 50);
        rc = snprintf(buf + i, 2048 - i, "e"); INC(i, rc, 2048);
    }

    rc = snprintf(buf + i, 2048 - i, "e1:t%d:", tid_len); INC(i, rc, 2048);
    COPY(buf, i, tid, tid_len, 2048);
    ADD_V(buf, i, 2048);
    rc = snprintf(buf + i, 2048 - i, "1:y1:re"); INC(i, rc, 2048);

    return dht_send(buf, i, 0, sa, salen);

 fail:
    errno = ENOSPC;
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x860, %rsp            # imm = 0x860
movl 0x38(%rbp), %eax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
movl $0x0, -0x844(%rbp)
leaq -0x840(%rbp), %rdi
movslq -0x844(%rbp), %rax
addq %rax, %rdi
movl $0x800, %eax            # imm = 0x800
subl -0x844(%rbp), %eax
movslq %eax, %rsi
leaq 0x1494(%rip), %rdx      # 0xc9aa
movb $0x0, %al
callq 0x2120
movl %eax, -0x848(%rbp)
cmpl $0x0, -0x848(%rbp)
jl 0xb53f
movl -0x844(%rbp), %eax
addl -0x848(%rbp), %eax
cmpl $0x800, %eax            # imm = 0x800
jle 0xb544
jmp 0xbc4f
movl -0x848(%rbp), %eax
addl -0x844(%rbp), %eax
movl %eax, -0x844(%rbp)
movl -0x844(%rbp), %eax
addl $0x14, %eax
cmpl $0x800, %eax            # imm = 0x800
jle 0xb56b
jmp 0xbc4f
movslq -0x844(%rbp), %rax
movq 0x56b7(%rip), %rcx      # 0x10c30
movq %rcx, -0x840(%rbp,%rax)
movq 0x56b0(%rip), %rcx      # 0x10c38
movq %rcx, -0x838(%rbp,%rax)
movl 0x56aa(%rip), %ecx      # 0x10c40
movl %ecx, -0x830(%rbp,%rax)
movl -0x844(%rbp), %eax
addl $0x14, %eax
movl %eax, -0x844(%rbp)
cmpl $0x0, -0x34(%rbp)
jle 0xb667
leaq -0x840(%rbp), %rdi
movslq -0x844(%rbp), %rax
addq %rax, %rdi
movl $0x800, %eax            # imm = 0x800
subl -0x844(%rbp), %eax
movslq %eax, %rsi
movl -0x34(%rbp), %ecx
leaq 0x13f2(%rip), %rdx      # 0xc9d1
movb $0x0, %al
callq 0x2120
movl %eax, -0x848(%rbp)
cmpl $0x0, -0x848(%rbp)
jl 0xb608
movl -0x844(%rbp), %eax
addl -0x848(%rbp), %eax
cmpl $0x800, %eax            # imm = 0x800
jle 0xb60d
jmp 0xbc4f
movl -0x848(%rbp), %eax
addl -0x844(%rbp), %eax
movl %eax, -0x844(%rbp)
cmpl $0x0, -0x34(%rbp)
jl 0xb635
movl -0x844(%rbp), %eax
addl -0x34(%rbp), %eax
cmpl $0x800, %eax            # imm = 0x800
jle 0xb63a
jmp 0xbc4f
leaq -0x840(%rbp), %rdi
movslq -0x844(%rbp), %rax
addq %rax, %rdi
movq -0x30(%rbp), %rsi
movslq -0x34(%rbp), %rdx
callq 0x2200
movl -0x34(%rbp), %eax
addl -0x844(%rbp), %eax
movl %eax, -0x844(%rbp)
cmpl $0x0, 0x18(%rbp)
jle 0xb722
leaq -0x840(%rbp), %rdi
movslq -0x844(%rbp), %rax
addq %rax, %rdi
movl $0x800, %eax            # imm = 0x800
subl -0x844(%rbp), %eax
movslq %eax, %rsi
movl 0x18(%rbp), %ecx
leaq 0x1342(%rip), %rdx      # 0xc9dc
movb $0x0, %al
callq 0x2120
movl %eax, -0x848(%rbp)
cmpl $0x0, -0x848(%rbp)
jl 0xb6c3
movl -0x844(%rbp), %eax
addl -0x848(%rbp), %eax
cmpl $0x800, %eax            # imm = 0x800
jle 0xb6c8
jmp 0xbc4f
movl -0x848(%rbp), %eax
addl -0x844(%rbp), %eax
movl %eax, -0x844(%rbp)
cmpl $0x0, 0x18(%rbp)
jl 0xb6f0
movl -0x844(%rbp), %eax
addl 0x18(%rbp), %eax
cmpl $0x800, %eax            # imm = 0x800
jle 0xb6f5
jmp 0xbc4f
leaq -0x840(%rbp), %rdi
movslq -0x844(%rbp), %rax
addq %rax, %rdi
movq 0x10(%rbp), %rsi
movslq 0x18(%rbp), %rdx
callq 0x2200
movl 0x18(%rbp), %eax
addl -0x844(%rbp), %eax
movl %eax, -0x844(%rbp)
cmpl $0x0, 0x38(%rbp)
jle 0xb7dd
leaq -0x840(%rbp), %rdi
movslq -0x844(%rbp), %rax
addq %rax, %rdi
movl $0x800, %eax            # imm = 0x800
subl -0x844(%rbp), %eax
movslq %eax, %rsi
movl 0x38(%rbp), %ecx
leaq 0xf5f(%rip), %rdx       # 0xc6b4
movb $0x0, %al
callq 0x2120
movl %eax, -0x848(%rbp)
cmpl $0x0, -0x848(%rbp)
jl 0xb77e
movl -0x844(%rbp), %eax
addl -0x848(%rbp), %eax
cmpl $0x800, %eax            # imm = 0x800
jle 0xb783
jmp 0xbc4f
movl -0x848(%rbp), %eax
addl -0x844(%rbp), %eax
movl %eax, -0x844(%rbp)
cmpl $0x0, 0x38(%rbp)
jl 0xb7ab
movl -0x844(%rbp), %eax
addl 0x38(%rbp), %eax
cmpl $0x800, %eax            # imm = 0x800
jle 0xb7b0
jmp 0xbc4f
leaq -0x840(%rbp), %rdi
movslq -0x844(%rbp), %rax
addq %rax, %rdi
movq 0x30(%rbp), %rsi
movslq 0x38(%rbp), %rdx
callq 0x2200
movl 0x38(%rbp), %eax
addl -0x844(%rbp), %eax
movl %eax, -0x844(%rbp)
cmpq $0x0, 0x28(%rbp)
je 0xbac4
movq 0x28(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jle 0xbac4
movl 0x20(%rbp), %edx
movl $0x10, %eax
movl $0x4, %ecx
cmpl $0x2, %edx
cmovel %ecx, %eax
movl %eax, -0x858(%rbp)
callq 0x2230
movq 0x28(%rbp), %rcx
movslq 0x14(%rcx), %rcx
cqto
idivq %rcx
movl %edx, %eax
movl %eax, -0x84c(%rbp)
movl -0x84c(%rbp), %eax
movl %eax, -0x850(%rbp)
movl $0x0, -0x854(%rbp)
leaq -0x840(%rbp), %rdi
movslq -0x844(%rbp), %rax
addq %rax, %rdi
movl $0x800, %eax            # imm = 0x800
subl -0x844(%rbp), %eax
movslq %eax, %rsi
leaq 0x1183(%rip), %rdx      # 0xc9e8
movb $0x0, %al
callq 0x2120
movl %eax, -0x848(%rbp)
cmpl $0x0, -0x848(%rbp)
jl 0xb88e
movl -0x844(%rbp), %eax
addl -0x848(%rbp), %eax
cmpl $0x800, %eax            # imm = 0x800
jle 0xb893
jmp 0xbc4f
movl -0x848(%rbp), %eax
addl -0x844(%rbp), %eax
movl %eax, -0x844(%rbp)
movq 0x28(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x850(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movzwl 0x18(%rax), %eax
cmpl -0x858(%rbp), %eax
jne 0xba13
movq 0x28(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x850(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movzwl 0x1a(%rax), %edi
callq 0x2100
movw %ax, -0x85a(%rbp)
leaq -0x840(%rbp), %rdi
movslq -0x844(%rbp), %rax
addq %rax, %rdi
movl $0x800, %eax            # imm = 0x800
subl -0x844(%rbp), %eax
movslq %eax, %rsi
movl -0x858(%rbp), %ecx
addl $0x2, %ecx
leaq 0x10c4(%rip), %rdx      # 0xc9e4
movb $0x0, %al
callq 0x2120
movl %eax, -0x848(%rbp)
cmpl $0x0, -0x848(%rbp)
jl 0xb949
movl -0x844(%rbp), %eax
addl -0x848(%rbp), %eax
cmpl $0x800, %eax            # imm = 0x800
jle 0xb94e
jmp 0xbc4f
movl -0x848(%rbp), %eax
addl -0x844(%rbp), %eax
movl %eax, -0x844(%rbp)
cmpl $0x0, -0x858(%rbp)
jl 0xb97c
movl -0x844(%rbp), %eax
addl -0x858(%rbp), %eax
cmpl $0x800, %eax            # imm = 0x800
jle 0xb981
jmp 0xbc4f
leaq -0x840(%rbp), %rdi
movslq -0x844(%rbp), %rax
addq %rax, %rdi
movq 0x28(%rbp), %rax
movq 0x20(%rax), %rsi
movslq -0x850(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rsi
addq $0x8, %rsi
movslq -0x858(%rbp), %rdx
callq 0x2200
movl -0x858(%rbp), %eax
addl -0x844(%rbp), %eax
movl %eax, -0x844(%rbp)
movl -0x844(%rbp), %eax
addl $0x2, %eax
cmpl $0x800, %eax            # imm = 0x800
jle 0xb9df
jmp 0xbc4f
movslq -0x844(%rbp), %rax
movw -0x85a(%rbp), %cx
movw %cx, -0x840(%rbp,%rax)
movl -0x844(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x844(%rbp)
movl -0x854(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x854(%rbp)
movl -0x850(%rbp), %eax
addl $0x1, %eax
movq 0x28(%rbp), %rcx
cltd
idivl 0x14(%rcx)
movl %edx, -0x850(%rbp)
movl -0x850(%rbp), %ecx
xorl %eax, %eax
cmpl -0x84c(%rbp), %ecx
movb %al, -0x85b(%rbp)
je 0xba50
cmpl $0x32, -0x854(%rbp)
setl %al
movb %al, -0x85b(%rbp)
movb -0x85b(%rbp), %al
testb $0x1, %al
jne 0xb8a5
leaq -0x840(%rbp), %rdi
movslq -0x844(%rbp), %rax
addq %rax, %rdi
movl $0x800, %eax            # imm = 0x800
subl -0x844(%rbp), %eax
movslq %eax, %rsi
leaq 0x1085(%rip), %rdx      # 0xcb09
movb $0x0, %al
callq 0x2120
movl %eax, -0x848(%rbp)
cmpl $0x0, -0x848(%rbp)
jl 0xbaad
movl -0x844(%rbp), %eax
addl -0x848(%rbp), %eax
cmpl $0x800, %eax            # imm = 0x800
jle 0xbab2
jmp 0xbc4f
movl -0x848(%rbp), %eax
addl -0x844(%rbp), %eax
movl %eax, -0x844(%rbp)
leaq -0x840(%rbp), %rdi
movslq -0x844(%rbp), %rax
addq %rax, %rdi
movl $0x800, %eax            # imm = 0x800
subl -0x844(%rbp), %eax
movslq %eax, %rsi
movl -0x24(%rbp), %ecx
leaq 0xe71(%rip), %rdx       # 0xc95e
movb $0x0, %al
callq 0x2120
movl %eax, -0x848(%rbp)
cmpl $0x0, -0x848(%rbp)
jl 0xbb16
movl -0x844(%rbp), %eax
addl -0x848(%rbp), %eax
cmpl $0x800, %eax            # imm = 0x800
jle 0xbb1b
jmp 0xbc4f
movl -0x848(%rbp), %eax
addl -0x844(%rbp), %eax
movl %eax, -0x844(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0xbb43
movl -0x844(%rbp), %eax
addl -0x24(%rbp), %eax
cmpl $0x800, %eax            # imm = 0x800
jle 0xbb48
jmp 0xbc4f
leaq -0x840(%rbp), %rdi
movslq -0x844(%rbp), %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
movslq -0x24(%rbp), %rdx
callq 0x2200
movl -0x24(%rbp), %eax
addl -0x844(%rbp), %eax
movl %eax, -0x844(%rbp)
cmpl $0x0, 0x5100(%rip)      # 0x10c7c
je 0xbbca
movslq -0x844(%rbp), %rax
addq $0x9, %rax
cmpq $0x800, %rax            # imm = 0x800
jbe 0xbb96
jmp 0xbc4f
movslq -0x844(%rbp), %rax
movq 0x50cc(%rip), %rcx      # 0x10c70
movq %rcx, -0x840(%rbp,%rax)
movb 0x50c6(%rip), %cl       # 0x10c78
movb %cl, -0x838(%rbp,%rax)
movslq -0x844(%rbp), %rax
addq $0x9, %rax
movl %eax, -0x844(%rbp)
leaq -0x840(%rbp), %rdi
movslq -0x844(%rbp), %rax
addq %rax, %rdi
movl $0x800, %eax            # imm = 0x800
subl -0x844(%rbp), %eax
movslq %eax, %rsi
leaq 0xdc7(%rip), %rdx       # 0xc9b7
movb $0x0, %al
callq 0x2120
movl %eax, -0x848(%rbp)
cmpl $0x0, -0x848(%rbp)
jl 0xbc19
movl -0x844(%rbp), %eax
addl -0x848(%rbp), %eax
cmpl $0x800, %eax            # imm = 0x800
jle 0xbc1b
jmp 0xbc4f
movl -0x848(%rbp), %eax
addl -0x844(%rbp), %eax
movl %eax, -0x844(%rbp)
leaq -0x840(%rbp), %rdi
movslq -0x844(%rbp), %rsi
movq -0x10(%rbp), %rcx
movl -0x14(%rbp), %r8d
xorl %edx, %edx
callq 0xa110
movl %eax, -0x4(%rbp)
jmp 0xbc61
callq 0x2060
movl $0x1c, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x860, %rsp            # imm = 0x860
popq %rbp
retq
nopl (%rax)