// File: /workspace/github_c_makefile_star2_O0/martintopholm[P]xping/icmp-unpriv.c
// Function: probe_send
void
probe_send(struct probe *prb, int seq)
{
	int pair[2];
	pid_t pid;

	if (!prb->resolved) {
		target_mark(prb->owner, seq, '@');
		return;
	}

	/* Save most recent sequence number to close gap between
	 * probe_send returning (target_probe increasing npkts) and forked
	 * program outputting */
	prb->seqlast = seq;

	/* Clear ahead to avoid overwriting a result in case of small
	 * timing indiscrepancies */
	target_mark(prb->owner, seq+1, ' ');

	/* If we have a cached early mark, send it right away. */
	if (prb->early_mark != '\0') {
		target_mark(prb->owner, seq, prb->early_mark);
		prb->early_mark = '\0';
	}

	/* Check for existing ping process */
	if (prb->pid && kill(prb->pid, 0) == 0)
		return;

	/* Create ipc socket pair and fork ping process */
	if (evutil_socketpair(AF_UNIX, SOCK_STREAM, 0, pair) < 0) {
		target_mark(prb->owner, seq, '!'); /* transmit error */
		return;
	}
	prb->seqdelta = seq - 1; /* linux ping(8) begins icmp_seq=1 */
	evutil_make_socket_nonblocking(pair[0]);
	if (prb->fd >= 0)
		close(prb->fd);
	if (prb->ev_read != NULL)
		event_free(prb->ev_read);
	prb->ev_read = event_new(ev_base, pair[0], EV_READ|EV_PERSIST, readping, prb);
	event_add(prb->ev_read, NULL);
	switch (pid = fork()) {
	case -1:
		target_mark(prb->owner, seq, '!'); /* transmit error */
		return;
	case 0:
		evutil_closesocket(pair[0]);
		dup2(pair[1], 1);
		dup2(pair[1], 2);
		execping(prb);
		/* NEVER REACHED */
		break;
	default:
		evutil_closesocket(pair[1]);
		prb->pid = pid;
		prb->fd = pair[0];
		break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x40(%rax)
jne 0x3706
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rdi
movl -0xc(%rbp), %esi
movl $0x40, %edx
callq 0x2530
jmp 0x38b1
movl -0xc(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x6c(%rax)
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rdi
movl -0xc(%rbp), %esi
addl $0x1, %esi
movl $0x20, %edx
callq 0x2530
movq -0x8(%rbp), %rax
cmpl $0x0, 0x70(%rax)
je 0x375a
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rdi
movl -0xc(%rbp), %esi
movq -0x8(%rbp), %rax
movl 0x70(%rax), %edx
callq 0x2530
movq -0x8(%rbp), %rax
movl $0x0, 0x70(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x60(%rax)
je 0x377c
movq -0x8(%rbp), %rax
movl 0x60(%rax), %edi
xorl %esi, %esi
callq 0x22f0
cmpl $0x0, %eax
jne 0x377c
jmp 0x38b1
leaq -0x14(%rbp), %rcx
movl $0x1, %esi
xorl %edx, %edx
movl %esi, %edi
callq 0x2370
cmpl $0x0, %eax
jge 0x37b0
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rdi
movl -0xc(%rbp), %esi
movl $0x21, %edx
callq 0x2530
jmp 0x38b1
movl -0xc(%rbp), %ecx
subl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x68(%rax)
movl -0x14(%rbp), %edi
callq 0x2300
movq -0x8(%rbp), %rax
cmpl $0x0, 0x64(%rax)
jl 0x37db
movq -0x8(%rbp), %rax
movl 0x64(%rax), %edi
callq 0x23d0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x78(%rax)
je 0x37f3
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rdi
callq 0x2390
leaq 0x3a6e(%rip), %rax      # 0x7268
movq (%rax), %rdi
movl -0x14(%rbp), %esi
movq -0x8(%rbp), %r8
leaq 0xb5(%rip), %rcx        # 0x38c0
movl $0x12, %edx
callq 0x21a0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x20c0
callq 0x2060
movl %eax, -0x18(%rbp)
movl %eax, %ecx
movl %ecx, -0x1c(%rbp)
subl $-0x1, %eax
je 0x384e
jmp 0x3845
movl -0x1c(%rbp), %eax
testl %eax, %eax
je 0x3868
jmp 0x3895
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rdi
movl -0xc(%rbp), %esi
movl $0x21, %edx
callq 0x2530
jmp 0x38b1
movl -0x14(%rbp), %edi
callq 0x2120
movl -0x10(%rbp), %edi
movl $0x1, %esi
callq 0x21c0
movl -0x10(%rbp), %edi
movl $0x2, %esi
callq 0x21c0
movq -0x8(%rbp), %rdi
callq 0x3c80
jmp 0x38b1
movl -0x10(%rbp), %edi
callq 0x2120
movl -0x18(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x60(%rax)
movl -0x14(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x64(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)