#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 */

/* Variables and functions */
int O_CREAT;
int O_RDWR;
int /*<<< orphan*/ close(int);
int futimes(int, int /*<<< orphan*/ *);
int open(char const *, int, int);
int /*<<< orphan*/ unlink(char const *);
int main(void) {
  static const char *filename = "/tmp/futimes.tmp";
  int fd, ret;
  fd = open(filename, O_RDWR | O_CREAT, 0666);
  if (fd < 0)
    return 1;
  (void)unlink(filename);
  ret = futimes(fd, NULL);
  (void)ret;
  (void)close(fd);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eea(%rip),%rdi
mov    0x2e83(%rip),%rax
mov    (%rax),%esi
mov    0x2e92(%rip),%rax
or     (%rax),%esi
mov    $0x1b6,%edx
call   1060 <open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    118b <main+0x4b>
movl   $0x1,-0x4(%rbp)
jmp    11b5 <main+0x75>
mov    0x2eae(%rip),%rdi
call   1030 <unlink@plt>
mov    -0x8(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <futimes@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <close@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2e98(%rip),%rax
mov    0x2ea9(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0xea6(%rip),%rdi
mov    $0x1b6,%edx
call   1060 <open@plt>
test   %eax,%eax
js     1186 <main+0x46>
mov    %eax,%ebx
lea    0xe8f(%rip),%rdi
call   1030 <unlink@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1040 <futimes@plt>
mov    %ebx,%edi
call   1050 <close@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@main.filename = internal global i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i32 0, i32 0)
@.str = [17 x i8] c"/tmp/futimes.tmp\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = load i8*, i8** @main.filename
%5 = load i32, i32* @O_RDWR
%6 = load i32, i32* @O_CREAT
%7 = or i32 %5, %6
%8 = call i32 @open(i8* %4, i32 %7, i32 438)
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %0
store i32 1, i32* %1
br label %20
12: ; preds = %0
%13 = load i8*, i8** @main.filename
%14 = call i32 @unlink(i8* %13)
%15 = load i32, i32* %2
%16 = call i32 @futimes(i32 %15, i32* null)
store i32 %16, i32* %3
%17 = load i32, i32* %3
%18 = load i32, i32* %2
%19 = call i32 @close(i32 %18)
store i32 1, i32* %1
br label %20
20: ; preds = %12, %11
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@.str = [17 x i8] c"/tmp/futimes.tmp\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
define i32 @main() {
%1 = load i32, i32* @O_RDWR
%2 = load i32, i32* @O_CREAT
%3 = or i32 %2, %1
%4 = tail call i32 @open(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %3, i32 438)
%5 = icmp slt i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %0
%7 = tail call i32 @unlink(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @futimes(i32 %4, i32* null)
%9 = tail call i32 @close(i32 %4)
br label %10
10: ; preds = %0, %6
ret i32 1
}