// File: /workspace/github_c_makefile_star2_O1/jfriesse[P]omping/cliprint.c
// Function: cliprint_final_stats
void
cliprint_final_stats(const struct rh_list *remote_hosts, int host_name_len,
    enum sf_transport_method transport_method)
{
	const char *cast_str;
	struct rh_item *rh_item;
	struct rh_item_ci *ci;
	enum sf_cast_type cast_type;
	double avg_rtt;
	int i;
	int loss;
	int loss_adj;
	uint64_t received;
	uint64_t sent;

	printf("\n");

	loss_adj = 0;

	TAILQ_FOREACH(rh_item, remote_hosts, entries) {
		for (i = 0; i < 2; i++) {
			if (i == 0) {
				cast_type = SF_CT_UNI;
			} else {
				switch (transport_method) {
				case SF_TM_ASM:
				case SF_TM_SSM:
					cast_type = SF_CT_MULTI;
					break;
				case SF_TM_IPBC:
					cast_type = SF_CT_BROAD;
					break;
				default:
					DEBUG_PRINTF("Internal error - unknown transport method");
					errx(1, "Internal error - unknown transport method");
					/* NOTREACHED */
				}
			}

			cast_str = sf_cast_type_to_str(cast_type);
			ci = &rh_item->client_info;

			received = ci->no_received[i];
			sent = ci->no_sent;

			printf("%-*s : ", host_name_len, rh_item->addr->host_name);

			if (received == 0 && i == 0) {
				printf("response message never received\n");
				break;
			}

			if (i != 0) {
				loss_adj = util_packet_loss_percent(sent - ci->first_mcast_seq + 1,
				    received);
			}

			loss = util_packet_loss_percent(sent, received);

			if (received == 0) {
				avg_rtt = 0;
			} else {
				avg_rtt = ci->avg_rtt[i] / UTIL_NSINMS;
			}

			printf("%5scast, ", cast_str);

			printf("xmt/rcv/%%loss = ");
			printf("%"PRIu64"/%"PRIu64, sent, received);

			if (ci->no_dups[i] > 0) {
				printf("+%"PRIu64, ci->no_dups[i]);
			}

			printf("/%d%%", loss);
			if (i != 0 && ci->first_mcast_seq > 1) {
				printf(" (seq>=%"PRIu32" %d%%)", ci->first_mcast_seq, loss_adj);
			}

			printf(", min/avg/max/std-dev = ");
			printf("%.3f/%.3f/%.3f/%.3f", ci->rtt_min[i] / UTIL_NSINMS, avg_rtt,
			    ci->rtt_max[i] / UTIL_NSINMS,
			    util_ov_std_dev(ci->m2_rtt[i], ci->no_received[i]) / UTIL_NSINMS);
			printf("\n");
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, 0xc(%rsp)
movl %esi, 0x14(%rsp)
movq %rdi, %rbx
movl $0xa, %edi
callq 0x2050
movq (%rbx), %rbp
testq %rbp, %rbp
je 0x464e
movl 0xc(%rsp), %eax
movq %rax, 0x20(%rsp)
movl $0x0, 0x10(%rsp)
xorl %r12d, %r12d
testq %r12, %r12
je 0x4489
cmpl $0x3, 0xc(%rsp)
jae 0x465d
movq 0x20(%rsp), %rax
leaq 0x6560(%rip), %rcx      # 0xa9e4
movl (%rcx,%rax,4), %edi
jmp 0x448b
xorl %edi, %edi
callq 0x7f57
movq %rax, %r15
movq 0xd0(%rbp,%r12,8), %r13
movq (%rbp), %rax
movq 0xe0(%rbp), %r14
movq 0x80(%rax), %rdx
leaq 0x6544(%rip), %rdi      # 0xa9f8
movl 0x14(%rsp), %esi
xorl %eax, %eax
callq 0x2100
movq %r12, %rax
orq %r13, %rax
je 0x4632
testq %r12, %r12
je 0x44eb
movl 0xe8(%rbp), %eax
movq %r14, %rdi
subq %rax, %rdi
incq %rdi
movq %r13, %rsi
callq 0x9349
movl %eax, 0x10(%rsp)
movq %r14, %rdi
movq %r13, %rsi
callq 0x9349
movl %eax, %ebx
testq %r13, %r13
je 0x450e
movsd 0x78(%rbp,%r12,8), %xmm0
divsd 0x64e4(%rip), %xmm0     # 0xa9f0
jmp 0x4512
xorpd %xmm0, %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0x65fc(%rip), %rdi      # 0xab1b
movq %r15, %rsi
xorl %eax, %eax
callq 0x2100
leaq 0x65f5(%rip), %rdi      # 0xab25
xorl %eax, %eax
callq 0x2100
leaq 0x65f9(%rip), %rdi      # 0xab37
movq %r14, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x2100
movq 0xc0(%rbp,%r12,8), %rsi
testq %rsi, %rsi
je 0x4566
leaq 0x65e0(%rip), %rdi      # 0xab3f
xorl %eax, %eax
callq 0x2100
leaq 0x65d7(%rip), %rdi      # 0xab44
movl %ebx, %esi
xorl %eax, %eax
callq 0x2100
testq %r12, %r12
je 0x4598
movl 0xe8(%rbp), %esi
cmpl $0x2, %esi
jb 0x4598
leaq 0x65bd(%rip), %rdi      # 0xab4a
movl 0x10(%rsp), %edx
xorl %eax, %eax
callq 0x2100
leaq 0x65bb(%rip), %rdi      # 0xab5a
xorl %eax, %eax
callq 0x2100
movsd 0xa8(%rbp,%r12,8), %xmm1
movsd 0x6438(%rip), %xmm2     # 0xa9f0
divsd %xmm2, %xmm1
movsd %xmm1, 0x30(%rsp)
movsd 0x88(%rbp,%r12,8), %xmm0
movsd 0x98(%rbp,%r12,8), %xmm1
divsd %xmm2, %xmm1
movsd %xmm1, 0x28(%rsp)
movq 0xd0(%rbp,%r12,8), %rdi
callq 0x918b
movapd %xmm0, %xmm3
divsd 0x63f7(%rip), %xmm3     # 0xa9f0
leaq 0x6573(%rip), %rdi      # 0xab73
movsd 0x30(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movsd 0x28(%rsp), %xmm2
movb $0x4, %al
callq 0x2100
movl $0xa, %edi
callq 0x2050
incq %r12
cmpq $0x1, %r12
je 0x4468
jmp 0x463e
leaq 0x66a4(%rip), %rdi      # 0xacdd
callq 0x2090
movq 0x138(%rbp), %rbp
testq %rbp, %rbp
jne 0x4465
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x63f6(%rip), %rdi      # 0xaa5a
leaq 0x6486(%rip), %rbx      # 0xaaf1
movl $0xb4, %esi
movl $0x2, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4ada
movl $0x1, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0