// File: /workspace/github_cpp_makefile_star2_O1/menhits[P]phplus/src/PhplusStdLib.cpp
// Function: addToProgIntToStr(CppProgram*)
void addToProgIntToStr(CppProgram * prog)
{
	if (!prog->hasFunc("$intToStr"))
	{
		string strType=prog->getTypeCode(String);
		
		prog->addFunc("$intToStr", {{"int", "in"}}, prog->getTypeCode(String),
			"bool neg = in < 0;\n"
			"if (neg) in *= -1;\n"
			"int val = in;\n"
			"int size = 0;\n"
			"while (val)\n"
			"{\n"
			"	size++;\n"
			"	val /= 10;\n"
			"}\n"
			"if (size == 0)\n\tsize = 1;\n"
			"if (neg)\n\tsize++;\n"
			"unsigned char * data = (unsigned char *)malloc(size);\n"
			"val = in;\n"
			"for (int i = 0; i<(neg ? size-1 : size); i++)\n"
			"{\n"
			"	data[size-i-1] = (val % 10) + '0';\n"
			"	val /= 10;\n"
			"}\n"
			"if (neg)\n\tdata[0] = '-';\n"
			"return "+strType+"(size, data);\n"
		);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x120, %rsp            # imm = 0x120
movq %rdi, %rbx
leaq 0x70(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x4aba3(%rip), %rsi     # 0x79152
leaq 0x4aba5(%rip), %rdx     # 0x7915b
leaq 0x60(%rsp), %rdi
callq 0xdf6a
leaq 0x60(%rsp), %rsi
movq %rbx, %rdi
callq 0x1c806
movl %eax, %ebp
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e5de
callq 0xa2b0
testb %bpl, %bpl
jne 0x2e813
leaq 0x6ae72(%rip), %r12     # 0x99460
movq (%r12), %rcx
movq 0x8(%r12), %rax
movq %rcx, 0x18(%rsp)
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x2e61b
movq 0x6a99b(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x2e617
incl 0x8(%rax)
jmp 0x2e61b
lock
incl 0x8(%rax)
leaq 0x100(%rsp), %rdi
leaq 0x18(%rsp), %rdx
movq %rbx, %rsi
callq 0x1a7f4
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2e63f
callq 0xdcba
leaq 0xb0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x4ab00(%rip), %rsi     # 0x79152
leaq 0x4ab02(%rip), %rdx     # 0x7915b
leaq 0xa0(%rsp), %rdi
callq 0xdf6a
leaq 0x485a8(%rip), %rsi     # 0x76c15
leaq 0x48839(%rip), %rdx     # 0x76ead
leaq 0x60(%rsp), %rdi
callq 0x4e3f0
leaq 0x48(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0x7(%rsp), %rcx
movl $0x1, %edx
callq 0x4e2a2
movq (%r12), %rcx
movq 0x8(%r12), %rax
movq %rcx, 0x8(%rsp)
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x2e6c4
movq 0x6a8f2(%rip), %rcx     # 0x98fa8
cmpb $0x0, (%rcx)
je 0x2e6c0
incl 0x8(%rax)
jmp 0x2e6c4
lock
incl 0x8(%rax)
leaq 0xe0(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %rbx, %rsi
callq 0x1a7f4
leaq 0x4aa7c(%rip), %rsi     # 0x7915c
leaq 0xc0(%rsp), %rdi
leaq 0x100(%rsp), %rdx
callq 0xdbef
leaq 0x4aa47(%rip), %rsi     # 0x79143
leaq 0xc0(%rsp), %rdi
callq 0xa560
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2e731
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x2e739
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq 0x28(%rsp), %r8
movq %rdx, 0x8(%r8)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xa0(%rsp), %rsi
leaq 0x48(%rsp), %rdx
leaq 0xe0(%rsp), %rcx
movq %rbx, %rdi
callq 0x1c826
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x2e781
callq 0xa2b0
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e797
callq 0xa2b0
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e7ad
callq 0xa2b0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2e7bc
callq 0xdcba
leaq 0x48(%rsp), %rdi
callq 0x4e2e4
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e7dc
callq 0xa2b0
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e7eb
callq 0xa2b0
movq 0xa0(%rsp), %rdi
cmpq %r14, %rdi
je 0x2e7fd
callq 0xa2b0
leaq 0x110(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e813
callq 0xa2b0
addq $0x120, %rsp            # imm = 0x120
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x2e83a
callq 0xa2b0
jmp 0x2e83a
movq %rax, %rbx
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e855
callq 0xa2b0
jmp 0x2e855
movq %rax, %rbx
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e870
callq 0xa2b0
jmp 0x2e870
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2e87f
callq 0xdcba
leaq 0x48(%rsp), %rdi
callq 0x4e2e4
jmp 0x2e88e
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x4e278
movq 0xa0(%rsp), %rdi
cmpq %r14, %rdi
je 0x2e8b4
callq 0xa2b0
jmp 0x2e8b4
movq %rax, %rbx
jmp 0x2e898
movq %rax, %rbx
leaq 0x110(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x2e8e8
jmp 0x2e8f2
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2e8f2
callq 0xdcba
jmp 0x2e8f2
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e8f2
callq 0xa2b0
jmp 0x2e8f2
movq %rax, %rbx
movq %rbx, %rdi
callq 0xa510