// File: /workspace/github_cpp_makefile_star2_O3/sjtuwrk[P]SunwayMR/tools/SunwayMRHelper.hpp
// Function: SunwayMRHelper::setLocalResouce(int, int)
void SunwayMRHelper::setLocalResouce(int threads, int memory) {

	// send repeatedly
	stringstream ss;
	ss << threads << " " << memory << " " << listenPort;
	stringstream info;
	info << "SunwayMRHelper: set local resource: thread: "
			<< threads << " memory: " << memory
			<< " listenPort: " << listenPort;
	Logging::logInfo(info.str());

	int v = 0;
	struct thread_data *data = new thread_data (*this, ss.str().c_str(), v);

	//pthread_cancel(sendResourceInfoThread);
	if (!xyz_send_host_resource_info_thread_canceled_flag) {
		xyz_send_host_resource_info_thread_cancel_flag = true;
		while (!xyz_send_host_resource_info_thread_canceled_flag);
	}
	int rc = pthread_create(&sendResourceInfoThread, NULL, sendHostResourceInfoToMasterRepeatedly, (void *)data);
	if (rc){
		Logging::logError("SunwayMRHelper: SunwayMRHelper: failed to create thread to send host resource info.");
		exit(1);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x338, %rsp            # imm = 0x338
movl %edx, %ebp
movl %esi, %r12d
movq %rdi, %r14
leaq 0x1b0(%rsp), %rbx
movq %rbx, %rdi
callq 0x3240
leaq 0x1c0(%rsp), %rdi
movl %r12d, %esi
callq 0x3600
movq %rax, %r15
leaq 0x5e91(%rip), %rsi      # 0xe5be
movl $0x1, %edx
movq %rax, %rdi
callq 0x3400
movq %r15, %rdi
movl %ebp, %esi
callq 0x3600
movq %rax, %r15
leaq 0x5e70(%rip), %rsi      # 0xe5be
movl $0x1, %edx
movq %rax, %rdi
callq 0x3400
movl 0x13c(%r14), %esi
movq %r15, %rdi
callq 0x3600
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x3240
leaq 0x38(%rsp), %r13
leaq 0x5cfc(%rip), %rsi      # 0xe47f
movl $0x2c, %edx
movq %r13, %rdi
callq 0x3400
movq %r13, %rdi
movl %r12d, %esi
callq 0x3600
movq %rax, %r12
leaq 0x5d07(%rip), %rsi      # 0xe4ac
movl $0x9, %edx
movq %rax, %rdi
callq 0x3400
movq %r12, %rdi
movl %ebp, %esi
callq 0x3600
movq %rax, %r12
leaq 0x5cf0(%rip), %rsi      # 0xe4b6
movl $0xd, %edx
movq %rax, %rdi
callq 0x3400
movl 0x13c(%r14), %esi
movq %r12, %rdi
callq 0x3600
leaq 0x40(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x3580
leaq 0x8(%rsp), %rdi
callq 0x56e8
leaq 0x18(%rsp), %r13
movq -0x10(%r13), %rdi
cmpq %r13, %rdi
je 0x8816
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3390
movl $0x18, %edi
callq 0x3380
movq %rax, %r12
leaq 0x1c8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x3580
movq 0x8(%rsp), %rdi
movq %r14, (%r12)
movq %rdi, 0x8(%r12)
movl $0x0, 0x10(%r12)
cmpq %r13, %rdi
je 0x885e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3390
addq $0x190, %r14            # imm = 0x190
leaq -0xe13(%rip), %rdx      # 0x7a59
movq %r14, %rdi
xorl %esi, %esi
movq %r12, %rcx
callq 0x3670
testl %eax, %eax
jne 0x88c8
movq 0xa72c(%rip), %r14      # 0x12fb0
movq %r15, %rdi
movq %r14, %rsi
callq 0x3260
movl $0x80, %r12d
addq %r12, %r15
movq %r15, %rdi
callq 0x3150
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3260
addq %r12, %rbx
movq %rbx, %rdi
callq 0x3150
addq $0x338, %rsp            # imm = 0x338
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8(%rsp), %rdi
movq %r13, (%rdi)
leaq 0x5bed(%rip), %rsi      # 0xe4c4
leaq 0x5c39(%rip), %rdx      # 0xe517
callq 0xc5ec
leaq 0x8(%rsp), %rdi
callq 0x58ec
leaq 0x8(%rsp), %rdi
callq 0x36f8
movl $0x1, %edi
callq 0x3440
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
jne 0x8932
jmp 0x894d
jmp 0x894a
movq %rax, %rbx
movl $0x18, %esi
movq %r12, %rdi
jmp 0x893a
jmp 0x894a
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x894d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0x894d
jmp 0x894a
jmp 0x8945
movq %rax, %rbx
jmp 0x896b
movq %rax, %rbx
movq 0xa65c(%rip), %rsi      # 0x12fb0
leaq 0x28(%rsp), %rdi
callq 0x3260
leaq 0xa8(%rsp), %rdi
callq 0x3150
movq 0xa63e(%rip), %rsi      # 0x12fb0
leaq 0x1b0(%rsp), %rdi
callq 0x3260
leaq 0x230(%rsp), %rdi
callq 0x3150
movq %rbx, %rdi
callq 0x3640