#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 /*<<< orphan*/ time_t;
struct tm {
  int tm_year;
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
};
struct stat {
  int /*<<< orphan*/ st_mtime;
};
typedef int /*<<< orphan*/ buffer;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ IsCopyright(char *, char *);
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 *, ...);
int /*<<< orphan*/ free(char *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
char *strdup(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void ProcessFile(char *filename, FILE *output, char *dir) {
  char buffer[1024];
  FILE *src;
  char *lines[4];
  int i, j;
  struct stat sb;
  time_t now;
  struct tm *tm;
  src = fopen(filename, "r");
  if (src == NULL) {
    fprintf(stderr, "Failed to open %s/%s\n", dir, filename);
    exit(1);
  }
  for (i = 0; i < 4; ++i) {
    if (fgets(buffer, sizeof(buffer), src) == NULL) {
      fclose(src);
      for (j = 0; j < i; ++j)
        free(lines[j]);
      return;
    }
    lines[i] = strdup(buffer);
  }
  fclose(src);
  if (IsCopyright(lines[0], buffer)) {
    stat(filename, &sb);
    tm = localtime(&sb.st_mtime);
    fprintf(output, "*** %s~\t%d-%0d-%0d %02d:%02d:%02d.000000000 -0800\n",
            filename, tm->tm_year + 1900, tm->tm_mon, tm->tm_mday, tm->tm_hour,
            tm->tm_min, tm->tm_sec);
    time(&now);
    tm = localtime(&now);
    fprintf(output, "--- %s\t%d-%0d-%0d %02d:%02d:%02d.000000000 -0800\n",
            filename, tm->tm_year + 1900, tm->tm_mon, tm->tm_mday, tm->tm_hour,
            tm->tm_min, tm->tm_sec);
    fprintf(output, "***************\n");
    fprintf(output, "*** 1,4 ****\n");
    fprintf(output, "! %s", lines[0]);
    fprintf(output, "  %s", lines[1]);
    fprintf(output, "  %s", lines[2]);
    fprintf(output, "  %s", lines[3]);
    fprintf(output, "--- 1,4 ----\n");
    fprintf(output, "! %s", buffer);
    fprintf(output, "  %s", lines[1]);
    fprintf(output, "  %s", lines[2]);
    fprintf(output, "  %s", lines[3]);
  }
  for (j = 0; j < 4; ++j)
    free(lines[j]);
}


x86 assembly (clang, -O0):
<ProcessFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x490,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe2e(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x428(%rbp)
cmpq   $0x0,-0x428(%rbp)
jne    1216 <ProcessFile+0x66>
mov    0x2ded(%rip),%rax
movslq (%rax),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xdfd(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
movl   $0x0,-0x454(%rbp)
cmpl   $0x4,-0x454(%rbp)
jge    12d6 <ProcessFile+0x126>
lea    -0x420(%rbp),%rdi
mov    -0x428(%rbp),%rdx
mov    $0x400,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
jne    12a4 <ProcessFile+0xf4>
mov    -0x428(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x458(%rbp)
mov    -0x458(%rbp),%eax
cmp    -0x454(%rbp),%eax
jge    129f <ProcessFile+0xef>
movslq -0x458(%rbp),%rax
mov    -0x450(%rbp,%rax,8),%rdi
ff
call   1030 <free@plt>
mov    -0x458(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x458(%rbp)
jmp    1265 <ProcessFile+0xb5>
jmp    154e <ProcessFile+0x39e>
lea    -0x420(%rbp),%rdi
call   10d0 <strdup@plt>
mov    %rax,%rcx
movslq -0x454(%rbp),%rax
mov    %rcx,-0x450(%rbp,%rax,8)
ff
mov    -0x454(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x454(%rbp)
jmp    1220 <ProcessFile+0x70>
mov    -0x428(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x450(%rbp),%rdi
lea    -0x420(%rbp),%rsi
call   10a0 <IsCopyright@plt>
cmp    $0x0,%rax
je     150f <ProcessFile+0x35f>
mov    -0x8(%rbp),%rdi
lea    -0x460(%rbp),%rsi
call   1080 <stat@plt>
lea    -0x460(%rbp),%rdi
call   1040 <localtime@plt>
mov    %rax,-0x470(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x470(%rbp),%rax
mov    (%rax),%ecx
add    $0x76c,%ecx
mov    -0x470(%rbp),%rax
mov    0x4(%rax),%r8d
mov    -0x470(%rbp),%rax
mov    0x8(%rax),%r9d
mov    -0x470(%rbp),%rax
mov    0xc(%rax),%r11d
mov    -0x470(%rbp),%rax
mov    0x10(%rax),%r10d
mov    -0x470(%rbp),%rax
mov    0x14(%rax),%eax
lea    0xca2(%rip),%rsi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
mov    $0x0,%al
call   1070 <fprintf@plt>
lea    -0x464(%rbp),%rdi
call   1090 <time@plt>
lea    -0x464(%rbp),%rdi
call   1040 <localtime@plt>
mov    %rax,-0x470(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x470(%rbp),%rax
mov    (%rax),%ecx
add    $0x76c,%ecx
mov    -0x470(%rbp),%rax
mov    0x4(%rax),%r8d
mov    -0x470(%rbp),%rax
mov    0x8(%rax),%r9d
mov    -0x470(%rbp),%rax
mov    0xc(%rax),%r11d
mov    -0x470(%rbp),%rax
mov    0x10(%rax),%r10d
mov    -0x470(%rbp),%rax
mov    0x14(%rax),%eax
lea    0xc4e(%rip),%rsi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xc61(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xc60(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x450(%rbp),%rdx
lea    0xc55(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x448(%rbp),%rdx
lea    0xc41(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x440(%rbp),%rdx
lea    0xc28(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x438(%rbp),%rdx
lea    0xc0f(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xc02(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x420(%rbp),%rdx
lea    0xbdf(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x448(%rbp),%rdx
lea    0xbcb(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x440(%rbp),%rdx
lea    0xbb2(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x438(%rbp),%rdx
lea    0xb99(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x0,-0x458(%rbp)
cmpl   $0x4,-0x458(%rbp)
jge    154e <ProcessFile+0x39e>
movslq -0x458(%rbp),%rax
mov    -0x450(%rbp,%rax,8),%rdi
ff
call   1030 <free@plt>
mov    -0x458(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x458(%rbp)
jmp    1519 <ProcessFile+0x369>
add    $0x490,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ProcessFile>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x448,%rsp
mov    %rdx,%rbx
mov    %rsi,%r12
mov    %rdi,%r15
lea    0xe1f(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     14f5 <ProcessFile+0x335>
mov    %rax,%r13
lea    0x40(%rsp),%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1485 <ProcessFile+0x2c5>
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   10e0 <strdup@plt>
mov    %rax,%r14
mov    %rax,0x20(%rsp)
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r13,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     148f <ProcessFile+0x2cf>
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   10e0 <strdup@plt>
mov    %rax,%rbp
mov    %rax,0x28(%rsp)
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r13,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1499 <ProcessFile+0x2d9>
mov    %rbp,0x10(%rsp)
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   10e0 <strdup@plt>
mov    %rax,%rbp
mov    %rax,0x30(%rsp)
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r13,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     14a0 <ProcessFile+0x2e0>
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   10e0 <strdup@plt>
mov    %rax,0x8(%rsp)
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   10a0 <IsCopyright@plt>
test   %rax,%rax
mov    %rbp,%rbx
mov    0x10(%rsp),%rbp
je     1461 <ProcessFile+0x2a1>
lea    0x18(%rsp),%r13
mov    %r15,%rdi
mov    %r13,%rsi
call   1080 <stat@plt>
mov    %r13,%rdi
call   1040 <localtime@plt>
mov    %rbx,(%rsp)
mov    $0x76c,%r13d
mov    (%rax),%ecx
add    %r13d,%ecx
mov    0x4(%rax),%r8d
mov    0x8(%rax),%r9d
mov    0xc(%rax),%r10d
mov    0x10(%rax),%r11d
mov    0x14(%rax),%ebx
sub    $0x8,%rsp
lea    0xd01(%rip),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
xor    %eax,%eax
push   %rbx
push   %r11
push   %r10
call   1070 <fprintf@plt>
add    $0x20,%rsp
lea    0x1c(%rsp),%rbx
mov    %rbx,%rdi
call   1090 <time@plt>
mov    %rbx,%rdi
call   1040 <localtime@plt>
add    (%rax),%r13d
mov    0x4(%rax),%r8d
mov    0x8(%rax),%r9d
mov    0xc(%rax),%r10d
mov    0x10(%rax),%r11d
mov    0x14(%rax),%ebx
sub    $0x8,%rsp
lea    0xce8(%rip),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
mov    %r13d,%ecx
xor    %eax,%eax
push   %rbx
push   %r11
push   %r10
call   1070 <fprintf@plt>
add    $0x20,%rsp
lea    0xcfa(%rip),%rdi
mov    $0x10,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10d0 <fwrite@plt>
lea    0xcf2(%rip),%rdi
mov    $0xd,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10d0 <fwrite@plt>
lea    0xce7(%rip),%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0xcd5(%rip),%r15
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    (%rsp),%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    0x8(%rsp),%r13
mov    %r13,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0xc9d(%rip),%rdi
mov    $0xd,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10d0 <fwrite@plt>
lea    0x40(%rsp),%rdx
mov    %r12,%rdi
mov    %rbx,%rsi
mov    (%rsp),%rbx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
jmp    14e3 <ProcessFile+0x323>
mov    %r13,%rdi
call   1050 <fclose@plt>
jmp    14e3 <ProcessFile+0x323>
mov    $0x1,%ebx
mov    $0x1,%bpl
jmp    14a7 <ProcessFile+0x2e7>
mov    $0x2,%ebx
jmp    14a5 <ProcessFile+0x2e5>
mov    $0x3,%ebx
xor    %ebp,%ebp
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    %r14,%rdi
call   1030 <free@plt>
test   %bpl,%bpl
jne    14e3 <ProcessFile+0x323>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x20(%rsp,%rbp,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    14d0 <ProcessFile+0x310>
add    $0x448,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2ae4(%rip),%rax
movslq (%rax),%rdi
lea    0xafc(%rip),%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"Failed to open %s/%s\0A\00"
@.str.2 = [51 x i8] c"*** %s~\09%d-%0d-%0d %02d:%02d:%02d.000000000 -0800\0A\00"
@.str.3 = [50 x i8] c"--- %s\09%d-%0d-%0d %02d:%02d:%02d.000000000 -0800\0A\00"
@.str.4 = [17 x i8] c"***************\0A\00"
@.str.5 = [14 x i8] c"*** 1,4 ****\0A\00"
@.str.6 = [5 x i8] c"! %s\00"
@.str.7 = [5 x i8] c" %s\00"
@.str.8 = [14 x i8] c"--- 1,4 ----\0A\00"
define void @ProcessFile(i8* %0, i32* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca [1024 x i8]
%8 = alloca i32*
%9 = alloca [4 x i8*]
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.stat
%13 = alloca i32
%14 = alloca %struct.tm*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
%15 = load i8*, i8** %4
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %16, i32** %8
%17 = load i32*, i32** %8
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %27
19: ; preds = %3
%20 = load i32, i32* @stderr
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to i32*
%23 = load i8*, i8** %6
%24 = load i8*, i8** %4
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %23, i8* %24)
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %3
store i32 0, i32* %10
br label %28
28: ; preds = %59, %27
%29 = load i32, i32* %10
%30 = icmp slt i32 %29, 4
br i1 %30, label %31, label %62
31: ; preds = %28
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%33 = load i32*, i32** %8
%34 = call i32* @fgets(i8* %32, i32 1024, i32* %33)
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %53
36: ; preds = %31
%37 = load i32*, i32** %8
%38 = call i32 @fclose(i32* %37)
store i32 0, i32* %11
br label %39
39: ; preds = %49, %36
%40 = load i32, i32* %11
%41 = load i32, i32* %10
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %52
43: ; preds = %39
%44 = load i32, i32* %11
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 %45
%47 = load i8*, i8** %46
%48 = call i32 @free(i8* %47)
br label %49
49: ; preds = %43
%50 = load i32, i32* %11
%51 = add nsw i32 %50, 1
store i32 %51, i32* %11
br label %39
52: ; preds = %39
br label %171
53: ; preds = %31
%54 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%55 = call i8* @strdup(i8* %54)
%56 = load i32, i32* %10
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 %57
store i8* %55, i8** %58
br label %59
59: ; preds = %53
%60 = load i32, i32* %10
%61 = add nsw i32 %60, 1
store i32 %61, i32* %10
br label %28
62: ; preds = %28
%63 = load i32*, i32** %8
%64 = call i32 @fclose(i32* %63)
%65 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 0
%66 = load i8*, i8** %65
%67 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%68 = call i64 @IsCopyright(i8* %66, i8* %67)
%69 = icmp ne i64 %68, 0
br i1 %69, label %70, label %158
70: ; preds = %62
%71 = load i8*, i8** %4
%72 = call i32 @stat(i8* %71, %struct.stat* %12)
%73 = getelementptr inbounds %struct.stat, %struct.stat* %12, i32 0, i32 0
%74 = call %struct.tm* @localtime(i32* %73)
store %struct.tm* %74, %struct.tm** %14
%75 = load i32*, i32** %5
%76 = load i8*, i8** %4
%77 = load %struct.tm*, %struct.tm** %14
%78 = getelementptr inbounds %struct.tm, %struct.tm* %77, i32 0, i32 0
%79 = load i32, i32* %78
%80 = add nsw i32 %79, 1900
%81 = load %struct.tm*, %struct.tm** %14
%82 = getelementptr inbounds %struct.tm, %struct.tm* %81, i32 0, i32 1
%83 = load i32, i32* %82
%84 = load %struct.tm*, %struct.tm** %14
%85 = getelementptr inbounds %struct.tm, %struct.tm* %84, i32 0, i32 2
%86 = load i32, i32* %85
%87 = load %struct.tm*, %struct.tm** %14
%88 = getelementptr inbounds %struct.tm, %struct.tm* %87, i32 0, i32 3
%89 = load i32, i32* %88
%90 = load %struct.tm*, %struct.tm** %14
%91 = getelementptr inbounds %struct.tm, %struct.tm* %90, i32 0, i32 4
%92 = load i32, i32* %91
%93 = load %struct.tm*, %struct.tm** %14
%94 = getelementptr inbounds %struct.tm, %struct.tm* %93, i32 0, i32 5
%95 = load i32, i32* %94
%96 = call i32 (i32*, i8*, ...) @fprintf(i32* %75, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i8* %76, i32 %80, i32 %83, i32 %86, i32 %89, i32 %92, i32 %95)
%97 = call i32 @time(i32* %13)
%98 = call %struct.tm* @localtime(i32* %13)
store %struct.tm* %98, %struct.tm** %14
%99 = load i32*, i32** %5
%100 = load i8*, i8** %4
%101 = load %struct.tm*, %struct.tm** %14
%102 = getelementptr inbounds %struct.tm, %struct.tm* %101, i32 0, i32 0
%103 = load i32, i32* %102
%104 = add nsw i32 %103, 1900
%105 = load %struct.tm*, %struct.tm** %14
%106 = getelementptr inbounds %struct.tm, %struct.tm* %105, i32 0, i32 1
%107 = load i32, i32* %106
%108 = load %struct.tm*, %struct.tm** %14
%109 = getelementptr inbounds %struct.tm, %struct.tm* %108, i32 0, i32 2
%110 = load i32, i32* %109
%111 = load %struct.tm*, %struct.tm** %14
%112 = getelementptr inbounds %struct.tm, %struct.tm* %111, i32 0, i32 3
%113 = load i32, i32* %112
%114 = load %struct.tm*, %struct.tm** %14
%115 = getelementptr inbounds %struct.tm, %struct.tm* %114, i32 0, i32 4
%116 = load i32, i32* %115
%117 = load %struct.tm*, %struct.tm** %14
%118 = getelementptr inbounds %struct.tm, %struct.tm* %117, i32 0, i32 5
%119 = load i32, i32* %118
%120 = call i32 (i32*, i8*, ...) @fprintf(i32* %99, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i8* %100, i32 %104, i32 %107, i32 %110, i32 %113, i32 %116, i32 %119)
%121 = load i32*, i32** %5
%122 = call i32 (i32*, i8*, ...) @fprintf(i32* %121, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%123 = load i32*, i32** %5
%124 = call i32 (i32*, i8*, ...) @fprintf(i32* %123, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%125 = load i32*, i32** %5
%126 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 0
%127 = load i8*, i8** %126
%128 = call i32 (i32*, i8*, ...) @fprintf(i32* %125, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %127)
%129 = load i32*, i32** %5
%130 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 1
%131 = load i8*, i8** %130
%132 = call i32 (i32*, i8*, ...) @fprintf(i32* %129, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %131)
%133 = load i32*, i32** %5
%134 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 2
%135 = load i8*, i8** %134
%136 = call i32 (i32*, i8*, ...) @fprintf(i32* %133, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %135)
%137 = load i32*, i32** %5
%138 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 3
%139 = load i8*, i8** %138
%140 = call i32 (i32*, i8*, ...) @fprintf(i32* %137, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %139)
%141 = load i32*, i32** %5
%142 = call i32 (i32*, i8*, ...) @fprintf(i32* %141, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%143 = load i32*, i32** %5
%144 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%145 = call i32 (i32*, i8*, ...) @fprintf(i32* %143, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %144)
%146 = load i32*, i32** %5
%147 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 1
%148 = load i8*, i8** %147
%149 = call i32 (i32*, i8*, ...) @fprintf(i32* %146, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %148)
%150 = load i32*, i32** %5
%151 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 2
%152 = load i8*, i8** %151
%153 = call i32 (i32*, i8*, ...) @fprintf(i32* %150, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %152)
%154 = load i32*, i32** %5
%155 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 3
%156 = load i8*, i8** %155
%157 = call i32 (i32*, i8*, ...) @fprintf(i32* %154, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %156)
br label %158
158: ; preds = %70, %62
store i32 0, i32* %11
br label %159
159: ; preds = %168, %158
%160 = load i32, i32* %11
%161 = icmp slt i32 %160, 4
br i1 %161, label %162, label %171
162: ; preds = %159
%163 = load i32, i32* %11
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 %164
%166 = load i8*, i8** %165
%167 = call i32 @free(i8* %166)
br label %168
168: ; preds = %162
%169 = load i32, i32* %11
%170 = add nsw i32 %169, 1
store i32 %170, i32* %11
br label %159
171: ; preds = %52, %159
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"Failed to open %s/%s\0A\00"
@.str.2 = [51 x i8] c"*** %s~\09%d-%0d-%0d %02d:%02d:%02d.000000000 -0800\0A\00"
@.str.3 = [50 x i8] c"--- %s\09%d-%0d-%0d %02d:%02d:%02d.000000000 -0800\0A\00"
@.str.4 = [17 x i8] c"***************\0A\00"
@.str.5 = [14 x i8] c"*** 1,4 ****\0A\00"
@.str.6 = [5 x i8] c"! %s\00"
@.str.7 = [5 x i8] c" %s\00"
@.str.8 = [14 x i8] c"--- 1,4 ----\0A\00"
define void @ProcessFile(i8* %0, i32* nocapture %1, i8* %2) {
%4 = alloca [1024 x i8]
%5 = alloca [4 x i8*]
%6 = alloca %struct.stat
%7 = alloca i32
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%9 = bitcast [4 x i8*]* %5 to i8*
%10 = bitcast %struct.stat* %6 to i8*
%11 = bitcast i32* %7 to i8*
%12 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %17, label %14
14: ; preds = %3
%15 = call i32* @fgets(i8* %8, i32 1024, i32* %12)
%16 = icmp eq i32* %15, null
br i1 %16, label %23, label %37
17: ; preds = %3
%18 = load i32, i32* @stderr
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
%21 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %0)
%22 = tail call i32 @exit(i32 1)
unreachable
23: ; preds = %14
%24 = call i32 @fclose(i32* %12)
br label %107
25: ; preds = %37, %42, %47
%26 = phi i1 [ true, %37 ], [ false, %42 ], [ false, %47 ]
%27 = phi i64 [ 1, %37 ], [ 2, %42 ], [ 3, %47 ]
%28 = call i32 @fclose(i32* %12)
%29 = call i32 @free(i8* %38)
br i1 %26, label %107, label %30
30: ; preds = %25, %30
%31 = phi i64 [ %35, %30 ], [ 1, %25 ]
%32 = getelementptr inbounds [4 x i8*], [4 x i8*]* %5, i64 0, i64 %31
%33 = load i8*, i8** %32
%34 = call i32 @free(i8* %33)
%35 = add nuw nsw i64 %31, 1
%36 = icmp eq i64 %35, %27
br i1 %36, label %107, label %30
37: ; preds = %14
%38 = call i8* @strdup(i8* %8)
%39 = getelementptr inbounds [4 x i8*], [4 x i8*]* %5, i64 0, i64 0
store i8* %38, i8** %39
%40 = call i32* @fgets(i8* %8, i32 1024, i32* %12)
%41 = icmp eq i32* %40, null
br i1 %41, label %25, label %42
42: ; preds = %37
%43 = call i8* @strdup(i8* %8)
%44 = getelementptr inbounds [4 x i8*], [4 x i8*]* %5, i64 0, i64 1
store i8* %43, i8** %44
%45 = call i32* @fgets(i8* %8, i32 1024, i32* %12)
%46 = icmp eq i32* %45, null
br i1 %46, label %25, label %47
47: ; preds = %42
%48 = call i8* @strdup(i8* %8)
%49 = getelementptr inbounds [4 x i8*], [4 x i8*]* %5, i64 0, i64 2
store i8* %48, i8** %49
%50 = call i32* @fgets(i8* %8, i32 1024, i32* %12)
%51 = icmp eq i32* %50, null
br i1 %51, label %25, label %52
52: ; preds = %47
%53 = call i8* @strdup(i8* %8)
%54 = call i32 @fclose(i32* %12)
%55 = call i64 @IsCopyright(i8* %38, i8* %8)
%56 = icmp eq i64 %55, 0
br i1 %56, label %102, label %57
57: ; preds = %52
%58 = call i32 @stat(i8* %0, %struct.stat* %6)
%59 = getelementptr inbounds %struct.stat, %struct.stat* %6, i64 0, i32 0
%60 = call %struct.tm* @localtime(i32* %59)
%61 = getelementptr inbounds %struct.tm, %struct.tm* %60, i64 0, i32 0
%62 = load i32, i32* %61
%63 = add nsw i32 %62, 1900
%64 = getelementptr inbounds %struct.tm, %struct.tm* %60, i64 0, i32 1
%65 = load i32, i32* %64
%66 = getelementptr inbounds %struct.tm, %struct.tm* %60, i64 0, i32 2
%67 = load i32, i32* %66
%68 = getelementptr inbounds %struct.tm, %struct.tm* %60, i64 0, i32 3
%69 = load i32, i32* %68
%70 = getelementptr inbounds %struct.tm, %struct.tm* %60, i64 0, i32 4
%71 = load i32, i32* %70
%72 = getelementptr inbounds %struct.tm, %struct.tm* %60, i64 0, i32 5
%73 = load i32, i32* %72
%74 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i8* %0, i32 %63, i32 %65, i32 %67, i32 %69, i32 %71, i32 %73)
%75 = call i32 @time(i32* %7)
%76 = call %struct.tm* @localtime(i32* %7)
%77 = getelementptr inbounds %struct.tm, %struct.tm* %76, i64 0, i32 0
%78 = load i32, i32* %77
%79 = add nsw i32 %78, 1900
%80 = getelementptr inbounds %struct.tm, %struct.tm* %76, i64 0, i32 1
%81 = load i32, i32* %80
%82 = getelementptr inbounds %struct.tm, %struct.tm* %76, i64 0, i32 2
%83 = load i32, i32* %82
%84 = getelementptr inbounds %struct.tm, %struct.tm* %76, i64 0, i32 3
%85 = load i32, i32* %84
%86 = getelementptr inbounds %struct.tm, %struct.tm* %76, i64 0, i32 4
%87 = load i32, i32* %86
%88 = getelementptr inbounds %struct.tm, %struct.tm* %76, i64 0, i32 5
%89 = load i32, i32* %88
%90 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i8* %0, i32 %79, i32 %81, i32 %83, i32 %85, i32 %87, i32 %89)
%91 = call i64 @fwrite(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i64 16, i64 1, i32* %1)
%92 = call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i64 13, i64 1, i32* %1)
%93 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %38)
%94 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %43)
%95 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %48)
%96 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %53)
%97 = call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i64 13, i64 1, i32* %1)
%98 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %8)
%99 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %43)
%100 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %48)
%101 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %53)
br label %102
102: ; preds = %57, %52
%103 = call i32 @free(i8* %38)
%104 = call i32 @free(i8* %43)
%105 = call i32 @free(i8* %48)
%106 = call i32 @free(i8* %53)
br label %107
107: ; preds = %30, %25, %23, %102
ret void
}