// File: menhits[P]phplus/src/PhplusStdLib.cpp
// Function: addToProgRunCmd(CppProgram*)
void addToProgRunCmd(CppProgram * prog)
{
	if (!prog->hasFunc("$runCmd"))
	{
		addToProgPpStr(prog);
		addToProgCStr(prog);
		addToProgConcatStr(prog);
		addToProgAsciiToStr(prog);
				
		string strType=prog->getTypeCode(String);
		
		prog->addFunc("$runCmd", {{strType, "cmd"}}, strType,
			strType+" result = "+prog->ppToCpp("$ppStr")+"(\"\");\n"
			"FILE* pipe = popen(cStr(cmd), \"r\");\n"
			"if (!pipe)\n"
			"	return result;\n"
			"while (!feof(pipe)) {\n"
			"	char c;\n"
			"	if ((c=getc(pipe)) != EOF)\n"
			"	{\n"
			"		result="+prog->ppToCpp("$concatStr")+"(result, "+prog->ppToCpp("$asciiToStr")+"(c));\n"
			"	}\n"
			"}\n"
			"pclose(pipe);\n"
			"return result;\n"
		);
	}
}

// Assembly:
subq $0x398, %rsp            # imm = 0x398
movq %rdi, 0x390(%rsp)
movq 0x390(%rsp), %rax
movq %rax, 0xa0(%rsp)
leaq 0x36f(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
callq 0xb690
movq 0xa8(%rsp), %rdx
leaq 0x82331(%rip), %rsi     # 0xd5254
leaq 0x370(%rsp), %rdi
callq 0xb4c0
jmp 0x52f32
movq 0xa0(%rsp), %rdi
leaq 0x370(%rsp), %rsi
callq 0x2a8a0
movb %al, 0x9f(%rsp)
jmp 0x52f50
movb 0x9f(%rsp), %al
xorb $-0x1, %al
movb %al, 0x9e(%rsp)
leaq 0x370(%rsp), %rdi
callq 0xb6e8
leaq 0x36f(%rsp), %rdi
callq 0xb3f0
movb 0x9e(%rsp), %al
testb $0x1, %al
jne 0x52f8a
jmp 0x5380c
movq 0x390(%rsp), %rdi
callq 0x4f020
movq 0x390(%rsp), %rdi
callq 0x4f4f0
movq 0x390(%rsp), %rdi
callq 0x50ef0
movq 0x390(%rsp), %rdi
callq 0x51dd0
movq 0x390(%rsp), %rax
movq %rax, 0x88(%rsp)
leaq 0xc5533(%rip), %rsi     # 0x118508
leaq 0x328(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0x1a920
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdx
leaq 0x338(%rsp), %rdi
callq 0x285b0
jmp 0x53009
leaq 0x328(%rsp), %rdi
callq 0x1a950
movq 0x390(%rsp), %rax
movq %rax, 0x78(%rsp)
leaq 0x307(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0xb690
movq 0x80(%rsp), %rdx
leaq 0x8220d(%rip), %rsi     # 0xd5254
leaq 0x308(%rsp), %rdi
callq 0xb4c0
jmp 0x53056
leaq 0x298(%rsp), %rdi
movq %rdi, 0x290(%rsp)
leaq 0x821ef(%rip), %rdx     # 0xd525c
leaq 0x338(%rsp), %rsi
callq 0x965c0
jmp 0x5307c
leaq 0x298(%rsp), %rax
movq %rax, 0x2d8(%rsp)
movq $0x1, 0x2e0(%rsp)
leaq 0x28f(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x2f150
movq 0x70(%rsp), %rcx
movq 0x2d8(%rsp), %rsi
movq 0x2e0(%rsp), %rdx
leaq 0x2e8(%rsp), %rdi
callq 0x96080
jmp 0x530ce
leaq 0x268(%rsp), %rdi
leaq 0x338(%rsp), %rsi
callq 0xb1a0
jmp 0x530e5
leaq 0x82174(%rip), %rdx     # 0xd5260
leaq 0x188(%rsp), %rdi
leaq 0x338(%rsp), %rsi
callq 0x1ba50
jmp 0x53103
movq 0x390(%rsp), %rax
movq %rax, 0x60(%rsp)
leaq 0x147(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0xb690
movq 0x68(%rsp), %rdx
leaq 0x817b7(%rip), %rsi     # 0xd48e5
leaq 0x148(%rsp), %rdi
callq 0xb4c0
jmp 0x5313d
movq 0x60(%rsp), %rsi
leaq 0x168(%rsp), %rdi
leaq 0x148(%rsp), %rdx
callq 0x2e130
jmp 0x53159
leaq 0x1a8(%rsp), %rdi
leaq 0x188(%rsp), %rsi
leaq 0x168(%rsp), %rdx
callq 0x1bf20
jmp 0x53178
leaq 0x820ec(%rip), %rdx     # 0xd526b
leaq 0x1c8(%rsp), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0xfa60
jmp 0x53196
movq 0x390(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0xff(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0xb690
movq 0x58(%rsp), %rdx
leaq 0x81ca2(%rip), %rsi     # 0xd4e63
leaq 0x100(%rsp), %rdi
callq 0xb4c0
jmp 0x531d0
movq 0x50(%rsp), %rsi
leaq 0x120(%rsp), %rdi
leaq 0x100(%rsp), %rdx
callq 0x2e130
jmp 0x531ec
leaq 0x1e8(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
leaq 0x120(%rsp), %rdx
callq 0x1bf20
jmp 0x5320b
leaq 0x820e6(%rip), %rdx     # 0xd52f8
leaq 0x208(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
callq 0xfa60
jmp 0x53229
movq 0x390(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0xb7(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0xb690
movq 0x48(%rsp), %rdx
leaq 0x81d97(%rip), %rsi     # 0xd4feb
leaq 0xb8(%rsp), %rdi
callq 0xb4c0
jmp 0x53263
movq 0x40(%rsp), %rsi
leaq 0xd8(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
callq 0x2e130
jmp 0x5327f
leaq 0x228(%rsp), %rdi
leaq 0x208(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
callq 0x1bf20
jmp 0x5329e
leaq 0x8205d(%rip), %rdx     # 0xd5302
leaq 0x248(%rsp), %rdi
leaq 0x228(%rsp), %rsi
callq 0xfa60
jmp 0x532bc
movq 0x78(%rsp), %rdi
leaq 0x308(%rsp), %rsi
leaq 0x2e8(%rsp), %rdx
leaq 0x268(%rsp), %rcx
leaq 0x248(%rsp), %r8
callq 0x2a900
jmp 0x532e8
leaq 0x248(%rsp), %rdi
callq 0xb6e8
leaq 0x228(%rsp), %rdi
callq 0xb6e8
leaq 0xd8(%rsp), %rdi
callq 0xb6e8
leaq 0xb8(%rsp), %rdi
callq 0xb6e8
leaq 0xb7(%rsp), %rdi
callq 0xb3f0
leaq 0x208(%rsp), %rdi
callq 0xb6e8
leaq 0x1e8(%rsp), %rdi
callq 0xb6e8
leaq 0x120(%rsp), %rdi
callq 0xb6e8
leaq 0x100(%rsp), %rdi
callq 0xb6e8
leaq 0xff(%rsp), %rdi
callq 0xb3f0
leaq 0x1c8(%rsp), %rdi
callq 0xb6e8
leaq 0x1a8(%rsp), %rdi
callq 0xb6e8
leaq 0x168(%rsp), %rdi
callq 0xb6e8
leaq 0x148(%rsp), %rdi
callq 0xb6e8
leaq 0x147(%rsp), %rdi
callq 0xb3f0
leaq 0x188(%rsp), %rdi
callq 0xb6e8
leaq 0x268(%rsp), %rdi
callq 0xb6e8
leaq 0x2e8(%rsp), %rdi
callq 0x2e540
leaq 0x28f(%rsp), %rdi
callq 0x33c90
leaq 0x298(%rsp), %rax
movq %rax, 0x30(%rsp)
addq $0x40, %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdi
addq $-0x40, %rdi
movq %rdi, 0x28(%rsp)
callq 0x2e470
movq 0x30(%rsp), %rcx
movq 0x28(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x38(%rsp)
jne 0x533f5
leaq 0x308(%rsp), %rdi
callq 0xb6e8
leaq 0x307(%rsp), %rdi
callq 0xb3f0
leaq 0x338(%rsp), %rdi
callq 0xb6e8
jmp 0x5380c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x5347f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
leaq 0x370(%rsp), %rdi
callq 0xb6e8
leaq 0x36f(%rsp), %rdi
callq 0xb3f0
jmp 0x53814
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
leaq 0x328(%rsp), %rdi
callq 0x1a950
jmp 0x53814
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x537f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
movq 0x290(%rsp), %rax
leaq 0x298(%rsp), %rcx
cmpq %rax, %rcx
movq %rax, 0x20(%rsp)
je 0x53528
movq 0x20(%rsp), %rdi
addq $-0x40, %rdi
movq %rdi, 0x18(%rsp)
callq 0x2e470
movq 0x18(%rsp), %rax
leaq 0x298(%rsp), %rcx
cmpq %rcx, %rax
movq %rax, 0x20(%rsp)
jne 0x534fe
jmp 0x537e3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x53799
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x5378c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x5377f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x53765
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x53758
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x5374b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x5373e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x53724
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x53717
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x5370a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x536fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x536e3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x536d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x536c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x536bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
leaq 0x248(%rsp), %rdi
callq 0xb6e8
leaq 0x228(%rsp), %rdi
callq 0xb6e8
leaq 0xd8(%rsp), %rdi
callq 0xb6e8
leaq 0xb8(%rsp), %rdi
callq 0xb6e8
leaq 0xb7(%rsp), %rdi
callq 0xb3f0
leaq 0x208(%rsp), %rdi
callq 0xb6e8
leaq 0x1e8(%rsp), %rdi
callq 0xb6e8
leaq 0x120(%rsp), %rdi
callq 0xb6e8
leaq 0x100(%rsp), %rdi
callq 0xb6e8
leaq 0xff(%rsp), %rdi
callq 0xb3f0
leaq 0x1c8(%rsp), %rdi
callq 0xb6e8
leaq 0x1a8(%rsp), %rdi
callq 0xb6e8
leaq 0x168(%rsp), %rdi
callq 0xb6e8
leaq 0x148(%rsp), %rdi
callq 0xb6e8
leaq 0x147(%rsp), %rdi
callq 0xb3f0
leaq 0x188(%rsp), %rdi
callq 0xb6e8
leaq 0x268(%rsp), %rdi
callq 0xb6e8
leaq 0x2e8(%rsp), %rdi
callq 0x2e540
leaq 0x28f(%rsp), %rdi
callq 0x33c90
leaq 0x298(%rsp), %rax
movq %rax, 0x8(%rsp)
addq $0x40, %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
addq $-0x40, %rdi
movq %rdi, (%rsp)
callq 0x2e470
movq 0x8(%rsp), %rcx
movq (%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x10(%rsp)
jne 0x537bc
jmp 0x537e3
leaq 0x308(%rsp), %rdi
callq 0xb6e8
leaq 0x307(%rsp), %rdi
callq 0xb3f0
leaq 0x338(%rsp), %rdi
callq 0xb6e8
jmp 0x53814
addq $0x398, %rsp            # imm = 0x398
retq
movq 0x360(%rsp), %rdi
callq 0xb680
nopw %cs:(%rax,%rax)