// File: /workspace/github_c_makefile_star2_O3/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 0x3a83(%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 0x2ed0
movq %rax, %rbx
testq %rax, %rax
je 0x18f3
cmpl $0x0, 0x4(%rsp)
jne 0x18f3
leaq 0x3a7f(%rip), %rdi      # 0x52f2
xorl %eax, %eax
callq 0x1060
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1060
leaq 0x3a75(%rip), %rdi      # 0x5305
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2fe6
movzwl %ax, %esi
leaq 0x3a65(%rip), %rdi      # 0x5316
xorl %eax, %eax
callq 0x1060
leaq 0x4(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2ff8
movq %rax, %r14
testq %rax, %rax
sete %al
movl (%r15), %edx
testl %edx, %edx
setne %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x192d
leaq 0x3827(%rip), %rdi      # 0x510e
movq %r14, %rsi
xorl %eax, %eax
callq 0x1060
jmp 0x1949
leaq 0x39c3(%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 0x39bf(%rip), %rdi      # 0x52da
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1060
jmp 0x19b3
leaq 0x3e9c(%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 0x3a12
movq %rax, %r14
testq %rax, %rax
sete %al
movl (%r15), %edx
testl %edx, %edx
setne %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x1984
leaq 0x37b9(%rip), %rdi      # 0x5131
movq %r14, %rsi
xorl %eax, %eax
callq 0x1060
jmp 0x19a9
leaq 0x37d5(%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 0x3bfc
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2faa
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq