#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 timeval {
  int dummy;
};
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
scalar_t__ S_ISLNK(int /*<<< orphan*/);
scalar_t__ lstat(char const *, struct stat *);
int utimes(char const *, struct timeval const *);
int lutimes(const char *path, const struct timeval *tvs) {
  struct stat st;
  if (lstat(path, &st))
    return -1;
  if (S_ISLNK(st.st_mode))
    return 0;
  return utimes(path, tvs);
}


x86 assembly (clang, -O0):
<lutimes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <lstat@plt>
cmp    $0x0,%rax
je     1163 <lutimes+0x33>
movl   $0xffffffff,-0x4(%rbp)
jmp    1191 <lutimes+0x61>
mov    -0x20(%rbp),%edi
call   1030 <S_ISLNK@plt>
cmp    $0x0,%rax
je     1181 <lutimes+0x51>
movl   $0x0,-0x4(%rbp)
jmp    1191 <lutimes+0x61>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <utimes@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lutimes>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%rsi
call   1040 <lstat@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    1161 <lutimes+0x31>
mov    (%rsp),%edi
call   1030 <S_ISLNK@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1169 <lutimes+0x39>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <utimes@plt>

LLVM IR (-O0):
%struct.timeval = type { i32 }
%struct.stat = type { i32 }
define i32 @lutimes(i8* %0, %struct.timeval* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.timeval*
%6 = alloca %struct.stat
store i8* %0, i8** %4
store %struct.timeval* %1, %struct.timeval** %5
%7 = load i8*, i8** %4
%8 = call i64 @lstat(i8* %7, %struct.stat* %6)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 -1, i32* %3
br label %21
11: ; preds = %2
%12 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%13 = load i32, i32* %12
%14 = call i64 @S_ISLNK(i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %11
store i32 0, i32* %3
br label %21
17: ; preds = %11
%18 = load i8*, i8** %4
%19 = load %struct.timeval*, %struct.timeval** %5
%20 = call i32 @utimes(i8* %18, %struct.timeval* %19)
store i32 %20, i32* %3
br label %21
21: ; preds = %17, %16, %10
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
%struct.stat = type { i32 }
define i32 @lutimes(i8* nocapture %0, %struct.timeval* nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = call i64 @lstat(i8* %0, %struct.stat* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%9 = load i32, i32* %8
%10 = tail call i64 @S_ISLNK(i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = tail call i32 @utimes(i8* %0, %struct.timeval* %1)
br label %14
14: ; preds = %7, %2, %12
%15 = phi i32 [ %13, %12 ], [ -1, %2 ], [ 0, %7 ]
ret i32 %15
}