// File: /workspace/github_c_makefile_star2_O0/jfriesse[P]omping/omping.c
// Function: omping_process_init_msg
static int
omping_process_init_msg(struct omping_instance *instance, const char *msg, size_t msg_len,
    const struct msg_decoded *msg_decoded, const struct sockaddr_storage *from,
    struct timeval rp_timestamp)
{
	struct rh_item *rh_item;

	rh_item = rh_list_find(&instance->remote_hosts, (const struct sockaddr *)from);
	if (rh_item == NULL) {
		DEBUG_PRINTF("Received message from unknown address");

		return (ms_stop(instance->ucast_socket, &instance->mcast_addr.sas,
		    msg_decoded, from));
	}

	if (rh_item->server_info.state == RH_SS_FINISHING) {
		DEBUG_PRINTF("We are in finishing state. Sending request to stop.");

		return (ms_stop(instance->ucast_socket, &instance->mcast_addr.sas,
		    msg_decoded, from));
	}

	if (!msg_decoded->mcast_prefix_isset) {
		DEBUG_PRINTF("Mcast prefix is not set");

		return (ms_response(instance->ucast_socket, &instance->mcast_addr.sas,
		    msg_decoded, from, 0, 1, NULL, 0));
	}

	if (!msg_has_prefix(msg, msg_len, &instance->mcast_addr.sas)) {
		DEBUG_PRINTF("Can't find required prefix");

		return (ms_response(instance->ucast_socket, &instance->mcast_addr.sas, msg_decoded,
		    from, 0, 1, NULL, 0));
	}

	if (util_time_absdiff(rh_item->server_info.last_init_ts, rp_timestamp) <
	    DEFAULT_WAIT_TIME) {
		DEBUG_PRINTF("Time diff between two init messages too short. Ignoring message.");
		return (0);
	}

	util_gen_sid(rh_item->server_info.ses_id);
	rh_item->server_info.state = RH_SS_ANSWER;
	rh_item->server_info.last_init_ts = rp_timestamp;

	return (ms_response(instance->ucast_socket, &instance->mcast_addr.sas, msg_decoded, from,
	    1, 0, rh_item->server_info.ses_id, SESSIONID_LEN));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x10(%rbp), %rdi
addq $0x130, %rdi            # imm = 0x130
movq -0x30(%rbp), %rsi
callq 0x9b40
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x896c
leaq 0x6676(%rip), %rdi      # 0xefa0
movl $0x297, %esi            # imm = 0x297
movl $0x2, %edx
leaq 0x68e4(%rip), %rcx      # 0xf21f
movb $0x0, %al
callq 0x5dc0
movq -0x10(%rbp), %rax
movl 0x198(%rax), %edi
movq -0x10(%rbp), %rsi
addq $0x98, %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x73e0
movl %eax, -0x4(%rbp)
jmp 0x8b90
movq -0x38(%rbp), %rax
cmpl $0x2, 0x100(%rax)
jne 0x89c2
leaq 0x6620(%rip), %rdi      # 0xefa0
movl $0x29e, %esi            # imm = 0x29E
movl $0x2, %edx
leaq 0x6982(%rip), %rcx      # 0xf313
movb $0x0, %al
callq 0x5dc0
movq -0x10(%rbp), %rax
movl 0x198(%rax), %edi
movq -0x10(%rbp), %rsi
addq $0x98, %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x73e0
movl %eax, -0x4(%rbp)
jmp 0x8b90
movq -0x28(%rbp), %rax
cmpl $0x0, 0x58(%rax)
jne 0x8a31
leaq 0x65cd(%rip), %rdi      # 0xefa0
movl $0x2a5, %esi            # imm = 0x2A5
movl $0x2, %edx
leaq 0x6963(%rip), %rcx      # 0xf347
movb $0x0, %al
callq 0x5dc0
movq -0x10(%rbp), %rax
movl 0x198(%rax), %edi
movq -0x10(%rbp), %rsi
addq $0x98, %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
xorl %r8d, %r8d
movl $0x1, %r9d
xorl %eax, %eax
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
callq 0x7300
movl %eax, -0x4(%rbp)
jmp 0x8b90
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
addq $0x98, %rdx
callq 0x6a80
cmpl $0x0, %eax
jne 0x8ab3
leaq 0x654b(%rip), %rdi      # 0xefa0
movl $0x2ac, %esi            # imm = 0x2AC
movl $0x2, %edx
leaq 0x68f9(%rip), %rcx      # 0xf35f
movb $0x0, %al
callq 0x5dc0
movq -0x10(%rbp), %rax
movl 0x198(%rax), %edi
movq -0x10(%rbp), %rsi
addq $0x98, %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
xorl %r8d, %r8d
movl $0x1, %r9d
xorl %eax, %eax
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
callq 0x7300
movl %eax, -0x4(%rbp)
jmp 0x8b90
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
movq 0x128(%rcx), %rdi
movq 0x130(%rcx), %rsi
movq (%rax), %rdx
movq 0x8(%rax), %rcx
callq 0xcbe0
cmpq $0x3e8, %rax            # imm = 0x3E8
jae 0x8b08
leaq 0x64bc(%rip), %rdi      # 0xefa0
movl $0x2b4, %esi            # imm = 0x2B4
movl $0x2, %edx
leaq 0x6885(%rip), %rcx      # 0xf37a
movb $0x0, %al
callq 0x5dc0
movl $0x0, -0x4(%rbp)
jmp 0x8b90
movq -0x38(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
addq $0x4, %rdi
callq 0xcae0
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %rax
movl $0x1, 0x100(%rax)
movq -0x38(%rbp), %rax
movq (%rcx), %rdx
movq %rdx, 0x128(%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x130(%rax)
movq -0x10(%rbp), %rax
movl 0x198(%rax), %edi
movq -0x10(%rbp), %rsi
addq $0x98, %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
addq $0x100, %rax            # imm = 0x100
addq $0x4, %rax
movl $0x1, %r8d
xorl %r9d, %r9d
movq %rax, (%rsp)
movq $0x10, 0x8(%rsp)
callq 0x7300
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)