// File: /workspace/github_c_makefile_star2_O0/mkubecek[P]nperf/client/main.c
// Function: collect_stats
static int collect_stats(struct client_config *config, double *iter_result)
{
	bool show_thread = config->stats_mask & STATS_F_THREAD;
	bool show_raw = config->stats_mask & STATS_F_RAW;
	unsigned int n_threads = config->n_threads;
	unsigned int test_mode = config->test_mode;
	struct xfer_stats sum_client, sum_server;
	double result, sum_rslt, sum_rslt_sqr;
	double elapsed = config->elapsed;
	struct xfer_stats *server_stats;
	unsigned int i;

	server_stats = recv_server_stats(config);
	if (!server_stats)
		return -EFAULT;
	if (show_thread || show_raw)
		printf("test time: %.3lf\n\n", elapsed);

	/* raw stats */
	xfer_stats_reset(&sum_client);
	if (show_raw)
		xfer_stats_raw_header("client");
	for (i = 0; i < n_threads; i++) {
		const struct xfer_stats *wstats =
			&config->workers_data[i].stats;

		if (show_raw)
			xfer_stats_print_raw(wstats, i);
		xfer_stats_add(&sum_client, wstats);
	}
	if (show_raw) {
		xfer_stats_print_raw(&sum_client, XFER_STATS_TOTAL);
		putchar('\n');
	}

	xfer_stats_reset(&sum_server);
	if (show_raw)
		xfer_stats_raw_header("server");
	for (i = 0; i < n_threads; i++) {
		if (show_raw)
			xfer_stats_print_raw(&server_stats[i], i);
		xfer_stats_add(&sum_server, &server_stats[i]);
	}
	if (show_raw) {
		xfer_stats_print_raw(&sum_server, XFER_STATS_TOTAL);
		putchar('\n');
	}

	/* thread stats */
	sum_rslt = sum_rslt_sqr = 0.0;
	for (i = 0; i < n_threads; i++) {
		result = xfer_stats_result(&config->workers_data[i].stats,
					   &server_stats[i], test_mode,
					   elapsed);
		sum_rslt += result;
		sum_rslt_sqr += result * (double)result;

		if (show_thread)
			xfer_stats_print_thread(&config->workers_data[i].stats,
						&server_stats[i], i, test_mode,
						elapsed, &config->print_opts);
	}
	free(server_stats);

	if (show_thread) {
		xfer_stats_print_thread(&sum_client, &sum_server,
					XFER_STATS_TOTAL, test_mode, elapsed,
					&config->print_opts);
		xfer_stats_thread_footer(sum_rslt, sum_rslt_sqr, n_threads,
					 &config->print_opts);
		putchar('\n');
	}
	*iter_result = sum_rslt;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0x34(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x19(%rbp)
movq -0x10(%rbp), %rax
movl 0x34(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x1a(%rbp)
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movsd 0x78(%rax), %xmm0
movsd %xmm0, -0xa8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3bc0
movq %rax, -0xb0(%rbp)
cmpq $0x0, -0xb0(%rbp)
jne 0x2968
movl $0xfffffff2, -0x4(%rbp) # imm = 0xFFFFFFF2
jmp 0x2c71
testb $0x1, -0x19(%rbp)
jne 0x2974
testb $0x1, -0x1a(%rbp)
je 0x298a
movsd -0xa8(%rbp), %xmm0
leaq 0x486b(%rip), %rdi      # 0x71ee
movb $0x1, %al
callq 0x2130
leaq -0x58(%rbp), %rdi
callq 0x3d10
testb $0x1, -0x1a(%rbp)
je 0x29a5
leaq 0x4861(%rip), %rdi      # 0x7201
callq 0x54b0
movl $0x0, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpl -0x20(%rbp), %eax
jae 0x2a13
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movl -0xb4(%rbp), %ecx
shlq $0x7, %rcx
addq %rcx, %rax
addq $0x30, %rax
movq %rax, -0xc0(%rbp)
testb $0x1, -0x1a(%rbp)
je 0x29f2
movq -0xc0(%rbp), %rdi
movl -0xb4(%rbp), %esi
callq 0x5500
movq -0xc0(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x3d40
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x29af
testb $0x1, -0x1a(%rbp)
je 0x2a31
leaq -0x58(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5500
movl $0xa, %edi
callq 0x2050
leaq -0x88(%rbp), %rdi
callq 0x3d10
testb $0x1, -0x1a(%rbp)
je 0x2a4f
leaq 0x47be(%rip), %rdi      # 0x7208
callq 0x54b0
movl $0x0, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpl -0x20(%rbp), %eax
jae 0x2aba
testb $0x1, -0x1a(%rbp)
je 0x2a89
movq -0xb0(%rbp), %rdi
movl -0xb4(%rbp), %eax
imulq $0x30, %rax, %rax
addq %rax, %rdi
movl -0xb4(%rbp), %esi
callq 0x5500
movq -0xb0(%rbp), %rsi
movl -0xb4(%rbp), %eax
imulq $0x30, %rax, %rax
addq %rax, %rsi
leaq -0x88(%rbp), %rdi
callq 0x3d40
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x2a59
testb $0x1, -0x1a(%rbp)
je 0x2adb
leaq -0x88(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5500
movl $0xa, %edi
callq 0x2050
xorps %xmm0, %xmm0
movsd %xmm0, -0xa0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x98(%rbp)
movl $0x0, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpl -0x20(%rbp), %eax
jae 0x2bf6
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rdi
movl -0xb4(%rbp), %eax
shlq $0x7, %rax
addq %rax, %rdi
addq $0x30, %rdi
movq -0xb0(%rbp), %rsi
movl -0xb4(%rbp), %eax
imulq $0x30, %rax, %rax
addq %rax, %rsi
movl -0x24(%rbp), %edx
movsd -0xa8(%rbp), %xmm0
callq 0x5400
movsd %xmm0, -0x90(%rbp)
movsd -0x90(%rbp), %xmm0
addsd -0x98(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movsd -0x90(%rbp), %xmm0
movsd -0x90(%rbp), %xmm2
movsd -0xa0(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xa0(%rbp)
testb $0x1, -0x19(%rbp)
je 0x2be0
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rdi
movl -0xb4(%rbp), %eax
shlq $0x7, %rax
addq %rax, %rdi
addq $0x30, %rdi
movq -0xb0(%rbp), %rsi
movl -0xb4(%rbp), %eax
imulq $0x30, %rax, %rax
addq %rax, %rsi
movl -0xb4(%rbp), %edx
movl -0x24(%rbp), %ecx
movsd -0xa8(%rbp), %xmm0
movq -0x10(%rbp), %r8
addq $0x48, %r8
callq 0x5680
jmp 0x2be2
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x2afb
movq -0xb0(%rbp), %rdi
callq 0x2030
testb $0x1, -0x19(%rbp)
je 0x2c5a
movl -0x24(%rbp), %ecx
movsd -0xa8(%rbp), %xmm0
movq -0x10(%rbp), %r8
addq $0x48, %r8
leaq -0x58(%rbp), %rdi
leaq -0x88(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5680
movsd -0x98(%rbp), %xmm0
movsd -0xa0(%rbp), %xmm1
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
addq $0x48, %rsi
callq 0x55c0
movl $0xa, %edi
callq 0x2050
movsd -0x98(%rbp), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax)