#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 void *time_t;
struct utimbuf {
  void *modtime;
  void *actime;
};
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ dohelp(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt(int, char **, char *);
size_t optind;
int optopt;
void *parsetimestring(char *);
int /*<<< orphan*/ perror(char *);
int stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ utime(char *, struct utimbuf *);
int main(int argc, char **argv) {
  int opt, filecount;
  struct stat sb;
  char *fn;
  char dts[16];
  time_t tim;
  struct utimbuf utb;
  while ((opt = getopt(argc, argv, ":h")) != -1) {
    switch (opt) {
    case 'h':
      dohelp(0);
      break;
    case ':':
      fprintf(stderr, "Option %c requires an argument\n", optopt);
      dohelp(1);
      break;
    case '?':
      fprintf(stderr, "Illegal option: %c\n", optopt);
      dohelp(1);
      break;
    }
  }
  if (!(argv[optind])) {
    fprintf(stderr, "No date string provided.\n");
    dohelp(1);
  } else {
    strcpy(dts, argv[optind]);
  }
  tim = parsetimestring(dts);
  filecount = 0;
  optind++;
  while (argv[optind]) {
    if (stat(argv[optind], &sb) == -1) {
      perror(argv[optind]);
      exit(EXIT_FAILURE);
    } else {
      fn = argv[optind];
      utb.actime = tim;
      utb.modtime = tim;
      utime(fn, &utb);
    }
    filecount++;
    optind++;
  }
  if (!(filecount)) {
    fprintf(stderr, "No filename provided.\n");
    dohelp(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe4c(%rip),%rdx
call   10a0 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1265 <main+0xd5>
mov    -0x14(%rbp),%eax
mov    %eax,-0x5c(%rbp)
sub    $0x3a,%eax
je     1207 <main+0x77>
jmp    11d9 <main+0x49>
mov    -0x5c(%rbp),%eax
sub    $0x3f,%eax
je     1236 <main+0xa6>
jmp    11ea <main+0x5a>
mov    -0x5c(%rbp),%eax
sub    $0x68,%eax
jne    1260 <main+0xd0>
jmp    11fb <main+0x6b>
xor    %edi,%edi
call   1050 <dohelp@plt>
jmp    1260 <main+0xd0>
mov    0x2dc2(%rip),%rax
mov    (%rax),%edi
mov    0x2dd1(%rip),%rax
mov    (%rax),%edx
lea    0xde3(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1050 <dohelp@plt>
jmp    1260 <main+0xd0>
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
mov    0x2da2(%rip),%rax
mov    (%rax),%edx
lea    0xdd4(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1050 <dohelp@plt>
jmp    11a6 <main+0x16>
mov    -0x10(%rbp),%rax
mov    0x2d70(%rip),%rcx
mov    (%rcx),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    12a4 <main+0x114>
mov    0x2d4b(%rip),%rax
mov    (%rax),%edi
lea    0xda9(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1050 <dohelp@plt>
jmp    12bf <main+0x12f>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x2d2d(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strcpy@plt>
lea    -0x40(%rbp),%rdi
call   1060 <parsetimestring@plt>
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x18(%rbp)
mov    0x2d06(%rip),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    0x2cf8(%rip),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x2cea(%rip),%rcx
mov    (%rcx),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     13a6 <main+0x216>
mov    -0x10(%rbp),%rax
mov    0x2cd1(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x20(%rbp),%rsi
call   1080 <stat@plt>
cmp    $0xffffffff,%eax
jne    134d <main+0x1bd>
mov    -0x10(%rbp),%rax
mov    0x2cad(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <perror@plt>
mov    0x2c82(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x2c88(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x58(%rbp),%rsi
call   1030 <utime@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    0x2c50(%rip),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    0x2c42(%rip),%rax
mov    %rcx,(%rax)
jmp    12eb <main+0x15b>
cmpl   $0x0,-0x18(%rbp)
jne    13d1 <main+0x241>
mov    0x2c19(%rip),%rax
mov    (%rax),%edi
lea    0xc91(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1050 <dohelp@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe56(%rip),%r14
lea    0xe52(%rip),%r15
mov    0x2e30(%rip),%r13
lea    0xe64(%rip),%r12
jmp    11f1 <main+0x61>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rsi
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1050 <dohelp@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   10a0 <getopt@plt>
cmp    $0x3e,%eax
jle    1220 <main+0x90>
mov    $0x0,%edi
cmp    $0x68,%eax
je     11ec <main+0x5c>
cmp    $0x3f,%eax
je     11d0 <main+0x40>
jmp    11f1 <main+0x61>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rsi
cmp    $0x3a,%eax
je     11d3 <main+0x43>
cmp    $0xffffffff,%eax
jne    11f1 <main+0x61>
mov    0x2dac(%rip),%r13
mov    0x0(%r13),%rax
mov    (%rbx,%rax,8),%rsi
test   %rsi,%rsi
je     124d <main+0xbd>
lea    0x20(%rsp),%rdi
call   1040 <strcpy@plt>
jmp    126e <main+0xde>
mov    0x2d7c(%rip),%rax
mov    (%rax),%edi
lea    0xdda(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1050 <dohelp@plt>
lea    0x20(%rsp),%rdi
call   1060 <parsetimestring@plt>
mov    %rax,%rbp
mov    0x0(%r13),%rax
lea    0x1(%rax),%rcx
mov    %rcx,0x0(%r13)
mov    0x8(%rbx,%rax,8),%r12
test   %r12,%r12
je     12e2 <main+0x152>
lea    0x8(%rsp),%r14
lea    0x10(%rsp),%r15
mov    %r12,%rdi
xchg   %ax,%ax
mov    %r14,%rsi
call   1080 <stat@plt>
mov    0x0(%r13),%rcx
mov    (%rbx,%rcx,8),%rdi
cmp    $0xffffffff,%eax
je     1314 <main+0x184>
mov    %rbp,0x18(%rsp)
mov    %rbp,0x10(%rsp)
mov    %r15,%rsi
call   1030 <utime@plt>
mov    0x0(%r13),%rax
lea    0x1(%rax),%rcx
mov    %rcx,0x0(%r13)
mov    0x8(%rbx,%rax,8),%rdi
test   %rdi,%rdi
jne    12a0 <main+0x110>
test   %r12,%r12
jne    1303 <main+0x173>
mov    0x2ce7(%rip),%rax
mov    (%rax),%edi
lea    0xd5f(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1050 <dohelp@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
call   1090 <perror@plt>
mov    0x2ca8(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
%struct.utimbuf = type { i8*, i8* }
@.str = [3 x i8] c":h\00"
@stderr = global i32 0
@.str.1 = [32 x i8] c"Option %c requires an argument\0A\00"
@optopt = global i32 0
@.str.2 = [20 x i8] c"Illegal option: %c\0A\00"
@optind = global i64 0
@.str.3 = [26 x i8] c"No date string provided.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [23 x i8] c"No filename provided.\0A\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 i8*
%10 = alloca [16 x i8]
%11 = alloca i8*
%12 = alloca %struct.utimbuf
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %13
13: ; preds = %32, %2
%14 = load i32, i32* %4
%15 = load i8**, i8*** %5
%16 = call i32 @getopt(i32 %14, i8** %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %16, i32* %6
%17 = icmp ne i32 %16, -1
br i1 %17, label %18, label %33
18: ; preds = %13
%19 = load i32, i32* %6
switch i32 %19, label %32 [
i32 104, label %20
i32 58, label %22
i32 63, label %27
]
20: ; preds = %18
%21 = call i32 @dohelp(i32 0)
br label %32
22: ; preds = %18
%23 = load i32, i32* @stderr
%24 = load i32, i32* @optopt
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = call i32 @dohelp(i32 1)
br label %32
27: ; preds = %18
%28 = load i32, i32* @stderr
%29 = load i32, i32* @optopt
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = call i32 @dohelp(i32 1)
br label %32
32: ; preds = %18, %27, %22, %20
br label %13
33: ; preds = %13
%34 = load i8**, i8*** %5
%35 = load i64, i64* @optind
%36 = getelementptr inbounds i8*, i8** %34, i64 %35
%37 = load i8*, i8** %36
%38 = icmp ne i8* %37, null
br i1 %38, label %43, label %39
39: ; preds = %33
%40 = load i32, i32* @stderr
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%42 = call i32 @dohelp(i32 1)
br label %50
43: ; preds = %33
%44 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%45 = load i8**, i8*** %5
%46 = load i64, i64* @optind
%47 = getelementptr inbounds i8*, i8** %45, i64 %46
%48 = load i8*, i8** %47
%49 = call i32 @strcpy(i8* %44, i8* %48)
br label %50
50: ; preds = %43, %39
%51 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%52 = call i8* @parsetimestring(i8* %51)
store i8* %52, i8** %11
store i32 0, i32* %7
%53 = load i64, i64* @optind
%54 = add i64 %53, 1
store i64 %54, i64* @optind
br label %55
55: ; preds = %87, %50
%56 = load i8**, i8*** %5
%57 = load i64, i64* @optind
%58 = getelementptr inbounds i8*, i8** %56, i64 %57
%59 = load i8*, i8** %58
%60 = icmp ne i8* %59, null
br i1 %60, label %61, label %92
61: ; preds = %55
%62 = load i8**, i8*** %5
%63 = load i64, i64* @optind
%64 = getelementptr inbounds i8*, i8** %62, i64 %63
%65 = load i8*, i8** %64
%66 = call i32 @stat(i8* %65, %struct.stat* %8)
%67 = icmp eq i32 %66, -1
br i1 %67, label %68, label %76
68: ; preds = %61
%69 = load i8**, i8*** %5
%70 = load i64, i64* @optind
%71 = getelementptr inbounds i8*, i8** %69, i64 %70
%72 = load i8*, i8** %71
%73 = call i32 @perror(i8* %72)
%74 = load i32, i32* @EXIT_FAILURE
%75 = call i32 @exit(i32 %74)
unreachable
76: ; preds = %61
%77 = load i8**, i8*** %5
%78 = load i64, i64* @optind
%79 = getelementptr inbounds i8*, i8** %77, i64 %78
%80 = load i8*, i8** %79
store i8* %80, i8** %9
%81 = load i8*, i8** %11
%82 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %12, i32 0, i32 1
store i8* %81, i8** %82
%83 = load i8*, i8** %11
%84 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %12, i32 0, i32 0
store i8* %83, i8** %84
%85 = load i8*, i8** %9
%86 = call i32 @utime(i8* %85, %struct.utimbuf* %12)
br label %87
87: ; preds = %76
%88 = load i32, i32* %7
%89 = add nsw i32 %88, 1
store i32 %89, i32* %7
%90 = load i64, i64* @optind
%91 = add i64 %90, 1
store i64 %91, i64* @optind
br label %55
92: ; preds = %55
%93 = load i32, i32* %7
%94 = icmp ne i32 %93, 0
br i1 %94, label %99, label %95
95: ; preds = %92
%96 = load i32, i32* @stderr
%97 = call i32 (i32, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%98 = call i32 @dohelp(i32 1)
br label %99
99: ; preds = %95, %92
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.utimbuf = type { i8*, i8* }
@.str = [3 x i8] c":h\00"
@stderr = global i32 0
@.str.1 = [32 x i8] c"Option %c requires an argument\0A\00"
@optopt = global i32 0
@.str.2 = [20 x i8] c"Illegal option: %c\0A\00"
@optind = global i64 0
@.str.3 = [26 x i8] c"No date string provided.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [23 x i8] c"No filename provided.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.stat
%4 = alloca [16 x i8]
%5 = alloca %struct.utimbuf
%6 = bitcast %struct.stat* %3 to i8*
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%8 = bitcast %struct.utimbuf* %5 to i8*
br label %9
9: ; preds = %20, %2
%10 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %10, label %20 [
i32 -1, label %21
i32 104, label %17
i32 58, label %12
i32 63, label %11
]
11: ; preds = %9
br label %12
12: ; preds = %9, %11
%13 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), %11 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), %9 ]
%14 = load i32, i32* @stderr
%15 = load i32, i32* @optopt
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* %13, i32 %15)
br label %17
17: ; preds = %12, %9
%18 = phi i32 [ 0, %9 ], [ 1, %12 ]
%19 = tail call i32 @dohelp(i32 %18)
br label %20
20: ; preds = %17, %9
br label %9
21: ; preds = %9
%22 = load i64, i64* @optind
%23 = getelementptr inbounds i8*, i8** %1, i64 %22
%24 = load i8*, i8** %23
%25 = icmp eq i8* %24, null
br i1 %25, label %26, label %30
26: ; preds = %21
%27 = load i32, i32* @stderr
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%29 = tail call i32 @dohelp(i32 1)
br label %32
30: ; preds = %21
%31 = call i32 @strcpy(i8* %7, i8* %24)
br label %32
32: ; preds = %30, %26
%33 = call i8* @parsetimestring(i8* %7)
%34 = load i64, i64* @optind
%35 = add i64 %34, 1
store i64 %35, i64* @optind
%36 = getelementptr inbounds i8*, i8** %1, i64 %35
%37 = load i8*, i8** %36
%38 = icmp eq i8* %37, null
br i1 %38, label %61, label %39
39: ; preds = %32
%40 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %5, i64 0, i32 1
%41 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %5, i64 0, i32 0
br label %42
42: ; preds = %39, %53
%43 = phi i8* [ %37, %39 ], [ %58, %53 ]
%44 = call i32 @stat(i8* %43, %struct.stat* %3)
%45 = icmp eq i32 %44, -1
%46 = load i64, i64* @optind
%47 = getelementptr inbounds i8*, i8** %1, i64 %46
%48 = load i8*, i8** %47
br i1 %45, label %49, label %53
49: ; preds = %42
%50 = call i32 @perror(i8* %48)
%51 = load i32, i32* @EXIT_FAILURE
%52 = call i32 @exit(i32 %51)
unreachable
53: ; preds = %42
store i8* %33, i8** %40
store i8* %33, i8** %41
%54 = call i32 @utime(i8* %48, %struct.utimbuf* %5)
%55 = load i64, i64* @optind
%56 = add i64 %55, 1
store i64 %56, i64* @optind
%57 = getelementptr inbounds i8*, i8** %1, i64 %56
%58 = load i8*, i8** %57
%59 = icmp eq i8* %58, null
br i1 %59, label %60, label %42
60: ; preds = %53
br i1 %38, label %61, label %65
61: ; preds = %32, %60
%62 = load i32, i32* @stderr
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%64 = call i32 @dohelp(i32 1)
br label %65
65: ; preds = %61, %60
ret i32 0
}