// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x3c(%rbp)
leaq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x8, %esi
leaq 0x6947(%rip), %rdx      # 0x82d2
movb $0x0, %al
callq 0x1060
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x3c(%rbp), %rdx
callq 0x35d0
movq %rax, -0x18(%rbp)
xorl %eax, %eax
cmpq -0x18(%rbp), %rax
je 0x19b5
cmpl $0x0, -0x3c(%rbp)
je 0x19f0
leaq 0x691d(%rip), %rdi      # 0x82d9
movb $0x0, %al
callq 0x1050
leaq -0x28(%rbp), %rdi
movq -0x8(%rbp), %rsi
movb $0x0, %al
callq 0x1050
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x3c(%rbp), %ecx
leaq 0x6912(%rip), %rdi      # 0x82f6
movb $0x0, %al
callq 0x1050
jmp 0x1b09
leaq 0x6917(%rip), %rdi      # 0x830e
movb $0x0, %al
callq 0x1050
leaq -0x28(%rbp), %rdi
movq -0x8(%rbp), %rsi
movb $0x0, %al
callq 0x1050
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq 0x6905(%rip), %rdi      # 0x8321
movb $0x0, %al
callq 0x1050
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x37d0
movw %ax, -0x2a(%rbp)
movzwl -0x2a(%rbp), %esi
leaq 0x68f3(%rip), %rdi      # 0x8332
movb $0x0, %al
callq 0x1050
movq -0x18(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x3820
movq %rax, -0x38(%rbp)
xorl %eax, %eax
cmpq -0x38(%rbp), %rax
je 0x1a65
cmpl $0x0, -0x3c(%rbp)
je 0x1a7c
movq -0x38(%rbp), %rsi
movl -0x3c(%rbp), %edx
leaq 0x669b(%rip), %rdi      # 0x810e
movb $0x0, %al
callq 0x1050
jmp 0x1a9c
leaq 0x66b0(%rip), %rdi      # 0x8133
movb $0x0, %al
callq 0x1050
movq -0x38(%rbp), %rdi
callq 0x1380
movq -0x38(%rbp), %rdi
callq 0x1030
movq -0x18(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x4b90
movq %rax, -0x20(%rbp)
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x1abb
cmpl $0x0, -0x3c(%rbp)
je 0x1ad2
movq -0x20(%rbp), %rsi
movl -0x3c(%rbp), %edx
leaq 0x6684(%rip), %rdi      # 0x814d
movb $0x0, %al
callq 0x1050
jmp 0x1afc
movq -0x20(%rbp), %rsi
leaq 0x669f(%rip), %rdi      # 0x817c
movb $0x0, %al
callq 0x1050
movq -0x20(%rbp), %rdi
callq 0x11e0
movq -0x20(%rbp), %rdi
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x4eb0
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3770
addq $0x40, %rsp
popq %rbp
retq
nop