// File: menhits[P]phplus/src/PhplusStdLib.cpp
// Function: addToProgGetInputLine(CppProgram*)
void addToProgGetInputLine(CppProgram * prog)
{
	if (!prog->hasFunc("$getInputLine"))
	{
		string strType=prog->getTypeCode(String);
		
		addToProgCStr(prog);
		
		prog->addFunc("$getInputLine", {{strType, "prompt"}}, strType,
			"fputs("+prog->ppToCpp("$cStr")+"(prompt), stdout);\n"
			"fflush(stdout);\n"
			"size_t bufferSize = 4096;\n"
			"char buffer[bufferSize];\n"
			"if (fgets(buffer, bufferSize, stdin))\n"
			"{\n"
			"	int size = strlen(buffer);\n"
			"	while (size > 0 && buffer[size - 1] == '\\n')\n"
			"		size-=1;\n"
			"	unsigned char * data = (unsigned char *)malloc(size);\n"
			"	memcpy(data, buffer, size);\n"
			"	return "+strType+"(size, data);\n"
			"}\nelse\n{\n"
			"	return "+strType+"(0, NULL);\n"
			"}"
		);
	}
}

// Assembly:
subq $0x2c8, %rsp            # imm = 0x2C8
movq %rdi, 0x2c0(%rsp)
movq 0x2c0(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x29f(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0xb690
movq 0x88(%rsp), %rdx
leaq 0x82d67(%rip), %rsi     # 0xd504a
leaq 0x2a0(%rsp), %rdi
callq 0xb4c0
jmp 0x522f2
movq 0x80(%rsp), %rdi
leaq 0x2a0(%rsp), %rsi
callq 0x2a8a0
movb %al, 0x7f(%rsp)
jmp 0x5230d
movb 0x7f(%rsp), %al
xorb $-0x1, %al
movb %al, 0x7e(%rsp)
leaq 0x2a0(%rsp), %rdi
callq 0xb6e8
leaq 0x29f(%rsp), %rdi
callq 0xb3f0
movb 0x7e(%rsp), %al
testb $0x1, %al
jne 0x5233e
jmp 0x529a4
movq 0x2c0(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0xc61b6(%rip), %rsi     # 0x118508
leaq 0x258(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x1a920
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
leaq 0x268(%rsp), %rdi
callq 0x285b0
jmp 0x5237d
leaq 0x258(%rsp), %rdi
callq 0x1a950
movq 0x2c0(%rsp), %rdi
callq 0x4f4f0
jmp 0x52399
movq 0x2c0(%rsp), %rax
movq %rax, 0x58(%rsp)
leaq 0x237(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0xb690
movq 0x60(%rsp), %rdx
leaq 0x82c86(%rip), %rsi     # 0xd504a
leaq 0x238(%rsp), %rdi
callq 0xb4c0
jmp 0x523d3
leaq 0x1c8(%rsp), %rdi
movq %rdi, 0x1c0(%rsp)
leaq 0x82c6e(%rip), %rdx     # 0xd5058
leaq 0x268(%rsp), %rsi
callq 0x96520
jmp 0x523f9
leaq 0x1c8(%rsp), %rax
movq %rax, 0x208(%rsp)
movq $0x1, 0x210(%rsp)
leaq 0x1bf(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x2f150
movq 0x50(%rsp), %rcx
movq 0x208(%rsp), %rsi
movq 0x210(%rsp), %rdx
leaq 0x218(%rsp), %rdi
callq 0x96080
jmp 0x5244b
leaq 0x198(%rsp), %rdi
leaq 0x268(%rsp), %rsi
callq 0xb1a0
jmp 0x52462
movq 0x2c0(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x97(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0xb690
movq 0x48(%rsp), %rdx
leaq 0x824b8(%rip), %rsi     # 0xd4945
leaq 0x98(%rsp), %rdi
callq 0xb4c0
jmp 0x5249c
movq 0x40(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
leaq 0x98(%rsp), %rdx
callq 0x2e130
jmp 0x524b8
leaq 0x82ba0(%rip), %rsi     # 0xd505f
leaq 0xd8(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
callq 0x1bcf0
jmp 0x524d6
leaq 0x82b89(%rip), %rdx     # 0xd5066
leaq 0xf8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0xfa60
jmp 0x524f4
leaq 0x118(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
leaq 0x268(%rsp), %rdx
callq 0x2e070
jmp 0x52513
leaq 0x82c7c(%rip), %rdx     # 0xd5196
leaq 0x138(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0xfa60
jmp 0x52531
leaq 0x158(%rsp), %rdi
leaq 0x138(%rsp), %rsi
leaq 0x268(%rsp), %rdx
callq 0x2e070
jmp 0x52550
leaq 0x82c5f(%rip), %rdx     # 0xd51b6
leaq 0x178(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0xfa60
jmp 0x5256e
movq 0x58(%rsp), %rdi
leaq 0x238(%rsp), %rsi
leaq 0x218(%rsp), %rdx
leaq 0x198(%rsp), %rcx
leaq 0x178(%rsp), %r8
callq 0x2a900
jmp 0x5259a
leaq 0x178(%rsp), %rdi
callq 0xb6e8
leaq 0x158(%rsp), %rdi
callq 0xb6e8
leaq 0x138(%rsp), %rdi
callq 0xb6e8
leaq 0x118(%rsp), %rdi
callq 0xb6e8
leaq 0xf8(%rsp), %rdi
callq 0xb6e8
leaq 0xd8(%rsp), %rdi
callq 0xb6e8
leaq 0xb8(%rsp), %rdi
callq 0xb6e8
leaq 0x98(%rsp), %rdi
callq 0xb6e8
leaq 0x97(%rsp), %rdi
callq 0xb3f0
leaq 0x198(%rsp), %rdi
callq 0xb6e8
leaq 0x218(%rsp), %rdi
callq 0x2e540
leaq 0x1bf(%rsp), %rdi
callq 0x33c90
leaq 0x1c8(%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 0x5264c
leaq 0x238(%rsp), %rdi
callq 0xb6e8
leaq 0x237(%rsp), %rdi
callq 0xb3f0
leaq 0x268(%rsp), %rdi
callq 0xb6e8
jmp 0x529a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0x526d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
leaq 0x2a0(%rsp), %rdi
callq 0xb6e8
leaq 0x29f(%rsp), %rdi
callq 0xb3f0
jmp 0x529ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
leaq 0x258(%rsp), %rdi
callq 0x1a950
jmp 0x529ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0x52995
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0x52988
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
movq 0x1c0(%rsp), %rax
leaq 0x1c8(%rsp), %rcx
cmpq %rax, %rcx
movq %rax, 0x20(%rsp)
je 0x52798
movq 0x20(%rsp), %rdi
addq $-0x40, %rdi
movq %rdi, 0x18(%rsp)
callq 0x2e470
movq 0x18(%rsp), %rax
leaq 0x1c8(%rsp), %rcx
cmpq %rcx, %rax
movq %rax, 0x20(%rsp)
jne 0x5276e
jmp 0x5297b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0x52931
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0x52924
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0x5290a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0x528fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0x528f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0x528e3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0x528d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0x528c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0x528bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
jmp 0x528af
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x290(%rsp)
movl %eax, 0x28c(%rsp)
leaq 0x178(%rsp), %rdi
callq 0xb6e8
leaq 0x158(%rsp), %rdi
callq 0xb6e8
leaq 0x138(%rsp), %rdi
callq 0xb6e8
leaq 0x118(%rsp), %rdi
callq 0xb6e8
leaq 0xf8(%rsp), %rdi
callq 0xb6e8
leaq 0xd8(%rsp), %rdi
callq 0xb6e8
leaq 0xb8(%rsp), %rdi
callq 0xb6e8
leaq 0x98(%rsp), %rdi
callq 0xb6e8
leaq 0x97(%rsp), %rdi
callq 0xb3f0
leaq 0x198(%rsp), %rdi
callq 0xb6e8
leaq 0x218(%rsp), %rdi
callq 0x2e540
leaq 0x1bf(%rsp), %rdi
callq 0x33c90
leaq 0x1c8(%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 0x52954
jmp 0x5297b
leaq 0x238(%rsp), %rdi
callq 0xb6e8
leaq 0x237(%rsp), %rdi
callq 0xb3f0
leaq 0x268(%rsp), %rdi
callq 0xb6e8
jmp 0x529ac
addq $0x2c8, %rsp            # imm = 0x2C8
retq
movq 0x290(%rsp), %rdi
callq 0xb680
nopl (%rax)