// File: /workspace/github_c_makefile_star2_O0/jfriesse[P]omping/omping.c
// Function: omping_process_answer_msg
static int
omping_process_answer_msg(struct omping_instance *instance, const char *msg, size_t msg_len,
    const struct msg_decoded *msg_decoded, const struct sockaddr_storage *from, uint8_t ttl,
    enum sf_cast_type cast_type, struct timeval rp_timestamp)
{
	struct rh_item *rh_item;
	double avg_rtt;
	double rtt;
	uint64_t received;
	uint64_t sent;
	int cast_index;
	int dist_set;
	int first_packet;
	int is_dup;
	int rtt_set;
	int loss;
	uint8_t dist;

	rh_item = rh_list_find(&instance->remote_hosts, (const struct sockaddr *)from);
	if (rh_item == NULL) {
		DEBUG_PRINTF("Received message from unknown address");
		return (-5);
	}

	if (msg_decoded->client_id == NULL) {
		DEBUG_PRINTF("Message doesn't contain client id");
		return (-5);
	}

	if (msg_decoded->client_id_len != CLIENTID_LEN ||
	    memcmp(msg_decoded->client_id, rh_item->client_info.client_id, CLIENTID_LEN) != 0) {
		DEBUG_PRINTF("Message doesn't contain our client id");
		return (-5);
	}

	if (!msg_decoded->seq_num_isset) {
		DEBUG_PRINTF("Message doesn't contain seq num");
		return (-5);
	}

	if (rh_item->client_info.state != RH_CS_QUERY) {
		DEBUG_PRINTF("Client is not in query state. Ignoring message");
		return (-5);
	}

	if (ttl > 0 && msg_decoded->ttl > 0) {
		dist_set = 1;
		dist =  msg_decoded->ttl - ttl;
	} else {
		dist_set = dist = 0;
	}

	if (msg_decoded->client_tstamp_isset) {
		rtt_set = 1;
		rtt = util_time_double_absdiff_ns(msg_decoded->client_tstamp, rp_timestamp);
	} else {
		rtt_set = 0;
		rtt = 0;
	}

	avg_rtt = 0;
	cast_index = (cast_type == SF_CT_UNI ? 0 : 1);
	is_dup = 0;

	if (instance->dup_buf_items > 0) {
		is_dup = rh_ci_is_dup_packet(&rh_item->client_info, msg_decoded->seq_num,
		    cast_index);
	}

	if (is_dup) {
		if (rh_item->client_info.no_dups[cast_index] == ((uint64_t)~0)) {
			DEBUG_PRINTF("Number of received duplicates for %s exhausted.",
			    rh_item->addr->host_name);
		} else {
			rh_item->client_info.no_dups[cast_index]++;
		}

		received = rh_item->client_info.no_received[cast_index];
	} else {
		first_packet = (rh_item->client_info.no_received[cast_index] == 0);

		received = ++rh_item->client_info.no_received[cast_index];

		if (cast_index == 0) {
			rh_item->client_info.lru_seq_num = msg_decoded->seq_num;
		}

		if (cast_type != SF_CT_UNI && first_packet &&
		    !rh_item->client_info.seq_num_overflow) {
			rh_item->client_info.first_mcast_seq = msg_decoded->seq_num;
		}

		if (rtt_set) {
			util_ov_update(&rh_item->client_info.avg_rtt[cast_index],
			    &rh_item->client_info.m2_rtt[cast_index], rtt, received);

			if (first_packet) {
				rh_item->client_info.rtt_max[cast_index] = rtt;
				rh_item->client_info.rtt_min[cast_index] = rtt;
			} else {
				if (rtt > rh_item->client_info.rtt_max[cast_index]) {
					rh_item->client_info.rtt_max[cast_index] = rtt;
				}

				if (rtt < rh_item->client_info.rtt_min[cast_index]) {
					rh_item->client_info.rtt_min[cast_index] = rtt;
				}
			}
		}
	}

	if (instance->cont_stat) {
		sent = rh_item->client_info.no_sent;

		if (cast_type != SF_CT_UNI && rh_item->client_info.first_mcast_seq > 0) {
			sent = sent - rh_item->client_info.first_mcast_seq + 1;
		}
		loss = util_packet_loss_percent(sent, received);
		avg_rtt = rh_item->client_info.avg_rtt[cast_index] / UTIL_NSINMS;
	} else {
		loss = 0;
	}

	if (instance->quiet == 0) {
		cliprint_packet_stats(rh_item->addr->host_name, instance->hn_max_len,
		    msg_decoded->seq_num, is_dup, msg_len, dist_set, dist, rtt_set,
		    rtt / UTIL_NSINMS, avg_rtt, loss, cast_type, instance->cont_stat);
	}

	return (0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xb0, %rsp
movb %r9b, %al
leaq 0x18(%rbp), %r9
movq %r9, -0x98(%rbp)
movl 0x10(%rbp), %r9d
movq %rdi, -0x20(%rbp)
movq %rsi, -0x28(%rbp)
movq %rdx, -0x30(%rbp)
movq %rcx, -0x38(%rbp)
movq %r8, -0x40(%rbp)
movb %al, -0x41(%rbp)
movq -0x20(%rbp), %rdi
addq $0x130, %rdi            # imm = 0x130
movq -0x40(%rbp), %rsi
callq 0x9b40
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x9381
leaq 0x5c43(%rip), %rdi      # 0xefa0
movl $0x217, %esi            # imm = 0x217
movl $0x2, %edx
leaq 0x5eb1(%rip), %rcx      # 0xf21f
movb $0x0, %al
callq 0x5dc0
movl $0xfffffffb, -0x14(%rbp) # imm = 0xFFFFFFFB
jmp 0x9854
movq -0x38(%rbp), %rax
cmpq $0x0, 0x70(%rax)
jne 0x93b7
leaq 0x5c0d(%rip), %rdi      # 0xefa0
movl $0x21c, %esi            # imm = 0x21C
movl $0x2, %edx
leaq 0x6042(%rip), %rcx      # 0xf3e6
movb $0x0, %al
callq 0x5dc0
movl $0xfffffffb, -0x14(%rbp) # imm = 0xFFFFFFFB
jmp 0x9854
movq -0x38(%rbp), %rax
cmpq $0x18, 0x28(%rax)
jne 0x93e5
movq -0x38(%rbp), %rax
movq 0x70(%rax), %rdi
movq -0x50(%rbp), %rsi
addq $0x8, %rsi
addq $0x4, %rsi
movl $0x18, %edx
callq 0x2180
cmpl $0x0, %eax
je 0x9410
leaq 0x5bb4(%rip), %rdi      # 0xefa0
movl $0x222, %esi            # imm = 0x222
movl $0x2, %edx
leaq 0x600b(%rip), %rcx      # 0xf408
movb $0x0, %al
callq 0x5dc0
movl $0xfffffffb, -0x14(%rbp) # imm = 0xFFFFFFFB
jmp 0x9854
movq -0x38(%rbp), %rax
cmpl $0x0, 0x64(%rax)
jne 0x9445
leaq 0x5b7f(%rip), %rdi      # 0xefa0
movl $0x227, %esi            # imm = 0x227
movl $0x2, %edx
leaq 0x61bb(%rip), %rcx      # 0xf5ed
movb $0x0, %al
callq 0x5dc0
movl $0xfffffffb, -0x14(%rbp) # imm = 0xFFFFFFFB
jmp 0x9854
movq -0x50(%rbp), %rax
cmpl $0x1, 0x8(%rax)
je 0x947a
leaq 0x5b4a(%rip), %rdi      # 0xefa0
movl $0x22c, %esi            # imm = 0x22C
movl $0x2, %edx
leaq 0x61a6(%rip), %rcx      # 0xf60d
movb $0x0, %al
callq 0x5dc0
movl $0xfffffffb, -0x14(%rbp) # imm = 0xFFFFFFFB
jmp 0x9854
movzbl -0x41(%rbp), %eax
cmpl $0x0, %eax
jle 0x94b3
movq -0x38(%rbp), %rax
movzbl 0x90(%rax), %eax
cmpl $0x0, %eax
jle 0x94b3
movl $0x1, -0x78(%rbp)
movq -0x38(%rbp), %rax
movzbl 0x90(%rax), %eax
movzbl -0x41(%rbp), %ecx
subl %ecx, %eax
movb %al, -0x89(%rbp)
jmp 0x94c1
movb $0x0, -0x89(%rbp)
movl $0x0, -0x78(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x0, 0x54(%rax)
je 0x94fa
movq -0x98(%rbp), %rax
movl $0x1, -0x84(%rbp)
movq -0x38(%rbp), %rcx
movq (%rcx), %rdi
movq 0x8(%rcx), %rsi
movq (%rax), %rdx
movq 0x8(%rax), %rcx
callq 0xcd30
movsd %xmm0, -0x60(%rbp)
jmp 0x950c
movl $0x0, -0x84(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x60(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
movl 0x10(%rbp), %edx
movl $0x1, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovel %ecx, %eax
movl %eax, -0x74(%rbp)
movl $0x0, -0x80(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x170(%rax)
jle 0x9555
movq -0x50(%rbp), %rdi
addq $0x8, %rdi
movq -0x38(%rbp), %rax
movl 0x50(%rax), %esi
movl -0x74(%rbp), %edx
callq 0x9870
movl %eax, -0x80(%rbp)
cmpl $0x0, -0x80(%rbp)
je 0x95d2
movq -0x50(%rbp), %rax
movslq -0x74(%rbp), %rcx
cmpq $-0x1, 0xc0(%rax,%rcx,8)
jne 0x959d
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq 0x80(%rax), %r8
leaq 0x5a1d(%rip), %rdi      # 0xefa0
movl $0x24b, %esi            # imm = 0x24B
movl $0x2, %edx
leaq 0x60a8(%rip), %rcx      # 0xf63c
movb $0x0, %al
callq 0x5dc0
jmp 0x95b9
movq -0x50(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq 0xc0(%rax,%rcx,8), %rdx
addq $0x1, %rdx
movq %rdx, 0xc0(%rax,%rcx,8)
movq -0x50(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq 0xd0(%rax,%rcx,8), %rax
movq %rax, -0x68(%rbp)
jmp 0x9735
movq -0x50(%rbp), %rax
movslq -0x74(%rbp), %rcx
cmpq $0x0, 0xd0(%rax,%rcx,8)
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x7c(%rbp)
movq -0x50(%rbp), %rcx
movslq -0x74(%rbp), %rdx
movq 0xd0(%rcx,%rdx,8), %rax
addq $0x1, %rax
movq %rax, 0xd0(%rcx,%rdx,8)
movq %rax, -0x68(%rbp)
cmpl $0x0, -0x74(%rbp)
jne 0x9625
movq -0x38(%rbp), %rax
movl 0x50(%rax), %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0xec(%rax)
cmpl $0x0, 0x10(%rbp)
je 0x964f
cmpl $0x0, -0x7c(%rbp)
je 0x964f
movq -0x50(%rbp), %rax
cmpl $0x0, 0xf8(%rax)
jne 0x964f
movq -0x38(%rbp), %rax
movl 0x50(%rax), %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0xe8(%rax)
cmpl $0x0, -0x84(%rbp)
je 0x9733
movq -0x50(%rbp), %rdi
addq $0x8, %rdi
addq $0x70, %rdi
movslq -0x74(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x50(%rbp), %rsi
addq $0x8, %rsi
addq $0x80, %rsi
movslq -0x74(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movsd -0x60(%rbp), %xmm0
movq -0x68(%rbp), %rdx
callq 0xcf10
cmpl $0x0, -0x7c(%rbp)
je 0x96cf
movsd -0x60(%rbp), %xmm0
movq -0x50(%rbp), %rax
movslq -0x74(%rbp), %rcx
movsd %xmm0, 0x98(%rax,%rcx,8)
movsd -0x60(%rbp), %xmm0
movq -0x50(%rbp), %rax
movslq -0x74(%rbp), %rcx
movsd %xmm0, 0xa8(%rax,%rcx,8)
jmp 0x9731
movsd -0x60(%rbp), %xmm0
movq -0x50(%rbp), %rax
movslq -0x74(%rbp), %rcx
ucomisd 0x98(%rax,%rcx,8), %xmm0
jbe 0x96fd
movsd -0x60(%rbp), %xmm0
movq -0x50(%rbp), %rax
movslq -0x74(%rbp), %rcx
movsd %xmm0, 0x98(%rax,%rcx,8)
movsd -0x60(%rbp), %xmm1
movq -0x50(%rbp), %rax
movslq -0x74(%rbp), %rcx
movsd 0xa8(%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x972f
movsd -0x60(%rbp), %xmm0
movq -0x50(%rbp), %rax
movslq -0x74(%rbp), %rcx
movsd %xmm0, 0xa8(%rax,%rcx,8)
jmp 0x9731
jmp 0x9733
jmp 0x9735
movq -0x20(%rbp), %rax
cmpl $0x0, 0x16c(%rax)
je 0x97b1
movq -0x50(%rbp), %rax
movq 0xe0(%rax), %rax
movq %rax, -0x70(%rbp)
cmpl $0x0, 0x10(%rbp)
je 0x977d
movq -0x50(%rbp), %rax
cmpl $0x0, 0xe8(%rax)
jbe 0x977d
movq -0x70(%rbp), %rax
movq -0x50(%rbp), %rcx
movl 0xe8(%rcx), %ecx
subq %rcx, %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0xcfb0
movl %eax, -0x88(%rbp)
movq -0x50(%rbp), %rax
movslq -0x74(%rbp), %rcx
movsd 0x78(%rax,%rcx,8), %xmm0
movsd 0x5272(%rip), %xmm1     # 0xea18
divsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
jmp 0x97bb
movl $0x0, -0x88(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x180(%rax)
jne 0x984d
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq 0x80(%rax), %rdi
movq -0x20(%rbp), %rax
movl 0x174(%rax), %esi
movq -0x38(%rbp), %rax
movl 0x50(%rax), %edx
movl -0x80(%rbp), %ecx
movq -0x30(%rbp), %r8
movl -0x78(%rbp), %r9d
movb -0x89(%rbp), %r14b
movl -0x84(%rbp), %ebx
movsd -0x60(%rbp), %xmm0
movsd 0x5208(%rip), %xmm1     # 0xea18
divsd %xmm1, %xmm0
movsd -0x58(%rbp), %xmm1
movl -0x88(%rbp), %r11d
movl 0x10(%rbp), %r10d
movq -0x20(%rbp), %rax
movl 0x16c(%rax), %eax
movzbl %r14b, %r14d
movl %r14d, (%rsp)
movl %ebx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x5780
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
addq $0xb0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)