#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 /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int O_RDWR;
int O_TRUNC;
int /*<<< orphan*/ close(int);
int errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int open(char *, int);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
char *strerror(int);
scalar_t__ utime(char *, struct utimbuf *);
int main(int argc, char *argv[]) {
  int fd, i;
  struct stat bufstat;
  struct utimbuf bufutime;
  if (argc < 2) {
    fprintf(stderr, "Usage: %s <filename1>...<filenameN>\n", argv[0]);
    fprintf(stderr, "Be careful, each file will be truncated to zero.\n");
    exit(EXIT_FAILURE);
  }
  for (i = 1; i < argc; i++) {
    if (stat(argv[i], &bufstat) < 0) {
      fprintf(stderr, "Err.:(%d) - %s on %s\n", errno, strerror(errno),
              argv[i]);
      continue;
    }
    if ((fd = open(argv[i], O_RDWR | O_TRUNC)) < 0) {
      fprintf(stderr, "Err.:(%d) - %s on %s\n", errno, strerror(errno),
              argv[i]);
      continue;
    }
    close(fd);
    bufutime.actime = bufstat.st_atime;
    bufutime.modtime = bufstat.st_mtime;
    if (utime(argv[i], &bufutime) < 0) {
      fprintf(stderr, "Err.:(%d) - %s on %s\n", errno, strerror(errno),
              argv[i]);
      continue;
    }
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11d3 <main+0x63>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe59(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
lea    0xe67(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1364 <main+0x1f4>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <stat@plt>
cmp    $0x0,%rax
jge    1253 <main+0xe3>
mov    0x2dc4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2db0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x30(%rbp),%edi
mov    -0x2c(%rbp),%edx
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rsi
mov    (%rax,%rsi,8),%r8
lea    0xe10(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1356 <main+0x1e6>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2d7a(%rip),%rax
mov    (%rax),%esi
mov    0x2d89(%rip),%rax
or     (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    12d0 <main+0x160>
mov    0x2d47(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    0x2d33(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x2d27(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x38(%rbp),%edi
mov    -0x34(%rbp),%edx
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rsi
mov    (%rax,%rsi,8),%r8
lea    0xd93(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1356 <main+0x1e6>
mov    -0x14(%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 -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <utime@plt>
cmp    $0x0,%rax
jge    1351 <main+0x1e1>
mov    0x2cc6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x2cb2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2ca6(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x40(%rbp),%edi
mov    -0x3c(%rbp),%edx
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rsi
mov    (%rax,%rsi,8),%r8
lea    0xd12(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1356 <main+0x1e6>
jmp    1356 <main+0x1e6>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11da <main+0x6a>
mov    0x2c4d(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r13
cmp    $0x2,%edi
jl     1286 <main+0x116>
mov    %edi,%r12d
mov    $0x1,%r15d
lea    0x10(%rsp),%r14
jmp    11e0 <main+0x70>
nopw   0x0(%rax,%rax,1)
mov    0x2e29(%rip),%rax
mov    (%rax),%ebx
mov    0x2e18(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1090 <strerror@plt>
mov    0x0(%r13,%r15,8),%r8
mov    %ebx,%edi
lea    0xe90(%rip),%rsi
mov    %ebp,%edx
mov    %rax,%rcx
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x1,%r15
cmp    %r15,%r12
je     126e <main+0xfe>
mov    0x0(%r13,%r15,8),%rdi
mov    %r14,%rsi
call   1060 <stat@plt>
test   %rax,%rax
js     1240 <main+0xd0>
mov    0x0(%r13,%r15,8),%rdi
mov    0x2dfa(%rip),%rax
mov    (%rax),%esi
mov    0x2dd9(%rip),%rax
or     (%rax),%esi
call   1070 <open@plt>
test   %eax,%eax
js     11a0 <main+0x30>
mov    %eax,%edi
call   1040 <close@plt>
mov    0x10(%rsp),%rax
mov    %rax,0x8(%rsp)
mov    0x0(%r13,%r15,8),%rdi
lea    0x8(%rsp),%rsi
call   1030 <utime@plt>
test   %rax,%rax
jns    11d3 <main+0x63>
jmp    11a0 <main+0x30>
nopl   0x0(%rax)
mov    0x2d89(%rip),%rax
mov    (%rax),%ebp
mov    0x2d78(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1090 <strerror@plt>
mov    0x0(%r13,%r15,8),%r8
mov    %ebp,%edi
lea    0xdf0(%rip),%rsi
mov    %ebx,%edx
jmp    11c9 <main+0x59>
mov    0x2d43(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d43(%rip),%rbx
mov    (%rbx),%edi
mov    0x0(%r13),%rdx
lea    0xd66(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%rbx),%edi
lea    0xd7b(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x2d08(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32, i32 }
%struct.utimbuf = type { i32, i32 }
@stderr = global i32 0
@.str = [37 x i8] c"Usage: %s <filename1>...<filenameN>\0A\00"
@.str.1 = [50 x i8] c"Be careful, each file will be truncated to zero.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [22 x i8] c"Err.:(%d) - %s on %s\0A\00"
@errno = global i32 0
@O_RDWR = global i32 0
@O_TRUNC = global i32 0
@EXIT_SUCCESS = global i32 0
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
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %22
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%20 = load i32, i32* @EXIT_FAILURE
%21 = call i32 @exit(i32 %20)
unreachable
22: ; preds = %2
store i32 1, i32* %7
br label %23
23: ; preds = %96, %22
%24 = load i32, i32* %7
%25 = load i32, i32* %4
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %99
27: ; preds = %23
%28 = load i8**, i8*** %5
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i64 @stat(i8* %32, %struct.stat* %8)
%34 = icmp slt i64 %33, 0
br i1 %34, label %35, label %46
35: ; preds = %27
%36 = load i32, i32* @stderr
%37 = load i32, i32* @errno
%38 = load i32, i32* @errno
%39 = call i8* @strerror(i32 %38)
%40 = load i8**, i8*** %5
%41 = load i32, i32* %7
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %37, i8* %39, i8* %44)
br label %96
46: ; preds = %27
%47 = load i8**, i8*** %5
%48 = load i32, i32* %7
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
%51 = load i8*, i8** %50
%52 = load i32, i32* @O_RDWR
%53 = load i32, i32* @O_TRUNC
%54 = or i32 %52, %53
%55 = call i32 @open(i8* %51, i32 %54)
store i32 %55, i32* %6
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %68
57: ; preds = %46
%58 = load i32, i32* @stderr
%59 = load i32, i32* @errno
%60 = load i32, i32* @errno
%61 = call i8* @strerror(i32 %60)
%62 = load i8**, i8*** %5
%63 = load i32, i32* %7
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8*, i8** %62, i64 %64
%66 = load i8*, i8** %65
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %59, i8* %61, i8* %66)
br label %96
68: ; preds = %46
%69 = load i32, i32* %6
%70 = call i32 @close(i32 %69)
%71 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 1
%72 = load i32, i32* %71
%73 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %9, i32 0, i32 1
store i32 %72, i32* %73
%74 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%75 = load i32, i32* %74
%76 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %9, i32 0, i32 0
store i32 %75, i32* %76
%77 = load i8**, i8*** %5
%78 = load i32, i32* %7
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8*, i8** %77, i64 %79
%81 = load i8*, i8** %80
%82 = call i64 @utime(i8* %81, %struct.utimbuf* %9)
%83 = icmp slt i64 %82, 0
br i1 %83, label %84, label %95
84: ; preds = %68
%85 = load i32, i32* @stderr
%86 = load i32, i32* @errno
%87 = load i32, i32* @errno
%88 = call i8* @strerror(i32 %87)
%89 = load i8**, i8*** %5
%90 = load i32, i32* %7
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i8*, i8** %89, i64 %91
%93 = load i8*, i8** %92
%94 = call i32 (i32, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %86, i8* %88, i8* %93)
br label %96
95: ; preds = %68
br label %96
96: ; preds = %95, %84, %57, %35
%97 = load i32, i32* %7
%98 = add nsw i32 %97, 1
store i32 %98, i32* %7
br label %23
99: ; preds = %23
%100 = load i32, i32* @EXIT_SUCCESS
ret i32 %100
}

LLVM IR (-O2):
%struct.stat = type { i32, i32 }
%struct.utimbuf = type { i32, i32 }
@stderr = global i32 0
@.str = [37 x i8] c"Usage: %s <filename1>...<filenameN>\0A\00"
@.str.1 = [50 x i8] c"Be careful, each file will be truncated to zero.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [22 x i8] c"Err.:(%d) - %s on %s\0A\00"
@errno = global i32 0
@O_RDWR = global i32 0
@O_TRUNC = global i32 0
@EXIT_SUCCESS = global i32 0
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 slt i32 %0, 2
br i1 %7, label %14, label %8
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 %22
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %1
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%20 = load i32, i32* @EXIT_FAILURE
%21 = tail call i32 @exit(i32 %20)
unreachable
22: ; preds = %8, %60
%23 = phi i64 [ 1, %8 ], [ %61, %60 ]
%24 = getelementptr inbounds i8*, i8** %1, i64 %23
%25 = load i8*, i8** %24
%26 = call i64 @stat(i8* %25, %struct.stat* %3)
%27 = icmp slt i64 %26, 0
br i1 %27, label %28, label %34
28: ; preds = %22
%29 = load i32, i32* @stderr
%30 = load i32, i32* @errno
%31 = call i8* @strerror(i32 %30)
%32 = load i8*, i8** %24
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %30, i8* %31, i8* %32)
br label %60
34: ; preds = %22
%35 = load i8*, i8** %24
%36 = load i32, i32* @O_RDWR
%37 = load i32, i32* @O_TRUNC
%38 = or i32 %37, %36
%39 = call i32 @open(i8* %35, i32 %38)
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %47
41: ; preds = %34
%42 = load i32, i32* @stderr
%43 = load i32, i32* @errno
%44 = call i8* @strerror(i32 %43)
%45 = load i8*, i8** %24
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %43, i8* %44, i8* %45)
br label %60
47: ; preds = %34
%48 = call i32 @close(i32 %39)
%49 = load i32, i32* %9
store i32 %49, i32* %10
%50 = load i32, i32* %11
store i32 %50, i32* %12
%51 = load i8*, i8** %24
%52 = call i64 @utime(i8* %51, %struct.utimbuf* %4)
%53 = icmp slt i64 %52, 0
br i1 %53, label %54, label %60
54: ; preds = %47
%55 = load i32, i32* @stderr
%56 = load i32, i32* @errno
%57 = call i8* @strerror(i32 %56)
%58 = load i8*, i8** %24
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %56, i8* %57, i8* %58)
br label %60
60: ; preds = %47, %54, %41, %28
%61 = add nuw nsw i64 %23, 1
%62 = icmp eq i64 %61, %13
br i1 %62, label %63, label %22
63: ; preds = %60
%64 = load i32, i32* @EXIT_SUCCESS
ret i32 %64
}