// File: /workspace/github_c_makefile_star2_O0/containers[P]conmon/src/conn_sock.c
// Function: socket_parent_dir
char *socket_parent_dir(gboolean use_full_attach_path, size_t desired_len)
{
	/* if we're to use the full path, ignore the socket path and only use the bundle_path */
	if (use_full_attach_path)
		return strdup(opt_bundle_path);

	char *base_path = g_build_filename(opt_socket_path, opt_cuuid, NULL);

	/*
	 * This is to address a corner case where the symlink path length can end up being
	 * the same as the socket.  When it happens, the symlink prevents the socket from being
	 * be created.  This could still be a problem with other containers, but it is safe
	 * to assume the CUUIDs don't change length in the same directory.  As a workaround,
	 *  in such case, make the symlink one char shorter.
	 *
	 * If we're using using_full_attach_path, this is unnecessary.
	 */
	if (strlen(base_path) == (desired_len - 1))
		base_path[desired_len - 2] = '\0';

	/*
	 * Create a symlink so we don't exceed unix domain socket
	 * path length limit.  We use the base path passed in from our parent.
	 */
	if (unlink(base_path) == -1 && errno != ENOENT)
		pexitf("Failed to remove existing symlink for socket directory %s", base_path);

	if (symlink(opt_bundle_path, base_path) == -1)
		pexit("Failed to create symlink for notify socket");

	// Ensure the link is deleted when we exit
	atexit(cleanup_socket_dir_symlink);

	return base_path;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0xb86d
leaq 0x1f734(%rip), %rax     # 0x2af90
movq (%rax), %rdi
callq 0x45f0
movq %rax, -0x8(%rbp)
jmp 0xb9aa
leaq 0xac4c(%rip), %rax      # 0x164c0
movq (%rax), %rdi
leaq 0x1f6fa(%rip), %rax     # 0x2af78
movq (%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
movb $0x0, %al
callq 0x46a0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x4360
movq -0x18(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0xb8b6
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
subq $0x2, %rcx
movb $0x0, (%rax,%rcx)
movq -0x20(%rbp), %rdi
callq 0x4290
cmpl $-0x1, %eax
jne 0xb923
callq 0x45c0
cmpl $0x2, (%rax)
je 0xb923
jmp 0xb8d0
movq 0xa719(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
movq -0x20(%rbp), %rdx
leaq 0x6248(%rip), %rsi      # 0x11b2d
movb $0x0, %al
callq 0x4830
leaq 0x1f655(%rip), %rax     # 0x2af48
cmpl $0x0, (%rax)
je 0xb919
leaq 0x1f641(%rip), %rax     # 0x2af40
movq (%rax), %rdx
movq -0x20(%rbp), %rcx
movl $0x3, %edi
leaq 0x6265(%rip), %rsi      # 0x11b77
movb $0x0, %al
callq 0x4120
movl $0x1, %edi
callq 0x41e0
leaq 0x1f666(%rip), %rax     # 0x2af90
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x4050
cmpl $-0x1, %eax
jne 0xb996
jmp 0xb93d
movq 0xa6ac(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x36c5(%rip), %rsi      # 0xf013
leaq 0x6277(%rip), %rdx      # 0x11bcc
movb $0x0, %al
callq 0x4830
leaq 0x1f5e5(%rip), %rax     # 0x2af48
cmpl $0x0, (%rax)
je 0xb98c
leaq 0x1f5d1(%rip), %rax     # 0x2af40
movq (%rax), %rdx
movl $0x3, %edi
leaq 0x36bf(%rip), %rsi      # 0xf03d
leaq 0x6247(%rip), %rcx      # 0x11bcc
movb $0x0, %al
callq 0x4120
movl $0x1, %edi
callq 0x41e0
leaq 0x2b73(%rip), %rdi      # 0xe510
callq 0xef70
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)