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

/* Variables and functions */
int _touch_error(char const *, int);
scalar_t__ stat(char const *, struct stat *);
int _touch_rtime(char const *filename, time_t *atime, time_t *mtime) {
  struct stat st;
  if (stat(filename, &st) != 0)
    return _touch_error(filename, 1);
  *atime = st.st_atime;
  *mtime = st.st_mtime;
  return 0;
}


x86 assembly (clang, -O0):
<_touch_rtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
je     1161 <_touch_rtime+0x41>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1030 <_touch_error@plt>
mov    %eax,-0x4(%rbp)
jmp    117a <_touch_rtime+0x5a>
mov    -0x24(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_touch_rtime>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0x8(%rsp),%rsi
call   1040 <stat@plt>
test   %rax,%rax
je     1150 <_touch_rtime+0x30>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <_touch_error@plt>
jmp    1160 <_touch_rtime+0x40>
mov    0xc(%rsp),%eax
mov    %eax,(%r15)
mov    0x8(%rsp),%eax
mov    %eax,(%r14)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.stat = type { i32, i32 }
define i32 @_touch_rtime(i8* %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca %struct.stat
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%9 = load i8*, i8** %5
%10 = call i64 @stat(i8* %9, %struct.stat* %8)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = call i32 @_touch_error(i8* %13, i32 1)
store i32 %14, i32* %4
br label %22
15: ; preds = %3
%16 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 1
%17 = load i32, i32* %16
%18 = load i32*, i32** %6
store i32 %17, i32* %18
%19 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%20 = load i32, i32* %19
%21 = load i32*, i32** %7
store i32 %20, i32* %21
store i32 0, i32* %4
br label %22
22: ; preds = %15, %12
%23 = load i32, i32* %4
ret i32 %23
}

LLVM IR (-O2):
%struct.stat = type { i32, i32 }
define i32 @_touch_rtime(i8* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = alloca %struct.stat
%5 = bitcast %struct.stat* %4 to i8*
%6 = call i64 @stat(i8* %0, %struct.stat* %4)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = call i32 @_touch_error(i8* %0, i32 1)
br label %15
10: ; preds = %3
%11 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 1
%12 = load i32, i32* %11
store i32 %12, i32* %1
%13 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%14 = load i32, i32* %13
store i32 %14, i32* %2
br label %15
15: ; preds = %10, %8
%16 = phi i32 [ %9, %8 ], [ 0, %10 ]
ret i32 %16
}