// File: /workspace/github_c_makefile_star2_O3/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
movw $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 0x392c
leaq 0x138(%rsp), %rbx
leaq 0x148(%rsp), %r14
movl 0x30(%r14), %edx
movl 0x44(%r14), %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x70f5
movq %rbx, %rdi
callq 0x725c
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
movl $0x1, %ebp
movq %r15, %rdi
movl $0x1, %edx
pushq %r12
pushq %r10
pushq %rax
pushq $0x0
pushq $0x1
callq 0x832c
addq $0x30, %rsp
movl %eax, 0x58(%r14)
cmpl $-0x1, %eax
je 0x5c3f
movl 0x158(%rsp), %eax
cmpq $0x3, %rax
ja 0x5b0c
leaq 0x548d(%rip), %rcx      # 0xaee8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %esi, %esi
jmp 0x5a9d
movl $0xffffffff, 0x184(%rsp) # imm = 0xFFFFFFFF
xorl %ebp, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7272
jmp 0x5b0c
movq %rbx, %rdi
movl $0x1, %esi
callq 0x7272
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 0x5ada
movzwl 0x6(%rsp), %esi
jmp 0x5adc
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 0x7e7f
addq $0x30, %rsp
movl %eax, 0x17c(%r15)
cmpl $-0x1, %eax
je 0x5c48
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x8ec1
movq %rbx, %rdi
movq %r15, %rsi
callq 0x71ec
movq %rbx, %rdi
callq 0x721b
movl %eax, 0x174(%r15)
callq 0x4844
movl 0x194(%r15), %esi
xorl %ecx, %ecx
cmpl $0x2, 0x150(%r15)
setne %cl
movq %r15, %rdi
movl %ecx, %edx
callq 0x5c5b
cmpl $0x0, 0x18c(%r15)
jne 0x5bf4
cmpl $0x0, 0x1a4(%rsp)
je 0x5bf4
cmpl $0x1, 0x158(%rsp)
je 0x5bf4
callq 0x48b0
leaq 0x53e8(%rip), %r15      # 0xaf70
leaq 0x53ea(%rip), %rcx      # 0xaf79
xorl %r13d, %r13d
movq %r15, %rdi
movl $0x79, %esi
movl $0x2, %edx
xorl %eax, %eax
callq 0x4ad6
movq %rbx, %rdi
movl $0x2, %esi
callq 0x7272
leaq 0x8(%rsp), %r12
movl 0x19c(%r12), %r8d
cmpl $-0x1, %r8d
movl %r8d, %ebp
cmovel %r13d, %ebp
leaq 0x53e6(%rip), %rcx      # 0xafb8
movq %r15, %rdi
movl $0x83, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x4ad6
movq %r12, %rdi
movl %ebp, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x5c5b
movq %r14, %rdi
callq 0x2d54
movq %rbx, %rdi
callq 0x7190
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 0x53ae(%rip), %rsi      # 0xaff4
jmp 0x5c4f
leaq 0x53c6(%rip), %rsi      # 0xb015
movl $0x1, %edi
xorl %eax, %eax
callq 0x2240