// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
cmpl $0x1, %edi
jg 0xb909
callq 0xb809
jmp 0xbb3f
movq %rsi, %rbx
movl %edi, %ebp
movq 0x8(%rsi), %rsi
leaq 0x70(%rsp), %r14
leaq 0x90(%rsp), %rdx
movq %r14, %rdi
callq 0xbe80
leaq 0x2fd8(%rip), %rsi      # 0xe906
movq %r14, %rdi
callq 0x3110
testl %eax, %eax
je 0xb953
leaq 0x2fc8(%rip), %rsi      # 0xe909
leaq 0x70(%rsp), %rdi
callq 0x3110
testl %eax, %eax
jne 0xba8b
leaq 0x2fac(%rip), %rsi      # 0xe906
leaq 0x70(%rsp), %rdi
callq 0x3110
testl %eax, %eax
je 0xb9f0
cmpl $0x2, %ebp
je 0xba8b
movq 0x10(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0xbe80
cmpl $0x4, %ebp
jb 0xba95
movq 0x18(%rbx), %rsi
leaq 0x90(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0xbe80
leaq 0x2f5b(%rip), %rsi      # 0xe90c
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
callq 0x3110
testl %eax, %eax
sete %bpl
movq (%rbx), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0xba97
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0xba97
cmpl $0x6, %ebp
jb 0xba8b
movq 0x10(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0xbe80
movq 0x18(%rbx), %rdi
callq 0x3570
movl %eax, %ebp
movq 0x20(%rbx), %rdi
callq 0x3570
movl %eax, %r14d
movq 0x28(%rbx), %rdi
callq 0x3570
movl %eax, %ebx
leaq 0x90(%rsp), %rdi
xorl %esi, %esi
callq 0x7cc0
leaq 0x60(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
leaq 0x50(%rsp), %rdi
callq 0xc556
leaq 0x90(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movl %ebp, %edx
movl %r14d, %ecx
movl %ebx, %r8d
callq 0x830a
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0xbaf6
movq 0x60(%rsp), %rsi
jmp 0xbaee
callq 0xb809
jmp 0xbb1e
xorl %ebp, %ebp
leaq 0x90(%rsp), %rdi
movl $0x1, %esi
callq 0x7cc0
leaq 0x40(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0xc556
movzbl %bpl, %edx
leaq 0x90(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x8994
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0xbaf6
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x90(%rsp), %rdi
callq 0x8666
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbb1e
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbb3f
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3390
xorl %eax, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0xbb99
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0xbb8a
movq 0x60(%rsp), %rsi
jmp 0xbb7d
jmp 0xbb87
jmp 0xbb99
jmp 0xbbbb
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0xbb8a
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0xbb8a
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x8666
jmp 0xbb9c
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbbbe
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0xbbbe
jmp 0xbbbb
movq %rax, %rbx
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbbdf
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3390
movq %rbx, %rdi
callq 0x3640
nop