// File: /workspace/github_cpp_makefile_star2_O1/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 0x3610
movq %rax, %r15
leaq 0x5d97(%rip), %rsi      # 0xe58e
movl $0x1, %edx
movq %rax, %rdi
callq 0x3400
movq %r15, %rdi
movl %ebp, %esi
callq 0x3610
movq %rax, %r15
leaq 0x5d76(%rip), %rsi      # 0xe58e
movl $0x1, %edx
movq %rax, %rdi
callq 0x3400
movl 0x13c(%r14), %esi
movq %r15, %rdi
callq 0x3610
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x3240
leaq 0x38(%rsp), %r13
leaq 0x5c02(%rip), %rsi      # 0xe44f
movl $0x2c, %edx
movq %r13, %rdi
callq 0x3400
movq %r13, %rdi
movl %r12d, %esi
callq 0x3610
movq %rax, %r12
leaq 0x5c0d(%rip), %rsi      # 0xe47c
movl $0x9, %edx
movq %rax, %rdi
callq 0x3400
movq %r12, %rdi
movl %ebp, %esi
callq 0x3610
movq %rax, %r12
leaq 0x5bf6(%rip), %rsi      # 0xe486
movl $0xd, %edx
movq %rax, %rdi
callq 0x3400
movl 0x13c(%r14), %esi
movq %r12, %rdi
callq 0x3610
leaq 0x40(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x3590
leaq 0x8(%rsp), %rdi
callq 0x56f8
leaq 0x18(%rsp), %r13
movq -0x10(%r13), %rdi
cmpq %r13, %rdi
je 0x88e0
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 0x3590
movq 0x8(%rsp), %rdi
movq %r14, (%r12)
movq %rdi, 0x8(%r12)
movl $0x0, 0x10(%r12)
cmpq %r13, %rdi
je 0x8928
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3390
addq $0x190, %r14            # imm = 0x190
leaq -0xe0f(%rip), %rdx      # 0x7b27
movq %r14, %rdi
xorl %esi, %esi
movq %r12, %rcx
callq 0x3680
testl %eax, %eax
jne 0x8992
movq 0xa662(%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 0x5af3(%rip), %rsi      # 0xe494
leaq 0x5b3f(%rip), %rdx      # 0xe4e7
callq 0xc5c2
leaq 0x8(%rsp), %rdi
callq 0x58fc
leaq 0x8(%rsp), %rdi
callq 0x3708
movl $0x1, %edi
callq 0x3440
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
jne 0x89fc
jmp 0x8a17
jmp 0x8a14
movq %rax, %rbx
movl $0x18, %esi
movq %r12, %rdi
jmp 0x8a04
jmp 0x8a14
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8a17
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0x8a17
jmp 0x8a14
jmp 0x8a0f
movq %rax, %rbx
jmp 0x8a35
movq %rax, %rbx
movq 0xa592(%rip), %rsi      # 0x12fb0
leaq 0x28(%rsp), %rdi
callq 0x3260
leaq 0xa8(%rsp), %rdi
callq 0x3150
movq 0xa574(%rip), %rsi      # 0x12fb0
leaq 0x1b0(%rsp), %rdi
callq 0x3260
leaq 0x230(%rsp), %rdi
callq 0x3150
movq %rbx, %rdi
callq 0x3650