// File: /workspace/github_c_makefile_star2_O2/phluid61[P]hsf/main.c
// Function: do_sh_item
void do_sh_item() {
	sh_char_t value[4] = "foo";

	SH_Token* obj;
	SH_BareItem* bi;
	SH_Item* item;

	SH_dict* params;

	SH_Key  *key1;
	SH_Item *val1;

	int err = 0;

	obj = SH_Token__init(value, 3, &err);
	if ((SH_Token*)0 == obj || err) {
		printf("* unable to init SH_Token(%s): [%llX] 0x%08X\n", (char*)value, (long long)obj, err);
	} else {
		printf("+ init SH_Token(%s): [%llX]\n", (char*)value, (long long)obj);
		bi = SH_BareItem__init_token(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);

			printf("  %c[36m--- create an item without any parameters -----%c[0m\n", 0x1b, 0x1b);
			item = SH_Item__init(bi, (SH_dict*)0, &err);
			if ((SH_Item*)0 == item || err) {
				printf("    * unable to init SH_Item: [%llX] 0x%08X\n", (long long)item, err);
			} else {
				printf("    + init SH_Item: [%llX]\n", (long long)item);
				__do_sh_item(item);

				SH_Item__destroy(item, SH_FALSE, 0);
			}

			printf("  %c[36m--- create an item with explicit parameters ---%c[0m\n", 0x1b, 0x1b);
			params = SH_dict__init(&err);
			if ((SH_dict*)0 == params || err) {
				printf("    * unable to init SH_dict: [%llX] 0x%08X\n", (long long)params, err);
			} else {
				printf("    + init SH_dict: [%llX]\n", (long long)params);

				item = SH_Item__init(bi, params, &err);
				if ((SH_Item*)0 == item || err) {
					printf("      * unable to init SH_Item: [%llX] 0x%08X\n", (long long)item, err);
				} else {
					printf("      + init SH_Item: [%llX]\n", (long long)item);
					__do_sh_item(item);

					SH_Item__destroy(item, SH_FALSE, 0);
				}

				SH_dict__destroy(params, SH_TRUE, 0);
			}

			printf("  %c[36m--- create an item with defined parameters ----%c[0m\n", 0x1b, 0x1b);
			params = SH_dict__init(&err);
			if ((SH_dict*)0 == params || err) {
				printf("    * unable to init SH_dict: [%llX] 0x%08X\n", (long long)params, err);
			} else {
				printf("    + init SH_dict: [%llX]\n", (long long)params);

				/* FIXME: catch errors here: */
				key1 = SH_Key__init((unsigned char*)"test", 4, &err);
				val1 = SH_Item__init(SH_BareItem__init_integer(SH_Integer__init(SH_INT_C(42), &err), &err), 0, &err);
				if (err) {
					printf("      x [%llX]=[%llX] 0x%08X\n", (long long)key1, (long long)val1, err);
				}
				SH_dict__add(params, key1, val1, &err);

				item = SH_Item__init(bi, params, &err);
				if ((SH_Item*)0 == item || err) {
					printf("      * unable to init SH_Item: [%llX] 0x%08X\n", (long long)item, err);
				} else {
					printf("      + init SH_Item: [%llX]\n", (long long)item);
					__do_sh_item(item);

					SH_Item__destroy(item, SH_FALSE, 0);
				}

				SH_dict__destroy(params, SH_TRUE, 0);
			}

			SH_BareItem__destroy(bi, SH_FALSE, 0);
		}

		SH_Token__destroy(obj, 0);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x4(%rsp), %rdi
movl $0x6f6f66, (%rdi)       # imm = 0x6F6F66
movq %rsp, %r14
andl $0x0, (%r14)
pushq $0x3
popq %rsi
movq %r14, %rdx
callq 0x2e80
movq %rax, %rbx
testq %rax, %rax
sete %al
movl (%r14), %ecx
testl %ecx, %ecx
setne %dl
orb %al, %dl
cmpb $0x1, %dl
jne 0x1f7c
leaq 0x3500(%rip), %rdi      # 0x5468
leaq 0x4(%rsp), %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1060
jmp 0x2270
leaq 0x3513(%rip), %rdi      # 0x5496
leaq 0x4(%rsp), %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1060
movq %rsp, %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x37a2
movq %rax, %r14
testq %rax, %rax
sete %al
movl (%r15), %edx
testl %edx, %edx
setne %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x1fce
leaq 0x3172(%rip), %rdi      # 0x5131
movq %r14, %rsi
xorl %eax, %eax
callq 0x1060
jmp 0x2266
leaq 0x318b(%rip), %rdi      # 0x5160
movq %r14, %rsi
xorl %eax, %eax
callq 0x1060
leaq 0x34cd(%rip), %rdi      # 0x54b3
pushq $0x1b
popq %rdx
movl %edx, %esi
xorl %eax, %eax
callq 0x1060
movq %rsp, %r12
movq %r14, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x3b84
movq %rax, %r15
testq %rax, %rax
sete %al
movl (%r12), %edx
testl %edx, %edx
setne %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x202e
leaq 0x3558(%rip), %rdi      # 0x557a
movq %r15, %rsi
xorl %eax, %eax
callq 0x1060
jmp 0x2053
leaq 0x3574(%rip), %rdi      # 0x55a9
movq %r15, %rsi
xorl %eax, %eax
callq 0x1060
movq %r15, %rdi
callq 0x1e07
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3c13
leaq 0x3497(%rip), %rdi      # 0x54f1
pushq $0x1b
popq %rdx
movl %edx, %esi
xorl %eax, %eax
callq 0x1060
movq %rsp, %r12
movq %r12, %rdi
callq 0x4377
movq %rax, %r15
testq %rax, %rax
sete %al
movl (%r12), %edx
testl %edx, %edx
setne %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x20a0
leaq 0x349e(%rip), %rdi      # 0x552f
movq %r15, %rsi
xorl %eax, %eax
callq 0x1060
jmp 0x2122
leaq 0x34b5(%rip), %rdi      # 0x555c
movq %r15, %rsi
xorl %eax, %eax
callq 0x1060
movq %rsp, %r13
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x3b84
movq %rax, %r12
testq %rax, %rax
sete %al
movl (%r13), %edx
testl %edx, %edx
setne %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x20ee
leaq 0x3496(%rip), %rdi      # 0x5578
movq %r12, %rsi
xorl %eax, %eax
callq 0x1060
jmp 0x2113
leaq 0x34b2(%rip), %rdi      # 0x55a7
movq %r12, %rsi
xorl %eax, %eax
callq 0x1060
movq %r12, %rdi
callq 0x1e07
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3c13
movq %r15, %rdi
movl $0xff, %esi
xorl %edx, %edx
callq 0x43ac
leaq 0x349c(%rip), %rdi      # 0x55c5
pushq $0x1b
popq %rdx
movl %edx, %esi
xorl %eax, %eax
callq 0x1060
movq %rsp, %r12
movq %r12, %rdi
callq 0x4377
movq %rax, %r15
testq %rax, %rax
sete %al
movl (%r12), %edx
testl %edx, %edx
setne %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x216f
leaq 0x33cf(%rip), %rdi      # 0x552f
movq %r15, %rsi
xorl %eax, %eax
callq 0x1060
jmp 0x225a
leaq 0x33e6(%rip), %rdi      # 0x555c
movq %r15, %rsi
xorl %eax, %eax
callq 0x1060
leaq 0x347c(%rip), %rdi      # 0x5603
pushq $0x4
popq %rsi
movq %rsp, %rbp
movq %rbp, %rdx
callq 0x3fb4
movq %rax, %r12
pushq $0x2a
popq %rdi
movq %rbp, %rsi
callq 0x28b0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x36c7
movq %rax, %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0x3b84
movq %rax, %r13
movl (%rbp), %ecx
testl %ecx, %ecx
je 0x21d9
leaq 0x343c(%rip), %rdi      # 0x5608
movq %r12, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x1060
movq %rsp, %rbp
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x44a0
movq %r14, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x3b84
movq %rax, %r12
testq %rax, %rax
sete %al
movl (%rbp), %edx
testl %edx, %edx
setne %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x2226
leaq 0x335e(%rip), %rdi      # 0x5578
movq %r12, %rsi
xorl %eax, %eax
callq 0x1060
jmp 0x224b
leaq 0x337a(%rip), %rdi      # 0x55a7
movq %r12, %rsi
xorl %eax, %eax
callq 0x1060
movq %r12, %rdi
callq 0x1e07
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3c13
movq %r15, %rdi
movl $0xff, %esi
xorl %edx, %edx
callq 0x43ac
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x38c6
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2fa6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq