// File: /workspace/github_c_makefile_star2_O1/phluid61[P]hsf/main.c
// Function: do_sh_string
void do_sh_string(sh_char_t* value, size_t n) {
	SH_String* obj;
	SH_BareItem* bi;

	/* used to printf() value, looks like "%#{n}s" */
	char template[8];

	uint16_t u;
	sh_char_t* s;

	int err = 0;

	snprintf(template, 8, "%%%lus", n);

	obj = SH_String__init(value, n, &err);
	if ((SH_String*)0 == obj || err) {
		printf("* unable to init SH_String(\"");
		printf(template, (char*)value);
		printf("\", %lu): [%llX] 0x%08X\n", n, (long long)obj, err);
	} else {
		printf("+ init SH_String(\"");
		printf(template, (char*)value);
		printf("\", %lu): [%llX]\n", n, (long long)obj);

		u = SH_String__length(obj, 0);
		printf("  - length =: %hu\n", u);

		s = SH_String__to_s(obj, &err);
		if ((sh_char_t*)0 == s || err) {
			printf("  * unable to to_s: [%llX] 0x%08X\n", (long long)s, err);
		} else {
			printf("  - to_s =:\n");
			hexdump_string(s);
			free(s);
		}

		bi = SH_BareItem__init_string(obj, &err);
		if ((SH_BareItem*)0 == bi || err) {
			printf("  * unable to init SH_BareItem: [%llX] 0x%08X\n", (long long)bi, err);
		} else {
			printf("  + init SH_BareItem: [%llX]\n", (long long)bi);
			do_sh_bareitem(bi);
			SH_BareItem__destroy(bi, SH_FALSE, 0);
		}

		SH_String__destroy(obj, 0);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %r15
leaq 0x4(%rsp), %rbx
movl $0x0, (%rbx)
leaq 0x3a96(%rip), %rdx      # 0x52b6
leaq 0x8(%rsp), %rdi
movl $0x8, %esi
movq %r14, %rcx
xorl %eax, %eax
callq 0x1070
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2e60
movq %rax, %rbx
testq %rax, %rax
je 0x18e0
cmpl $0x0, 0x4(%rsp)
jne 0x18e0
leaq 0x3a92(%rip), %rdi      # 0x52f2
xorl %eax, %eax
callq 0x1060
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1060
leaq 0x3a88(%rip), %rdi      # 0x5305
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2f6c
movzwl %ax, %esi
leaq 0x3a78(%rip), %rdi      # 0x5316
xorl %eax, %eax
callq 0x1060
leaq 0x4(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2f84
movq %rax, %r14
testq %rax, %rax
sete %al
movl (%r15), %edx
testl %edx, %edx
setne %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x191a
leaq 0x383a(%rip), %rdi      # 0x510e
movq %r14, %rsi
xorl %eax, %eax
callq 0x1060
jmp 0x1936
leaq 0x39d6(%rip), %rdi      # 0x52bd
xorl %eax, %eax
callq 0x1060
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1060
movl 0x4(%rsp), %ecx
leaq 0x39d2(%rip), %rdi      # 0x52da
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1060
jmp 0x19a0
leaq 0x3eaf(%rip), %rdi      # 0x57d0
callq 0x1040
movq %r14, %rdi
callq 0x131d
movq %r14, %rdi
callq 0x1030
leaq 0x4(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x38f5
movq %rax, %r14
testq %rax, %rax
sete %al
movl (%r15), %edx
testl %edx, %edx
setne %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x1971
leaq 0x37cc(%rip), %rdi      # 0x5131
movq %r14, %rsi
xorl %eax, %eax
callq 0x1060
jmp 0x1996
leaq 0x37e8(%rip), %rdi      # 0x5160
movq %r14, %rsi
xorl %eax, %eax
callq 0x1060
movq %r14, %rdi
callq 0x11ce
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3a6c
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2f30
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq