// File: sjtuwrk[P]SunwayMR/tools/SunwayMRHelper.hpp
// Function: SunwayMRHelper::start(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, int, int)
void SunwayMRHelper::start(string masterAddr, int masterListenPort, int threads, int memory) {
	this->masterAddr = masterAddr;
	this->masterListenPort = masterListenPort;
	this->threads = threads;
	this->memory = memory;
	this->localAddr = getLocalHost();

	if (localAddr == "") {
		Logging::logError("SunwayMRHelper: failed to obtain local IP address.");
		exit(1);
	} else {
		stringstream ipinfo;
		ipinfo << "SunwayMRHelper: local IP is " << localAddr;
		Logging::logInfo(ipinfo.str());
	}

	Logging::logInfo("SunwayMRHelper: starting listening");
	listening = init();
	if (!listening) {
		Logging::logError("SunwayMRHelper: failed to start listening.");
		exit(1);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2a0, %rsp            # imm = 0x2A0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x278(%rbp)
addq $0xf0, %rdi
callq 0x4050
movq -0x278(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, 0x130(%rax)
movl -0x18(%rbp), %ecx
movl %ecx, 0x134(%rax)
movl -0x1c(%rbp), %ecx
movl %ecx, 0x138(%rax)
leaq -0x40(%rbp), %rdi
callq 0x5850
movq -0x278(%rbp), %rdi
addq $0x110, %rdi            # imm = 0x110
leaq -0x40(%rbp), %rsi
callq 0x44f0
leaq -0x40(%rbp), %rdi
callq 0x4878
movq -0x278(%rbp), %rdi
addq $0x110, %rdi            # imm = 0x110
leaq 0xf89b(%rip), %rsi      # 0x1a07f
callq 0xef60
testb $0x1, %al
jne 0xa7f2
jmp 0xa873
leaq -0x61(%rbp), %rdi
movq %rdi, -0x280(%rbp)
callq 0x47a0
movq -0x280(%rbp), %rdx
leaq 0xfb51(%rip), %rsi      # 0x1a361
leaq -0x60(%rbp), %rdi
callq 0xe8d0
jmp 0xa81b
leaq -0x60(%rbp), %rdi
callq 0x7300
jmp 0xa826
leaq -0x60(%rbp), %rdi
callq 0x4878
leaq -0x61(%rbp), %rdi
callq 0x4470
movl $0x1, %edi
callq 0x44e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xa865
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x4878
leaq -0x61(%rbp), %rdi
callq 0x4470
jmp 0xaa7b
leaq -0x200(%rbp), %rdi
callq 0x4280
leaq -0x1f0(%rbp), %rdi
leaq 0xfb07(%rip), %rsi      # 0x1a394
callq 0x43f0
movq %rax, -0x288(%rbp)
jmp 0xa89b
movq -0x288(%rbp), %rdi
movq -0x278(%rbp), %rsi
addq $0x110, %rsi            # imm = 0x110
callq 0x4380
jmp 0xa8b7
leaq -0x220(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x43e0
jmp 0xa8cc
leaq -0x220(%rbp), %rdi
callq 0x7140
jmp 0xa8da
leaq -0x220(%rbp), %rdi
callq 0x4878
leaq -0x200(%rbp), %rdi
callq 0x42b0
jmp 0xa92b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xa91a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x4878
leaq -0x200(%rbp), %rdi
callq 0x42b0
jmp 0xaa7b
leaq -0x241(%rbp), %rdi
movq %rdi, -0x290(%rbp)
callq 0x47a0
movq -0x290(%rbp), %rdx
leaq 0xfa99(%rip), %rsi      # 0x1a3e5
leaq -0x240(%rbp), %rdi
callq 0xe8d0
jmp 0xa95a
leaq -0x240(%rbp), %rdi
callq 0x7140
jmp 0xa968
leaq -0x240(%rbp), %rdi
callq 0x4878
leaq -0x241(%rbp), %rdi
callq 0x4470
movq -0x278(%rbp), %rdi
callq 0xaa90
movb %al, %cl
movq -0x278(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x188(%rax)
testb $0x1, 0x188(%rax)
jne 0xaa72
leaq -0x269(%rbp), %rdi
movq %rdi, -0x298(%rbp)
callq 0x47a0
movq -0x298(%rbp), %rdx
leaq 0xfa3c(%rip), %rsi      # 0x1a408
leaq -0x268(%rbp), %rdi
callq 0xe8d0
jmp 0xa9da
leaq -0x268(%rbp), %rdi
callq 0x7300
jmp 0xa9e8
leaq -0x268(%rbp), %rdi
callq 0x4878
leaq -0x269(%rbp), %rdi
callq 0x4470
movl $0x1, %edi
callq 0x44e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xaa30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x4878
leaq -0x241(%rbp), %rdi
callq 0x4470
jmp 0xaa7b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xaa64
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x4878
leaq -0x269(%rbp), %rdi
callq 0x4470
jmp 0xaa7b
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x4780
nopw %cs:(%rax,%rax)