// File: /workspace/github_c_makefile_star2_O0/phluid61[P]hsf/src/key.c
// Function: SH_Key__init
SH_Key*
SH_Key__init(sh_char_t* value, size_t n, int* err) {
	SH_Key* obj;
	sh_char_t* ptr;
	sh_char_t  c;
	size_t m;

	__cascade(err, (SH_Key*)0);

	if (n < 1 || n > SH_KEY_LENGTH_MAX) {
		__raise(err, SH_E_KEY_TOO_LONG);
		return (SH_Key*)0;
	}

	if (*value < (sh_char_t)'a' || *value > (sh_char_t)'z') {
		__raise(err, SH_E_KEY_BAD_CHAR);
		return (SH_Key*)0;
	}

	ptr = value;
	m = 0;
	while (m < n) {
		c = *ptr;
		if (
				(c >= (sh_char_t)'a' && c <= (sh_char_t)'z') ||
				(c >= (sh_char_t)'0' && c <= (sh_char_t)'9') ||
				 c == (sh_char_t)'_' || c == (sh_char_t)'-' || c == (sh_char_t)'*') {
			ptr++;
			m++;
		} else {
			__raise(err, SH_E_KEY_BAD_CHAR);
			return (SH_Key*)0;
		}
	}

	obj = (SH_Key*)malloc(sizeof(SH_Key));
	if ((SH_Key*)0 == obj) {
		__raise(err, SH_E_MALLOC_ERROR);
		return (SH_Key*)0;
	}

	obj->value = (sh_char_t*)calloc(sizeof(sh_char_t), m + 1);
	if ((sh_char_t*)0 == obj->value) {
		free(obj);
		__raise(err, SH_E_MALLOC_ERROR);
		return (SH_Key*)0;
	}

	memcpy((void*)obj->value, (const void*)value, m);
	obj->length = m;

	__clear(err);
	return obj;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x1173
movq -0x20(%rbp), %rcx
xorl %eax, %eax
cmpl (%rcx), %eax
je 0x1173
movq $0x0, -0x8(%rbp)
jmp 0x1336
cmpq $0x1, -0x18(%rbp)
jb 0x1181
cmpq $0x40, -0x18(%rbp)
jbe 0x11a0
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x1193
movq -0x20(%rbp), %rax
movl $0x200001, (%rax)       # imm = 0x200001
movq $0x0, -0x8(%rbp)
jmp 0x1336
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x61, %eax
jl 0x11b8
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x7a, %eax
jle 0x11d7
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x11ca
movq -0x20(%rbp), %rax
movl $0x200002, (%rax)       # imm = 0x200002
movq $0x0, -0x8(%rbp)
jmp 0x1336
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x127b
movq -0x30(%rbp), %rax
movb (%rax), %al
movb %al, -0x31(%rbp)
movzbl -0x31(%rbp), %eax
cmpl $0x61, %eax
jl 0x1210
movzbl -0x31(%rbp), %eax
cmpl $0x7a, %eax
jle 0x123d
movzbl -0x31(%rbp), %eax
cmpl $0x30, %eax
jl 0x1222
movzbl -0x31(%rbp), %eax
cmpl $0x39, %eax
jle 0x123d
movzbl -0x31(%rbp), %eax
cmpl $0x5f, %eax
je 0x123d
movzbl -0x31(%rbp), %eax
cmpl $0x2d, %eax
je 0x123d
movzbl -0x31(%rbp), %eax
cmpl $0x2a, %eax
jne 0x1257
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x1276
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x1269
movq -0x20(%rbp), %rax
movl $0x200002, (%rax)       # imm = 0x200002
movq $0x0, -0x8(%rbp)
jmp 0x1336
jmp 0x11e7
movl $0x10, %edi
callq 0x1060
movq %rax, -0x28(%rbp)
xorl %eax, %eax
cmpq -0x28(%rbp), %rax
jne 0x12b0
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x12a3
movq -0x20(%rbp), %rax
movl $0x80000001, (%rax)     # imm = 0x80000001
movq $0x0, -0x8(%rbp)
jmp 0x1336
movq -0x40(%rbp), %rsi
addq $0x1, %rsi
movl $0x1, %edi
callq 0x1040
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
xorl %eax, %eax
cmpq (%rcx), %rax
jne 0x12fc
movq -0x28(%rbp), %rdi
callq 0x1030
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x12f2
movq -0x20(%rbp), %rax
movl $0x80000001, (%rax)     # imm = 0x80000001
movq $0x0, -0x8(%rbp)
jmp 0x1336
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x1050
movq -0x40(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x132e
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq