// File: /workspace/github_c_makefile_star2_O0/martintopholm[P]xping/icmp-unpriv.c
// Function: readping
static void
readping(int fd, short what, void *thunk)
{
	struct probe *prb = thunk;
	regmatch_t match[5];
	struct evbuffer_ptr evbufptr;
	double rtt;
	size_t len;
	char buf[BUFSIZ];
	char *end;
	long int seq;
	int mark;
	int n;

	evbuffer_read(prb->evbuf, fd, 512);
	evbufptr = evbuffer_search_eol(prb->evbuf, NULL, &len,
	    EVBUFFER_EOL_ANY);
	while (evbufptr.pos != -1) {
		len += evbufptr.pos;
		n = evbuffer_remove(prb->evbuf, buf, MIN(sizeof(buf)-1, len));
		buf[n] = '\0';
		mark = '\0';
		if (regexec(&re_reply, buf, 5, match, 0) == 0) {
			seq = strtol(buf + match[1].rm_so, &end, 10);
			rtt = strtod(buf + match[2].rm_so, &end);
			mark = '.';
		} else if (regexec(&re_other, buf, 5, match, 0) == 0) {
			seq = strtol(buf + match[1].rm_so, &end, 10);
			if (match[2].rm_so != match[2].rm_eo)
				mark = '#';
			else
				mark = '%';
		} else if (regexec(&re_xmiterr, buf, 5, match, 0) == 0) {
			/* Transmit errors are quickly identified,
			 * thus assume they refer to most recent packet */
			target_mark(prb->owner, prb->seqlast, '!');
		}
		if (mark != '\0') {
			/* Adjust sequence adjustment delta. In cast the
			 * first packet has icmp_seq=0 instead of 1 */
			if (prb->seqlast < 32768 && seq == 0)
				prb->seqdelta++;
			/*
			 * seq newer than last sent, thus packet arrived too
			 * early (before probe_send. Cached mark until
			 * probe_send is called next_time.
			 */
			if (prb->seqlast < seq + prb->seqdelta) {
				AZ(prb->early_mark == '\0');
				prb->early_mark = mark;
				return;
			}
			target_mark(prb->owner, seq + prb->seqdelta, mark);

			/* Check for timing drift: If packet isn't the
			 * latest reply and ping thinks rtt is less than
			 * i_interval it must have drifted */
			if (mark == '.' &&
			    seq + prb->seqdelta < prb->seqlast &&
			    rtt < i_interval) {
				killping(prb);
				target_mark(prb->owner, prb->seqlast, '!');
			}
		}
		evbufptr = evbuffer_search_eol(prb->evbuf, NULL, &len,
		    EVBUFFER_EOL_LF);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20d0, %rsp           # imm = 0x20D0
movw %si, %ax
movl %edi, -0x4(%rbp)
movw %ax, -0x6(%rbp)
movq %rdx, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rdi
movl -0x4(%rbp), %esi
movl $0x200, %edx            # imm = 0x200
callq 0x20e0
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rsi
leaq -0x20a0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
leaq -0x68(%rbp), %rcx
xorl %r8d, %r8d
callq 0x2330
movq -0x20a0(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x2098(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x2090(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $-0x1, -0x58(%rbp)
je 0x3c6c
movq -0x58(%rbp), %rax
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rax
movq %rax, -0x20c8(%rbp)
leaq -0x2070(%rbp), %rax
movq %rax, -0x20c0(%rbp)
movl $0x1fff, %eax           # imm = 0x1FFF
cmpq -0x68(%rbp), %rax
jae 0x398c
movl $0x1fff, %eax           # imm = 0x1FFF
movq %rax, -0x20d0(%rbp)
jmp 0x3997
movq -0x68(%rbp), %rax
movq %rax, -0x20d0(%rbp)
movq -0x20c0(%rbp), %rsi
movq -0x20c8(%rbp), %rdi
movq -0x20d0(%rbp), %rdx
callq 0x2270
movl %eax, -0x2088(%rbp)
movslq -0x2088(%rbp), %rax
movb $0x0, -0x2070(%rbp,%rax)
movl $0x0, -0x2084(%rbp)
leaq -0x2070(%rbp), %rsi
leaq -0x40(%rbp), %rcx
leaq 0x38b6(%rip), %rdi      # 0x7298
movl $0x5, %edx
xorl %r8d, %r8d
callq 0x2250
cmpl $0x0, %eax
jne 0x3a48
leaq -0x2070(%rbp), %rdi
movslq -0x38(%rbp), %rax
addq %rax, %rdi
leaq -0x2078(%rbp), %rsi
movl $0xa, %edx
callq 0x22d0
movq %rax, -0x2080(%rbp)
leaq -0x2070(%rbp), %rdi
movslq -0x30(%rbp), %rax
addq %rax, %rdi
leaq -0x2078(%rbp), %rsi
callq 0x2160
movsd %xmm0, -0x60(%rbp)
movl $0x2e, -0x2084(%rbp)
jmp 0x3af6
leaq -0x2070(%rbp), %rsi
leaq -0x40(%rbp), %rcx
leaq 0x387e(%rip), %rdi      # 0x72d8
movl $0x5, %edx
xorl %r8d, %r8d
callq 0x2250
cmpl $0x0, %eax
jne 0x3ab2
leaq -0x2070(%rbp), %rdi
movslq -0x38(%rbp), %rax
addq %rax, %rdi
leaq -0x2078(%rbp), %rsi
movl $0xa, %edx
callq 0x22d0
movq %rax, -0x2080(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x2c(%rbp), %eax
je 0x3aa6
movl $0x23, -0x2084(%rbp)
jmp 0x3ab0
movl $0x25, -0x2084(%rbp)
jmp 0x3af4
leaq -0x2070(%rbp), %rsi
leaq -0x40(%rbp), %rcx
leaq 0x3854(%rip), %rdi      # 0x7318
movl $0x5, %edx
xorl %r8d, %r8d
callq 0x2250
cmpl $0x0, %eax
jne 0x3af2
movq -0x18(%rbp), %rax
movq 0x90(%rax), %rdi
movq -0x18(%rbp), %rax
movl 0x6c(%rax), %esi
movl $0x21, %edx
callq 0x2530
jmp 0x3af4
jmp 0x3af6
cmpl $0x0, -0x2084(%rbp)
je 0x3c21
movq -0x18(%rbp), %rax
cmpl $0x8000, 0x6c(%rax)     # imm = 0x8000
jge 0x3b27
cmpq $0x0, -0x2080(%rbp)
jne 0x3b27
movq -0x18(%rbp), %rax
movl 0x68(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x68(%rax)
movq -0x18(%rbp), %rax
movslq 0x6c(%rax), %rax
movq -0x2080(%rbp), %rcx
movq -0x18(%rbp), %rdx
movslq 0x68(%rdx), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jge 0x3b92
jmp 0x3b48
movq -0x18(%rbp), %rax
cmpl $0x0, 0x70(%rax)
sete %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x3b5f
jmp 0x3b7e
leaq 0x178d(%rip), %rdi      # 0x52f3
leaq 0x17a5(%rip), %rsi      # 0x5312
movl $0x76, %edx
leaq 0x17a7(%rip), %rcx      # 0x5320
callq 0x2130
jmp 0x3b80
movl -0x2084(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x70(%rax)
jmp 0x3c6c
movq -0x18(%rbp), %rax
movq 0x90(%rax), %rdi
movq -0x2080(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq 0x68(%rcx), %rcx
addq %rcx, %rax
movl %eax, %esi
movl -0x2084(%rbp), %edx
callq 0x2530
cmpl $0x2e, -0x2084(%rbp)
jne 0x3c1f
movq -0x2080(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq 0x68(%rcx), %rcx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
movslq 0x6c(%rcx), %rcx
cmpq %rcx, %rax
jge 0x3c1f
movsd -0x60(%rbp), %xmm1
leaq 0x3618(%rip), %rax      # 0x7208
cvtsi2sdl (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x3c1f
movq -0x18(%rbp), %rdi
callq 0x3d70
movq -0x18(%rbp), %rax
movq 0x90(%rax), %rdi
movq -0x18(%rbp), %rax
movl 0x6c(%rax), %esi
movl $0x21, %edx
callq 0x2530
jmp 0x3c21
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rsi
leaq -0x20b8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
leaq -0x68(%rbp), %rcx
movl $0x3, %r8d
callq 0x2330
movq -0x20b8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x20b0(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x20a8(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x393c
addq $0x20d0, %rsp           # imm = 0x20D0
popq %rbp
retq
nopw %cs:(%rax,%rax)