// File: /workspace/github_c_makefile_star2_O0/phluid61[P]hsf/src/item.c
// Function: SH_Item__to_s
sh_char_t*
SH_Item__to_s(SH_Item* obj, int* err) {
	sh_char_t* obj_s;
	sh_char_t* tmp_s;
	sh_char_t* s;
	sh_char_t* ptr;

	size_t i;
	size_t n;
	size_t total;

	__sh_item__string str;
	str.length = (size_t)0;
	str.n = (size_t)0;

	obj_s = SH_BareItem__to_s(obj->item, err);
	__cascade(err, (sh_char_t*)0);

	SH_dict__each(obj->params, &__SH_Item__to_s_param, (void*)(&str), err);
	if (__catch(err)) {
		free(obj_s);
		for (i = 0; i < str.n; i++) {
			free(str.a[i]);
		}
		__cascade(err, (sh_char_t*)0);
	}

	n = strlen((const char*)obj_s);

	total = n;
	total += str.length;
	total += str.n; /* ';' and '=' for every pair */
	total += 1; /* NULL */

	s = (sh_char_t*)malloc(sizeof(sh_char_t) * total);
	if ((sh_char_t*)0 == s) {
		__raise(err, SH_E_MALLOC_ERROR);
		return (sh_char_t*)0;
	}

	ptr = s;

	if (n > 0) {
		memcpy((void*)ptr, (const void*)obj_s, n);
		free(obj_s);
		ptr += n;
	}

	for (i = 0; i < str.n; i++) {
		tmp_s = str.a[i];

		/* if the string is NULL, it was (probably) a SH_TRUE value, so don't emit anything */
		if ((sh_char_t*)0 != tmp_s) {
			*ptr = (i % 2 ? SH_CHAR_C('=') : SH_CHAR_C(';'));
			ptr ++;

			n = strlen((const char*)tmp_s);
			memcpy((void*)ptr, (const void*)tmp_s, n);
			free(str.a[i]);
			ptr += n;
		}
	}

	*ptr = SH_CHAR_C(0);

	return s;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2060, %rsp           # imm = 0x2060
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x2060(%rbp)
movq $0x0, -0x2058(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x10f0
movq %rax, -0x20(%rbp)
xorl %eax, %eax
cmpq -0x18(%rbp), %rax
je 0x16cc
movq -0x18(%rbp), %rcx
xorl %eax, %eax
cmpl (%rcx), %eax
je 0x16cc
movq $0x0, -0x8(%rbp)
jmp 0x18c2
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rcx
movq 0x2901(%rip), %rsi      # 0x3fe0
leaq -0x2060(%rbp), %rdx
callq 0x1080
xorl %eax, %eax
cmpq -0x18(%rbp), %rax
je 0x175b
movq -0x18(%rbp), %rcx
xorl %eax, %eax
cmpl (%rcx), %eax
je 0x175b
movq -0x20(%rbp), %rdi
callq 0x1040
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x2058(%rbp), %rax
jae 0x173a
movq -0x40(%rbp), %rax
movq -0x2050(%rbp,%rax,8), %rdi
callq 0x1040
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x170e
xorl %eax, %eax
cmpq -0x18(%rbp), %rax
je 0x1759
movq -0x18(%rbp), %rcx
xorl %eax, %eax
cmpl (%rcx), %eax
je 0x1759
movq $0x0, -0x8(%rbp)
jmp 0x18c2
jmp 0x175b
movq -0x20(%rbp), %rdi
callq 0x1070
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x2060(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x2058(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
shlq $0x0, %rdi
callq 0x10d0
movq %rax, -0x30(%rbp)
xorl %eax, %eax
cmpq -0x30(%rbp), %rax
jne 0x17d2
xorl %eax, %eax
cmpq -0x18(%rbp), %rax
je 0x17c5
movq -0x18(%rbp), %rax
movl $0x80000001, (%rax)     # imm = 0x80000001
movq $0x0, -0x8(%rbp)
jmp 0x18c2
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x48(%rbp)
jbe 0x1807
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x10c0
movq -0x20(%rbp), %rdi
callq 0x1040
movq -0x48(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x2058(%rbp), %rax
jae 0x18b3
movq -0x40(%rbp), %rax
movq -0x2050(%rbp,%rax,8), %rax
movq %rax, -0x28(%rbp)
xorl %eax, %eax
cmpq -0x28(%rbp), %rax
je 0x18a0
movq -0x40(%rbp), %rdx
andq $0x1, %rdx
movl $0x3b, %eax
movl $0x3d, %ecx
cmpq $0x0, %rdx
cmovnel %ecx, %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, (%rax)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
callq 0x1070
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x10c0
movq -0x40(%rbp), %rax
movq -0x2050(%rbp,%rax,8), %rdi
callq 0x1040
movq -0x48(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x18a2
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x180f
movq -0x38(%rbp), %rax
movb $0x0, (%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x2060, %rsp           # imm = 0x2060
popq %rbp
retq