#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 /*<<< orphan*/ XDR;

/* Variables and functions */
int PATH_MAX;
int /*<<< orphan*/ eacces(int);
scalar_t__ get_fn(int, int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ link(char *, char *);
int /*<<< orphan*/ status_return(int, int /*<<< orphan*/);
void ltspfs_link(int sockfd, XDR *in) {
  char from[PATH_MAX];
  char to[PATH_MAX];
  if (get_fn(sockfd, in, from)) {
    eacces(sockfd);
    return;
  }
  if (get_fn(sockfd, in, to)) {
    eacces(sockfd);
    return;
  }
  status_return(sockfd, link(from, to));
}


x86 assembly (clang, -O0):
<ltspfs_link>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x40(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x20(%rbp)
mov    (%rax),%eax
mov    %rax,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rcx
sub    %rsi,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <get_fn@plt>
cmp    $0x0,%rax
je     11c3 <ltspfs_link+0x83>
mov    -0x4(%rbp),%edi
call   1040 <eacces@plt>
movl   $0x1,-0x2c(%rbp)
jmp    1215 <ltspfs_link+0xd5>
mov    -0x38(%rbp),%rdx
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <get_fn@plt>
cmp    $0x0,%rax
je     11f1 <ltspfs_link+0xb1>
mov    -0x4(%rbp),%edi
call   1040 <eacces@plt>
movl   $0x1,-0x2c(%rbp)
jmp    1215 <ltspfs_link+0xd5>
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdi
mov    -0x4(%rbp),%eax
mov    %eax,-0x44(%rbp)
call   1050 <link@plt>
mov    -0x44(%rbp),%edi
mov    %eax,%esi
call   1030 <status_return@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltspfs_link>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %edi,%r15d
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rsp,%r12
sub    %rax,%r12
mov    %r12,%rsp
mov    %rbx,%rdx
call   1060 <get_fn@plt>
test   %rax,%rax
jne    1194 <ltspfs_link+0x54>
mov    %r15d,%edi
mov    %r14,%rsi
mov    %r12,%rdx
call   1060 <get_fn@plt>
test   %rax,%rax
je     11a9 <ltspfs_link+0x69>
mov    %r15d,%edi
call   1040 <eacces@plt>
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <link@plt>
mov    %r15d,%edi
mov    %eax,%esi
call   1030 <status_return@plt>
jmp    119c <ltspfs_link+0x5c>

LLVM IR (-O0):
@PATH_MAX = global i32 0
define void @ltspfs_link(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%9 = load i32, i32* @PATH_MAX
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %5
%12 = alloca i8, i64 %10
store i64 %10, i64* %6
%13 = load i32, i32* @PATH_MAX
%14 = zext i32 %13 to i64
%15 = alloca i8, i64 %14
store i64 %14, i64* %7
%16 = load i32, i32* %3
%17 = load i32*, i32** %4
%18 = call i64 @get_fn(i32 %16, i32* %17, i8* %12)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %2
%21 = load i32, i32* %3
%22 = call i32 @eacces(i32 %21)
store i32 1, i32* %8
br label %35
23: ; preds = %2
%24 = load i32, i32* %3
%25 = load i32*, i32** %4
%26 = call i64 @get_fn(i32 %24, i32* %25, i8* %15)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = load i32, i32* %3
%30 = call i32 @eacces(i32 %29)
store i32 1, i32* %8
br label %35
31: ; preds = %23
%32 = load i32, i32* %3
%33 = call i32 @link(i8* %12, i8* %15)
%34 = call i32 @status_return(i32 %32, i32 %33)
store i32 0, i32* %8
br label %35
35: ; preds = %31, %28, %20
%36 = load i8*, i8** %5
%37 = load i32, i32* %8
switch i32 %37, label %39 [
i32 0, label %38
i32 1, label %38
]
38: ; preds = %35, %35
ret void
39: ; preds = %35
unreachable
}

LLVM IR (-O2):
@PATH_MAX = global i32 0
define void @ltspfs_link(i32 %0, i32* %1) {
%3 = load i32, i32* @PATH_MAX
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = alloca i8, i64 %4
%7 = call i64 @get_fn(i32 %0, i32* %1, i8* %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = call i32 @eacces(i32 %0)
br label %19
11: ; preds = %2
%12 = call i64 @get_fn(i32 %0, i32* %1, i8* %6)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = call i32 @eacces(i32 %0)
br label %19
16: ; preds = %11
%17 = call i32 @link(i8* %5, i8* %6)
%18 = call i32 @status_return(i32 %0, i32 %17)
br label %19
19: ; preds = %16, %14, %9
ret void
}