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

/* Variables and functions */
int O_RDWR;
int O_TRUNC;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ err_ret(char *, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int open(char *, int);
scalar_t__ stat(char *, struct stat *);
scalar_t__ utime(char *, struct utimbuf *);
int main(int argc, char *argv[]) {
  int i, fd;
  struct stat statbuf;
  struct utimbuf timebuf;
  for (i = 1; i < argc; i++) {
    if (stat(argv[i], &statbuf) < 0) {
      err_ret("%s : stat error", argv[i]);
      continue;
    }
    if ((fd = open(argv[i], O_RDWR | O_TRUNC)) < 0) {
      err_ret("%s : open error", argv[i]);
      continue;
    }
    close(fd);
    timebuf.actime = statbuf.st_atime;
    timebuf.modtime = statbuf.st_mtime;
    if (utime(argv[i], &timebuf) < 0) {
      err_ret("%s : utime error", argv[i]);
      continue;
    }
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1274 <main+0x114>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <stat@plt>
cmp    $0x0,%rax
jge    11c5 <main+0x65>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe45(%rip),%rdi
call   1070 <err_ret@plt>
jmp    1266 <main+0x106>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2e08(%rip),%rax
mov    (%rax),%esi
mov    0x2e17(%rip),%rax
or     (%rax),%esi
call   1060 <open@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    1211 <main+0xb1>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe09(%rip),%rdi
call   1070 <err_ret@plt>
jmp    1266 <main+0x106>
mov    -0x18(%rbp),%edi
call   1040 <close@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <utime@plt>
cmp    $0x0,%rax
jge    1261 <main+0x101>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdc9(%rip),%rdi
call   1070 <err_ret@plt>
jmp    1266 <main+0x106>
jmp    1266 <main+0x106>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117d <main+0x1d>
xor    %edi,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jl     1230 <main+0xd0>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x1,%r12d
lea    0x10(%rsp),%r14
mov    0x2e52(%rip),%r15
mov    0x2e63(%rip),%r13
jmp    11b8 <main+0x58>
nopw   0x0(%rax,%rax,1)
lea    0xe59(%rip),%rdi
mov    %rcx,%rsi
call   1070 <err_ret@plt>
add    $0x1,%r12
cmp    %r12,%rbp
je     1230 <main+0xd0>
mov    (%rbx,%r12,8),%rdi
mov    %r14,%rsi
call   1050 <stat@plt>
mov    (%rbx,%r12,8),%rcx
test   %rax,%rax
js     11a0 <main+0x40>
mov    0x0(%r13),%esi
or     (%r15),%esi
mov    %rcx,%rdi
call   1060 <open@plt>
test   %eax,%eax
js     1220 <main+0xc0>
mov    %eax,%edi
call   1040 <close@plt>
mov    0x10(%rsp),%rax
mov    %rax,0x8(%rsp)
mov    (%rbx,%r12,8),%rdi
lea    0x8(%rsp),%rsi
call   1030 <utime@plt>
test   %rax,%rax
jns    11af <main+0x4f>
mov    (%rbx,%r12,8),%rsi
lea    0xe11(%rip),%rdi
jmp    11aa <main+0x4a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%r12,8),%rsi
lea    0xde5(%rip),%rdi
jmp    11aa <main+0x4a>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32, i32 }
%struct.utimbuf = type { i32, i32 }
@.str = [16 x i8] c"%s : stat error\00"
@O_RDWR = global i32 0
@O_TRUNC = global i32 0
@.str.1 = [16 x i8] c"%s : open error\00"
@.str.2 = [17 x i8] c"%s : utime error\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.stat
%9 = alloca %struct.utimbuf
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
br label %10
10: ; preds = %71, %2
%11 = load i32, i32* %6
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %74
14: ; preds = %10
%15 = load i8**, i8*** %5
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i64 @stat(i8* %19, %struct.stat* %8)
%21 = icmp slt i64 %20, 0
br i1 %21, label %22, label %29
22: ; preds = %14
%23 = load i8**, i8*** %5
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = call i32 @err_ret(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %27)
br label %71
29: ; preds = %14
%30 = load i8**, i8*** %5
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = load i8*, i8** %33
%35 = load i32, i32* @O_RDWR
%36 = load i32, i32* @O_TRUNC
%37 = or i32 %35, %36
%38 = call i32 @open(i8* %34, i32 %37)
store i32 %38, i32* %7
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %47
40: ; preds = %29
%41 = load i8**, i8*** %5
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
%45 = load i8*, i8** %44
%46 = call i32 @err_ret(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %45)
br label %71
47: ; preds = %29
%48 = load i32, i32* %7
%49 = call i32 @close(i32 %48)
%50 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 1
%51 = load i32, i32* %50
%52 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %9, i32 0, i32 1
store i32 %51, i32* %52
%53 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%54 = load i32, i32* %53
%55 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %9, i32 0, i32 0
store i32 %54, i32* %55
%56 = load i8**, i8*** %5
%57 = load i32, i32* %6
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8*, i8** %56, i64 %58
%60 = load i8*, i8** %59
%61 = call i64 @utime(i8* %60, %struct.utimbuf* %9)
%62 = icmp slt i64 %61, 0
br i1 %62, label %63, label %70
63: ; preds = %47
%64 = load i8**, i8*** %5
%65 = load i32, i32* %6
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8*, i8** %64, i64 %66
%68 = load i8*, i8** %67
%69 = call i32 @err_ret(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %68)
br label %71
70: ; preds = %47
br label %71
71: ; preds = %70, %63, %40, %22
%72 = load i32, i32* %6
%73 = add nsw i32 %72, 1
store i32 %73, i32* %6
br label %10
74: ; preds = %10
%75 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i32, i32 }
%struct.utimbuf = type { i32, i32 }
@.str = [16 x i8] c"%s : stat error\00"
@O_RDWR = global i32 0
@O_TRUNC = global i32 0
@.str.1 = [16 x i8] c"%s : open error\00"
@.str.2 = [17 x i8] c"%s : utime error\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = alloca %struct.utimbuf
%5 = bitcast %struct.stat* %3 to i8*
%6 = bitcast %struct.utimbuf* %4 to i8*
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %45
8: ; preds = %2
%9 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 1
%10 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %4, i64 0, i32 1
%11 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%12 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %4, i64 0, i32 0
%13 = zext i32 %0 to i64
br label %14
14: ; preds = %8, %42
%15 = phi i64 [ 1, %8 ], [ %43, %42 ]
%16 = getelementptr inbounds i8*, i8** %1, i64 %15
%17 = load i8*, i8** %16
%18 = call i64 @stat(i8* %17, %struct.stat* %3)
%19 = icmp slt i64 %18, 0
%20 = load i8*, i8** %16
br i1 %19, label %21, label %23
21: ; preds = %14
%22 = call i32 @err_ret(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %20)
br label %42
23: ; preds = %14
%24 = load i32, i32* @O_RDWR
%25 = load i32, i32* @O_TRUNC
%26 = or i32 %25, %24
%27 = call i32 @open(i8* %20, i32 %26)
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %23
%30 = load i8*, i8** %16
%31 = call i32 @err_ret(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %30)
br label %42
32: ; preds = %23
%33 = call i32 @close(i32 %27)
%34 = load i32, i32* %9
store i32 %34, i32* %10
%35 = load i32, i32* %11
store i32 %35, i32* %12
%36 = load i8*, i8** %16
%37 = call i64 @utime(i8* %36, %struct.utimbuf* %4)
%38 = icmp slt i64 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %32
%40 = load i8*, i8** %16
%41 = call i32 @err_ret(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %40)
br label %42
42: ; preds = %32, %39, %29, %21
%43 = add nuw nsw i64 %15, 1
%44 = icmp eq i64 %43, %13
br i1 %44, label %45, label %14
45: ; preds = %42, %2
%46 = call i32 @exit(i32 0)
unreachable
}