// File: /workspace/github_c_makefile_star2_O2/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
andl $0x0, (%rbx)
leaq 0x3ad3(%rip), %rdx      # 0x52b6
leaq 0x8(%rsp), %rdi
pushq $0x8
popq %rsi
movq %r14, %rcx
xorl %eax, %eax
callq 0x1070
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2cf4
movq %rax, %rbx
testq %rax, %rax
je 0x18a1
cmpl $0x0, 0x4(%rsp)
jne 0x18a1
leaq 0x3ad1(%rip), %rdi      # 0x52f2
xorl %eax, %eax
callq 0x1060
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1060
leaq 0x3ac7(%rip), %rdi      # 0x5305
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2e08
movzwl %ax, %esi
leaq 0x3ab7(%rip), %rdi      # 0x5316
xorl %eax, %eax
callq 0x1060
leaq 0x4(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2e1a
movq %rax, %r14
testq %rax, %rax
sete %al
movl (%r15), %edx
testl %edx, %edx
setne %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x18db
leaq 0x3879(%rip), %rdi      # 0x510e
movq %r14, %rsi
xorl %eax, %eax
callq 0x1060
jmp 0x18f7
leaq 0x3a15(%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 0x3a11(%rip), %rdi      # 0x52da
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1060
jmp 0x1961
leaq 0x3eee(%rip), %rdi      # 0x57d0
callq 0x1040
movq %r14, %rdi
callq 0x130e
movq %r14, %rdi
callq 0x1030
leaq 0x4(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3759
movq %rax, %r14
testq %rax, %rax
sete %al
movl (%r15), %edx
testl %edx, %edx
setne %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x1932
leaq 0x380b(%rip), %rdi      # 0x5131
movq %r14, %rsi
xorl %eax, %eax
callq 0x1060
jmp 0x1957
leaq 0x3827(%rip), %rdi      # 0x5160
movq %r14, %rsi
xorl %eax, %eax
callq 0x1060
movq %r14, %rdi
callq 0x11c9
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x38c6
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2dc1
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq