// File: /workspace/github_c_makefile_star2_O0/jfriesse[P]omping/omping.c
// Function: omping_send_receive_loop
static void
omping_send_receive_loop(struct omping_instance *instance, int timeout_time, int final_stats,
    int allow_auto_exit)
{
	struct timeval start_time;
	int clients_res;
	int loop_end;
	int poll_rec_res;
	int receive_timeout;
	uint64_t time_diff;

	if (timeout_time != 0) {
		start_time = util_get_time();
	}

	loop_end = 0;

	do {
		clients_res = omping_send_client_msgs(instance);
		if (clients_res != 0 && clients_res != -2) {
			err(3, "unknown value of clients_res %u", clients_res);
			/* NOTREACHED */
		}

		if (clients_res == -2) {
			if (clistate_is_exit_requested()) {
				loop_end = 1;
			}

			continue;
		}

		if (timeout_time != 0) {
			time_diff = util_time_absdiff(start_time, util_get_time());

			if ((int)time_diff + instance->wait_time > timeout_time) {
				receive_timeout = timeout_time - time_diff;
			} else {
				receive_timeout = instance->wait_time;
			}
		} else {
			receive_timeout = instance->wait_time;
		}

		poll_rec_res = omping_poll_receive_loop(instance, receive_timeout);

		if (poll_rec_res != 0 && poll_rec_res != -2) {
			err(3, "unknown value of poll_rec_res %u", poll_rec_res);
			/* NOTREACHED */
		}

		if (clistate_is_exit_requested()) {
			loop_end = 1;
		}

		if (timeout_time != 0 &&
		    (int)util_time_absdiff(start_time, util_get_time()) >= timeout_time) {
			loop_end = 1;
		}

		if (allow_auto_exit && instance->auto_exit && instance->rh_no_active == 0) {
			loop_end = 1;
		}
	} while (!loop_end);

	if (final_stats) {
		if (instance->op_mode == OMPING_OP_MODE_SHOW_VERSION) {
			cliprint_final_remote_version(&instance->remote_hosts,
			    instance->hn_max_len);
		} else {
			cliprint_final_stats(&instance->remote_hosts, instance->hn_max_len,
			    instance->transport_method);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x7928
callq 0xcb30
movq %rax, -0x50(%rbp)
movq %rdx, -0x48(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0x7b60
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x795d
cmpl $-0x2, -0x2c(%rbp)
je 0x795d
movl -0x2c(%rbp), %edx
movl $0x3, %edi
leaq 0x7712(%rip), %rsi      # 0xf068
movb $0x0, %al
callq 0x2240
cmpl $-0x2, -0x2c(%rbp)
jne 0x7979
callq 0x5a20
cmpl $0x0, %eax
je 0x7974
movl $0x1, -0x30(%rbp)
jmp 0x7a80
cmpl $0x0, -0xc(%rbp)
je 0x79d4
callq 0xcb30
movq %rax, -0x60(%rbp)
movq %rdx, -0x58(%rbp)
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq -0x58(%rbp), %rcx
callq 0xcbe0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
addl 0x1a0(%rcx), %eax
cmpl -0xc(%rbp), %eax
jle 0x79c5
movslq -0xc(%rbp), %rax
subq -0x40(%rbp), %rax
movl %eax, -0x38(%rbp)
jmp 0x79d2
movq -0x8(%rbp), %rax
movl 0x1a0(%rax), %eax
movl %eax, -0x38(%rbp)
jmp 0x79e1
movq -0x8(%rbp), %rax
movl 0x1a0(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movl -0x38(%rbp), %esi
callq 0x7e50
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x7a12
cmpl $-0x2, -0x34(%rbp)
je 0x7a12
movl -0x34(%rbp), %edx
movl $0x3, %edi
leaq 0x767d(%rip), %rsi      # 0xf088
movb $0x0, %al
callq 0x2240
callq 0x5a20
cmpl $0x0, %eax
je 0x7a23
movl $0x1, -0x30(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x7a57
callq 0xcb30
movq %rax, -0x70(%rbp)
movq %rdx, -0x68(%rbp)
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq -0x68(%rbp), %rcx
callq 0xcbe0
cmpl -0xc(%rbp), %eax
jl 0x7a57
movl $0x1, -0x30(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x7a7e
movq -0x8(%rbp), %rax
cmpl $0x0, 0x168(%rax)
je 0x7a7e
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1a4(%rax)
jne 0x7a7e
movl $0x1, -0x30(%rbp)
jmp 0x7a80
cmpl $0x0, -0x30(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x792f
cmpl $0x0, -0x10(%rbp)
je 0x7ae6
movq -0x8(%rbp), %rax
cmpl $0x3, 0x150(%rax)
jne 0x7ac0
movq -0x8(%rbp), %rdi
addq $0x130, %rdi            # imm = 0x130
movq -0x8(%rbp), %rax
movl 0x174(%rax), %esi
callq 0x52e0
jmp 0x7ae4
movq -0x8(%rbp), %rdi
addq $0x130, %rdi            # imm = 0x130
movq -0x8(%rbp), %rax
movl 0x174(%rax), %esi
movq -0x8(%rbp), %rax
movl 0x154(%rax), %edx
callq 0x5430
jmp 0x7ae6
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)