#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 */
struct utimbuf {
  int dummy;
};
struct afp_volume {
  int dummy;
};

/* Variables and functions */
int EPERM;
int extra_translate(struct afp_volume *, char const *, char **);
int /*<<< orphan*/ free(char *);
int appledouble_utime(struct afp_volume *volume, const char *path,
                      struct utimbuf *timebuf) {
  int resource;
  char *newpath;
  resource = extra_translate(volume, path, &newpath);
  free(newpath);
  if (resource == 0)
    return 0;
  return -EPERM;
}


x86 assembly (clang, -O0):
<appledouble_utime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1040 <extra_translate@plt>
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x24(%rbp)
jne    1167 <appledouble_utime+0x47>
movl   $0x0,-0x4(%rbp)
jmp    1175 <appledouble_utime+0x55>
xor    %eax,%eax
mov    0x2e68(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<appledouble_utime>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rdx
call   1040 <extra_translate@plt>
mov    %eax,%ebx
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    0x2e96(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
test   %ebx,%ebx
cmove  %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.afp_volume = type { i32 }
%struct.utimbuf = type { i32 }
@EPERM = global i32 0
define i32 @appledouble_utime(%struct.afp_volume* %0, i8* %1, %struct.utimbuf* %2) {
%4 = alloca i32
%5 = alloca %struct.afp_volume*
%6 = alloca i8*
%7 = alloca %struct.utimbuf*
%8 = alloca i32
%9 = alloca i8*
store %struct.afp_volume* %0, %struct.afp_volume** %5
store i8* %1, i8** %6
store %struct.utimbuf* %2, %struct.utimbuf** %7
%10 = load %struct.afp_volume*, %struct.afp_volume** %5
%11 = load i8*, i8** %6
%12 = call i32 @extra_translate(%struct.afp_volume* %10, i8* %11, i8** %9)
store i32 %12, i32* %8
%13 = load i8*, i8** %9
%14 = call i32 @free(i8* %13)
%15 = load i32, i32* %8
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %3
store i32 0, i32* %4
br label %21
18: ; preds = %3
%19 = load i32, i32* @EPERM
%20 = sub nsw i32 0, %19
store i32 %20, i32* %4
br label %21
21: ; preds = %18, %17
%22 = load i32, i32* %4
ret i32 %22
}

LLVM IR (-O2):
%struct.afp_volume = type { i32 }
%struct.utimbuf = type { i32 }
@EPERM = global i32 0
define i32 @appledouble_utime(%struct.afp_volume* %0, i8* %1, %struct.utimbuf* nocapture readnone %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = call i32 @extra_translate(%struct.afp_volume* %0, i8* %1, i8** %4)
%7 = load i8*, i8** %4
%8 = call i32 @free(i8* %7)
%9 = icmp eq i32 %6, 0
%10 = load i32, i32* @EPERM
%11 = sub nsw i32 0, %10
%12 = select i1 %9, i32 0, i32 %11
ret i32 %12
}