#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*/ err_ret(char *, char *);
scalar_t__ stat(char *, struct stat *);
scalar_t__ truncate(char *, int /*<<< orphan*/);
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 (truncate(argv[i], 0) < 0) {
      err_ret("%s: open error", argv[i]);
      continue;
    }
    timebuf.actime = statbuf.st_atime;
    timebuf.modtime = statbuf.st_mtime;
    if (utime(argv[i], &timebuf) < 0) {
      err_ret("%s: utime error", argv[i]);
      continue;
    }
  }
  return 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    123a <main+0xfa>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
jge    11a5 <main+0x65>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe65(%rip),%rdi
call   1060 <err_ret@plt>
jmp    122c <main+0xec>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
xor    %esi,%esi
call   1050 <truncate@plt>
cmp    $0x0,%rax
jge    11df <main+0x9f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe3a(%rip),%rdi
call   1060 <err_ret@plt>
jmp    122c <main+0xec>
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    1227 <main+0xe7>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe01(%rip),%rdi
call   1060 <err_ret@plt>
jmp    122c <main+0xec>
jmp    122c <main+0xec>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115d <main+0x1d>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jl     11ed <main+0xad>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x1,%r12d
lea    0x10(%rsp),%r14
lea    0xe92(%rip),%r15
lea    0x8(%rsp),%r13
jmp    1191 <main+0x51>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
call   1060 <err_ret@plt>
add    $0x1,%r12
cmp    %r12,%rbp
je     11ed <main+0xad>
mov    (%rbx,%r12,8),%rdi
mov    %r14,%rsi
call   1040 <stat@plt>
mov    (%rbx,%r12,8),%rsi
test   %rax,%rax
js     1180 <main+0x40>
mov    %rsi,%rdi
xor    %esi,%esi
call   1050 <truncate@plt>
test   %rax,%rax
js     11e0 <main+0xa0>
mov    0x10(%rsp),%rax
mov    %rax,0x8(%rsp)
mov    (%rbx,%r12,8),%rdi
mov    %r13,%rsi
call   1030 <utime@plt>
test   %rax,%rax
jns    1188 <main+0x48>
mov    (%rbx,%r12,8),%rsi
lea    0xe43(%rip),%rdi
jmp    1183 <main+0x43>
nopl   (%rax)
mov    (%rbx,%r12,8),%rsi
lea    0xe24(%rip),%rdi
jmp    1183 <main+0x43>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32, i32 }
%struct.utimbuf = type { i32, i32 }
@.str = [15 x i8] c"%s: stat error\00"
@.str.1 = [15 x i8] c"%s: open error\00"
@.str.2 = [16 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 = %66, %2
%11 = load i32, i32* %6
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %69
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 ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %27)
br label %66
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 = call i64 @truncate(i8* %34, i32 0)
%36 = icmp slt i64 %35, 0
br i1 %36, label %37, label %44
37: ; preds = %29
%38 = load i8**, i8*** %5
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8*, i8** %38, i64 %40
%42 = load i8*, i8** %41
%43 = call i32 @err_ret(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %42)
br label %66
44: ; preds = %29
%45 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 1
%46 = load i32, i32* %45
%47 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %9, i32 0, i32 1
store i32 %46, i32* %47
%48 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%49 = load i32, i32* %48
%50 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %9, i32 0, i32 0
store i32 %49, i32* %50
%51 = load i8**, i8*** %5
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %51, i64 %53
%55 = load i8*, i8** %54
%56 = call i64 @utime(i8* %55, %struct.utimbuf* %9)
%57 = icmp slt i64 %56, 0
br i1 %57, label %58, label %65
58: ; preds = %44
%59 = load i8**, i8*** %5
%60 = load i32, i32* %6
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8*, i8** %59, i64 %61
%63 = load i8*, i8** %62
%64 = call i32 @err_ret(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %63)
br label %66
65: ; preds = %44
br label %66
66: ; preds = %65, %58, %37, %22
%67 = load i32, i32* %6
%68 = add nsw i32 %67, 1
store i32 %68, i32* %6
br label %10
69: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32, i32 }
%struct.utimbuf = type { i32, i32 }
@.str = [15 x i8] c"%s: stat error\00"
@.str.1 = [15 x i8] c"%s: open error\00"
@.str.2 = [16 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 %41
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, %38
%15 = phi i64 [ 1, %8 ], [ %39, %38 ]
%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 ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %20)
br label %38
23: ; preds = %14
%24 = call i64 @truncate(i8* %20, i32 0)
%25 = icmp slt i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i8*, i8** %16
%28 = call i32 @err_ret(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %27)
br label %38
29: ; preds = %23
%30 = load i32, i32* %9
store i32 %30, i32* %10
%31 = load i32, i32* %11
store i32 %31, i32* %12
%32 = load i8*, i8** %16
%33 = call i64 @utime(i8* %32, %struct.utimbuf* %4)
%34 = icmp slt i64 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %29
%36 = load i8*, i8** %16
%37 = call i32 @err_ret(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %36)
br label %38
38: ; preds = %29, %35, %26, %21
%39 = add nuw nsw i64 %15, 1
%40 = icmp eq i64 %39, %13
br i1 %40, label %41, label %14
41: ; preds = %38, %2
ret i32 0
}