#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 time_t;
struct tm {
  int dummy;
};
struct dirent {
  char *d_name;
};
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ FILENAME_MAX;
int /*<<< orphan*/ checkmask(char *, char *);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
struct tm *gmtime(int *);
void *hex2sec(char *);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char const *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strftime(char *, int, char const *, struct tm *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int main(int argc, char **argv) {
  int i, ver;
  DIR *d;
  struct dirent *e;
  const char *s;
  FILE *fp;
  char path[FILENAME_MAX + 1];
  char line[1035];
  time_t date, lmod, expire;
  unsigned int len;
  struct tm ts;
  char sdate[30], slmod[30], sexpire[30];
  const char time_format[] = "%e %b %Y %R";
  if (argc != 2) {
    printf("Usage: cls directory\n");
    exit(0);
  }
  d = opendir(argv[1]);
  if (d == NULL) {
    perror("opendir");
    exit(1);
  }
  for (;;) {
    e = readdir(d);
    if (e == NULL)
      break;
    s = e->d_name;
    if (s[0] == '.' || s[0] == '#')
      continue;
    sprintf(path, "%s/%s", argv[1], s);
    fp = fopen(path, "r");
    if (fp == NULL) {
      perror("fopen");
      continue;
    }
    if (fgets(line, 1034, fp) == NULL) {
      perror("fgets");
      fclose(fp);
      continue;
    }
    if (!checkmask(line, "&&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&&\n")) {
      fprintf(stderr, "Bad cache file\n");
      fclose(fp);
      continue;
    }
    date = hex2sec(line);
    lmod = hex2sec(line + 9);
    expire = hex2sec(line + 18);
    ver = hex2sec(line + 27);
    len = hex2sec(line + 35);
    if (fgets(line, 1034, fp) == NULL) {
      perror("fgets");
      fclose(fp);
      continue;
    }
    fclose(fp);
    i = strlen(line);
    if (strncmp(line, "X-URL: ", 7) != 0 || line[i - 1] != '\n') {
      fprintf(stderr, "Bad cache file\n");
      continue;
    }
    line[i - 1] = '\0';
    if (date != -1) {
      ts = *gmtime(&date);
      strftime(sdate, 30, time_format, &ts);
    } else
      strcpy(sdate, "-");
    if (lmod != -1) {
      ts = *gmtime(&lmod);
      strftime(slmod, 30, time_format, &ts);
    } else
      strcpy(slmod, "-");
    if (expire != -1) {
      ts = *gmtime(&expire);
      strftime(sexpire, 30, time_format, &ts);
    } else
      strcpy(sexpire, "-");
    printf("%s: %d; %s  %s  %s\n", line + 7, ver, sdate, slmod, sexpire);
  }
  closedir(d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x500,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2da8(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x4f8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    0xd8e(%rip),%rax
mov    %rax,-0x4ec(%rbp)
mov    0xd89(%rip),%eax
mov    %eax,-0x4e4(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     12a4 <main+0x84>
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
xor    %edi,%edi
call   1130 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <opendir@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    12d6 <main+0xb6>
lea    0xd5b(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
jmp    12db <main+0xbb>
mov    -0x20(%rbp),%rdi
call   10d0 <readdir@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    12f8 <main+0xd8>
jmp    164d <main+0x42d>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     1323 <main+0x103>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
jne    1328 <main+0x108>
jmp    12db <main+0xbb>
mov    -0x4f8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x30(%rbp),%rcx
lea    0xce8(%rip),%rsi
call   1120 <sprintf@plt>
mov    -0x4f8(%rbp),%rdi
lea    0xcd3(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    137a <main+0x15a>
lea    0xcc0(%rip),%rdi
call   1100 <perror@plt>
jmp    12db <main+0xbb>
lea    -0x460(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    $0x40a,%esi
call   10b0 <fgets@plt>
cmp    $0x0,%rax
jne    13b3 <main+0x193>
lea    0xc96(%rip),%rdi
call   1100 <perror@plt>
mov    -0x38(%rbp),%rdi
call   1060 <fclose@plt>
jmp    12db <main+0xbb>
lea    -0x460(%rbp),%rdi
lea    0xc7b(%rip),%rsi
call   1050 <checkmask@plt>
cmp    $0x0,%eax
jne    13f2 <main+0x1d2>
mov    0x2c02(%rip),%rax
mov    (%rax),%edi
lea    0xc8b(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1060 <fclose@plt>
jmp    12db <main+0xbb>
lea    -0x460(%rbp),%rdi
call   1140 <hex2sec@plt>
mov    %eax,-0x464(%rbp)
lea    -0x460(%rbp),%rdi
add    $0x9,%rdi
call   1140 <hex2sec@plt>
mov    %eax,-0x468(%rbp)
lea    -0x460(%rbp),%rdi
add    $0x12,%rdi
call   1140 <hex2sec@plt>
mov    %eax,-0x46c(%rbp)
lea    -0x460(%rbp),%rdi
add    $0x1b,%rdi
call   1140 <hex2sec@plt>
mov    %eax,-0x18(%rbp)
lea    -0x460(%rbp),%rdi
add    $0x23,%rdi
call   1140 <hex2sec@plt>
mov    %eax,-0x470(%rbp)
lea    -0x460(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    $0x40a,%esi
call   10b0 <fgets@plt>
cmp    $0x0,%rax
jne    1492 <main+0x272>
lea    0xbb7(%rip),%rdi
call   1100 <perror@plt>
mov    -0x38(%rbp),%rdi
call   1060 <fclose@plt>
jmp    12db <main+0xbb>
mov    -0x38(%rbp),%rdi
call   1060 <fclose@plt>
lea    -0x460(%rbp),%rdi
call   1080 <strlen@plt>
mov    %eax,-0x14(%rbp)
lea    -0x460(%rbp),%rdi
lea    0xbc2(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    14e5 <main+0x2c5>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x460(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
je     14ff <main+0x2df>
mov    0x2aec(%rip),%rax
mov    (%rax),%edi
lea    0xb75(%rip),%rsi
call   10c0 <fprintf@plt>
jmp    12db <main+0xbb>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0x460(%rbp,%rax,1)
cmpl   $0xffffffff,-0x464(%rbp)
je     1554 <main+0x334>
lea    -0x464(%rbp),%rdi
call   1110 <gmtime@plt>
mov    (%rax),%eax
mov    %eax,-0x478(%rbp)
lea    -0x4a0(%rbp),%rdi
lea    -0x4ec(%rbp),%rdx
mov    $0x1e,%esi
lea    -0x478(%rbp),%rcx
call   10e0 <strftime@plt>
jmp    1567 <main+0x347>
lea    -0x4a0(%rbp),%rdi
lea    0xb20(%rip),%rsi
call   1040 <strcpy@plt>
cmpl   $0xffffffff,-0x468(%rbp)
je     15ac <main+0x38c>
lea    -0x468(%rbp),%rdi
call   1110 <gmtime@plt>
mov    (%rax),%eax
mov    %eax,-0x478(%rbp)
lea    -0x4c0(%rbp),%rdi
lea    -0x4ec(%rbp),%rdx
mov    $0x1e,%esi
lea    -0x478(%rbp),%rcx
call   10e0 <strftime@plt>
jmp    15bf <main+0x39f>
lea    -0x4c0(%rbp),%rdi
lea    0xac8(%rip),%rsi
call   1040 <strcpy@plt>
cmpl   $0xffffffff,-0x46c(%rbp)
je     1604 <main+0x3e4>
lea    -0x46c(%rbp),%rdi
call   1110 <gmtime@plt>
mov    (%rax),%eax
mov    %eax,-0x478(%rbp)
lea    -0x4e0(%rbp),%rdi
lea    -0x4ec(%rbp),%rdx
mov    $0x1e,%esi
lea    -0x478(%rbp),%rcx
call   10e0 <strftime@plt>
jmp    1617 <main+0x3f7>
lea    -0x4e0(%rbp),%rdi
lea    0xa70(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x460(%rbp),%rsi
add    $0x7,%rsi
mov    -0x18(%rbp),%edx
lea    -0x4a0(%rbp),%rcx
lea    -0x4c0(%rbp),%r8
lea    -0x4e0(%rbp),%r9
lea    0xa43(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    12db <main+0xbb>
mov    -0x20(%rbp),%rdi
call   10a0 <closedir@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4a8,%rsp
mov    0x2d9d(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%r12
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
movabs $0x5925206225206525,%rax
20 25 59
mov    %rax,-0x60(%rbp)
movl   $0x522520,-0x58(%rbp)
cmp    $0x2,%edi
jne    154c <main+0x31c>
mov    %rsi,%r15
mov    0x8(%rsi),%rdi
call   1080 <opendir@plt>
test   %rax,%rax
je     155f <main+0x32f>
mov    %rax,%rbx
mov    %rax,%rdi
call   10e0 <readdir@plt>
test   %rax,%rax
je     1533 <main+0x303>
lea    -0x4d0(%rbp),%r13
mov    %r12,-0x50(%rbp)
mov    %rbx,-0x38(%rbp)
jmp    12ea <main+0xba>
mov    0x2d18(%rip),%rax
mov    (%rax),%edi
lea    0xd8b(%rip),%rsi
call   10d0 <fprintf@plt>
mov    %r12,%r15
mov    -0x50(%rbp),%r12
mov    -0x38(%rbp),%rbx
mov    %rbx,%rdi
call   10e0 <readdir@plt>
test   %rax,%rax
je     1533 <main+0x303>
mov    (%rax),%rcx
movzbl (%rcx),%eax
cmp    $0x2e,%al
je     12d9 <main+0xa9>
cmp    $0x23,%al
je     12d9 <main+0xa9>
mov    %r15,%rbx
mov    0x8(%r15),%rdx
mov    %r12,%rdi
lea    0xd0b(%rip),%rsi
call   1130 <sprintf@plt>
mov    %r12,%rdi
lea    0xcfa(%rip),%rsi
call   1100 <fopen@plt>
test   %rax,%rax
je     1461 <main+0x231>
mov    %rax,%r14
mov    %r13,%rdi
mov    $0x40a,%esi
mov    %rax,%rdx
call   10c0 <fgets@plt>
test   %rax,%rax
je     1445 <main+0x215>
mov    %r13,%rdi
lea    0xcda(%rip),%rsi
call   1050 <checkmask@plt>
test   %eax,%eax
je     142e <main+0x1fe>
mov    %r13,%rdi
call   1150 <hex2sec@plt>
mov    %eax,-0x44(%rbp)
lea    -0x4c7(%rbp),%rdi
call   1150 <hex2sec@plt>
mov    %eax,-0x40(%rbp)
lea    -0x4be(%rbp),%rdi
call   1150 <hex2sec@plt>
mov    %eax,-0x3c(%rbp)
lea    -0x4b5(%rbp),%rdi
call   1150 <hex2sec@plt>
mov    %rax,%r15
lea    -0x4ad(%rbp),%rdi
call   1150 <hex2sec@plt>
mov    %r13,%rdi
mov    $0x40a,%esi
mov    %r14,%rdx
call   10c0 <fgets@plt>
test   %rax,%rax
je     1445 <main+0x215>
mov    %rbx,%r12
mov    %r14,%rdi
call   1070 <fclose@plt>
mov    %r13,%rdi
call   1090 <strlen@plt>
mov    %eax,%ebx
mov    %r13,%rdi
lea    0xc8f(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    12b9 <main+0x89>
movslq %ebx,%rax
cmpb   $0xa,-0x1(%rax,%r13,1)
jne    12b9 <main+0x89>
movb   $0x0,-0x4d1(%rbp,%rax,1)
cmpl   $0xffffffff,-0x44(%rbp)
je     146f <main+0x23f>
lea    -0x44(%rbp),%rdi
call   1120 <gmtime@plt>
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
lea    -0xa0(%rbp),%rdi
mov    $0x1e,%esi
lea    -0x60(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   10f0 <strftime@plt>
jmp    1482 <main+0x252>
mov    0x2ba3(%rip),%rax
mov    (%rax),%edi
lea    0xc16(%rip),%rsi
call   10d0 <fprintf@plt>
jmp    1451 <main+0x221>
lea    0xbd4(%rip),%rdi
call   1110 <perror@plt>
mov    %r14,%rdi
call   1070 <fclose@plt>
mov    %rbx,%r15
jmp    12d5 <main+0xa5>
lea    0xbb2(%rip),%rdi
call   1110 <perror@plt>
jmp    1459 <main+0x229>
lea    -0xa0(%rbp),%rdi
lea    0xbef(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0xc0(%rbp),%r14
mov    %r15,%rbx
cmpl   $0xffffffff,-0x40(%rbp)
je     14b8 <main+0x288>
lea    -0x40(%rbp),%rdi
call   1120 <gmtime@plt>
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
lea    -0x80(%rbp),%rdi
mov    $0x1e,%esi
lea    -0x60(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   10f0 <strftime@plt>
jmp    14c8 <main+0x298>
lea    -0x80(%rbp),%rdi
lea    0xba9(%rip),%rsi
call   1040 <strcpy@plt>
mov    %r12,%r15
cmpl   $0xffffffff,-0x3c(%rbp)
je     14f6 <main+0x2c6>
lea    -0x3c(%rbp),%rdi
call   1120 <gmtime@plt>
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    %r14,%rdi
mov    $0x1e,%esi
lea    -0x60(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   10f0 <strftime@plt>
jmp    1505 <main+0x2d5>
mov    %r14,%rdi
lea    0xb6c(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x50(%rbp),%r12
lea    0xb5e(%rip),%rdi
lea    -0x4c9(%rbp),%rsi
mov    %ebx,%edx
lea    -0xa0(%rbp),%rcx
lea    -0x80(%rbp),%r8
mov    %r14,%r9
xor    %eax,%eax
call   10a0 <printf@plt>
jmp    12d5 <main+0xa5>
mov    %rbx,%rdi
call   10b0 <closedir@plt>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb2f(%rip),%rdi
call   1060 <puts@plt>
xor    %edi,%edi
call   1140 <exit@plt>
lea    0xaa6(%rip),%rdi
call   1110 <perror@plt>
mov    $0x1,%edi
call   1140 <exit@plt>

LLVM IR (-O0):
%struct.dirent = type { i8* }
%struct.tm = type { i32 }
@FILENAME_MAX = global i32 0
@__const.main.time_format = [12 x i8] c"%e %b %Y %R\00"
@.str = [22 x i8] c"Usage: cls directory\0A\00"
@.str.1 = [8 x i8] c"opendir\00"
@.str.2 = [6 x i8] c"%s/%s\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [6 x i8] c"fopen\00"
@.str.5 = [6 x i8] c"fgets\00"
@.str.6 = [46 x i8] c"&&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&&\0A\00"
@stderr = global i32 0
@.str.7 = [16 x i8] c"Bad cache file\0A\00"
@.str.8 = [8 x i8] c"X-URL: \00"
@.str.9 = [2 x i8] c"-\00"
@.str.10 = [20 x i8] c"%s: %d; %s %s %s\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 i32*
%9 = alloca %struct.dirent*
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca i8*
%13 = alloca i64
%14 = alloca [1035 x i8]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca %struct.tm
%20 = alloca [30 x i8]
%21 = alloca [30 x i8]
%22 = alloca [30 x i8]
%23 = alloca [12 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%24 = load i32, i32* @FILENAME_MAX
%25 = add nsw i32 %24, 1
%26 = zext i32 %25 to i64
%27 = call i8* @llvm.stacksave()
store i8* %27, i8** %12
%28 = alloca i8, i64 %26
store i64 %26, i64* %13
%29 = bitcast [12 x i8]* %23 to i8*
%30 = load i32, i32* %4
%31 = icmp ne i32 %30, 2
br i1 %31, label %32, label %35
32: ; preds = %2
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%34 = call i32 @exit(i32 0)
unreachable
35: ; preds = %2
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32* @opendir(i8* %38)
store i32* %39, i32** %8
%40 = load i32*, i32** %8
%41 = icmp eq i32* %40, null
br i1 %41, label %42, label %45
42: ; preds = %35
%43 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%44 = call i32 @exit(i32 1)
unreachable
45: ; preds = %35
br label %46
46: ; preds = %187, %141, %121, %92, %84, %77, %67, %45
%47 = load i32*, i32** %8
%48 = call %struct.dirent* @readdir(i32* %47)
store %struct.dirent* %48, %struct.dirent** %9
%49 = load %struct.dirent*, %struct.dirent** %9
%50 = icmp eq %struct.dirent* %49, null
br i1 %50, label %51, label %52
51: ; preds = %46
br label %195
52: ; preds = %46
%53 = load %struct.dirent*, %struct.dirent** %9
%54 = getelementptr inbounds %struct.dirent, %struct.dirent* %53, i32 0, i32 0
%55 = load i8*, i8** %54
store i8* %55, i8** %10
%56 = load i8*, i8** %10
%57 = getelementptr inbounds i8, i8* %56, i64 0
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = icmp eq i32 %59, 46
br i1 %60, label %67, label %61
61: ; preds = %52
%62 = load i8*, i8** %10
%63 = getelementptr inbounds i8, i8* %62, i64 0
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp eq i32 %65, 35
br i1 %66, label %67, label %68
67: ; preds = %61, %52
br label %46
68: ; preds = %61
%69 = load i8**, i8*** %5
%70 = getelementptr inbounds i8*, i8** %69, i64 1
%71 = load i8*, i8** %70
%72 = load i8*, i8** %10
%73 = call i32 @sprintf(i8* %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %71, i8* %72)
%74 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %74, i32** %11
%75 = load i32*, i32** %11
%76 = icmp eq i32* %75, null
br i1 %76, label %77, label %79
77: ; preds = %68
%78 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %46
79: ; preds = %68
%80 = getelementptr inbounds [1035 x i8], [1035 x i8]* %14, i64 0, i64 0
%81 = load i32*, i32** %11
%82 = call i32* @fgets(i8* %80, i32 1034, i32* %81)
%83 = icmp eq i32* %82, null
br i1 %83, label %84, label %88
84: ; preds = %79
%85 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%86 = load i32*, i32** %11
%87 = call i32 @fclose(i32* %86)
br label %46
88: ; preds = %79
%89 = getelementptr inbounds [1035 x i8], [1035 x i8]* %14, i64 0, i64 0
%90 = call i32 @checkmask(i8* %89, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%91 = icmp ne i32 %90, 0
br i1 %91, label %97, label %92
92: ; preds = %88
%93 = load i32, i32* @stderr
%94 = call i32 @fprintf(i32 %93, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%95 = load i32*, i32** %11
%96 = call i32 @fclose(i32* %95)
br label %46
97: ; preds = %88
%98 = getelementptr inbounds [1035 x i8], [1035 x i8]* %14, i64 0, i64 0
%99 = call i8* @hex2sec(i8* %98)
%100 = ptrtoint i8* %99 to i32
store i32 %100, i32* %15
%101 = getelementptr inbounds [1035 x i8], [1035 x i8]* %14, i64 0, i64 0
%102 = getelementptr inbounds i8, i8* %101, i64 9
%103 = call i8* @hex2sec(i8* %102)
%104 = ptrtoint i8* %103 to i32
store i32 %104, i32* %16
%105 = getelementptr inbounds [1035 x i8], [1035 x i8]* %14, i64 0, i64 0
%106 = getelementptr inbounds i8, i8* %105, i64 18
%107 = call i8* @hex2sec(i8* %106)
%108 = ptrtoint i8* %107 to i32
store i32 %108, i32* %17
%109 = getelementptr inbounds [1035 x i8], [1035 x i8]* %14, i64 0, i64 0
%110 = getelementptr inbounds i8, i8* %109, i64 27
%111 = call i8* @hex2sec(i8* %110)
%112 = ptrtoint i8* %111 to i32
store i32 %112, i32* %7
%113 = getelementptr inbounds [1035 x i8], [1035 x i8]* %14, i64 0, i64 0
%114 = getelementptr inbounds i8, i8* %113, i64 35
%115 = call i8* @hex2sec(i8* %114)
%116 = ptrtoint i8* %115 to i32
store i32 %116, i32* %18
%117 = getelementptr inbounds [1035 x i8], [1035 x i8]* %14, i64 0, i64 0
%118 = load i32*, i32** %11
%119 = call i32* @fgets(i8* %117, i32 1034, i32* %118)
%120 = icmp eq i32* %119, null
br i1 %120, label %121, label %125
121: ; preds = %97
%122 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%123 = load i32*, i32** %11
%124 = call i32 @fclose(i32* %123)
br label %46
125: ; preds = %97
%126 = load i32*, i32** %11
%127 = call i32 @fclose(i32* %126)
%128 = getelementptr inbounds [1035 x i8], [1035 x i8]* %14, i64 0, i64 0
%129 = call i32 @strlen(i8* %128)
store i32 %129, i32* %6
%130 = getelementptr inbounds [1035 x i8], [1035 x i8]* %14, i64 0, i64 0
%131 = call i64 @strncmp(i8* %130, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 7)
%132 = icmp ne i64 %131, 0
br i1 %132, label %141, label %133
133: ; preds = %125
%134 = load i32, i32* %6
%135 = sub nsw i32 %134, 1
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds [1035 x i8], [1035 x i8]* %14, i64 0, i64 %136
%138 = load i8, i8* %137
%139 = sext i8 %138 to i32
%140 = icmp ne i32 %139, 10
br i1 %140, label %141, label %144
141: ; preds = %133, %125
%142 = load i32, i32* @stderr
%143 = call i32 @fprintf(i32 %142, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
br label %46
144: ; preds = %133
%145 = load i32, i32* %6
%146 = sub nsw i32 %145, 1
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds [1035 x i8], [1035 x i8]* %14, i64 0, i64 %147
store i8 0, i8* %148
%149 = load i32, i32* %15
%150 = icmp ne i32 %149, -1
br i1 %150, label %151, label %158
151: ; preds = %144
%152 = call %struct.tm* @gmtime(i32* %15)
%153 = bitcast %struct.tm* %19 to i8*
%154 = bitcast %struct.tm* %152 to i8*
%155 = getelementptr inbounds [30 x i8], [30 x i8]* %20, i64 0, i64 0
%156 = getelementptr inbounds [12 x i8], [12 x i8]* %23, i64 0, i64 0
%157 = call i32 @strftime(i8* %155, i32 30, i8* %156, %struct.tm* %19)
br label %161
158: ; preds = %144
%159 = getelementptr inbounds [30 x i8], [30 x i8]* %20, i64 0, i64 0
%160 = call i32 @strcpy(i8* %159, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %161
161: ; preds = %158, %151
%162 = load i32, i32* %16
%163 = icmp ne i32 %162, -1
br i1 %163, label %164, label %171
164: ; preds = %161
%165 = call %struct.tm* @gmtime(i32* %16)
%166 = bitcast %struct.tm* %19 to i8*
%167 = bitcast %struct.tm* %165 to i8*
%168 = getelementptr inbounds [30 x i8], [30 x i8]* %21, i64 0, i64 0
%169 = getelementptr inbounds [12 x i8], [12 x i8]* %23, i64 0, i64 0
%170 = call i32 @strftime(i8* %168, i32 30, i8* %169, %struct.tm* %19)
br label %174
171: ; preds = %161
%172 = getelementptr inbounds [30 x i8], [30 x i8]* %21, i64 0, i64 0
%173 = call i32 @strcpy(i8* %172, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %174
174: ; preds = %171, %164
%175 = load i32, i32* %17
%176 = icmp ne i32 %175, -1
br i1 %176, label %177, label %184
177: ; preds = %174
%178 = call %struct.tm* @gmtime(i32* %17)
%179 = bitcast %struct.tm* %19 to i8*
%180 = bitcast %struct.tm* %178 to i8*
%181 = getelementptr inbounds [30 x i8], [30 x i8]* %22, i64 0, i64 0
%182 = getelementptr inbounds [12 x i8], [12 x i8]* %23, i64 0, i64 0
%183 = call i32 @strftime(i8* %181, i32 30, i8* %182, %struct.tm* %19)
br label %187
184: ; preds = %174
%185 = getelementptr inbounds [30 x i8], [30 x i8]* %22, i64 0, i64 0
%186 = call i32 @strcpy(i8* %185, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %187
187: ; preds = %184, %177
%188 = getelementptr inbounds [1035 x i8], [1035 x i8]* %14, i64 0, i64 0
%189 = getelementptr inbounds i8, i8* %188, i64 7
%190 = load i32, i32* %7
%191 = getelementptr inbounds [30 x i8], [30 x i8]* %20, i64 0, i64 0
%192 = getelementptr inbounds [30 x i8], [30 x i8]* %21, i64 0, i64 0
%193 = getelementptr inbounds [30 x i8], [30 x i8]* %22, i64 0, i64 0
%194 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i8* %189, i32 %190, i8* %191, i8* %192, i8* %193)
br label %46
195: ; preds = %51
%196 = load i32*, i32** %8
%197 = call i32 @closedir(i32* %196)
store i32 0, i32* %3
%198 = load i8*, i8** %12
%199 = load i32, i32* %3
ret i32 %199
}

LLVM IR (-O2):
%struct.tm = type { i32 }
%struct.dirent = type { i8* }
@FILENAME_MAX = global i32 0
@__const.main.time_format = [12 x i8] c"%e %b %Y %R\00"
@.str.1 = [8 x i8] c"opendir\00"
@.str.2 = [6 x i8] c"%s/%s\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [6 x i8] c"fopen\00"
@.str.5 = [6 x i8] c"fgets\00"
@.str.6 = [46 x i8] c"&&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&&\0A\00"
@stderr = global i32 0
@.str.7 = [16 x i8] c"Bad cache file\0A\00"
@.str.8 = [8 x i8] c"X-URL: \00"
@.str.9 = [2 x i8] c"-\00"
@.str.10 = [20 x i8] c"%s: %d; %s %s %s\0A\00"
@str = [21 x i8] c"Usage: cls directory\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1035 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.tm
%8 = alloca [30 x i8]
%9 = alloca [30 x i8]
%10 = alloca [30 x i8]
%11 = alloca [12 x i8]
%12 = load i32, i32* @FILENAME_MAX
%13 = add nsw i32 %12, 1
%14 = zext i32 %13 to i64
%15 = alloca i8, i64 %14
%16 = getelementptr inbounds [1035 x i8], [1035 x i8]* %3, i64 0, i64 0
%17 = bitcast i32* %4 to i8*
%18 = bitcast i32* %5 to i8*
%19 = bitcast i32* %6 to i8*
%20 = bitcast %struct.tm* %7 to i8*
%21 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%22 = getelementptr inbounds [30 x i8], [30 x i8]* %9, i64 0, i64 0
%23 = getelementptr inbounds [30 x i8], [30 x i8]* %10, i64 0, i64 0
%24 = getelementptr inbounds [12 x i8], [12 x i8]* %11, i64 0, i64 0
%25 = icmp eq i32 %0, 2
br i1 %25, label %29, label %26
26: ; preds = %2
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%28 = tail call i32 @exit(i32 0)
unreachable
29: ; preds = %2
%30 = getelementptr inbounds i8*, i8** %1, i64 1
%31 = load i8*, i8** %30
%32 = tail call i32* @opendir(i8* %31)
%33 = icmp eq i32* %32, null
br i1 %33, label %44, label %34
34: ; preds = %29
%35 = call %struct.dirent* @readdir(i32* %32)
%36 = icmp eq %struct.dirent* %35, null
br i1 %36, label %140, label %37
37: ; preds = %34
%38 = getelementptr inbounds [1035 x i8], [1035 x i8]* %3, i64 0, i64 9
%39 = getelementptr inbounds [1035 x i8], [1035 x i8]* %3, i64 0, i64 18
%40 = getelementptr inbounds [1035 x i8], [1035 x i8]* %3, i64 0, i64 27
%41 = getelementptr inbounds [1035 x i8], [1035 x i8]* %3, i64 0, i64 35
%42 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 0
%43 = getelementptr inbounds [1035 x i8], [1035 x i8]* %3, i64 0, i64 7
br label %47
44: ; preds = %29
%45 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%46 = tail call i32 @exit(i32 1)
unreachable
47: ; preds = %37, %52
%48 = phi %struct.dirent* [ %35, %37 ], [ %53, %52 ]
%49 = getelementptr inbounds %struct.dirent, %struct.dirent* %48, i64 0, i32 0
%50 = load i8*, i8** %49
%51 = load i8, i8* %50
switch i8 %51, label %55 [
i8 46, label %52
i8 35, label %52
]
52: ; preds = %47, %47, %60, %65, %71, %91, %105, %138
%53 = call %struct.dirent* @readdir(i32* %32)
%54 = icmp eq %struct.dirent* %53, null
br i1 %54, label %140, label %47
55: ; preds = %47
%56 = load i8*, i8** %30
%57 = call i32 @sprintf(i8* %15, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %56, i8* %50)
%58 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%59 = icmp eq i32* %58, null
br i1 %59, label %60, label %62
60: ; preds = %55
%61 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %52
62: ; preds = %55
%63 = call i32* @fgets(i8* %16, i32 1034, i32* %58)
%64 = icmp eq i32* %63, null
br i1 %64, label %65, label %68
65: ; preds = %62
%66 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%67 = call i32 @fclose(i32* %58)
br label %52
68: ; preds = %62
%69 = call i32 @checkmask(i8* %16, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%70 = icmp eq i32 %69, 0
br i1 %70, label %71, label %75
71: ; preds = %68
%72 = load i32, i32* @stderr
%73 = call i32 @fprintf(i32 %72, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%74 = call i32 @fclose(i32* %58)
br label %52
75: ; preds = %68
%76 = call i8* @hex2sec(i8* %16)
%77 = ptrtoint i8* %76 to i64
%78 = trunc i64 %77 to i32
store i32 %78, i32* %4
%79 = call i8* @hex2sec(i8* %38)
%80 = ptrtoint i8* %79 to i64
%81 = trunc i64 %80 to i32
store i32 %81, i32* %5
%82 = call i8* @hex2sec(i8* %39)
%83 = ptrtoint i8* %82 to i64
%84 = trunc i64 %83 to i32
store i32 %84, i32* %6
%85 = call i8* @hex2sec(i8* %40)
%86 = ptrtoint i8* %85 to i64
%87 = trunc i64 %86 to i32
%88 = call i8* @hex2sec(i8* %41)
%89 = call i32* @fgets(i8* %16, i32 1034, i32* %58)
%90 = icmp eq i32* %89, null
br i1 %90, label %91, label %94
91: ; preds = %75
%92 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%93 = call i32 @fclose(i32* %58)
br label %52
94: ; preds = %75
%95 = call i32 @fclose(i32* %58)
%96 = call i32 @strlen(i8* %16)
%97 = call i64 @strncmp(i8* %16, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 7)
%98 = icmp eq i64 %97, 0
br i1 %98, label %99, label %105
99: ; preds = %94
%100 = add nsw i32 %96, -1
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds [1035 x i8], [1035 x i8]* %3, i64 0, i64 %101
%103 = load i8, i8* %102
%104 = icmp eq i8 %103, 10
br i1 %104, label %108, label %105
105: ; preds = %99, %94
%106 = load i32, i32* @stderr
%107 = call i32 @fprintf(i32 %106, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
br label %52
108: ; preds = %99
store i8 0, i8* %102
%109 = load i32, i32* %4
%110 = icmp eq i32 %109, -1
br i1 %110, label %116, label %111
111: ; preds = %108
%112 = call %struct.tm* @gmtime(i32* %4)
%113 = getelementptr %struct.tm, %struct.tm* %112, i64 0, i32 0
%114 = load i32, i32* %113
store i32 %114, i32* %42
%115 = call i32 @strftime(i8* %21, i32 30, i8* %24, %struct.tm* %7)
br label %118
116: ; preds = %108
%117 = call i32 @strcpy(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %118
118: ; preds = %116, %111
%119 = load i32, i32* %5
%120 = icmp eq i32 %119, -1
br i1 %120, label %126, label %121
121: ; preds = %118
%122 = call %struct.tm* @gmtime(i32* %5)
%123 = getelementptr %struct.tm, %struct.tm* %122, i64 0, i32 0
%124 = load i32, i32* %123
store i32 %124, i32* %42
%125 = call i32 @strftime(i8* %22, i32 30, i8* %24, %struct.tm* %7)
br label %128
126: ; preds = %118
%127 = call i32 @strcpy(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %128
128: ; preds = %126, %121
%129 = load i32, i32* %6
%130 = icmp eq i32 %129, -1
br i1 %130, label %136, label %131
131: ; preds = %128
%132 = call %struct.tm* @gmtime(i32* %6)
%133 = getelementptr %struct.tm, %struct.tm* %132, i64 0, i32 0
%134 = load i32, i32* %133
store i32 %134, i32* %42
%135 = call i32 @strftime(i8* %23, i32 30, i8* %24, %struct.tm* %7)
br label %138
136: ; preds = %128
%137 = call i32 @strcpy(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %138
138: ; preds = %136, %131
%139 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i8* %43, i32 %87, i8* %21, i8* %22, i8* %23)
br label %52
140: ; preds = %52, %34
%141 = call i32 @closedir(i32* %32)
ret i32 0
}