#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int ENOTSUP;
int /*<<< orphan*/ cctools_debug(long long, char *, char const *, char const *);
int chirp_fs_hdfs_resolve(char const *, char *);
int errno;
int64_t chirp_fs_hdfs_link(const char *path, const char *newpath) {
  char resolved_path[1024];
  if (chirp_fs_hdfs_resolve(path, resolved_path) == -1)
    return -1;
  path = resolved_path;
  char resolved_newpath[1024];
  if (chirp_fs_hdfs_resolve(newpath, resolved_newpath) == -1)
    return -1;
  newpath = resolved_newpath;
  cctools_debug((1LL << 32), "link %s %s", path, newpath);
  return (errno = ENOTSUP, -1);
}


x86 assembly (clang, -O0):
<chirp_fs_hdfs_link>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x420(%rbp),%rsi
call   1030 <chirp_fs_hdfs_resolve@plt>
cmp    $0xffffffff,%eax
jne    1158 <chirp_fs_hdfs_link+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ca <chirp_fs_hdfs_link+0xaa>
lea    -0x420(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x820(%rbp),%rsi
call   1030 <chirp_fs_hdfs_resolve@plt>
cmp    $0xffffffff,%eax
jne    1188 <chirp_fs_hdfs_link+0x68>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ca <chirp_fs_hdfs_link+0xaa>
lea    -0x820(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
movabs $0x100000000,%rdi
lea    0xe54(%rip),%rsi
call   1040 <cctools_debug@plt>
mov    0x2e30(%rip),%rax
mov    (%rax),%ecx
mov    0x2e17(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chirp_fs_hdfs_link>:
push   %rbx
sub    $0x800,%rsp
mov    %rsi,%rbx
lea    0x400(%rsp),%rsi
call   1030 <chirp_fs_hdfs_resolve@plt>
cmp    $0xffffffff,%eax
je     1180 <chirp_fs_hdfs_link+0x60>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <chirp_fs_hdfs_resolve@plt>
cmp    $0xffffffff,%eax
je     1180 <chirp_fs_hdfs_link+0x60>
lea    0xeac(%rip),%rsi
movabs $0x100000000,%rdi
lea    0x400(%rsp),%rdx
mov    %rsp,%rcx
call   1040 <cctools_debug@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%eax
mov    0x2e5a(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
add    $0x800,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"link %s %s\00"
@ENOTSUP = global i32 0
@errno = global i32 0
define i32 @chirp_fs_hdfs_link(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [1024 x i8]
%7 = alloca [1024 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%10 = call i32 @chirp_fs_hdfs_resolve(i8* %8, i8* %9)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 -1, i32* %3
br label %26
13: ; preds = %2
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
store i8* %14, i8** %4
%15 = load i8*, i8** %5
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%17 = call i32 @chirp_fs_hdfs_resolve(i8* %15, i8* %16)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %20
19: ; preds = %13
store i32 -1, i32* %3
br label %26
20: ; preds = %13
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
store i8* %21, i8** %5
%22 = load i8*, i8** %4
%23 = load i8*, i8** %5
%24 = call i32 @cctools_debug(i64 4294967296, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %22, i8* %23)
%25 = load i32, i32* @ENOTSUP
store i32 %25, i32* @errno
store i32 -1, i32* %3
br label %26
26: ; preds = %20, %19, %12
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [11 x i8] c"link %s %s\00"
@ENOTSUP = global i32 0
@errno = global i32 0
define i32 @chirp_fs_hdfs_link(i8* %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = call i32 @chirp_fs_hdfs_resolve(i8* %0, i8* %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %16, label %8
8: ; preds = %2
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%10 = call i32 @chirp_fs_hdfs_resolve(i8* %1, i8* %9)
%11 = icmp eq i32 %10, -1
br i1 %11, label %15, label %12
12: ; preds = %8
%13 = call i32 @cctools_debug(i64 4294967296, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %9)
%14 = load i32, i32* @ENOTSUP
store i32 %14, i32* @errno
br label %15
15: ; preds = %8, %12
br label %16
16: ; preds = %2, %15
ret i32 -1
}