#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 stat {
  int /*<<< orphan*/ st_atime;
};

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stat(char *, struct stat *);
int utime(char *, int /*<<< orphan*/ *);
int main() {
  struct stat sb;
  int result;
  stat("./utime.c", &sb);
  printf("Last file access: %s", ctime(&sb.st_atime));
  result = utime("./utime.c", NULL);
  if (result) {
    printf("error\n");
    return result;
  }
  stat("./utime.c", &sb);
  printf("Last file access: %s", ctime(&sb.st_atime));
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <stat@plt>
lea    -0x8(%rbp),%rdi
call   1040 <ctime@plt>
mov    %rax,%rsi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe80(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <utime@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11af <main+0x6f>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11df <main+0x9f>
lea    0xe4a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <stat@plt>
lea    -0x8(%rbp),%rdi
call   1040 <ctime@plt>
mov    %rax,%rsi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xea5(%rip),%r14
mov    %rsp,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <stat@plt>
mov    %rbx,%rdi
call   1050 <ctime@plt>
lea    0xe92(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <utime@plt>
mov    %eax,%ebx
test   %eax,%eax
je     11a0 <main+0x50>
lea    0xe86(%rip),%rdi
call   1040 <puts@plt>
jmp    11cb <main+0x7b>
lea    0xe59(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
call   1070 <stat@plt>
mov    %r14,%rdi
call   1050 <ctime@plt>
lea    0xe49(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [10 x i8] c"./utime.c\00"
@.str.1 = [21 x i8] c"Last file access: %s\00"
@.str.2 = [7 x i8] c"error\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.stat
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @stat(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
%5 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%6 = call i8* @ctime(i32* %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = call i32 @utime(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* null)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* %3
store i32 %13, i32* %1
br label %20
14: ; preds = %0
%15 = call i32 @stat(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
%16 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%17 = call i8* @ctime(i32* %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i32, i32* %3
store i32 %19, i32* %1
br label %20
20: ; preds = %14, %11
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [10 x i8] c"./utime.c\00"
@.str.1 = [21 x i8] c"Last file access: %s\00"
@str = [6 x i8] c"error\00"
define i32 @main() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = call i32 @stat(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%4 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
%5 = call i8* @ctime(i32* %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = call i32 @utime(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* null)
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %0
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %15
11: ; preds = %0
%12 = call i32 @stat(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%13 = call i8* @ctime(i32* %4)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %11, %9
ret i32 %7
}