// File: /workspace/github_c_makefile_star2_O0/jarun[P]nnn/src/nnn.c
// Function: make_tmp_tree
static char *make_tmp_tree(char **paths, ssize_t entries, const char *prefix)
{
	/* tmpdir holds the full path */
	/* tmp holds the path without the tmp dir prefix */
	int err;
	struct stat sb;
	char *slash, *tmp;
	ssize_t len = xstrlen(prefix);
	char *tmpdir = malloc(PATH_MAX);

	if (!tmpdir) {
		DPRINTF_S(strerror(errno));
		return NULL;
	}

	tmp = tmpdir + tmpfplen - 1;
	xstrsncpy(tmpdir, g_tmpfpath, tmpfplen);
	xstrsncpy(tmp, "/nnnXXXXXX", 11);

	/* Points right after the base tmp dir */
	tmp += 10;

	/* handle the case where files are directly under / */
	if (!prefix[1] && (prefix[0] == '/'))
		len = 0;

	if (!mkdtemp(tmpdir)) {
		free(tmpdir);

		DPRINTF_S(strerror(errno));
		return NULL;
	}

	listpath = tmpdir;

	for (ssize_t i = 0; i < entries; ++i) {
		if (!paths[i])
			continue;

		err = stat(paths[i], &sb);
		if (err && errno == ENOENT)
			continue;

		/* Don't copy the common prefix */
		xstrsncpy(tmp, paths[i] + len, xstrlen(paths[i]) - len + 1);

		/* Get the dir containing the path */
		slash = xmemrchr((uchar_t *)tmp, '/', xstrlen(paths[i]) - len);
		if (slash)
			*slash = '\0';

		if (access(tmpdir, F_OK)) /* Create directory if it doesn't exist */
			xmktree(tmpdir, TRUE);

		if (slash)
			*slash = '/';

		if (symlink(paths[i], tmpdir)) {
			DPRINTF_S(paths[i]);
			DPRINTF_S(strerror(errno));
		}
	}

	/* Get the dir in which to start */
	*tmp = '\0';
	return tmpdir;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x5cc0
movq %rax, -0xd0(%rbp)
movl $0x1000, %edi           # imm = 0x1000
callq 0x45e0
movq %rax, -0xd8(%rbp)
cmpq $0x0, -0xd8(%rbp)
jne 0xcd9f
movq $0x0, -0x8(%rbp)
jmp 0xd004
movq -0xd8(%rbp), %rax
movzbl 0x13c93(%rip), %ecx     # 0x20a40
movslq %ecx, %rcx
addq %rcx, %rax
addq $-0x1, %rax
movq %rax, -0xc8(%rbp)
movq -0xd8(%rbp), %rdi
movzbl 0x13c74(%rip), %eax     # 0x20a40
movl %eax, %edx
leaq 0x13c2b(%rip), %rsi     # 0x20a00
callq 0x6250
movq -0xc8(%rbp), %rdi
leaq 0xf385(%rip), %rsi      # 0x1c16d
movl $0xb, %edx
callq 0x6250
movq -0xc8(%rbp), %rax
addq $0xa, %rax
movq %rax, -0xc8(%rbp)
movq -0x20(%rbp), %rax
cmpb $0x0, 0x1(%rax)
jne 0xce25
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0xce25
movq $0x0, -0xd0(%rbp)
movq -0xd8(%rbp), %rdi
callq 0x4680
cmpq $0x0, %rax
jne 0xce50
movq -0xd8(%rbp), %rdi
callq 0x4090
movq $0x0, -0x8(%rbp)
jmp 0xd004
movq -0xd8(%rbp), %rax
movq %rax, 0x15022(%rip)     # 0x21e80
movq $0x0, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0xcfef
movq -0x10(%rbp), %rax
movq -0xe0(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0xce91
jmp 0xcfd8
movq -0x10(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x4300
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0xcec4
callq 0x40c0
cmpl $0x2, (%rax)
jne 0xcec4
jmp 0xcfd8
movq -0xc8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x10(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq -0xd0(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x10(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x5cc0
movq -0xf8(%rbp), %rdi
movq -0xf0(%rbp), %rsi
movq %rax, %rdx
subq -0xd0(%rbp), %rdx
addq $0x1, %rdx
callq 0x6250
movq -0xc8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x10(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x5cc0
movq -0xe8(%rbp), %rdi
movq %rax, %rdx
subq -0xd0(%rbp), %rdx
movl $0x2f, %esi
callq 0xcad0
movq %rax, -0xc0(%rbp)
cmpq $0x0, -0xc0(%rbp)
je 0xcf7c
movq -0xc0(%rbp), %rax
movb $0x0, (%rax)
movq -0xd8(%rbp), %rdi
xorl %esi, %esi
callq 0x4720
cmpl $0x0, %eax
je 0xcfa0
movq -0xd8(%rbp), %rdi
movl $0x1, %esi
callq 0x7360
cmpq $0x0, -0xc0(%rbp)
je 0xcfb4
movq -0xc0(%rbp), %rax
movb $0x2f, (%rax)
movq -0x10(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0xd8(%rbp), %rsi
callq 0x4910
cmpl $0x0, %eax
je 0xcfd6
jmp 0xcfd6
jmp 0xcfd8
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0xce69
movq -0xc8(%rbp), %rax
movb $0x0, (%rax)
movq -0xd8(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)