#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*/ rmdir(char *);
int /*<<< orphan*/ status_return(int, int /*<<< orphan*/);
void ltspfs_rmdir(int sockfd, XDR *in) {
  char path[PATH_MAX];
  if (get_fn(sockfd, in, path)) {
    eacces(sockfd);
    return;
  }
  status_return(sockfd, rmdir(path));
}


x86 assembly (clang, -O0):
<ltspfs_rmdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x30(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <get_fn@plt>
cmp    $0x0,%rax
je     11a5 <ltspfs_rmdir+0x65>
mov    -0x4(%rbp),%edi
call   1050 <eacces@plt>
movl   $0x1,-0x24(%rbp)
jmp    11c5 <ltspfs_rmdir+0x85>
mov    -0x30(%rbp),%rdi
mov    -0x4(%rbp),%eax
mov    %eax,-0x34(%rbp)
call   1030 <rmdir@plt>
mov    -0x34(%rbp),%edi
mov    %eax,%esi
call   1040 <status_return@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltspfs_rmdir>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
mov    %edi,%r14d
mov    0x2e9f(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdx
call   1060 <get_fn@plt>
test   %rax,%rax
je     117b <ltspfs_rmdir+0x3b>
mov    %r14d,%edi
call   1050 <eacces@plt>
jmp    118d <ltspfs_rmdir+0x4d>
mov    %rbx,%rdi
call   1030 <rmdir@plt>
mov    %r14d,%edi
mov    %eax,%esi
call   1040 <status_return@plt>
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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