// File: menhits[P]phplus/src/PhplusStdLib.cpp
// Function: addToProgDoubleToStr(CppProgram*)
void addToProgDoubleToStr(CppProgram * prog)
{
	if (!prog->hasFunc("$doubleToStr"))
	{
		addToProgIntToStr(prog);
		addToProgConcatStr(prog);
		addToProgPpStr(prog);
		
		string intToStr=prog->ppToCpp("$intToStr");
		string concat=prog->ppToCpp("$concatStr");
		string ppStr=prog->ppToCpp("$ppStr");
		
		prog->addFunc("$doubleToStr", {{"double", "in"}}, prog->getTypeCode(String),
			
			"long long b = (in - (long long)in) * 10000000000 * (in>=0 ? 1 : -1);\n"
			"if (b % 10 == 9)\n\tb += 1;\n"
			"while (b>0 && !(b % 10))\n\tb /= 10;\n"
			"return "+concat+"("+concat+"("+intToStr+"((int)in), "+ppStr+"(\".\")), "+intToStr+"(b));\n"
		);
	}
}

// Assembly:
subq $0x3d8, %rsp            # imm = 0x3D8
movq %rdi, 0x3d0(%rsp)
movq 0x3d0(%rsp), %rax
movq %rax, 0xa0(%rsp)
leaq 0x3af(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
callq 0xb690
movq 0xa8(%rsp), %rdx
leaq 0x83b05(%rip), %rsi     # 0xd4f38
leaq 0x3b0(%rsp), %rdi
callq 0xb4c0
jmp 0x51442
movq 0xa0(%rsp), %rdi
leaq 0x3b0(%rsp), %rsi
callq 0x2a8a0
movb %al, 0x9f(%rsp)
jmp 0x51460
movb 0x9f(%rsp), %al
xorb $-0x1, %al
movb %al, 0x9e(%rsp)
leaq 0x3b0(%rsp), %rdi
callq 0xb6e8
leaq 0x3af(%rsp), %rdi
callq 0xb3f0
movb 0x9e(%rsp), %al
testb $0x1, %al
jne 0x5149a
jmp 0x51daf
movq 0x3d0(%rsp), %rdi
callq 0x4ffe0
movq 0x3d0(%rsp), %rdi
callq 0x50ef0
movq 0x3d0(%rsp), %rdi
callq 0x4f020
movq 0x3d0(%rsp), %rax
movq %rax, 0x88(%rsp)
leaq 0x357(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0xb690
movq 0x90(%rsp), %rdx
leaq 0x83549(%rip), %rsi     # 0xd4a3e
leaq 0x358(%rsp), %rdi
callq 0xb4c0
jmp 0x51504
movq 0x88(%rsp), %rsi
leaq 0x378(%rsp), %rdi
leaq 0x358(%rsp), %rdx
callq 0x2e130
jmp 0x51523
leaq 0x358(%rsp), %rdi
callq 0xb6e8
leaq 0x357(%rsp), %rdi
callq 0xb3f0
movq 0x3d0(%rsp), %rax
movq %rax, 0x78(%rsp)
leaq 0x30f(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0xb690
movq 0x80(%rsp), %rdx
leaq 0x838f5(%rip), %rsi     # 0xd4e63
leaq 0x310(%rsp), %rdi
callq 0xb4c0
jmp 0x5157d
movq 0x78(%rsp), %rsi
leaq 0x330(%rsp), %rdi
leaq 0x310(%rsp), %rdx
callq 0x2e130
jmp 0x51599
leaq 0x310(%rsp), %rdi
callq 0xb6e8
leaq 0x30f(%rsp), %rdi
callq 0xb3f0
movq 0x3d0(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x2c7(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0xb690
movq 0x70(%rsp), %rdx
leaq 0x83307(%rip), %rsi     # 0xd48e5
leaq 0x2c8(%rsp), %rdi
callq 0xb4c0
jmp 0x515ed
movq 0x68(%rsp), %rsi
leaq 0x2e8(%rsp), %rdi
leaq 0x2c8(%rsp), %rdx
callq 0x2e130
jmp 0x51609
leaq 0x2c8(%rsp), %rdi
callq 0xb6e8
leaq 0x2c7(%rsp), %rdi
callq 0xb3f0
movq 0x3d0(%rsp), %rax
movq %rax, 0x58(%rsp)
leaq 0x29f(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0xb690
movq 0x60(%rsp), %rdx
leaq 0x838ea(%rip), %rsi     # 0xd4f38
leaq 0x2a0(%rsp), %rdi
callq 0xb4c0
jmp 0x5165d
leaq 0x230(%rsp), %rdi
movq %rdi, 0x228(%rsp)
leaq 0x80564(%rip), %rsi     # 0xd1bd8
leaq 0x80802(%rip), %rdx     # 0xd1e7d
callq 0x96430
jmp 0x51682
leaq 0x230(%rsp), %rax
movq %rax, 0x270(%rsp)
movq $0x1, 0x278(%rsp)
leaq 0x227(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x2f150
movq 0x50(%rsp), %rcx
movq 0x270(%rsp), %rsi
movq 0x278(%rsp), %rdx
leaq 0x280(%rsp), %rdi
callq 0x96080
jmp 0x516d4
movq 0x3d0(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0xc6e20(%rip), %rsi     # 0x118508
leaq 0x1f0(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x1a920
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
leaq 0x200(%rsp), %rdi
callq 0x285b0
jmp 0x51713
leaq 0x8382b(%rip), %rsi     # 0xd4f45
leaq 0xb0(%rsp), %rdi
leaq 0x330(%rsp), %rdx
callq 0xfab0
jmp 0x51731
leaq 0x85ab0(%rip), %rdx     # 0xd71e8
leaq 0xd0(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0xfa60
jmp 0x5174f
leaq 0xf0(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
leaq 0x330(%rsp), %rdx
callq 0x2e070
jmp 0x5176e
leaq 0x85a73(%rip), %rdx     # 0xd71e8
leaq 0x110(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0xfa60
jmp 0x5178c
leaq 0x130(%rsp), %rdi
leaq 0x110(%rsp), %rsi
leaq 0x378(%rsp), %rdx
callq 0x2e070
jmp 0x517ab
leaq 0x8381d(%rip), %rdx     # 0xd4fcf
leaq 0x150(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0xfa60
jmp 0x517c9
leaq 0x170(%rsp), %rdi
leaq 0x150(%rsp), %rsi
leaq 0x2e8(%rsp), %rdx
callq 0x2e070
jmp 0x517e8
leaq 0x837ec(%rip), %rdx     # 0xd4fdb
leaq 0x190(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0xfa60
jmp 0x51806
leaq 0x1b0(%rsp), %rdi
leaq 0x190(%rsp), %rsi
leaq 0x378(%rsp), %rdx
callq 0x2e070
jmp 0x51825
leaq 0x837b8(%rip), %rdx     # 0xd4fe4
leaq 0x1d0(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0xfa60
jmp 0x51843
movq 0x58(%rsp), %rdi
leaq 0x2a0(%rsp), %rsi
leaq 0x280(%rsp), %rdx
leaq 0x200(%rsp), %rcx
leaq 0x1d0(%rsp), %r8
callq 0x2a900
jmp 0x5186f
leaq 0x1d0(%rsp), %rdi
callq 0xb6e8
leaq 0x1b0(%rsp), %rdi
callq 0xb6e8
leaq 0x190(%rsp), %rdi
callq 0xb6e8
leaq 0x170(%rsp), %rdi
callq 0xb6e8
leaq 0x150(%rsp), %rdi
callq 0xb6e8
leaq 0x130(%rsp), %rdi
callq 0xb6e8
leaq 0x110(%rsp), %rdi
callq 0xb6e8
leaq 0xf0(%rsp), %rdi
callq 0xb6e8
leaq 0xd0(%rsp), %rdi
callq 0xb6e8
leaq 0xb0(%rsp), %rdi
callq 0xb6e8
leaq 0x200(%rsp), %rdi
callq 0xb6e8
leaq 0x1f0(%rsp), %rdi
callq 0x1a950
leaq 0x280(%rsp), %rdi
callq 0x2e540
leaq 0x227(%rsp), %rdi
callq 0x33c90
leaq 0x230(%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 0x5193b
leaq 0x2a0(%rsp), %rdi
callq 0xb6e8
leaq 0x29f(%rsp), %rdi
callq 0xb3f0
leaq 0x2e8(%rsp), %rdi
callq 0xb6e8
leaq 0x330(%rsp), %rdi
callq 0xb6e8
leaq 0x378(%rsp), %rdi
callq 0xb6e8
jmp 0x51daf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
jmp 0x519df
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
leaq 0x3b0(%rsp), %rdi
callq 0xb6e8
leaq 0x3af(%rsp), %rdi
callq 0xb3f0
jmp 0x51db7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
jmp 0x51a28
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
leaq 0x358(%rsp), %rdi
callq 0xb6e8
leaq 0x357(%rsp), %rdi
callq 0xb3f0
jmp 0x51db7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
jmp 0x51a71
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
leaq 0x310(%rsp), %rdi
callq 0xb6e8
leaq 0x30f(%rsp), %rdi
callq 0xb3f0
jmp 0x51da0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
jmp 0x51aba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
leaq 0x2c8(%rsp), %rdi
callq 0xb6e8
leaq 0x2c7(%rsp), %rdi
callq 0xb3f0
jmp 0x51d93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
jmp 0x51d79
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
movq 0x228(%rsp), %rax
leaq 0x230(%rsp), %rcx
cmpq %rax, %rcx
movq %rax, 0x20(%rsp)
je 0x51b3d
movq 0x20(%rsp), %rdi
addq $-0x40, %rdi
movq %rdi, 0x18(%rsp)
callq 0x2e470
movq 0x18(%rsp), %rax
leaq 0x230(%rsp), %rcx
cmpq %rcx, %rax
movq %rax, 0x20(%rsp)
jne 0x51b13
jmp 0x51d6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
jmp 0x51d22
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
jmp 0x51d08
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
jmp 0x51cfb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
jmp 0x51cee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
jmp 0x51ce1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
jmp 0x51cd4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
jmp 0x51cc7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
jmp 0x51cba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
jmp 0x51cad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
jmp 0x51ca0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
jmp 0x51c93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
jmp 0x51c86
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x3a0(%rsp)
movl %eax, 0x39c(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0xb6e8
leaq 0x1b0(%rsp), %rdi
callq 0xb6e8
leaq 0x190(%rsp), %rdi
callq 0xb6e8
leaq 0x170(%rsp), %rdi
callq 0xb6e8
leaq 0x150(%rsp), %rdi
callq 0xb6e8
leaq 0x130(%rsp), %rdi
callq 0xb6e8
leaq 0x110(%rsp), %rdi
callq 0xb6e8
leaq 0xf0(%rsp), %rdi
callq 0xb6e8
leaq 0xd0(%rsp), %rdi
callq 0xb6e8
leaq 0xb0(%rsp), %rdi
callq 0xb6e8
leaq 0x200(%rsp), %rdi
callq 0xb6e8
leaq 0x1f0(%rsp), %rdi
callq 0x1a950
leaq 0x280(%rsp), %rdi
callq 0x2e540
leaq 0x227(%rsp), %rdi
callq 0x33c90
leaq 0x230(%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 0x51d45
jmp 0x51d6c
leaq 0x2a0(%rsp), %rdi
callq 0xb6e8
leaq 0x29f(%rsp), %rdi
callq 0xb3f0
leaq 0x2e8(%rsp), %rdi
callq 0xb6e8
leaq 0x330(%rsp), %rdi
callq 0xb6e8
leaq 0x378(%rsp), %rdi
callq 0xb6e8
jmp 0x51db7
addq $0x3d8, %rsp            # imm = 0x3D8
retq
movq 0x3a0(%rsp), %rdi
callq 0xb680
nopw %cs:(%rax,%rax)