#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*/ time_t;
struct chirp_client {
  int dummy;
};
typedef int /*<<< orphan*/ safepath;
typedef int int64_t;

/* Variables and functions */
scalar_t__ EINVAL;
scalar_t__ errno;
int simple_command(struct chirp_client *, int /*<<< orphan*/, char *, char *,
                   char const *);
int /*<<< orphan*/ url_encode(char const *, char *, int);
int64_t chirp_client_lremovexattr(struct chirp_client *c, const char *path,
                                  const char *name, time_t stoptime) {
  char safepath[1024];
  url_encode(path, safepath, sizeof(safepath));
  int64_t result =
      simple_command(c, stoptime, "lremovexattr %s %s\n", safepath, name);
  if (result == -1 && errno == EINVAL)
    errno = EINVAL;
  return result;
}


x86 assembly (clang, -O0):
<chirp_client_lremovexattr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
call   1040 <url_encode@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
lea    -0x420(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xe98(%rip),%rdx
call   1030 <simple_command@plt>
mov    %eax,-0x424(%rbp)
cmpl   $0xffffffff,-0x424(%rbp)
jne    11ae <chirp_client_lremovexattr+0x8e>
mov    0x2e59(%rip),%rax
mov    (%rax),%rax
mov    0x2e47(%rip),%rcx
cmp    (%rcx),%rax
jne    11ae <chirp_client_lremovexattr+0x8e>
mov    0x2e37(%rip),%rax
mov    (%rax),%rcx
mov    0x2e35(%rip),%rax
mov    %rcx,(%rax)
mov    -0x424(%rbp),%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chirp_client_lremovexattr>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %rdi,%rbx
mov    %rsp,%r15
mov    %rsi,%rdi
mov    %r15,%rsi
mov    $0x400,%edx
call   1040 <url_encode@plt>
lea    0xeb1(%rip),%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r15,%rcx
mov    %r14,%r8
call   1030 <simple_command@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.chirp_client = type { i32 }
@.str = [20 x i8] c"lremovexattr %s %s\0A\00"
@errno = global i64 0
@EINVAL = global i64 0
define i32 @chirp_client_lremovexattr(%struct.chirp_client* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca [1024 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = call i32 @url_encode(i8* %1, i8* %6, i32 1024)
%8 = call i32 @simple_command(%struct.chirp_client* %0, i32 %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %2)
ret i32 %8
}