#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 yaffs_utimbuf {
  int dummy;
};
struct yaffs_obj {
  int dummy;
};

/* Variables and functions */
int yaffsfs_DoUtime(struct yaffs_obj *, struct yaffs_utimbuf const *);
struct yaffs_obj *yaffsfs_HandleToObject(int);
int /*<<< orphan*/ yaffsfs_Lock();
int /*<<< orphan*/ yaffsfs_SetError(int);
int /*<<< orphan*/ yaffsfs_Unlock();
int yaffs_futime(int fd, const struct yaffs_utimbuf *buf) {
  struct yaffs_obj *obj;
  int retVal = -1;
  yaffsfs_Lock();
  obj = yaffsfs_HandleToObject(fd);
  if (obj)
    retVal = yaffsfs_DoUtime(obj, buf);
  else
    yaffsfs_SetError(-9);
  yaffsfs_Unlock();
  return retVal;
}


x86 assembly (clang, -O0):
<yaffs_futime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
mov    $0x0,%al
call   1060 <yaffsfs_Lock@plt>
mov    -0x4(%rbp),%edi
call   1050 <yaffsfs_HandleToObject@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1199 <yaffs_futime+0x49>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <yaffsfs_DoUtime@plt>
mov    %eax,-0x1c(%rbp)
jmp    11a3 <yaffs_futime+0x53>
mov    $0xfffffff7,%edi
call   1040 <yaffsfs_SetError@plt>
mov    $0x0,%al
call   1030 <yaffsfs_Unlock@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yaffs_futime>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1060 <yaffsfs_Lock@plt>
mov    %ebp,%edi
call   1050 <yaffsfs_HandleToObject@plt>
test   %rax,%rax
je     117a <yaffs_futime+0x2a>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1070 <yaffsfs_DoUtime@plt>
mov    %eax,%ebx
jmp    1189 <yaffs_futime+0x39>
mov    $0xfffffff7,%edi
call   1040 <yaffsfs_SetError@plt>
mov    $0xffffffff,%ebx
xor    %eax,%eax
call   1030 <yaffsfs_Unlock@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.yaffs_utimbuf = type { i32 }
%struct.yaffs_obj = type { i32 }
define i32 @yaffs_futime(i32 %0, %struct.yaffs_utimbuf* %1) {
%3 = alloca i32
%4 = alloca %struct.yaffs_utimbuf*
%5 = alloca %struct.yaffs_obj*
%6 = alloca i32
store i32 %0, i32* %3
store %struct.yaffs_utimbuf* %1, %struct.yaffs_utimbuf** %4
store i32 -1, i32* %6
%7 = call i32 (...) @yaffsfs_Lock()
%8 = load i32, i32* %3
%9 = call %struct.yaffs_obj* @yaffsfs_HandleToObject(i32 %8)
store %struct.yaffs_obj* %9, %struct.yaffs_obj** %5
%10 = load %struct.yaffs_obj*, %struct.yaffs_obj** %5
%11 = icmp ne %struct.yaffs_obj* %10, null
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = load %struct.yaffs_obj*, %struct.yaffs_obj** %5
%14 = load %struct.yaffs_utimbuf*, %struct.yaffs_utimbuf** %4
%15 = call i32 @yaffsfs_DoUtime(%struct.yaffs_obj* %13, %struct.yaffs_utimbuf* %14)
store i32 %15, i32* %6
br label %18
16: ; preds = %2
%17 = call i32 @yaffsfs_SetError(i32 -9)
br label %18
18: ; preds = %16, %12
%19 = call i32 (...) @yaffsfs_Unlock()
%20 = load i32, i32* %6
ret i32 %20
}

LLVM IR (-O2):
%struct.yaffs_utimbuf = type { i32 }
%struct.yaffs_obj = type { i32 }
define i32 @yaffs_futime(i32 %0, %struct.yaffs_utimbuf* %1) {
%3 = tail call i32 (...) @yaffsfs_Lock()
%4 = tail call %struct.yaffs_obj* @yaffsfs_HandleToObject(i32 %0)
%5 = icmp eq %struct.yaffs_obj* %4, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @yaffsfs_DoUtime(%struct.yaffs_obj* %4, %struct.yaffs_utimbuf* %1)
br label %10
8: ; preds = %2
%9 = tail call i32 @yaffsfs_SetError(i32 -9)
br label %10
10: ; preds = %8, %6
%11 = phi i32 [ %7, %6 ], [ -1, %8 ]
%12 = tail call i32 (...) @yaffsfs_Unlock()
ret i32 %11
}