// File: /workspace/github_cpp_makefile_star2_O1/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 0xb9f7
callq 0xb8f7
jmp 0xbc2d
movq %rsi, %rbx
movl %edi, %ebp
movq 0x8(%rsi), %rsi
leaq 0x70(%rsp), %r14
leaq 0x90(%rsp), %rdx
movq %r14, %rdi
callq 0xbe6e
leaq 0x2eba(%rip), %rsi      # 0xe8d6
movq %r14, %rdi
callq 0x3110
testl %eax, %eax
je 0xba41
leaq 0x2eaa(%rip), %rsi      # 0xe8d9
leaq 0x70(%rsp), %rdi
callq 0x3110
testl %eax, %eax
jne 0xbb79
leaq 0x2e8e(%rip), %rsi      # 0xe8d6
leaq 0x70(%rsp), %rdi
callq 0x3110
testl %eax, %eax
je 0xbade
cmpl $0x2, %ebp
je 0xbb79
movq 0x10(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0xbe6e
cmpl $0x4, %ebp
jl 0xbb83
movq 0x18(%rbx), %rsi
leaq 0x90(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0xbe6e
leaq 0x2e3d(%rip), %rsi      # 0xe8dc
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 0xbb85
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0xbb85
cmpl $0x6, %ebp
jl 0xbb79
movq 0x10(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0xbe6e
movq 0x18(%rbx), %rdi
callq 0x3580
movl %eax, %ebp
movq 0x20(%rbx), %rdi
callq 0x3580
movl %eax, %r14d
movq 0x28(%rbx), %rdi
callq 0x3580
movl %eax, %ebx
leaq 0x90(%rsp), %rdi
xorl %esi, %esi
callq 0x7d8e
leaq 0x60(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
leaq 0x50(%rsp), %rdi
callq 0xc532
leaq 0x90(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movl %ebp, %edx
movl %r14d, %ecx
movl %ebx, %r8d
callq 0x83d8
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0xbbe4
movq 0x60(%rsp), %rsi
jmp 0xbbdc
callq 0xb8f7
jmp 0xbc0c
xorl %ebp, %ebp
leaq 0x90(%rsp), %rdi
movl $0x1, %esi
callq 0x7d8e
leaq 0x40(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0xc532
movzbl %bpl, %edx
leaq 0x90(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x8a5e
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0xbbe4
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x90(%rsp), %rdi
callq 0x8730
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbc0c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbc2d
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 0xbc87
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0xbc78
movq 0x60(%rsp), %rsi
jmp 0xbc6b
jmp 0xbc75
jmp 0xbc87
jmp 0xbca9
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0xbc78
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0xbc78
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x8730
jmp 0xbc8a
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbcac
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0xbcac
jmp 0xbca9
movq %rax, %rbx
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbccd
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3390
movq %rbx, %rdi
callq 0x3650
nop