LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/findstr[P]version-database/meta.c
// Function: writedata
static void
writedata(drb_t *drb, dr_t data)
{
	int size;
	uint8_t *p;
	p = drb_check(drb, data->size);
	uint32(p) = size = data->size;		p += 4;
	memcpy(p, data->buf, size);		p += size;
	drb_end(drb, p);
	return ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x4(%rsi), %esi
callq 0x5c03
movq %rax, %r15
movslq 0x4(%rbx), %r12
movl %r12d, (%rax)
addq $0x4, %r15
addq $0x8, %rbx
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x21c0
addl %r12d, %r15d
subl 0x8(%r14), %r15d
addl $-0x8, %r15d
movl %r15d, (%r14)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/findstr[P]version-database/meta.c
// Function: ctrl_dff
void
ctrl_dff(drb_t *drb, struct DFF *c)
{
	writeact(drb, CTRL_DFF);
	writename(drb, c->name);
	writedata(drb, c->patch);
	printf(".DFF %s patch:%d Byte\n",
		c->name->buf, c->patch->size);
	return ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x20
popq %rsi
callq 0x57ee
movq (%rbx), %rsi
movq %r14, %rdi
callq 0x5813
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x5867
movq (%rbx), %rsi
movq 0x8(%rbx), %rax
addq $0x8, %rsi
movl 0x4(%rax), %edx
leaq 0x2f63(%rip), %rdi      # 0x885b
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x2110
// File: /workspace/github_c_makefile_star2_O2/findstr[P]version-database/meta.c
// Function: ctrl_dfx
void
ctrl_dfx(drb_t *drb, struct DFX *c)
{
	writeact(drb, CTRL_DFX);
	writename(drb, c->name);
	writename(drb, c->namea);
	writedata(drb, c->patch);
	printf(".DFX %s -> %s patch:%d Byte\n",
		c->namea->buf, c->name->buf, c->patch->size);
	return ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x30
popq %rsi
callq 0x57ee
movq (%rbx), %rsi
movq %r14, %rdi
callq 0x5813
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x5813
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x5867
movq (%rbx), %rdx
movq 0x8(%rbx), %rsi
addq $0x8, %rsi
addq $0x8, %rdx
movq 0x10(%rbx), %rax
movl 0x4(%rax), %ecx
leaq 0x2f1a(%rip), %rdi      # 0x8872
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x2110
// File: /workspace/github_c_makefile_star2_O2/findstr[P]version-database/meta.c
// Function: ctrl_cpy
void
ctrl_cpy(drb_t *drb, struct CPY *c)
{
	writeact(drb, CTRL_CPY);
	writename(drb, c->name);
	writename(drb, c->namea);
	printf(".CPY %s => %s\n", c->namea->buf, c->name->buf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x40
popq %rsi
callq 0x57ee
movq (%rbx), %rsi
movq %r14, %rdi
callq 0x5813
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x5813
movq (%rbx), %rdx
movq 0x8(%rbx), %rsi
addq $0x8, %rsi
addq $0x8, %rdx
leaq 0x2eba(%rip), %rdi      # 0x8898
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x2110
// File: /workspace/github_c_makefile_star2_O2/findstr[P]version-database/meta.c
// Function: ctrl_read
const uint8_t *
ctrl_read(const uint8_t *p, struct CTRL *ctrl)
{
	ctrl->act = uint8(p);	p += 1;
	switch (ctrl->act) {
	case CTRL_NEW:
		return ctrl_new_read(p, &ctrl->u.new);
	case CTRL_DFF:
		return ctrl_dff_read(p, &ctrl->u.dff);
	case CTRL_DFX:
		return ctrl_dfx_read(p, &ctrl->u.dfx);
	case CTRL_CPY:
		return ctrl_cpy_read(p, &ctrl->u.cpy);
	case CTRL_DEL:
		return ctrl_del_read(p, &ctrl->u.del);
	default:
		assert(0);
	}
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movzbl (%rdi), %eax
movb %al, (%rsi)
addl $-0x10, %eax
roll $0x1c, %eax
cmpl $0x4, %eax
ja 0x5b46
movq %rsi, %rbx
incq %rdi
leaq 0x2e07(%rip), %rcx      # 0x881c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x18(%rbp), %r14
movq %rdi, (%r14)
movq %r14, %rdi
callq 0x5d90
movq %rax, 0x8(%rbx)
movq %r14, %rdi
callq 0x5dc6
movq %rax, 0x10(%rbx)
movq 0x8(%rbx), %rsi
cvtsi2ssl 0x4(%rax), %xmm0
addq $0x8, %rsi
mulss 0x2dc6(%rip), %xmm0     # 0x8818
cvtss2sd %xmm0, %xmm0
leaq 0x2de7(%rip), %rdi      # 0x8844
movb $0x1, %al
callq 0x2110
jmp 0x5b3a
leaq -0x18(%rbp), %r14
movq %rdi, (%r14)
movq %r14, %rdi
callq 0x5d90
movq %rax, 0x8(%rbx)
leaq 0x8(%rax), %rsi
leaq 0x2e08(%rip), %rdi      # 0x888f
xorl %eax, %eax
callq 0x2110
jmp 0x5b3a
leaq -0x18(%rbp), %r14
movq %rdi, (%r14)
movq %r14, %rdi
callq 0x5d90
movq %rax, 0x8(%rbx)
movq %r14, %rdi
callq 0x5d90
movq %rax, 0x10(%rbx)
movq %r14, %rdi
callq 0x5dc6
movq %rax, 0x18(%rbx)
movq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rsi
addq $0x8, %rsi
addq $0x8, %rdx
movl 0x4(%rax), %ecx
leaq 0x2d9a(%rip), %rdi      # 0x8872
xorl %eax, %eax
callq 0x2110
jmp 0x5b3a
leaq -0x18(%rbp), %r14
movq %rdi, (%r14)
movq %r14, %rdi
callq 0x5d90
movq %rax, 0x8(%rbx)
movq %r14, %rdi
callq 0x5d90
movq %rax, 0x10(%rbx)
jmp 0x5b3a
leaq -0x18(%rbp), %r14
movq %rdi, (%r14)
movq %r14, %rdi
callq 0x5d90
movq %rax, 0x8(%rbx)
movq %r14, %rdi
callq 0x5dc6
movq %rax, 0x10(%rbx)
movq 0x8(%rbx), %rsi
addq $0x8, %rsi
movl 0x4(%rax), %edx
leaq 0x2d28(%rip), %rdi      # 0x885b
xorl %eax, %eax
callq 0x2110
movq (%r14), %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2e4b(%rip), %rdi      # 0x8998
leaq 0x2d53(%rip), %rsi      # 0x88a7
leaq 0x2d53(%rip), %rcx      # 0x88ae
movl $0xd9, %edx
callq 0x2130
// File: /workspace/github_c_makefile_star2_O2/findstr[P]version-database/meta.c
// Function: ctrl_destroy
void
ctrl_destroy(struct CTRL *ctrl)
{
	switch (ctrl->act) {
	case CTRL_NEW:
		ctrl_new_free(&ctrl->u.new);
		break;
	case CTRL_DFF:
		ctrl_dff_free(&ctrl->u.dff);
		break;
	case CTRL_DFX:
		ctrl_dfx_free(&ctrl->u.dfx);
		break;
	case CTRL_CPY:
		ctrl_cpy_free(&ctrl->u.cpy);
		break;
	case CTRL_DEL:
		ctrl_del_free(&ctrl->u.del);
		break;
	default:
		assert(0);
	}
	return ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movzbl (%rdi), %ecx
addl $-0x10, %ecx
roll $0x1c, %ecx
cmpl $0x4, %ecx
ja 0x5bbf
movq %rdi, %rbx
pushq $0x8
popq %rax
leaq 0x2ca9(%rip), %rdx      # 0x8830
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
pushq $0x10
popq %r14
jmp 0x5ba6
movq 0x8(%rbx), %rdi
callq 0x5e4b
pushq $0x18
popq %r14
pushq $0x10
popq %rax
movq (%rbx,%rax), %rdi
callq 0x5e4b
movq %r14, %rax
movq (%rbx,%rax), %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x5e4b
leaq 0x2dd2(%rip), %rdi      # 0x8998
leaq 0x2cda(%rip), %rsi      # 0x88a7
leaq 0x2d13(%rip), %rcx      # 0x88e7
movl $0xf2, %edx
callq 0x2130
// File: /workspace/github_c_makefile_star2_O2/findstr[P]version-database/./dr.h
// Function: drb_check
static inline uint8_t *
drb_check(drb_t *drb, int size)
{
	int seqsize = drb->seq->size;
	int needsize = drb->size + size;
	while (seqsize < needsize) {
		seqsize *= 2;
		drb->seq = dr_resize(drb->seq, seqsize);
	}
	return &drb->seq->buf[drb->size];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movq 0x8(%rdi), %r12
movl 0x4(%r12), %r15d
addl (%rdi), %r14d
cmpl %r14d, %r15d
jge 0x5c8a
addl %r15d, %r15d
cmpl $0x1, (%r12)
jne 0x5c4a
movslq %r15d, %rsi
addq $0xc, %rsi
movq %r12, %rdi
callq 0x2210
movq %rax, %r12
movl %r15d, 0x4(%rax)
jmp 0x5c84
movl %r15d, %edi
xorl %esi, %esi
callq 0x5dfb
movq %rax, %r13
movl 0x4(%r12), %eax
cmpl %r15d, %eax
cmovgel %r15d, %eax
movl %eax, 0x4(%r12)
leaq 0x8(%r13), %rdi
leaq 0x8(%r12), %rsi
movslq %eax, %rdx
callq 0x21c0
movq %r12, %rdi
callq 0x5e4b
movq %r13, %r12
movq %r12, 0x8(%rbx)
jmp 0x5c23
movslq (%rbx), %rax
addq %r12, %rax
addq $0x8, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/findstr[P]version-database/meta.c
// Function: patch_copy
void
patch_copy(drb_t *drb, struct COPY *copy)
{
	uint8_t *p = drb_check(drb, 1+4+4);
	uint8(p) = PATCH_COPY;	p += 1;
	uint32(p) = copy->pos;	p += 4;
	uint32(p) = copy->size;	p += 4;
	drb_end(drb, p);
	return ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x9
popq %rsi
callq 0x5c03
movb $0x1, (%rax)
movl (%rbx), %ecx
movl %ecx, 0x1(%rax)
movl 0x4(%rbx), %ecx
movl %ecx, 0x5(%rax)
subl 0x8(%r14), %eax
incl %eax
movl %eax, (%r14)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/findstr[P]version-database/meta.c
// Function: patch_insert
void
patch_insert(drb_t *drb, struct INSERT *insert)
{
	int size = insert->size;
	uint8_t *p = drb_check(drb, 1+4+size);
	uint8(p) = PATCH_INSERT;	p += 1;
	uint32(p) = size;		p += 4;
	memcpy(p, insert->p, size);	p += size;
	drb_end(drb, p);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movslq 0x8(%rsi), %r15
leal 0x5(%r15), %esi
callq 0x5c03
movq %rax, %r12
movb $0x2, (%rax)
movl %r15d, 0x1(%rax)
addq $0x5, %r12
movq (%r14), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x21c0
addl %r15d, %r12d
subl 0x8(%rbx), %r12d
addl $-0x8, %r12d
movl %r12d, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/findstr[P]version-database/meta.c
// Function: patch_read
const uint8_t *
patch_read(const uint8_t *p, struct PATCH *patch)
{
	patch->act = uint8(p);		p += 1;
	if (patch->act == PATCH_COPY)
		return patch_copy_read(p, &patch->u.copy);
	else if (patch->act == PATCH_INSERT)
		return patch_insert_read(p, &patch->u.insert);
	else
		assert(0);
	return NULL;
}

// Assembly:
movzbl (%rdi), %eax
movb %al, (%rsi)
cmpl $0x2, %eax
je 0x5d54
cmpl $0x1, %eax
jne 0x5d6d
movl 0x1(%rdi), %eax
movl %eax, 0x8(%rsi)
movl 0x5(%rdi), %eax
movl %eax, 0xc(%rsi)
addq $0x9, %rdi
jmp 0x5d69
movl 0x1(%rdi), %eax
movl %eax, 0x10(%rsi)
leaq 0x5(%rdi), %rcx
movq %rcx, 0x8(%rsi)
addq %rax, %rdi
addq $0x5, %rdi
movq %rdi, %rax
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x2c20(%rip), %rdi      # 0x8998
leaq 0x2b28(%rip), %rsi      # 0x88a7
leaq 0x2b82(%rip), %rcx      # 0x8908
movl $0x136, %edx            # imm = 0x136
callq 0x2130
// File: /workspace/github_c_makefile_star2_O2/findstr[P]version-database/meta.c
// Function: readname
static dr_t
readname(const uint8_t **pp)
{
	int size;
	dr_t name;
	const uint8_t *p = *pp;
	size = NAME_LEN(p);	p += NAME_LEN_SIZE;
	name = dr_new(size, p); p += size;
	*pp = p;
	return name;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r15
movzwl (%r15), %r14d
leaq 0x2(%r15), %rsi
movl %r14d, %edi
callq 0x5dfb
leaq (%r15,%r14), %rcx
addq $0x2, %rcx
movq %rcx, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/findstr[P]version-database/meta.c
// Function: readdata
static dr_t
readdata(const uint8_t **pp)
{
	int size;
	dr_t data;
	const uint8_t *p = *pp;
	size = uint32(p);	p += 4;
	data = dr_new(size, p);	p += size;
	*pp = p;
	return data;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r15
movslq (%r15), %r14
leaq 0x4(%r15), %rsi
movl %r14d, %edi
callq 0x5dfb
leaq (%r15,%r14), %rcx
addq $0x4, %rcx
movq %rcx, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/findstr[P]version-database/dc3.c
// Function: radix_pass
static void
radix_pass(int *src, int *dst, int size, const int *buf, int space)
{
	int i, n, *c;
	space += 1;
	c = NEW(int, space);
	for (i = 0; i < space; i++)
		c[i] = 0;
	for (i = 0; i < size; i++) {
		int n = V(src[i]);
		++c[n];
	}
	n = 0;
	for (i = 0; i < space; i++) {
		int tmp = c[i];
		c[i] = n;
		n += tmp;
	}
	for (i = 0; i < size; i++) {
		int pos = c[V(src[i])]++;
		dst[pos] = src[i];
	}
	free(c);
	return ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %r12
movslq %r8d, %r13
leaq 0x4(,%r13,4), %rdi
callq 0x21f0
xorl %ecx, %ecx
cmpq %r13, %rcx
jg 0x6492
andl $0x0, (%rax,%rcx,4)
incq %rcx
jmp 0x6484
xorl %ecx, %ecx
testl %r14d, %r14d
cmovlel %ecx, %r14d
cmpq %rcx, %r14
je 0x64b0
movslq (%r12,%rcx,4), %rdx
movslq (%rbx,%rdx,4), %rdx
incl (%rax,%rdx,4)
incq %rcx
jmp 0x649b
xorl %ecx, %ecx
xorl %edx, %edx
cmpq %r13, %rcx
jg 0x64c8
movl (%rax,%rcx,4), %esi
addl %edx, %esi
movl %edx, (%rax,%rcx,4)
incq %rcx
movl %esi, %edx
jmp 0x64b4
xorl %ecx, %ecx
cmpq %rcx, %r14
je 0x64ec
movslq (%r12,%rcx,4), %rdx
movslq (%rbx,%rdx,4), %rsi
movslq (%rax,%rsi,4), %rdi
leal 0x1(%rdi), %r8d
movl %r8d, (%rax,%rsi,4)
movl %edx, (%r15,%rdi,4)
incq %rcx
jmp 0x64ca
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2030
// File: /workspace/github_c_makefile_star2_O2/findstr[P]version-database/dc3.c
// Function: dc3
int *
dc3(const uint8_t *dat, int size)
{
	int i, *p;
	int *SA = NEW(int, size);
	int *buf = NEW(int, size+3);
	p = buf;
	for (i = 0; i < size; i++)
		*p++ = dat[i]+1;
	for (i = 0; i < 3; i++)
		*p++ = TERM;
	dc3_r(buf, SA, size, 0xff+1);
	free(buf);
	return SA;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %r12
movslq %esi, %r13
leaq (,%r13,4), %rdi
callq 0x21f0
movq %rax, %rbx
leaq 0xc(,%r13,4), %rdi
callq 0x21f0
movq %rax, %r15
xorl %ecx, %ecx
testl %r13d, %r13d
movl $0x0, %edx
cmovgl %r14d, %edx
cmpq %rcx, %rdx
je 0x655e
movzbl (%r12,%rcx), %esi
incl %esi
movl %esi, (%rax)
addq $0x4, %rax
incq %rcx
jmp 0x6547
xorl %ecx, %ecx
cmpl $0x3, %ecx
je 0x656e
andl $0x0, (%rax,%rcx,4)
incq %rcx
jmp 0x6560
movq %r15, %rdi
movq %rbx, %rsi
movl %r14d, %edx
movl $0x100, %ecx            # imm = 0x100
callq 0x5e88
movq %r15, %rdi
callq 0x2030
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/findstr[P]version-database/sha1.c
// Function: SHA1_Update
void SHA1_Update(SHA1_CTX *ctx, const void *data, unsigned long len)
{
	unsigned int lenW = ctx->size & 63;

	ctx->size += len;

	/* Read the data into W and process blocks as they get full */
	if (lenW) {
		unsigned int left = 64 - lenW;
		if (len < left)
			left = len;
		memcpy(lenW + (char *)ctx->W, data, left);
		lenW = (lenW + left) & 63;
		len -= left;
		data = ((const char *)data + left);
		if (lenW)
			return;
		SHA1_Block(ctx, ctx->W);
	}
	while (len >= 64) {
		SHA1_Block(ctx, data);
		data = ((const char *)data + 64);
		len -= 64;
	}
	if (len)
		memcpy(ctx->W, data, len);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rdi), %r13
leaq (%rdx,%r13), %rcx
movl %r13d, %eax
movq %rcx, (%rdi)
andl $0x3f, %eax
je 0x663a
pushq $0x40
popq %rcx
subl %eax, %ecx
cmpq %rbx, %rcx
movl %ebx, %r12d
cmovbel %ecx, %r12d
movl %r13d, %eax
andl $0x3f, %eax
leaq (%r15,%rax), %rdi
addq $0x1c, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x21c0
movl %r12d, %eax
addl %r13d, %eax
testb $0x3f, %al
jne 0x6665
leaq 0x1c(%r15), %rsi
addq %r12, %r14
subq %r12, %rbx
movq %r15, %rdi
callq 0x6674
jmp 0x663a
movq %r15, %rdi
movq %r14, %rsi
callq 0x6674
addq $0x40, %r14
addq $-0x40, %rbx
cmpq $0x40, %rbx
jae 0x6627
testq %rbx, %rbx
je 0x6665
addq $0x1c, %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21c0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/findstr[P]version-database/sha1.c
// Function: SHA1_Final
void SHA1_Final(unsigned char hashout[20], SHA1_CTX *ctx)
{
	static const unsigned char pad[64] = { 0x80 };
	unsigned int padlen[2];
	int i;

	/* Pad with a binary 1 (ie 0x80), then zeroes, then length */
	padlen[0] = htonl((uint32_t)(ctx->size >> 29));
	padlen[1] = htonl((uint32_t)(ctx->size << 3));

	i = ctx->size & 63;
	SHA1_Update(ctx, pad, 1 + (63 & (55 - i)));
	SHA1_Update(ctx, padlen, 8);

	/* Output hash */
	for (i = 0; i < 5; i++)
		put_be32(hashout + i * 4, ctx->H[i]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %rax
leal (,%rax,8), %ecx
pushq $0x37
popq %rdx
subl %eax, %edx
shrq $0x1d, %rax
bswapl %eax
leaq -0x20(%rbp), %r15
movl %eax, (%r15)
bswapl %ecx
movl %ecx, 0x4(%r15)
andl $0x3f, %edx
incq %rdx
leaq 0x10b2(%rip), %rsi      # 0x8a20
movq %rbx, %rdi
callq 0x65b8
pushq $0x8
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x65b8
xorl %eax, %eax
cmpq $0x5, %rax
je 0x799b
movl 0x8(%rbx,%rax,4), %ecx
bswapl %ecx
movl %ecx, (%r14,%rax,4)
incq %rax
jmp 0x7986
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/primatesv1hanuman80/ref/primate.cpp
// Function: GenerateRoundConstants()
void GenerateRoundConstants() //Generation of 5-bit round constant by using the primitive polynomial x^5+x^2+1 with initial value 1.
{
	//Round constants for p_1
	rc_p1[0]=1;
	//printf("\nRound constants for p_1: \n %.2x", rc_p1[0]);
	for(int i=1; i<p1rounds; i++){
		rc_p1[i] = ((rc_p1[i-1]<<1) ^ ((rc_p1[i-1]>>1)&1) ^ ((rc_p1[i-1]>>4)&1))&31;
		//printf("\n %.2x", rc_p1[i]);
	}

	//Round constant for p_4
	rc_p4[0] = ((rc_p1[p1rounds-1]<<1) ^ ((rc_p1[p1rounds-1]>>1)&1) ^ ((rc_p1[p1rounds-1]>>4)&1))&31;
	//printf("\nRound constants for p_4: \n %.2x", rc_p4[0]);
	for(int i=1; i<p4rounds; i++){
		rc_p4[i] = ((rc_p4[i-1]<<1) ^ ((rc_p4[i-1]>>1)&1) ^ ((rc_p4[i-1]>>4)&1))&31;
		//printf("\n %.2x", rc_p4[i]);
	}
}

// Assembly:
movq 0x30a7(%rip), %rax      # 0x4fc8
movb $0x1, (%rax)
pushq $0x1
popq %rcx
movb $0x1, %dl
cmpq $0xc, %rcx
je 0x1f56
leal (%rdx,%rdx), %esi
movl %edx, %edi
shrb %dil
andb $0x1, %dil
shrb $0x4, %dl
andb $0x1, %dl
andb $0x1e, %sil
orb %dil, %sil
xorb %dl, %sil
movb %sil, (%rax,%rcx)
incq %rcx
movl %esi, %edx
jmp 0x1f29
movb 0xb(%rax), %cl
leal (%rcx,%rcx), %eax
movl %ecx, %edx
shrb %dl
andb $0x1, %dl
shrb $0x4, %cl
andb $0x1, %cl
andb $0x1e, %al
orb %dl, %al
xorb %cl, %al
movq 0x3082(%rip), %rcx      # 0x4ff8
movb %al, (%rcx)
pushq $0x1
popq %rdx
cmpq $0xc, %rdx
je 0x1fa7
leal (%rax,%rax), %esi
movl %eax, %edi
shrb %dil
andb $0x1, %dil
shrb $0x4, %al
andb $0x1, %al
andb $0x1e, %sil
orb %dil, %sil
xorb %al, %sil
movb %sil, (%rcx,%rdx)
incq %rdx
movl %esi, %eax
jmp 0x1f7b
retq
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/primatesv1hanuman80/ref/primate.cpp
// Function: InitializeState(unsigned char*, unsigned char*, unsigned char*)
void InitializeState(unsigned char *state, unsigned char *key, unsigned char *nonce)
{
	GenerateRoundConstants();

	for(int i=0; i<RateSizeElements; i++)
		state[i]=0;
	for(int i=0; i<KeySizeElements; i++)
		state[RateSizeElements+i]=key[i];
	for(int i=0; i<NonceSizeElements; i++)
		state[(RateSizeElements+KeySizeElements)+i]=nonce[i];
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
callq 0x1140
xorl %eax, %eax
cmpq $0x8, %rax
je 0x1fcd
movb $0x0, (%r14,%rax)
incq %rax
jmp 0x1fbd
xorl %eax, %eax
cmpq $0x10, %rax
je 0x1fe3
movb (%r15,%rax), %cl
movb %cl, 0x8(%r14,%rax)
incq %rax
jmp 0x1fcf
xorl %eax, %eax
cmpq $0x10, %rax
je 0x1ff8
movb (%rbx,%rax), %cl
movb %cl, 0x18(%r14,%rax)
incq %rax
jmp 0x1fe5
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: type_string_to_number
int type_string_to_number(char *type)
{
    if (0 == strcmp("int", type)) {
        return LEDA_TYPE_INT;
    } else if (0 == strcmp("bool", type)) {
        return LEDA_TYPE_BOOL;
    } else if (0 == strcmp("float", type)) {
        return LEDA_TYPE_FLOAT;
    } else if (0 == strcmp("text", type)) {
        return LEDA_TYPE_TEXT;
    } else if (0 == strcmp("date", type)) {
        return LEDA_TYPE_DATE;
    } else if (0 == strcmp("enum", type)) {
        return LEDA_TYPE_ENUM;
    } else if (0 == strcmp("struct", type)) {
        return LEDA_TYPE_STRUCT;
    } else if (0 == strcmp("array", type)) {
        return LEDA_TYPE_ARRAY;
    } else if (0 == strcmp("double", type)) {
        return LEDA_TYPE_DOUBLE;
    } else {
        return -1;
    }
    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x57eb(%rip), %rdi      # 0xa048
movq %rbx, %rsi
callq 0x43b0
testl %eax, %eax
je 0x4916
leaq 0x57d8(%rip), %rdi      # 0xa04c
movq %rbx, %rsi
callq 0x43b0
testl %eax, %eax
je 0x491a
leaq 0x57c6(%rip), %rdi      # 0xa051
movq %rbx, %rsi
callq 0x43b0
testl %eax, %eax
je 0x491e
leaq 0x57b5(%rip), %rdi      # 0xa057
movq %rbx, %rsi
callq 0x43b0
testl %eax, %eax
je 0x4922
leaq 0x57a7(%rip), %rdi      # 0xa05c
movq %rbx, %rsi
callq 0x43b0
testl %eax, %eax
je 0x4926
leaq 0x5799(%rip), %rdi      # 0xa061
movq %rbx, %rsi
callq 0x43b0
testl %eax, %eax
je 0x492a
leaq 0x578b(%rip), %rdi      # 0xa066
movq %rbx, %rsi
callq 0x43b0
testl %eax, %eax
je 0x492e
leaq 0x577f(%rip), %rdi      # 0xa06d
movq %rbx, %rsi
callq 0x43b0
testl %eax, %eax
je 0x4932
leaq 0x5772(%rip), %rdi      # 0xa073
movq %rbx, %rsi
callq 0x43b0
movl %eax, %ecx
xorl %eax, %eax
negl %ecx
sbbl %eax, %eax
orl $0x8, %eax
jmp 0x4935
xorl %eax, %eax
jmp 0x4935
pushq $0x1
jmp 0x4934
pushq $0x2
jmp 0x4934
pushq $0x3
jmp 0x4934
pushq $0x4
jmp 0x4934
pushq $0x5
jmp 0x4934
pushq $0x6
jmp 0x4934
pushq $0x7
popq %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: get_msg_id
unsigned int get_msg_id()
{
    int ret = 0;

    pthread_mutex_lock(&g_msg_locker);
    ret = ++g_msg_id;
    pthread_mutex_unlock(&g_msg_locker);

    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x96ec(%rip), %rbx      # 0xe480
movq %rbx, %rdi
callq 0x4720
movl 0x9705(%rip), %r14d     # 0xe4a8
incl %r14d
movl %r14d, 0x96fb(%rip)     # 0xe4a8
movq %rbx, %rdi
callq 0x4460
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: wsa_insert_reply
int wsa_insert_reply(int msg_id)
{
    wsa_reply_t *reply;

    pthread_mutex_lock(&wsa_replay_lock);
    reply = (wsa_reply_t *)malloc(sizeof(wsa_reply_t));
    if (NULL == reply) {
        log_e(LOG_TAG, "no memory\r\n");
        pthread_mutex_unlock(&wsa_replay_lock);
        return LE_ERROR_ALLOCATING_MEM;
    }
    reply->msg_id = msg_id;
    reply->code = LE_ERROR_UNKNOWN;
    if (0 != sem_init(&reply->sem, 0, 0)) {
        free(reply);
        pthread_mutex_unlock(&wsa_replay_lock);
        log_e(LOG_TAG, "semphore init error!");
        return LE_ERROR_UNKNOWN;
    }
    list_add(&reply->list_node, &wsa_replay_head);
    pthread_mutex_unlock(&wsa_replay_lock);
    return LE_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
movq 0x91af(%rip), %rdi      # 0xdf80
callq 0x4720
pushq $0x40
popq %rdi
callq 0x4758
testq %rax, %rax
je 0x4e5c
movq %rax, %r14
movl %ebx, 0x10(%rax)
movl $0x186a0, 0x14(%rax)    # imm = 0x186A0
movq %rax, %rdi
addq $0x18, %rdi
xorl %ebx, %ebx
xorl %esi, %esi
xorl %edx, %edx
callq 0x4550
testl %eax, %eax
je 0x4ea6
movq %r14, %rdi
callq 0x4750
movq 0x9167(%rip), %rdi      # 0xdf80
callq 0x4460
leaq 0x5316(%rip), %rax      # 0xa13b
movq %rax, (%rsp)
leaq 0x5260(%rip), %rsi      # 0xa090
leaq 0x525f(%rip), %rdx      # 0xa096
leaq 0x525d(%rip), %rcx      # 0xa09b
leaq 0x52d9(%rip), %r8       # 0xa11e
pushq $0x3
popq %rdi
movl $0x121, %r9d            # imm = 0x121
xorl %eax, %eax
callq 0x4290
movl $0x186a0, %ebx          # imm = 0x186A0
jmp 0x4eca
leaq 0x52cc(%rip), %rax      # 0xa12f
movq %rax, (%rsp)
leaq 0x5222(%rip), %rsi      # 0xa090
leaq 0x5221(%rip), %rdx      # 0xa096
leaq 0x521f(%rip), %rcx      # 0xa09b
leaq 0x529b(%rip), %r8       # 0xa11e
pushq $0x3
popq %rdi
movl $0x118, %r9d            # imm = 0x118
xorl %eax, %eax
callq 0x4290
movq 0x90e6(%rip), %rdi      # 0xdf80
callq 0x4460
movl $0x186a2, %ebx          # imm = 0x186A2
jmp 0x4eca
movq 0x90fb(%rip), %rax      # 0xdfa8
movq (%rax), %rcx
movq %r14, 0x8(%rcx)
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
movq %r14, (%rax)
movq 0x90bb(%rip), %rdi      # 0xdf80
callq 0x4460
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: wsa_remove_reply
void wsa_remove_reply(int msg_id)
{
    wsa_reply_t *reply;

    reply = _wsa_get_reply_by_msg_id(msg_id);
    if (NULL == reply) {
        return;
    }

    pthread_mutex_lock(&wsa_replay_lock);
    if (reply->payload) {
        free(reply->payload);
        reply->payload = NULL;
    }
    sem_destroy(&reply->sem);
    list_del(&reply->list_node);
    free(reply);
    pthread_mutex_unlock(&wsa_replay_lock);
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
callq 0x4f42
testq %rax, %rax
je 0x4f3b
movq %rax, %rbx
movq 0x9091(%rip), %rdi      # 0xdf80
callq 0x4720
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x4f07
callq 0x4750
andq $0x0, 0x38(%rbx)
movq %rbx, %rdi
addq $0x18, %rdi
callq 0x4710
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movq %rcx, 0x8(%rax)
movq %rax, (%rcx)
movq %rbx, %rdi
callq 0x4750
movq 0x9050(%rip), %rdi      # 0xdf80
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x4460
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: wsa_get_reply_by_msg_id
static wsa_reply_t *_wsa_get_reply_by_msg_id(int msg_id)
{
    wsa_reply_t *pos, *next, *reply = NULL;

    pthread_mutex_lock(&wsa_replay_lock);
    list_for_each_entry_safe(pos, next, &wsa_replay_head, list_node) {
        if (pos->msg_id == msg_id) {
            reply = pos;
            break;
        }
    }
    pthread_mutex_unlock(&wsa_replay_lock);
    return reply;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edi, %r14d
movq 0x902d(%rip), %rdi      # 0xdf80
callq 0x4720
movq 0x9049(%rip), %rax      # 0xdfa8
movq %rax, %rbx
movq (%rbx), %rbx
cmpq %rax, %rbx
je 0x4f72
cmpl %r14d, 0x10(%rbx)
jne 0x4f62
jmp 0x4f74
xorl %ebx, %ebx
movq 0x9005(%rip), %rdi      # 0xdf80
callq 0x4460
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: wsa_set_reply_result
int wsa_set_reply_result(int msg_id, int code, char *payload)
{
    wsa_reply_t *reply;

    reply = _wsa_get_reply_by_msg_id(msg_id);
    if (NULL == reply) {
        return -1;
    }

    pthread_mutex_lock(&wsa_replay_lock);
    reply->code = code;
    if (payload) {
        reply->payload = strdup(payload);
    }
    pthread_mutex_unlock(&wsa_replay_lock);
    sem_post(&reply->sem);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %r15d
callq 0x4f42
testq %rax, %rax
je 0x4fe2
movq %rax, %rbx
movq 0x8fd4(%rip), %rdi      # 0xdf80
callq 0x4720
movl %r15d, 0x14(%rbx)
testq %r14, %r14
je 0x4fc6
movq %r14, %rdi
callq 0x46b0
movq %rax, 0x38(%rbx)
movq 0x8fb3(%rip), %rdi      # 0xdf80
callq 0x4460
addq $0x18, %rbx
movq %rbx, %rdi
callq 0x4340
xorl %eax, %eax
jmp 0x4fe5
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: wsa_get_reply_result
int wsa_get_reply_result(int msg_id, int timeout_ms, int *code, char **payload)
{
    int time_count = 0, s;
    wsa_reply_t *reply;
    struct timespec ts = {0};

    reply = _wsa_get_reply_by_msg_id(msg_id);
    if (NULL == reply) {
        log_d(LOG_TAG, "get reply err:%d\r\n", msg_id);
        return LE_ERROR_INVAILD_PARAM;
    }
    if (-1 == clock_gettime(CLOCK_REALTIME, &ts)) {
        wsa_remove_reply(msg_id);
        return LE_ERROR_UNKNOWN;
    }
    ts.tv_nsec = ts.tv_nsec + (timeout_ms % 1000) * 1000000000;
    ts.tv_sec = ts.tv_sec + timeout_ms / 1000;
    while ((s = sem_timedwait(&reply->sem, &ts)) == -1 && errno == EINTR) {
        continue;
    }

    if (-1 == s) {
        wsa_remove_reply(msg_id);
        log_e(LOG_TAG, "get reply time_out:%s", strerror(errno));
        return LE_ERROR_TIMEOUT;
    }
    
    if (code) {
        *code = reply->code;
    }
    if (payload) {
        *payload = strdup(reply->payload);
    }
    wsa_remove_reply(msg_id);

    return LE_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r15
movq %rdx, %r12
movl %esi, %r13d
movl %edi, %ebx
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
callq 0x4f42
testq %rax, %rax
je 0x50dc
movq %rax, %r14
leaq -0x50(%rbp), %rsi
xorl %edi, %edi
callq 0x4170
cmpl $-0x1, %eax
je 0x511a
movq %r12, -0x30(%rbp)
movq %r15, -0x38(%rbp)
movl $0x3e8, %ecx            # imm = 0x3E8
movl %r13d, %eax
cltd
idivl %ecx
imull $0x3b9aca00, %edx, %ecx # imm = 0x3B9ACA00
movslq %ecx, %rcx
leaq -0x50(%rbp), %r13
addq %rcx, 0x8(%r13)
cltq
addq %rax, (%r13)
movq %r14, %r12
addq $0x18, %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x4200
cmpl $-0x1, %eax
jne 0x5128
callq 0x4080
cmpl $0x4, (%rax)
je 0x5069
movq %rax, %r15
movl %ebx, %edi
callq 0x43d0
movl (%r15), %edi
callq 0x46c0
movq %rax, %r10
leaq 0x50db(%rip), %r11      # 0xa17e
leaq 0x4fe6(%rip), %rsi      # 0xa090
leaq 0x4fe5(%rip), %rdx      # 0xa096
leaq 0x4fe3(%rip), %rcx      # 0xa09b
leaq 0x5097(%rip), %r8       # 0xa156
pushq $0x3
popq %rdi
movl $0x168, %r9d            # imm = 0x168
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x4290
popq %rax
popq %rcx
movl $0x186a6, %eax          # imm = 0x186A6
jmp 0x5155
leaq 0x5088(%rip), %r10      # 0xa16b
leaq 0x5066(%rip), %rsi      # 0xa150
leaq 0x4fa5(%rip), %rdx      # 0xa096
leaq 0x4fa3(%rip), %rcx      # 0xa09b
leaq 0x5057(%rip), %r8       # 0xa156
xorl %edi, %edi
movl $0x159, %r9d            # imm = 0x159
xorl %eax, %eax
pushq %rbx
pushq %r10
callq 0x4290
popq %rax
popq %rcx
movl $0x186a1, %eax          # imm = 0x186A1
jmp 0x5155
movl %ebx, %edi
callq 0x43d0
movl $0x186a0, %eax          # imm = 0x186A0
jmp 0x5155
movq -0x30(%rbp), %rcx
testq %rcx, %rcx
je 0x5137
movl 0x14(%r14), %eax
movl %eax, (%rcx)
movq -0x38(%rbp), %r15
testq %r15, %r15
je 0x514c
movq 0x38(%r14), %rdi
callq 0x46b0
movq %rax, (%r15)
movl %ebx, %edi
callq 0x43d0
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: leda_parse_received_msg
int leda_parse_received_msg(cJSON *root, int *msg_id, int *code, char **method, cJSON **payload)
{
    cJSON *item = NULL;

    item = cJSON_GetObjectItem(root, "messageId");
    if ((NULL == item) || (cJSON_Number != item->type)) {
        log_e(LOG_TAG, "msg id type is not integer\n");
        return MSG_INVALID;
    }
    *msg_id = item->valueint;
    *payload = cJSON_GetObjectItem(root, "payload");
    item = cJSON_GetObjectItem(root, "code");    
    if (item) {
        if (cJSON_Number != item->type) {
            log_e(LOG_TAG, "code type is not integer\n");
            return MSG_INVALID;
        }
        *code = item->valueint;
        return MSG_RSP;
    }
    item = cJSON_GetObjectItem(root, "method");
    if ((NULL == item) || (cJSON_String != item->type)) {
        return MSG_INVALID;
    }
    *method = item->valuestring;

    return MSG_METHOD;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r12
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %r15
leaq 0x500c(%rip), %rsi      # 0xa194
callq 0x40d0
testq %rax, %rax
je 0x51d6
cmpl $0x8, 0x18(%rax)
jne 0x51d6
movl 0x28(%rax), %eax
movl %eax, (%r13)
leaq 0x502c(%rip), %rsi      # 0xa1d2
movq %r15, %rdi
callq 0x40d0
movq %rax, (%r12)
leaq 0x5021(%rip), %rsi      # 0xa1da
movq %r15, %rdi
callq 0x40d0
testq %rax, %rax
je 0x521f
cmpl $0x8, 0x18(%rax)
jne 0x524a
movl 0x28(%rax), %eax
movl %eax, (%r14)
xorl %eax, %eax
jmp 0x5210
leaq 0x4fd9(%rip), %rax      # 0xa1b6
movq %rax, (%rsp)
leaq 0x4ea8(%rip), %rsi      # 0xa090
leaq 0x4ea7(%rip), %rdx      # 0xa096
leaq 0x4ea5(%rip), %rcx      # 0xa09b
leaq 0x4fa1(%rip), %r8       # 0xa19e
pushq $0x3
popq %rdi
movl $0x17e, %r9d            # imm = 0x17E
xorl %eax, %eax
callq 0x4290
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x506c(%rip), %rsi      # 0xa292
movq %r15, %rdi
callq 0x40d0
movq %rax, %rcx
pushq $-0x1
popq %rax
testq %rcx, %rcx
je 0x5210
cmpl $0x10, 0x18(%rcx)
jne 0x5210
movq 0x20(%rcx), %rax
movq %rax, (%rbx)
pushq $0x1
jmp 0x520f
leaq 0x4f8e(%rip), %rax      # 0xa1df
movq %rax, (%rsp)
leaq 0x4e34(%rip), %rsi      # 0xa090
leaq 0x4e33(%rip), %rdx      # 0xa096
leaq 0x4e31(%rip), %rcx      # 0xa09b
leaq 0x4f2d(%rip), %r8       # 0xa19e
pushq $0x3
popq %rdi
movl $0x186, %r9d            # imm = 0x186
jmp 0x5206
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: leda_send_rsp
int leda_send_rsp(int code, int msg_id, cJSON *payload)
{
    cJSON *root;
    char *msg;
    int ret;

    root = cJSON_CreateObject();
    if (!root) {
        return LE_ERROR_ALLOCATING_MEM;
    }
    cJSON_AddNumberToObject(root, "code", code);
    cJSON_AddNumberToObject(root, "messageId", msg_id);
    if (!payload) {
        payload  = cJSON_CreateObject();
        if (!payload) {
            cJSON_Delete(root);
            return LE_ERROR_ALLOCATING_MEM;
        }
    }
    cJSON_AddItemToObject(root, "payload", payload);

    msg = cJSON_Print(root);
    cJSON_Delete(root);
    if (!msg) {
        return LE_ERROR_ALLOCATING_MEM;
    }
    log_i(LOG_TAG, "send messege to server: %s", msg);
    ret = wsc_add_msg(msg, strlen(msg) + 1, 0);
    free(msg);

    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movl %esi, %r15d
movl %edi, %r12d
callq 0x4640
testq %rax, %rax
je 0x584c
movq %rax, %rbx
cvtsi2sd %r12d, %xmm0
leaq 0x4a4f(%rip), %rsi      # 0xa1da
movq %rax, %rdi
callq 0x4240
cvtsi2sd %r15d, %xmm0
leaq 0x49f5(%rip), %rsi      # 0xa194
movq %rbx, %rdi
callq 0x4240
testq %r14, %r14
jne 0x57bd
callq 0x4640
movq %rax, %r14
testq %rax, %rax
je 0x5844
leaq 0x4a0e(%rip), %rsi      # 0xa1d2
movq %rbx, %rdi
movq %r14, %rdx
callq 0x4690
movq %rbx, %rdi
callq 0x40e0
movq %rax, %r14
movq %rbx, %rdi
callq 0x41d0
testq %r14, %r14
je 0x584c
leaq 0x4a70(%rip), %r10      # 0xa25e
leaq 0x4a4d(%rip), %rsi      # 0xa242
leaq 0x489a(%rip), %rdx      # 0xa096
leaq 0x4898(%rip), %rcx      # 0xa09b
leaq 0x4a9e(%rip), %r8       # 0xa2a8
pushq $0x1
popq %rdi
movl $0x23d, %r9d            # imm = 0x23D
xorl %eax, %eax
pushq %r14
pushq %r10
callq 0x4290
popq %rax
popq %rcx
movq %r14, %rdi
callq 0x4230
leaq 0x1(%rax), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x4500
movl %eax, %ebx
movq %r14, %rdi
callq 0x4750
movl %ebx, %eax
jmp 0x5851
movq %rbx, %rdi
callq 0x41d0
movl $0x186a2, %eax          # imm = 0x186A2
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: leda_rsp_get_properties
int leda_rsp_get_properties(char *pk, char *dn, int msg_id, leda_device_data_t *data, int data_cnt)
{
    int ret = LE_ERROR_UNKNOWN;
    cJSON *root, *payload, *properties;
    char *msg;

    payload = cJSON_CreateObject();
    if (!payload) {
        return LE_ERROR_ALLOCATING_MEM;
    }

    if (g_devs_cb.get_properties_cb) {
        ret = g_devs_cb.get_properties_cb(pk, dn, data, data_cnt, g_devs_cb.usr_data_get_property);
    } else {
        log_e(LOG_TAG, "callback get_properties_cb unregistered!\n");
    }
    
    if (ret == LE_SUCCESS) {
        properties = struct_data_to_json_data(data, data_cnt);
        cJSON_AddItemToObject(payload, "properties", properties);
    }

    return leda_send_rsp(ret, msg_id, payload);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %r15d
movq %rcx, %r12
movl %edx, -0x2c(%rbp)
movq %rsi, %r13
movq %rdi, %rbx
callq 0x4640
testq %rax, %rax
je 0x58cf
movq %rax, %r14
movq 0x8c4a(%rip), %rax      # 0xe4d8
testq %rax, %rax
je 0x58e3
movq 0x8c46(%rip), %r8       # 0xe4e0
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
movl %r15d, %ecx
callq *%rax
movl %eax, %edi
testl %eax, %eax
jne 0x591f
movq %r12, %rdi
movl %r15d, %esi
callq 0x4600
leaq 0x4a03(%rip), %rsi      # 0xa2c3
movq %r14, %rdi
movq %rax, %rdx
callq 0x4690
xorl %edi, %edi
jmp 0x591f
movl $0x186a2, %eax          # imm = 0x186A2
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x49e4(%rip), %rax      # 0xa2ce
movq %rax, (%rsp)
leaq 0x479b(%rip), %rsi      # 0xa090
leaq 0x479a(%rip), %rdx      # 0xa096
leaq 0x4798(%rip), %rcx      # 0xa09b
leaq 0x49ac(%rip), %r8       # 0xa2b6
pushq $0x3
popq %rdi
movl $0x252, %r9d            # imm = 0x252
xorl %eax, %eax
callq 0x4290
movl $0x186a0, %edi          # imm = 0x186A0
movl -0x2c(%rbp), %esi
movq %r14, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x43c0
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: leda_rsp_set_properties
int leda_rsp_set_properties(char *pk, char *dn, int msg_id, leda_device_data_t *data, int data_cnt)
{
    int ret = LE_ERROR_UNKNOWN;

    if (g_devs_cb.set_properties_cb) {
        ret = g_devs_cb.set_properties_cb(pk, dn, data, data_cnt, g_devs_cb.set_properties_cb);
    } else {
        log_e(LOG_TAG, "callback set_properties_cb unregistered!\n");
    }

    return leda_send_rsp(ret, msg_id, NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edx, %ebx
movq 0x8ba1(%rip), %rax      # 0xe4e8
testq %rax, %rax
je 0x595b
movq %rcx, %rdx
movl %r8d, %ecx
movq %rax, %r8
callq *%rax
movl %eax, %edi
jmp 0x5997
leaq 0x49ae(%rip), %rax      # 0xa310
movq %rax, (%rsp)
leaq 0x4723(%rip), %rsi      # 0xa090
leaq 0x4722(%rip), %rdx      # 0xa096
leaq 0x4720(%rip), %rcx      # 0xa09b
leaq 0x4976(%rip), %r8       # 0xa2f8
pushq $0x3
popq %rdi
movl $0x265, %r9d            # imm = 0x265
xorl %eax, %eax
callq 0x4290
movl $0x186a0, %edi          # imm = 0x186A0
movl %ebx, %esi
xorl %edx, %edx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x43c0
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: cb_ws_estab
static void cb_ws_estab(void *user)
{
    g_conn_state = LEDA_WS_CONNECTED;
    log_i(LOG_TAG, "connection establish.\n");

    if (g_conn_cb.conn_state_change_cb) {
        g_conn_cb.conn_state_change_cb(LEDA_WS_CONNECTED, g_conn_cb.usr_data);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
andl $0x0, 0x84ab(%rip)      # 0xe3d8
leaq 0x44e2(%rip), %rax      # 0xa416
movq %rax, (%rsp)
leaq 0x4303(%rip), %rsi      # 0xa242
leaq 0x4150(%rip), %rdx      # 0xa096
leaq 0x414e(%rip), %rcx      # 0xa09b
leaq 0x44b6(%rip), %r8       # 0xa40a
pushq $0x1
popq %rdi
movl $0x329, %r9d            # imm = 0x329
xorl %eax, %eax
callq 0x4290
movq 0x85a5(%rip), %rax      # 0xe510
testq %rax, %rax
je 0x5f80
movq 0x85a1(%rip), %rsi      # 0xe518
xorl %edi, %edi
addq $0x10, %rsp
popq %rbp
jmpq *%rax
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: cb_ws_close
static void cb_ws_close(void *user)
{
    g_conn_state = LEDA_WS_DISCONNECTED;
    log_i(LOG_TAG, "connection closed.\n");

    if (g_conn_cb.conn_state_change_cb) {
        g_conn_cb.conn_state_change_cb(LEDA_WS_DISCONNECTED, g_conn_cb.usr_data);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x1, 0x8440(%rip)      # 0xe3d8
leaq 0x449a(%rip), %rax      # 0xa439
movq %rax, (%rsp)
leaq 0x4298(%rip), %rsi      # 0xa242
leaq 0x40e5(%rip), %rdx      # 0xa096
leaq 0x40e3(%rip), %rcx      # 0xa09b
leaq 0x446e(%rip), %r8       # 0xa42d
pushq $0x1
popq %rdi
movl $0x31f, %r9d            # imm = 0x31F
xorl %eax, %eax
callq 0x4290
movq 0x853a(%rip), %rax      # 0xe510
testq %rax, %rax
je 0x5fec
movq 0x8536(%rip), %rsi      # 0xe518
pushq $0x1
popq %rdi
addq $0x10, %rsp
popq %rbp
jmpq *%rax
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/leda.c
// Function: leda_wsc_exit
int leda_wsc_exit()
{
    g_is_init = 0;
    force_exit = 1;
    
    if (g_threadpool_recv_proc) {
        threadpool_destroy(g_threadpool_recv_proc, threadpool_graceful);
    }
    if (context) {
        lws_cancel_service(context);
        context = NULL;
    }

    return ws_client_destroy();

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movb $0x0, 0x8363(%rip)      # 0xe50c
movq 0x7e40(%rip), %rax      # 0xdff0
movl $0x1, (%rax)
movq 0x7dcb(%rip), %rax      # 0xdf88
movq (%rax), %rdi
testq %rdi, %rdi
je 0x61cd
pushq $0x1
popq %rsi
callq 0x4610
movq 0x7df4(%rip), %rbx      # 0xdfc8
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x61e5
callq 0x4370
andq $0x0, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x4120
nop
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/ali_ws/ws_client.c
// Function: wsc_init
int wsc_init(p_wsc_param_conn pc, p_wsc_param_cb cb)
{
    int ret = 0;
    if (!pc || !cb || !pc->url) {
        printf("wsc init failed, param should not be NULL.\n");
        return LE_ERROR_INVAILD_PARAM;
    }

    if (!strncmp(pc->url, "wss", 3) && !pc->ca_path) {
        printf("ca path must not be NULL when use ssl\n");
    }

    g_cbs = malloc(sizeof(wsc_param_cb));
    if (!g_cbs) {
        printf("malloc error.\n");
        return LE_ERROR_ALLOCATING_MEM;
    }

    memset(g_cbs, 0, sizeof(wsc_param_cb));
    memcpy(g_cbs, cb, sizeof(wsc_param_cb));
    
    force_exit = 0;

    ret = client_buf_mgmt_init(1024 * 2, 1024);
    if (ret != LE_SUCCESS) {
        free(g_cbs);
        g_cbs = NULL;
        return ret;
    }

    pthread_t id;
    ret = pthread_create(&id, NULL, thread_wsc_network, pc);
    if (ret == 0) {
        printf("wsc init ok\n");
    } else {
        free(g_cbs);
        g_cbs = NULL;
#ifndef _WIN32
        printf("wsc init faild, %s.\n", strerror(errno));
#else
        char buffer[64] = { 0 };
        strerror_s(buffer, sizeof(buffer), errno);
        printf("wsc init faild, %s.\n", buffer);
#endif
        client_buf_mgmt_destroy();

        return LE_ERROR_UNKNOWN;
    }
    pthread_detach(id);

    return LE_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x62a9
movq %rdi, %rbx
movq (%rdi), %rax
testq %rax, %rax
je 0x62a9
movq %rsi, %r14
cmpb $0x77, (%rax)
jne 0x6248
cmpb $0x73, 0x1(%rax)
jne 0x6248
cmpb $0x73, 0x2(%rax)
jne 0x6248
cmpq $0x0, 0x10(%rbx)
jne 0x6248
leaq 0x4272(%rip), %rdi      # 0xa4b5
callq 0x4100
pushq $0x30
popq %rdi
callq 0x4758
movq 0x7d49(%rip), %r15      # 0xdfa0
movq %rax, (%r15)
testq %rax, %rax
je 0x62c9
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movq 0x7d71(%rip), %rax      # 0xdff0
movl $0x0, (%rax)
movl $0x800, %edi            # imm = 0x800
movl $0x400, %esi            # imm = 0x400
callq 0x4530
testl %eax, %eax
je 0x62dd
movl %eax, %r14d
movq (%r15), %rdi
callq 0x4750
andq $0x0, (%r15)
jmp 0x62bb
leaq 0x41da(%rip), %rdi      # 0xa48a
callq 0x4100
movl $0x186a1, %r14d         # imm = 0x186A1
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x420b(%rip), %rdi      # 0xa4db
callq 0x4100
movl $0x186a2, %r14d         # imm = 0x186A2
jmp 0x62bb
movq 0x7cf4(%rip), %rdx      # 0xdfd8
xorl %r14d, %r14d
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
movq %rbx, %rcx
callq 0x4560
testl %eax, %eax
je 0x632f
movq (%r15), %rdi
callq 0x4750
andq $0x0, (%r15)
callq 0x4080
movl (%rax), %edi
callq 0x46c0
leaq 0x415d(%rip), %rdi      # 0xa475
movq %rax, %rsi
xorl %eax, %eax
callq 0x4270
callq 0x4250
movl $0x186a0, %r14d         # imm = 0x186A0
jmp 0x62bb
leaq 0x41b3(%rip), %rdi      # 0xa4e9
callq 0x4100
movq -0x20(%rbp), %rdi
callq 0x44b0
jmp 0x62bb
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/ali_ws/ws_client.c
// Function: ws_client_destroy
int ws_client_destroy()
{
    force_exit = 1;
#ifndef _WIN32
    usleep(1000*1000);
#else
    Sleep(1000);
#endif
    if (g_cbs) {
        free(g_cbs);
        g_cbs = NULL;
    }

    return client_buf_mgmt_destroy();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x7c71(%rip), %rax      # 0xdff0
movl $0x1, (%rax)
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x4740
movq 0x7c0a(%rip), %rbx      # 0xdfa0
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x63a7
callq 0x4750
andq $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x4250
nop
// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/ali_ws/ws_client_callback.c
// Function: recvframeAppend
static int recvframeAppend(struct lws *wsi, void **appendBuffer, void *in, size_t preLen, size_t len)
{
    char *tmp = NULL;
    
    if (*appendBuffer == NULL){
        tmp = malloc(preLen + len + 1);
    } else {
        tmp = realloc((void *)*appendBuffer,preLen + len + 1);
    } 

    if(!tmp)
    {
        lwsl_notice("recv malloc error:  %p\n", wsi);
        return 0;
    }

    memcpy(tmp + preLen, (void *)in, len);
    *(tmp + preLen +len) = 0;
    *appendBuffer = tmp;
    return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, -0x30(%rbp)
movq (%rsi), %rdi
leaq (%rcx,%r8), %rsi
incq %rsi
testq %rdi, %rdi
je 0x6559
callq 0x4760
jmp 0x6561
movq %rsi, %rdi
callq 0x4758
movq %rax, %r12
testq %rax, %rax
je 0x6584
addq %r12, %r14
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x43f0
movb $0x0, (%rbx,%r14)
movq %r12, (%r15)
jmp 0x659b
leaq 0x3f95(%rip), %rsi      # 0xa520
xorl %ebx, %ebx
pushq $0x4
popq %rdi
movq -0x30(%rbp), %rdx
xorl %eax, %eax
callq 0x4260
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq