// File: /workspace/github_c_makefile_star2_O3/mkubecek[P]nperf/client/main.c
// Function: all_iterations
int all_iterations(struct client_config *config)
{
	double confid_target_hw, confid_ival_hw;
	unsigned int n_iter, iter;
	unsigned int stats_mask;
	bool confid_target_set;
	double sum, sum_sqr;
	int ret = 0;

	stats_mask = config->stats_mask;
	confid_target_hw = 0.999 * config->confid_target / 200.0;
	confid_target_set = config->confid_target_set;
	confid_ival_hw = HUGE_VAL;

	sum = sum_sqr = 0.0;
	n_iter = 0;
	for (iter = 0; iter < config->max_iter; iter++) {
		double iter_result;

		if (stats_mask & (STATS_F_THREAD | STATS_F_RAW))
			printf("iteration %u\n", iter + 1);
		ret = one_iteration(&client_config, &iter_result);
		if (ret < 0)
			break;
		n_iter++;

		iter_results[iter] = iter_result;
		sum += iter_result;
		sum_sqr += iter_result * iter_result;
		if (iter > 0)
			confid_ival_hw = confid_interval(sum, sum_sqr, iter + 1,
							 config->confid_level) /
					 (sum / (iter + 1));
		if (stats_mask & STATS_F_ITER) {
			print_iter_result(iter + 1, iter + 1, iter_result,
					  sum, sum_sqr, config->confid_level,
					  &config->print_opts);
			if (stats_mask & (STATS_F_THREAD | STATS_F_RAW))
				putchar('\n');
		}
		fflush(stdout);

		if (confid_target_set && (n_iter >= config->min_iter) &&
		    (confid_ival_hw <= confid_target_hw))
			break;
	}
	if (ret < 0) {
		fprintf(stderr, "*** Iteration %u failed, quitting. ***\n\n",
			iter + 1);
		if (!n_iter)
			return ret;
	}

	if (n_iter > 1 &&
	    (stats_mask & STATS_F_ITER) &&
	    (stats_mask & (STATS_F_THREAD | STATS_F_RAW))) {
		sum = sum_sqr = 0.0;
		for (iter = 0; iter < n_iter; iter++) {
			double result = iter_results[iter];

			sum += result;
			sum_sqr += result * result;
			print_iter_result(iter + 1, n_iter, result, sum,
					  sum_sqr, config->confid_level,
					  &config->print_opts);
		}
	}

	if (config->confid_target_set &&
	    ((n_iter < 2) || (200.0 * confid_ival_hw > config->confid_target)))
		fprintf(stderr,
			"*** Failed to reach confidence target.\n"
			"*** Confidence interval width is %.4lg%% (+/- %.4lg%%), requested %.4lg%%.\n"
			"*** The result is not reliable enough.\n",
			200.0 * confid_ival_hw, 100.0 * confid_ival_hw,
			config->confid_target);
	if (stats_mask & STATS_F_TOTAL)
		print_iter_result(XFER_STATS_TOTAL, n_iter, 0.0,
				  sum, sum_sqr, config->confid_level,
				  &config->print_opts);

	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movl 0x34(%rdi), %r15d
cmpl $0x0, 0x18(%rdi)
je 0x333a
movsd 0x28(%rbx), %xmm0
mulsd 0x1e40(%rip), %xmm0     # 0x5010
divsd 0x1e40(%rip), %xmm0     # 0x5018
movsd %xmm0, 0x20(%rsp)
movb 0x30(%rbx), %r13b
leaq 0x48(%rbx), %rax
movq %rax, 0x18(%rsp)
movsd 0x1e2d(%rip), %xmm0     # 0x5020
xorpd %xmm4, %xmm4
xorl %r14d, %r14d
xorpd %xmm1, %xmm1
movsd %xmm0, 0x10(%rsp)
movsd %xmm1, (%rsp)
movsd %xmm4, 0x8(%rsp)
movq %r14, %r12
testb $0xc, %r15b
je 0x322b
leal 0x1(%r12), %esi
leaq 0x1e5c(%rip), %rdi      # 0x5080
xorl %eax, %eax
callq 0x2120
leaq 0x5fae(%rip), %rdi      # 0x91e0
leaq 0x30(%rsp), %rsi
callq 0x25bc
movl %eax, %ebp
testl %eax, %eax
js 0x3447
leaq 0x1(%r12), %r14
movsd 0x30(%rsp), %xmm3
movq 0x6018(%rip), %rax      # 0x9270
movsd %xmm3, (%rax,%r12,8)
movsd (%rsp), %xmm0
addsd %xmm3, %xmm0
movapd %xmm3, %xmm1
mulsd %xmm3, %xmm1
addsd 0x8(%rsp), %xmm1
testq %r12, %r12
movsd %xmm0, (%rsp)
movsd %xmm1, 0x8(%rsp)
je 0x32ba
movl 0x20(%rbx), %esi
movsd %xmm3, 0x28(%rsp)
movl %r14d, %edi
callq 0x4a48
movl %r14d, %eax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
movsd (%rsp), %xmm2
divsd %xmm1, %xmm2
movsd 0x28(%rsp), %xmm3
divsd %xmm2, %xmm0
movsd %xmm0, 0x10(%rsp)
testb $0x2, %r15b
je 0x32f2
movl 0x20(%rbx), %edx
movl %r14d, %edi
movl %r14d, %esi
movapd %xmm3, %xmm0
movsd (%rsp), %xmm1
movsd 0x8(%rsp), %xmm2
movq 0x18(%rsp), %rcx
callq 0x4835
testb $0xc, %r15b
je 0x32f2
movl $0xa, %edi
callq 0x2050
movq 0x5cd7(%rip), %rax      # 0x8fd0
movq (%rax), %rdi
callq 0x2210
testb %r13b, %r13b
movsd 0x10(%rsp), %xmm0
je 0x331e
cmpl %r14d, 0x14(%rbx)
ja 0x331e
movsd 0x20(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jae 0x3356
movl 0x18(%rbx), %eax
cmpq %rax, %r14
movsd (%rsp), %xmm1
movsd 0x8(%rsp), %xmm4
jb 0x31fe
incl %r12d
jmp 0x3364
cmpb $0x1, 0x30(%rbx)
je 0x347f
xorl %ebp, %ebp
xorpd %xmm4, %xmm4
xorpd %xmm1, %xmm1
xorl %r12d, %r12d
jmp 0x3411
incl %r12d
movsd (%rsp), %xmm1
movsd 0x8(%rsp), %xmm4
cmpl $0x2, %r12d
movsd %xmm0, 0x10(%rsp)
jb 0x33e0
movl %r15d, %eax
andl $0x2, %eax
je 0x33e0
movl %r15d, %eax
andl $0xc, %eax
je 0x33e0
movl %r12d, %r14d
xorpd %xmm4, %xmm4
xorl %r13d, %r13d
xorpd %xmm1, %xmm1
movq 0x5edb(%rip), %rax      # 0x9270
movsd (%rax,%r13,8), %xmm0
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movapd %xmm0, %xmm2
mulsd %xmm0, %xmm2
addsd %xmm2, %xmm4
movsd %xmm4, 0x8(%rsp)
incq %r13
movl 0x20(%rbx), %edx
movl %r13d, %edi
movl %r14d, %esi
movapd %xmm4, %xmm2
movq 0x18(%rsp), %rcx
callq 0x4835
movsd 0x8(%rsp), %xmm4
movsd (%rsp), %xmm1
cmpq %r13, %r14
jne 0x338e
cmpb $0x0, 0x30(%rbx)
je 0x3411
movsd 0x28(%rbx), %xmm2
cmpl $0x1, %r12d
jbe 0x349b
movsd 0x1c1b(%rip), %xmm0     # 0x5018
movsd 0x10(%rsp), %xmm3
mulsd %xmm3, %xmm0
ucomisd %xmm2, %xmm0
ja 0x34ad
testb $0x1, %r15b
je 0x3436
movl 0x20(%rbx), %edx
addq $0x48, %rbx
xorpd %xmm0, %xmm0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl %r12d, %esi
movapd %xmm4, %xmm2
movq %rbx, %rcx
callq 0x4835
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x5baa(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leal 0x1(%r12), %edx
leaq 0x1c31(%rip), %rsi      # 0x508e
xorl %eax, %eax
callq 0x21d0
testl %r12d, %r12d
je 0x3436
movsd 0x8(%rsp), %xmm4
movsd (%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
jmp 0x3364
movsd 0x28(%rbx), %xmm2
xorpd %xmm1, %xmm1
movsd 0x1b90(%rip), %xmm3     # 0x5020
xorl %r12d, %r12d
xorl %ebp, %ebp
xorpd %xmm4, %xmm4
jmp 0x34a1
movsd 0x10(%rsp), %xmm3
movsd 0x1b6f(%rip), %xmm0     # 0x5018
mulsd %xmm3, %xmm0
movsd %xmm4, 0x8(%rsp)
movsd %xmm1, (%rsp)
movq 0x5b39(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
mulsd 0x1b5e(%rip), %xmm3     # 0x5028
leaq 0x1be6(%rip), %rsi      # 0x50b7
movapd %xmm3, %xmm1
movb $0x3, %al
callq 0x21d0
movsd 0x8(%rsp), %xmm4
movsd (%rsp), %xmm1
jmp 0x3411