#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 */
typedef int /*<<< orphan*/ time_t;
struct utimbuf {
  int /*<<< orphan*/ modtime;
  int /*<<< orphan*/ actime;
};
struct tm {
  int dummy;
};

/* Variables and functions */
scalar_t__ ENOENT;
scalar_t__ errno;
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ print_tm(struct tm *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int utime(char *, struct utimbuf *);
int main(void) {
  time_t t = time(NULL);
  struct utimbuf u = {.actime = t, .modtime = t};
  struct tm *p = localtime(&t);
  printf("utime\\(\"utime\\\\nfilename\", \\[");
  print_tm(p);
  printf(", ");
  print_tm(p);
  printf("\\]\\) += -1 ENOENT .*\n");
  return utime("utime\nfilename", &u) == -1 && errno == ENOENT ? 0 : 77;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <localtime@plt>
mov    %rax,-0x18(%rbp)
lea    0xe75(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <print_tm@plt>
lea    0xe7e(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <print_tm@plt>
lea    0xe6c(%rip),%rdi
call   1050 <printf@plt>
lea    0xe76(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <utime@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
mov    %al,-0x19(%rbp)
jne    11f4 <main+0xa4>
mov    0x2dff(%rip),%rax
mov    (%rax),%rax
mov    0x2de5(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%dl
mov    $0x4d,%eax
xor    %ecx,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
xor    %ebx,%ebx
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,0xc(%rsp)
mov    %eax,0x10(%rsp)
mov    %eax,0x14(%rsp)
lea    0xc(%rsp),%rdi
call   1040 <localtime@plt>
mov    %rax,%r14
lea    0xe70(%rip),%rdi
call   1060 <printf@plt>
mov    %r14,%rdi
call   1070 <print_tm@plt>
lea    0xe7a(%rip),%rdi
call   1060 <printf@plt>
mov    %r14,%rdi
call   1070 <print_tm@plt>
lea    0xe78(%rip),%rdi
call   1050 <puts@plt>
lea    0xe5d(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1030 <utime@plt>
mov    0x2e0b(%rip),%rcx
mov    (%rcx),%rcx
mov    0x2df1(%rip),%rdx
cmp    (%rdx),%rcx
mov    $0x4d,%ecx
cmovne %ecx,%ebx
cmp    $0xffffffff,%eax
cmovne %ecx,%ebx
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.utimbuf = type { i32, i32 }
%struct.tm = type { i32 }
@.str = [30 x i8] c"utime\\(\22utime\\\\nfilename\22, \\[\00"
@.str.1 = [3 x i8] c", \00"
@.str.2 = [22 x i8] c"\\]\\) += -1 ENOENT .*\0A\00"
@.str.3 = [15 x i8] c"utime\0Afilename\00"
@errno = global i64 0
@ENOENT = global i64 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.utimbuf
%4 = alloca %struct.tm*
store i32 0, i32* %1
%5 = call i32 @time(i32* null)
store i32 %5, i32* %2
%6 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %3, i32 0, i32 0
%7 = load i32, i32* %2
store i32 %7, i32* %6
%8 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %3, i32 0, i32 1
%9 = load i32, i32* %2
store i32 %9, i32* %8
%10 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %10, %struct.tm** %4
%11 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%12 = load %struct.tm*, %struct.tm** %4
%13 = call i32 @print_tm(%struct.tm* %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = load %struct.tm*, %struct.tm** %4
%16 = call i32 @print_tm(%struct.tm* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @utime(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), %struct.utimbuf* %3)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %24
20: ; preds = %0
%21 = load i64, i64* @errno
%22 = load i64, i64* @ENOENT
%23 = icmp eq i64 %21, %22
br label %24
24: ; preds = %20, %0
%25 = phi i1 [ false, %0 ], [ %23, %20 ]
%26 = zext i1 %25 to i64
%27 = select i1 %25, i32 0, i32 77
ret i32 %27
}

LLVM IR (-O2):
%struct.utimbuf = type { i32, i32 }
%struct.tm = type { i32 }
@.str = [30 x i8] c"utime\\(\22utime\\\\nfilename\22, \\[\00"
@.str.1 = [3 x i8] c", \00"
@.str.3 = [15 x i8] c"utime\0Afilename\00"
@errno = global i64 0
@ENOENT = global i64 0
@str = [21 x i8] c"\\]\\) += -1 ENOENT .*\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.utimbuf
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 @time(i32* null)
store i32 %4, i32* %1
%5 = bitcast %struct.utimbuf* %2 to i8*
%6 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %2, i64 0, i32 0
store i32 %4, i32* %6
%7 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %2, i64 0, i32 1
store i32 %4, i32* %7
%8 = call %struct.tm* @localtime(i32* %1)
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @print_tm(%struct.tm* %8)
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @print_tm(%struct.tm* %8)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%14 = call i32 @utime(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), %struct.utimbuf* %2)
%15 = icmp eq i32 %14, -1
%16 = load i64, i64* @errno
%17 = load i64, i64* @ENOENT
%18 = icmp eq i64 %16, %17
%19 = select i1 %15, i1 %18, i1 false
%20 = select i1 %19, i32 0, i32 77
ret i32 %20
}