// File: /workspace/github_c_makefile_star2_O3/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, 0x8(%rsp)
movl %esi, 0x1c(%rsp)
movq %rdi, %rbx
movl $0xa, %edi
callq 0x2050
movq (%rbx), %r15
testq %r15, %r15
je 0x4638
movl 0x8(%rsp), %eax
movq %rax, 0x28(%rsp)
movl $0x0, 0xc(%rsp)
movb $0x1, %bpl
xorl %r13d, %r13d
xorl %edi, %edi
testb $0x1, %bpl
jne 0x4466
cmpl $0x3, 0x8(%rsp)
jae 0x4647
movq 0x28(%rsp), %rax
leaq 0x6581(%rip), %rcx      # 0xa9e4
movl (%rcx,%rax,4), %edi
callq 0x7e37
movq %rax, %r14
movq 0xd0(%r15,%r13,8), %rbx
movq (%r15), %rax
movq 0xe0(%r15), %r12
movq 0x80(%rax), %rdx
leaq 0x656a(%rip), %rdi      # 0xa9f8
movl 0x1c(%rsp), %esi
xorl %eax, %eax
callq 0x2100
movq %r13, %rax
orq %rbx, %rax
je 0x461c
testb $0x1, %bpl
jne 0x44c7
movl 0xe8(%r15), %eax
movq %r12, %rdi
subq %rax, %rdi
incq %rdi
movq %rbx, %rsi
callq 0x91f9
movl %eax, 0xc(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x91f9
movl %eax, 0x10(%rsp)
testq %rbx, %rbx
je 0x44ec
movsd 0x78(%r15,%r13,8), %xmm0
divsd 0x6506(%rip), %xmm0     # 0xa9f0
jmp 0x44f0
xorpd %xmm0, %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0x661e(%rip), %rdi      # 0xab1b
movq %r14, %rsi
xorl %eax, %eax
callq 0x2100
leaq 0x6617(%rip), %rdi      # 0xab25
xorl %eax, %eax
callq 0x2100
leaq 0x661b(%rip), %rdi      # 0xab37
movq %r12, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2100
movq 0xc0(%r15,%r13,8), %rsi
testq %rsi, %rsi
je 0x4544
leaq 0x6602(%rip), %rdi      # 0xab3f
xorl %eax, %eax
callq 0x2100
leaq 0x65f9(%rip), %rdi      # 0xab44
movl 0x10(%rsp), %esi
xorl %eax, %eax
callq 0x2100
testb $0x1, %bpl
jne 0x457a
movl 0xe8(%r15), %esi
cmpl $0x2, %esi
jb 0x457a
leaq 0x65db(%rip), %rdi      # 0xab4a
movl 0xc(%rsp), %edx
xorl %eax, %eax
callq 0x2100
leaq 0x65d9(%rip), %rdi      # 0xab5a
xorl %eax, %eax
callq 0x2100
movsd 0xa8(%r15,%r13,8), %xmm1
movsd 0x6456(%rip), %xmm2     # 0xa9f0
divsd %xmm2, %xmm1
movsd %xmm1, 0x10(%rsp)
movsd 0x88(%r15,%r13,8), %xmm0
movsd 0x98(%r15,%r13,8), %xmm1
divsd %xmm2, %xmm1
movsd %xmm1, 0x30(%rsp)
movq 0xd0(%r15,%r13,8), %rdi
callq 0x903b
movapd %xmm0, %xmm3
divsd 0x6415(%rip), %xmm3     # 0xa9f0
leaq 0x6591(%rip), %rdi      # 0xab73
movsd 0x10(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
movsd 0x30(%rsp), %xmm2
movb $0x4, %al
callq 0x2100
movl $0xa, %edi
callq 0x2050
movl $0x1, %r13d
testb $0x1, %bpl
movl $0x0, %ebp
jne 0x4444
jmp 0x4628
leaq 0x66ba(%rip), %rdi      # 0xacdd
callq 0x2090
movq 0x138(%r15), %r15
testq %r15, %r15
jne 0x443e
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x640c(%rip), %rdi      # 0xaa5a
leaq 0x649c(%rip), %rbx      # 0xaaf1
movl $0xb4, %esi
movl $0x2, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4ad6
movl $0x1, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0