// File: /workspace/github_c_makefile_star2_O2/jfriesse[P]omping/omping.c
// Function: main
int
main(int argc, char *argv[])
{
	struct omping_instance instance;
	int allow_auto_exit;
	int final_stats;
	int wait_for_finish_time;

	omping_instance_create(&instance, argc, argv);

	clisig_register_handlers();

	if (instance.op_mode == OMPING_OP_MODE_SERVER) {
		final_stats = allow_auto_exit = 0;
	} else {
		final_stats = allow_auto_exit = 1;
	}

	omping_send_receive_loop(&instance, instance.timeout_time, final_stats, allow_auto_exit);

	if (!instance.single_addr && instance.wait_for_finish_time != 0 &&
	    instance.op_mode != OMPING_OP_MODE_CLIENT) {
		clistate_cancel_exit();

		DEBUG_PRINTF("Moving all clients to stop state and server to finishing state");
		rh_list_put_to_finish_state(&instance.remote_hosts, RH_LFS_BOTH);

		if (instance.wait_for_finish_time == -1) {
			wait_for_finish_time = 0;
		} else {
			wait_for_finish_time = instance.wait_for_finish_time;
		}

		VERBOSE_PRINTF("Waiting for %d ms to inform other nodes about instance exit",
		    instance.wait_for_finish_time);

		omping_send_receive_loop(&instance, wait_for_finish_time, 0, 0);
	}

	omping_instance_free(&instance);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x6(%rsp), %r13
andw $0x0, (%r13)
leaq 0x8(%rsp), %r15
xorl %r12d, %r12d
movl $0x1b0, %edx            # imm = 0x1B0
movq %r15, %rdi
xorl %esi, %esi
callq 0x2150
movl %ebp, %edi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x3828
leaq 0x138(%rsp), %rbx
leaq 0x148(%rsp), %r14
movl 0x30(%r14), %edx
movl 0x44(%r14), %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6e5d
movq %rbx, %rdi
callq 0x6fca
movl %eax, 0x64(%r14)
movzbl 0x6a(%r14), %esi
movl 0x4c(%r14), %ecx
movq 0x18(%r14), %r8
movl 0x14(%r14), %r9d
movl 0x50(%r14), %eax
movl 0x48(%r14), %r10d
cmpl $0x1, 0x10(%r14)
cmoveq %r13, %r12
subq $0x8, %rsp
pushq $0x1
popq %rbp
movq %r15, %rdi
movl %ebp, %edx
pushq %r12
pushq %r10
pushq %rax
pushq $0x0
pushq $0x1
callq 0x7f62
addq $0x30, %rsp
movl %eax, 0x58(%r14)
cmpl $-0x1, %eax
je 0x5a55
movl 0x158(%rsp), %eax
cmpq $0x3, %rax
ja 0x592d
leaq 0x4667(%rip), %rcx      # 0x9ee8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %esi, %esi
jmp 0x58be
orl $-0x1, 0x184(%rsp)
xorl %ebp, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6fe0
jmp 0x592d
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x6fe0
cmpl $0x1, 0x158(%rsp)
sete %sil
leaq 0xa0(%rsp), %rdi
movq 0xc0(%rdi), %rdx
movzbl 0x112(%rdi), %ecx
movl 0xf4(%rdi), %r8d
movl 0xbc(%rdi), %r9d
movl 0xf8(%rdi), %eax
movl 0xf0(%rdi), %r10d
testb %sil, %sil
je 0x58fb
movzwl 0x6(%rsp), %esi
jmp 0x58fd
xorl %esi, %esi
movzwl %si, %r11d
leaq 0x8(%rsp), %r15
movq %r15, %rsi
pushq %r11
pushq %r10
pushq %rax
pushq $0x0
pushq $0x1
pushq %r14
callq 0x7b1b
addq $0x30, %rsp
movl %eax, 0x17c(%r15)
cmpl $-0x1, %eax
je 0x5a5e
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x8a37
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6f56
movq %rbx, %rdi
callq 0x6f85
movl %eax, 0x174(%r15)
callq 0x4730
movl 0x194(%r15), %esi
xorl %ecx, %ecx
cmpl $0x2, 0x150(%r15)
setne %cl
movq %r15, %rdi
movl %ecx, %edx
callq 0x5a6f
cmpl $0x0, 0x18c(%r15)
jne 0x5a0a
cmpl $0x0, 0x1a4(%rsp)
je 0x5a0a
cmpl $0x1, 0x158(%rsp)
je 0x5a0a
callq 0x4794
leaq 0x45cb(%rip), %r15      # 0x9f70
leaq 0x45cd(%rip), %rcx      # 0x9f79
xorl %r13d, %r13d
pushq $0x79
popq %rsi
pushq $0x2
popq %rbp
movq %r15, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x4998
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6fe0
leaq 0x8(%rsp), %r12
movl 0x19c(%r12), %r8d
cmpl $-0x1, %r8d
movl %r8d, %ebp
cmovel %r13d, %ebp
leaq 0x45ce(%rip), %rcx      # 0x9fb8
pushq $0x1
popq %rdx
movq %r15, %rdi
movl $0x83, %esi
xorl %eax, %eax
callq 0x4998
movq %r12, %rdi
movl %ebp, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x5a6f
movq %r14, %rdi
callq 0x2cc8
movq %rbx, %rdi
callq 0x6eef
movq 0x88(%rsp), %rdi
callq 0x2040
movq 0x120(%rsp), %rdi
callq 0x2040
movq 0x160(%rsp), %rdi
callq 0x2040
xorl %eax, %eax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4598(%rip), %rsi      # 0x9ff4
jmp 0x5a65
leaq 0x45b0(%rip), %rsi      # 0xa015
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x2240