#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 actime;
  int modtime;
};
struct stat {
  int dummy;
};

/* Variables and functions */
int S_IREAD;
int S_IWRITE;
int /*<<< orphan*/ close(int);
int creat(char *, int);
int /*<<< orphan*/ fstat(int, struct stat *);
int /*<<< orphan*/ getcwd(char *, int);
int /*<<< orphan*/ lstat(char *, struct stat *);
int /*<<< orphan*/ stat(char *, struct stat *);
int /*<<< orphan*/ utime(char *, struct utimbuf *);
int main() {
  int fd;
  char cwd[128];
  struct stat sbuf;
  struct utimbuf ubuf;
  getcwd(cwd, 128);
  fd = creat("foobar", S_IREAD | S_IWRITE);
  fstat(fd, &sbuf);
  fstat(-1, &sbuf);
  fstat(-1, (struct stat *)-1);
  close(fd);
  stat("foobar", &sbuf);
  stat((char *)-1, &sbuf);
  stat((char *)-1, (struct stat *)-1);
  lstat("foobar", &sbuf);
  lstat((char *)-1, &sbuf);
  lstat((char *)-1, (struct stat *)-1);
  ubuf.actime = 1;
  ubuf.modtime = 1135641600;
  utime("foobar", &ubuf);
  ubuf.actime = 1135690000;
  ubuf.modtime = 1135700000;
  utime("foobar", &ubuf);
  ubuf.actime = 1;
  ubuf.modtime = 1135641600;
  utime((char *)-1, &ubuf);
  utime("foobar", (struct utimbuf *)-1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
mov    $0x80,%esi
call   1040 <getcwd@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%esi
mov    0x2e45(%rip),%rax
or     (%rax),%esi
lea    0xe54(%rip),%rdi
call   1080 <creat@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x98(%rbp),%rsi
call   1090 <fstat@plt>
mov    $0xffffffff,%edi
lea    -0x98(%rbp),%rsi
call   1090 <fstat@plt>
mov    $0xffffffff,%edi
mov    $0xffffffffffffffff,%rsi
call   1090 <fstat@plt>
mov    -0x8(%rbp),%edi
call   1050 <close@plt>
lea    0xe0c(%rip),%rdi
lea    -0x98(%rbp),%rsi
call   1070 <stat@plt>
mov    $0xffffffffffffffff,%rdi
lea    -0x98(%rbp),%rsi
call   1070 <stat@plt>
mov    $0xffffffffffffffff,%rsi
mov    %rsi,%rdi
call   1070 <stat@plt>
lea    0xdd7(%rip),%rdi
lea    -0x98(%rbp),%rsi
call   1060 <lstat@plt>
mov    $0xffffffffffffffff,%rdi
lea    -0x98(%rbp),%rsi
call   1060 <lstat@plt>
mov    $0xffffffffffffffff,%rsi
mov    %rsi,%rdi
call   1060 <lstat@plt>
movl   $0x1,-0xa0(%rbp)
movl   $0x43b08400,-0x9c(%rbp)
84 b0 43
lea    0xd8e(%rip),%rdi
lea    -0xa0(%rbp),%rsi
call   1030 <utime@plt>
movl   $0x43b14110,-0xa0(%rbp)
41 b1 43
movl   $0x43b16820,-0x9c(%rbp)
68 b1 43
lea    0xd67(%rip),%rdi
lea    -0xa0(%rbp),%rsi
call   1030 <utime@plt>
movl   $0x1,-0xa0(%rbp)
movl   $0x43b08400,-0x9c(%rbp)
84 b0 43
mov    $0xffffffffffffffff,%rdi
lea    -0xa0(%rbp),%rsi
call   1030 <utime@plt>
lea    0xd2d(%rip),%rdi
mov    $0xffffffffffffffff,%rsi
call   1030 <utime@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x90,%rsp
lea    0x10(%rsp),%rdi
mov    $0x80,%esi
call   1040 <getcwd@plt>
mov    0x2e47(%rip),%rax
mov    0x2e50(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0xe5d(%rip),%r14
mov    %r14,%rdi
call   1080 <creat@plt>
mov    %eax,%ebp
lea    0x8(%rsp),%rbx
mov    %eax,%edi
mov    %rbx,%rsi
call   1090 <fstat@plt>
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1090 <fstat@plt>
mov    $0xffffffff,%edi
mov    $0xffffffffffffffff,%rsi
call   1090 <fstat@plt>
mov    %ebp,%edi
call   1050 <close@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <stat@plt>
mov    $0xffffffffffffffff,%rdi
mov    %rbx,%rsi
call   1070 <stat@plt>
mov    $0xffffffffffffffff,%rdi
mov    $0xffffffffffffffff,%rsi
call   1070 <stat@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <lstat@plt>
mov    $0xffffffffffffffff,%rdi
mov    %rbx,%rsi
call   1060 <lstat@plt>
mov    $0xffffffffffffffff,%rdi
mov    $0xffffffffffffffff,%rsi
call   1060 <lstat@plt>
movabs $0x43b0840000000001,%rbp
84 b0 43
mov    %rbp,(%rsp)
mov    %rsp,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <utime@plt>
movabs $0x43b1682043b14110,%rax
68 b1 43
mov    %rax,(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <utime@plt>
mov    %rbp,(%rsp)
mov    $0xffffffffffffffff,%rdi
mov    %rbx,%rsi
call   1030 <utime@plt>
mov    %r14,%rdi
mov    $0xffffffffffffffff,%rsi
call   1030 <utime@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
%struct.utimbuf = type { i32, i32 }
@.str = [7 x i8] c"foobar\00"
@S_IREAD = global i32 0
@S_IWRITE = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [128 x i8]
%4 = alloca %struct.stat
%5 = alloca %struct.utimbuf
store i32 0, i32* %1
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%7 = call i32 @getcwd(i8* %6, i32 128)
%8 = load i32, i32* @S_IREAD
%9 = load i32, i32* @S_IWRITE
%10 = or i32 %8, %9
%11 = call i32 @creat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %10)
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = call i32 @fstat(i32 %12, %struct.stat* %4)
%14 = call i32 @fstat(i32 -1, %struct.stat* %4)
%15 = call i32 @fstat(i32 -1, %struct.stat* inttoptr (i64 -1 to %struct.stat*))
%16 = load i32, i32* %2
%17 = call i32 @close(i32 %16)
%18 = call i32 @stat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.stat* %4)
%19 = call i32 @stat(i8* inttoptr (i64 -1 to i8*), %struct.stat* %4)
%20 = call i32 @stat(i8* inttoptr (i64 -1 to i8*), %struct.stat* inttoptr (i64 -1 to %struct.stat*))
%21 = call i32 @lstat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.stat* %4)
%22 = call i32 @lstat(i8* inttoptr (i64 -1 to i8*), %struct.stat* %4)
%23 = call i32 @lstat(i8* inttoptr (i64 -1 to i8*), %struct.stat* inttoptr (i64 -1 to %struct.stat*))
%24 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %5, i32 0, i32 0
store i32 1, i32* %24
%25 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %5, i32 0, i32 1
store i32 1135641600, i32* %25
%26 = call i32 @utime(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.utimbuf* %5)
%27 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %5, i32 0, i32 0
store i32 1135690000, i32* %27
%28 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %5, i32 0, i32 1
store i32 1135700000, i32* %28
%29 = call i32 @utime(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.utimbuf* %5)
%30 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %5, i32 0, i32 0
store i32 1, i32* %30
%31 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %5, i32 0, i32 1
store i32 1135641600, i32* %31
%32 = call i32 @utime(i8* inttoptr (i64 -1 to i8*), %struct.utimbuf* %5)
%33 = call i32 @utime(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.utimbuf* inttoptr (i64 -1 to %struct.utimbuf*))
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.utimbuf = type { i32, i32 }
@.str = [7 x i8] c"foobar\00"
@S_IREAD = global i32 0
@S_IWRITE = global i32 0
define i32 @main() {
%1 = alloca [128 x i8]
%2 = alloca %struct.stat
%3 = alloca %struct.utimbuf
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%5 = bitcast %struct.stat* %2 to i8*
%6 = bitcast %struct.utimbuf* %3 to i8*
%7 = call i32 @getcwd(i8* %4, i32 128)
%8 = load i32, i32* @S_IREAD
%9 = load i32, i32* @S_IWRITE
%10 = or i32 %9, %8
%11 = call i32 @creat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @fstat(i32 %11, %struct.stat* %2)
%13 = call i32 @fstat(i32 -1, %struct.stat* %2)
%14 = call i32 @fstat(i32 -1, %struct.stat* inttoptr (i64 -1 to %struct.stat*))
%15 = call i32 @close(i32 %11)
%16 = call i32 @stat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
%17 = call i32 @stat(i8* inttoptr (i64 -1 to i8*), %struct.stat* %2)
%18 = call i32 @stat(i8* inttoptr (i64 -1 to i8*), %struct.stat* inttoptr (i64 -1 to %struct.stat*))
%19 = call i32 @lstat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
%20 = call i32 @lstat(i8* inttoptr (i64 -1 to i8*), %struct.stat* %2)
%21 = call i32 @lstat(i8* inttoptr (i64 -1 to i8*), %struct.stat* inttoptr (i64 -1 to %struct.stat*))
%22 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %3, i64 0, i32 0
store i32 1, i32* %22
%23 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %3, i64 0, i32 1
store i32 1135641600, i32* %23
%24 = call i32 @utime(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.utimbuf* %3)
store i32 1135690000, i32* %22
store i32 1135700000, i32* %23
%25 = call i32 @utime(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.utimbuf* %3)
store i32 1, i32* %22
store i32 1135641600, i32* %23
%26 = call i32 @utime(i8* inttoptr (i64 -1 to i8*), %struct.utimbuf* %3)
%27 = call i32 @utime(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.utimbuf* inttoptr (i64 -1 to %struct.utimbuf*))
ret i32 0
}