// File: /workspace/github_cpp_makefile_star2_O2/sjtuwrk[P]SunwayMR/sunwaymr.cpp
// Function: main
int main(int argc, char *argv[]) {
	if (argc <= 1) {
		printUsage();
	} else {
		string cmdType = string(argv[1]);

		if (cmdType == "-t" || cmdType == "-a") {
			if (cmdType == "-t") { // listen
				if (argc >= 6) {
					string master = string(argv[2]);
					int masterListenPort = atoi(argv[3]);
					int threads = atoi(argv[4]);
					int memory = atoi(argv[5]);

					SunwayMRHelper helper = SunwayMRHelper(false);
					helper.start(master, masterListenPort, threads, memory);


				} else {
					printUsage();
				}

			} else { // start app
				if (argc >= 3) {
					string filePath = string(argv[2]);
					bool localMode = false;
					if (argc>3) {
						string argv4 = string(argv[3]);
						if (argv4 == "-local") localMode = true;
					}

					SunwayMRHelper helper = SunwayMRHelper(true);
					helper.runApplication(filePath, localMode);

				} else {
					printUsage();
				}
			}

		} else {
			printUsage();
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x220, %rsp            # imm = 0x220
cmpl $0x1, %edi
jg 0x8e18
callq 0x8da8
jmp 0x8fba
movq %rsi, %rbx
movl %edi, %ebp
movq 0x8(%rsi), %rsi
leaq 0x28(%rsp), %r14
leaq 0x88(%rsp), %rdx
movq %r14, %rdi
callq 0x915a
leaq 0x3a99(%rip), %rsi      # 0xc8d6
movq %r14, %rdi
callq 0x91d8
testb %al, %al
jne 0x8e62
leaq 0x3a89(%rip), %rsi      # 0xc8d9
leaq 0x28(%rsp), %rdi
callq 0x91d8
testb %al, %al
je 0x8efb
leaq 0x3a6d(%rip), %rsi      # 0xc8d6
leaq 0x28(%rsp), %rdi
callq 0x91d8
testb %al, %al
je 0x8ef6
cmpl $0x6, %ebp
jb 0x8efb
movq 0x10(%rbx), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x915a
movq 0x18(%rbx), %rdi
callq 0x3540
movl %eax, %ebp
movq 0x20(%rbx), %rdi
callq 0x3540
movl %eax, %r14d
movq 0x28(%rbx), %rdi
callq 0x3540
movl %eax, %ebx
leaq 0x88(%rsp), %rdi
xorl %esi, %esi
callq 0x682e
leaq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3490
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
movl %ebp, %edx
movl %r14d, %ecx
movl %ebx, %r8d
callq 0x6ca2
leaq 0x68(%rsp), %rdi
jmp 0x8f94
cmpl $0x2, %ebp
jne 0x8f05
callq 0x8da8
jmp 0x8fb0
movq 0x10(%rbx), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x915a
cmpl $0x4, %ebp
jb 0x8f59
movq 0x18(%rbx), %rsi
leaq 0x88(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x915a
leaq 0x399f(%rip), %rsi      # 0xc8dc
leaq 0x88(%rsp), %r14
movq %r14, %rdi
callq 0x91d8
movl %eax, %ebx
movq %r14, %rdi
callq 0x36e8
jmp 0x8f5b
xorl %ebx, %ebx
leaq 0x88(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x682e
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3490
movzbl %bl, %edx
leaq 0x88(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x7134
leaq 0x48(%rsp), %rdi
callq 0x36e8
leaq 0x88(%rsp), %rdi
callq 0x6ef4
leaq 0x8(%rsp), %rdi
callq 0x36e8
leaq 0x28(%rsp), %rdi
callq 0x36e8
xorl %eax, %eax
addq $0x220, %rsp            # imm = 0x220
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x8ff9
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x8fdc
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x36e8
jmp 0x8fe8
jmp 0x8fe5
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x6ef4
jmp 0x8ffc
jmp 0x8ff9
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x36e8
jmp 0x900f
jmp 0x900c
jmp 0x900c
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x36e8
movq %rbx, %rdi
callq 0x3610
nop