#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);
  close(fd);
  stat("foobar", &sbuf);
  lstat("foobar", &sbuf);
  ubuf.actime = 1;
  ubuf.modtime = 1135641600;
  utime("foobar", &ubuf);
  ubuf.actime = 1135690000;
  ubuf.modtime = 1135700000;
  utime("foobar", &ubuf);
  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    -0x8(%rbp),%edi
call   1050 <close@plt>
lea    0xe2e(%rip),%rdi
lea    -0x98(%rbp),%rsi
call   1070 <stat@plt>
lea    0xe1b(%rip),%rdi
lea    -0x98(%rbp),%rsi
call   1060 <lstat@plt>
movl   $0x1,-0xa0(%rbp)
movl   $0x43b08400,-0x9c(%rbp)
84 b0 43
lea    0xdf4(%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    0xdcd(%rip),%rdi
lea    -0xa0(%rbp),%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    %ebp,%edi
call   1050 <close@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <stat@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <lstat@plt>
movabs $0x43b0840000000001,%rax
84 b0 43
mov    %rax,(%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>
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 = load i32, i32* %2
%15 = call i32 @close(i32 %14)
%16 = call i32 @stat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.stat* %4)
%17 = call i32 @lstat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.stat* %4)
%18 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %5, i32 0, i32 0
store i32 1, i32* %18
%19 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %5, i32 0, i32 1
store i32 1135641600, i32* %19
%20 = call i32 @utime(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.utimbuf* %5)
%21 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %5, i32 0, i32 0
store i32 1135690000, i32* %21
%22 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %5, i32 0, i32 1
store i32 1135700000, i32* %22
%23 = call i32 @utime(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.utimbuf* %5)
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 @close(i32 %11)
%14 = call i32 @stat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
%15 = call i32 @lstat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
%16 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %3, i64 0, i32 0
store i32 1, i32* %16
%17 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %3, i64 0, i32 1
store i32 1135641600, i32* %17
%18 = call i32 @utime(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.utimbuf* %3)
store i32 1135690000, i32* %16
store i32 1135700000, i32* %17
%19 = call i32 @utime(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %struct.utimbuf* %3)
ret i32 0
}