// File: /workspace/github_c_makefile_star2_O0/lyda[P]tz/zic.c
// Function: dolink
static void
dolink(fromfield, tofield)
const char * const	fromfield;
const char * const	tofield;
{
	register char *	fromname;
	register char *	toname;

	if (fromfield[0] == '/')
		fromname = ecpyalloc(fromfield);
	else {
		fromname = ecpyalloc(directory);
		fromname = ecatalloc(fromname, "/");
		fromname = ecatalloc(fromname, fromfield);
	}
	if (tofield[0] == '/')
		toname = ecpyalloc(tofield);
	else {
		toname = ecpyalloc(directory);
		toname = ecatalloc(toname, "/");
		toname = ecatalloc(toname, tofield);
	}
	/*
	** We get to be careful here since
	** there's a fair chance of root running us.
	*/
	if (!itsdir(toname))
		(void) remove(toname);
	if (link(fromname, toname) != 0) {
		int	result;

		if (mkdirs(toname) != 0)
			exit(EXIT_FAILURE);

		result = link(fromname, toname);
#if HAVE_SYMLINK
		if (result != 0 &&
			access(fromname, F_OK) == 0 &&
			!itsdir(fromname)) {
				const char *s = tofield;
				register char * symlinkcontents = NULL;

				while ((s = strchr(s+1, '/')) != NULL)
					symlinkcontents =
						ecatalloc(symlinkcontents,
						"../");
				symlinkcontents =
					ecatalloc(symlinkcontents,
					fromname);
				result = symlink(symlinkcontents,
					toname);
				if (result == 0)
warning(_("hard link failed, symbolic link used"));
				ifree(symlinkcontents);
		}
#endif /* HAVE_SYMLINK */
		if (result != 0) {
			const char *e = strerror(errno);

			(void) fprintf(stderr,
				_("%s: Can't link from %s to %s: %s\n"),
				progname, fromname, toname, e);
			exit(EXIT_FAILURE);
		}
	}
	ifree(fromname);
	ifree(toname);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0x3dc3
movq -0x8(%rbp), %rdi
callq 0xd140
movq %rax, %rdi
callq 0x40b0
movq %rax, -0x18(%rbp)
jmp 0x3e10
movq 0xe3ee(%rip), %rdi      # 0x121b8
callq 0xd140
movq %rax, %rdi
callq 0x40b0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0xa63a(%rip), %rsi      # 0xe420
callq 0xd090
movq %rax, %rdi
callq 0x40b0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0xd090
movq %rax, %rdi
callq 0x40b0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0x3e33
movq -0x10(%rbp), %rdi
callq 0xd140
movq %rax, %rdi
callq 0x40b0
movq %rax, -0x20(%rbp)
jmp 0x3e80
movq 0xe37e(%rip), %rdi      # 0x121b8
callq 0xd140
movq %rax, %rdi
callq 0x40b0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq 0xa5ca(%rip), %rsi      # 0xe420
callq 0xd090
movq %rax, %rdi
callq 0x40b0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xd090
movq %rax, %rdi
callq 0x40b0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x41b0
cmpl $0x0, %eax
jne 0x3e97
movq -0x20(%rbp), %rdi
callq 0x2070
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x2260
cmpl $0x0, %eax
je 0x3fe0
movq -0x20(%rbp), %rdi
callq 0x4220
cmpl $0x0, %eax
je 0x3ec5
movl $0x1, %edi
callq 0x2270
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x2260
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x3f93
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x2210
cmpl $0x0, %eax
jne 0x3f93
movq -0x18(%rbp), %rdi
callq 0x41b0
cmpl $0x0, %eax
jne 0x3f93
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x30(%rbp), %rdi
addq $0x1, %rdi
movl $0x2f, %esi
callq 0x20f0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x3f4f
movq -0x38(%rbp), %rdi
leaq 0xa4e2(%rip), %rsi      # 0xe41e
callq 0xd090
movq %rax, %rdi
callq 0x40b0
movq %rax, -0x38(%rbp)
jmp 0x3f15
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xd090
movq %rax, %rdi
callq 0x40b0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x2110
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x3f8a
leaq 0xa49d(%rip), %rdi      # 0xe422
callq 0x4000
movq -0x38(%rbp), %rdi
callq 0xd160
cmpl $0x0, -0x24(%rbp)
je 0x3fde
callq 0x2050
movl (%rax), %edi
callq 0x2290
movq %rax, -0x40(%rbp)
movq 0xe048(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xe1f6(%rip), %rdx      # 0x121b0
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
movq -0x40(%rbp), %r9
leaq 0xa47a(%rip), %rsi      # 0xe447
movb $0x0, %al
callq 0x2180
movl $0x1, %edi
callq 0x2270
jmp 0x3fe0
movq -0x18(%rbp), %rdi
callq 0xd160
movq -0x20(%rbp), %rdi
callq 0xd160
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)