// File: /workspace/github_cpp_makefile_star2_O3/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 0x4b88d(%rip), %rsi     # 0x7a112
leaq 0x4b88f(%rip), %rdx     # 0x7a11b
leaq 0x60(%rsp), %rdi
callq 0xdfa8
leaq 0x60(%rsp), %rsi
movq %rbx, %rdi
callq 0x1cb42
movl %eax, %ebp
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x2e8b4
callq 0xa2b0
testb %bpl, %bpl
jne 0x2eae9
leaq 0x6bb9c(%rip), %r12     # 0x9a460
movq (%r12), %rcx
movq 0x8(%r12), %rax
movq %rcx, 0x18(%rsp)
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x2e8f1
movq 0x6b6c5(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
je 0x2e8ed
incl 0x8(%rax)
jmp 0x2e8f1
lock
incl 0x8(%rax)
leaq 0x100(%rsp), %rdi
leaq 0x18(%rsp), %rdx
movq %rbx, %rsi
callq 0x1aab2
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2e915
callq 0xdce4
leaq 0xb0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x4b7ea(%rip), %rsi     # 0x7a112
leaq 0x4b7ec(%rip), %rdx     # 0x7a11b
leaq 0xa0(%rsp), %rdi
callq 0xdfa8
leaq 0x492d2(%rip), %rsi     # 0x77c15
leaq 0x49563(%rip), %rdx     # 0x77ead
leaq 0x60(%rsp), %rdi
callq 0x4f1b8
leaq 0x48(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0x7(%rsp), %rcx
movl $0x1, %edx
callq 0x4f06a
movq (%r12), %rcx
movq 0x8(%r12), %rax
movq %rcx, 0x8(%rsp)
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x2e99a
movq 0x6b61c(%rip), %rcx     # 0x99fa8
cmpb $0x0, (%rcx)
je 0x2e996
incl 0x8(%rax)
jmp 0x2e99a
lock
incl 0x8(%rax)
leaq 0xe0(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %rbx, %rsi
callq 0x1aab2
leaq 0x4b766(%rip), %rsi     # 0x7a11c
leaq 0xc0(%rsp), %rdi
leaq 0x100(%rsp), %rdx
callq 0xdc11
leaq 0x4b731(%rip), %rsi     # 0x7a103
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 0x2ea07
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x2ea0f
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 0x1cb62
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x2ea57
callq 0xa2b0
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2ea6d
callq 0xa2b0
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2ea83
callq 0xa2b0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2ea92
callq 0xdce4
leaq 0x48(%rsp), %rdi
callq 0x4f0ac
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2eab2
callq 0xa2b0
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x2eac1
callq 0xa2b0
movq 0xa0(%rsp), %rdi
cmpq %r14, %rdi
je 0x2ead3
callq 0xa2b0
leaq 0x110(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2eae9
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 0x2eb10
callq 0xa2b0
jmp 0x2eb10
movq %rax, %rbx
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2eb2b
callq 0xa2b0
jmp 0x2eb2b
movq %rax, %rbx
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2eb46
callq 0xa2b0
jmp 0x2eb46
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2eb55
callq 0xdce4
leaq 0x48(%rsp), %rdi
callq 0x4f0ac
jmp 0x2eb64
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x4f040
movq 0xa0(%rsp), %rdi
cmpq %r14, %rdi
je 0x2eb8a
callq 0xa2b0
jmp 0x2eb8a
movq %rax, %rbx
jmp 0x2eb6e
movq %rax, %rbx
leaq 0x110(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x2ebbe
jmp 0x2ebc8
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2ebc8
callq 0xdce4
jmp 0x2ebc8
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ebc8
callq 0xa2b0
jmp 0x2ebc8
movq %rax, %rbx
movq %rbx, %rdi
callq 0xa510