// File: /workspace/github_c_makefile_star2_O0/xiaowenhuyuehu[P]remote_access/src/core/config_manager.c
// Function: load_cfg_from_json
static char *_load_cfg_from_json(char *path, char *name)
{
	char *content = NULL;
	char *file_name = NULL;
	FILE *fp = NULL;
	long file_len = 0;
	int tmp = 0;

	if(!name || !path)
		return NULL;

	tmp = strlen(path) + strlen(name) + 1 + 1;//add \0 and /
	file_name = malloc(tmp);
	if(file_name == NULL){
		log_error("failed to alloc memory to save abs path");	
		exit(1);
	}
	memset(file_name, 0, tmp);
	snprintf(file_name, tmp, "%s/%s", path, name);
	fp = fopen(file_name, "r");
	if(!fp){
		log_error("failed to open file: %s: %s", file_name, strerror(errno));
		free(file_name);
		exit(1);
	}

	fseek(fp, 0L, SEEK_SET);
	fseek(fp, 0L, SEEK_END);
	file_len = ftell(fp);
	if(file_len <= 0){
		log_error("file: %s is empty", file_name);
		fclose(fp);
		free(file_name);
		exit(1);
	}

    file_len += 1;
	content = malloc(file_len);
	if(content == NULL){
		log_error("failed to alloc memory to save config file content ");
		fclose(fp);
		free(file_name);
		exit(1);
	}
	memset(content, 0, file_len); 
	fseek(fp, 0L, SEEK_SET);
	if(fread(content, 1, file_len, fp) < file_len - 1){
        log_error("failed to read file content: %s\n", strerror(errno)); 
    }
	fclose(fp);
	free(file_name);
	return content;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x9c85
cmpq $0x0, -0x10(%rbp)
jne 0x9c92
movq $0x0, -0x8(%rbp)
jmp 0x9f0b
movq -0x10(%rbp), %rdi
callq 0x2260
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2260
movq %rax, %rcx
movq -0x48(%rbp), %rax
addq %rcx, %rax
addq $0x1, %rax
addq $0x1, %rax
movl %eax, -0x3c(%rbp)
movslq -0x3c(%rbp), %rdi
callq 0x2140
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x9d01
movl $0x3, %edi
leaq 0x1903(%rip), %rsi      # 0xb5e0
leaq 0x220b(%rip), %rdx      # 0xbeef
movl $0x2b, %ecx
leaq 0x2369(%rip), %r8       # 0xc059
movb $0x0, %al
callq 0x4f90
movl $0x1, %edi
callq 0x2100
movq -0x28(%rbp), %rdi
movslq -0x3c(%rbp), %rdx
xorl %esi, %esi
callq 0x2090
movq -0x28(%rbp), %rdi
movslq -0x3c(%rbp), %rsi
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %r8
leaq 0x235a(%rip), %rdx      # 0xc081
movb $0x0, %al
callq 0x20b0
movq -0x28(%rbp), %rdi
leaq 0x1b49(%rip), %rsi      # 0xb882
callq 0x2150
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x9d9e
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
callq 0x23e0
movl (%rax), %edi
callq 0x2320
movq -0x50(%rbp), %r9
movl $0x3, %edi
leaq 0x1873(%rip), %rsi      # 0xb5e0
leaq 0x217b(%rip), %rdx      # 0xbeef
movl $0x32, %ecx
leaq 0x2307(%rip), %r8       # 0xc087
movq %rax, (%rsp)
movb $0x0, %al
callq 0x4f90
movq -0x28(%rbp), %rdi
callq 0x2240
movl $0x1, %edi
callq 0x2100
movq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x20d0
movq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x20d0
movq -0x30(%rbp), %rdi
callq 0x20a0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jg 0x9e19
movq -0x28(%rbp), %r9
movl $0x3, %edi
leaq 0x17fd(%rip), %rsi      # 0xb5e0
leaq 0x2105(%rip), %rdx      # 0xbeef
movl $0x3b, %ecx
leaq 0x22ad(%rip), %r8       # 0xc0a3
movb $0x0, %al
callq 0x4f90
movq -0x30(%rbp), %rdi
callq 0x24a0
movq -0x28(%rbp), %rdi
callq 0x2240
movl $0x1, %edi
callq 0x2100
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x2140
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x9e7b
movl $0x3, %edi
leaq 0x179b(%rip), %rsi      # 0xb5e0
leaq 0x20a3(%rip), %rdx      # 0xbeef
movl $0x44, %ecx
leaq 0x225d(%rip), %r8       # 0xc0b5
movb $0x0, %al
callq 0x4f90
movq -0x30(%rbp), %rdi
callq 0x24a0
movq -0x28(%rbp), %rdi
callq 0x2240
movl $0x1, %edi
callq 0x2100
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rdx
xorl %esi, %esi
callq 0x2090
movq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x20d0
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rcx
movl $0x1, %esi
callq 0x23c0
movq -0x38(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x9ef1
callq 0x23e0
movl (%rax), %edi
callq 0x2320
movq %rax, %r9
movl $0x3, %edi
leaq 0x1709(%rip), %rsi      # 0xb5e0
leaq 0x2011(%rip), %rdx      # 0xbeef
movl $0x4c, %ecx
leaq 0x21ff(%rip), %r8       # 0xc0e9
movb $0x0, %al
callq 0x4f90
movq -0x30(%rbp), %rdi
callq 0x24a0
movq -0x28(%rbp), %rdi
callq 0x2240
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)