#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 timeval {
  scalar_t__ tv_usec;
  int /*<<< orphan*/ tv_sec;
};
struct stat {
  int /*<<< orphan*/ st_atime;
};
typedef int /*<<< orphan*/ line;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_RDWR;
int O_TRUNC;
int /*<<< orphan*/ close(int);
scalar_t__ compare_file(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fdopen(int, char *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fileno(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
scalar_t__ fstat(int, struct stat *);
int getopt(int, char **, char *);
scalar_t__ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
scalar_t__ malloc(scalar_t__);
int open(char *, int, ...);
char *optarg;
int optind;
int /*<<< orphan*/ parse_config_file(int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ rename(char *, char *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ set_utimes(char *, int /*<<< orphan*/, struct timeval *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ *stdout;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ substitute_line(char *);
scalar_t__ unlink(char *);
int main(int argc, char **argv) {
  char line[2048];
  int c;
  int fd;
  FILE *in, *out, *old = NULL;
  char *outfn = NULL, *newfn = NULL;
  int verbose = 0;
  int adjust_timestamp = 0;
  int got_atime = 0;
  struct stat stbuf;
  struct timeval tv[2];
  while ((c = getopt(argc, argv, "f:tv")) != EOF) {
    switch (c) {
    case 'f':
      in = fopen(optarg, "r");
      if (!in) {
        perror(optarg);
        exit(1);
      }
      parse_config_file(in);
      fclose(in);
      break;
    case 't':
      adjust_timestamp++;
      break;
    case 'v':
      verbose++;
      break;
    default:
      fprintf(stderr, "%s: [-f config-file] [file]\n", argv[0]);
      break;
    }
  }
  if (optind < argc) {
    in = fopen(argv[optind], "r");
    if (!in) {
      perror(argv[optind]);
      exit(1);
    }
    optind++;
  } else
    in = stdin;
  if (optind < argc) {
    outfn = argv[optind];
    newfn = (char *)malloc(strlen(outfn) + 20);
    if (!newfn) {
      fprintf(stderr, "Memory error!  Exiting.\n");
      exit(1);
    }
    strcpy(newfn, outfn);
    strcat(newfn, ".new");
    fd = open(newfn, O_CREAT | O_TRUNC | O_RDWR, 0444);
    if (fd < 0) {
      perror(newfn);
      exit(1);
    }
    out = fdopen(fd, "w+");
    if (!out) {
      perror("fdopen");
      exit(1);
    }
    fd = open(outfn, O_RDONLY);
    if (fd > 0) {
      if (fstat(fd, &stbuf) == 0) {
        tv[0].tv_sec = stbuf.st_atime;
        tv[0].tv_usec = 0;
        got_atime = 1;
      }
      old = fdopen(fd, "r");
      if (!old)
        close(fd);
    }
  } else {
    out = stdout;
    outfn = 0;
  }
  while (!feof(in)) {
    if (fgets(line, sizeof(line), in) == NULL)
      break;
    substitute_line(line);
    fputs(line, out);
  }
  fclose(in);
  if (outfn) {
    fflush(out);
    rewind(out);
    if (old && compare_file(old, out)) {
      if (verbose)
        printf("No change, keeping %s.\n", outfn);
      if (adjust_timestamp) {
        if (verbose)
          printf("Updating modtime for %s\n", outfn);
        if (gettimeofday(&tv[1], NULL) < 0) {
          perror("gettimeofday");
          exit(1);
        }
        if (got_atime == 0)
          tv[0] = tv[1];
        else if (verbose)
          printf("Using original atime\n");
        set_utimes(outfn, fileno(old), tv);
      }
      fclose(out);
      if (unlink(newfn) < 0)
        perror("unlink");
    } else {
      if (verbose)
        printf("Creating or replacing %s.\n", outfn);
      fclose(out);
      if (old)
        fclose(old);
      old = NULL;
      if (rename(newfn, outfn) < 0) {
        perror("rename");
        exit(1);
      }
    }
  }
  if (old)
    fclose(old);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x880,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x830(%rbp)
movq   $0x0,-0x838(%rbp)
movq   $0x0,-0x840(%rbp)
movl   $0x0,-0x844(%rbp)
movl   $0x0,-0x848(%rbp)
movl   $0x0,-0x84c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xcda(%rip),%rdx
call   1190 <getopt@plt>
mov    %eax,-0x814(%rbp)
mov    0x2c80(%rip),%rcx
cmp    (%rcx),%eax
je     142e <main+0x16e>
mov    -0x814(%rbp),%eax
mov    %eax,-0x874(%rbp)
sub    $0x66,%eax
je     1382 <main+0xc2>
jmp    135a <main+0x9a>
mov    -0x874(%rbp),%eax
sub    $0x74,%eax
je     13e3 <main+0x123>
jmp    136e <main+0xae>
mov    -0x874(%rbp),%eax
sub    $0x76,%eax
je     13f7 <main+0x137>
jmp    140b <main+0x14b>
mov    0x2c67(%rip),%rax
mov    (%rax),%rdi
lea    0xc72(%rip),%rsi
call   1160 <fopen@plt>
mov    %rax,-0x820(%rbp)
cmpq   $0x0,-0x820(%rbp)
jne    13c6 <main+0x106>
mov    0x2c3c(%rip),%rax
mov    (%rax),%rdi
call   1170 <perror@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    -0x820(%rbp),%rdi
call   11e0 <parse_config_file@plt>
mov    -0x820(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1429 <main+0x169>
mov    -0x848(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x848(%rbp)
jmp    1429 <main+0x169>
mov    -0x844(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x844(%rbp)
jmp    1429 <main+0x169>
mov    0x2b8e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xbe5(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    1318 <main+0x58>
mov    0x2b7b(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    14ae <main+0x1ee>
mov    -0x10(%rbp),%rax
mov    0x2b65(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xbac(%rip),%rsi
call   1160 <fopen@plt>
mov    %rax,-0x820(%rbp)
cmpq   $0x0,-0x820(%rbp)
jne    1494 <main+0x1d4>
mov    -0x10(%rbp),%rax
mov    0x2b32(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
call   1170 <perror@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    0x2b15(%rip),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    0x2b09(%rip),%rax
mov    %ecx,(%rax)
jmp    14bf <main+0x1ff>
mov    0x2b0b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x820(%rbp)
mov    0x2aea(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    1695 <main+0x3d5>
mov    -0x10(%rbp),%rax
mov    0x2ad4(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x838(%rbp)
mov    -0x838(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdi
add    $0x14,%rdi
call   1110 <malloc@plt>
mov    %rax,-0x840(%rbp)
cmpq   $0x0,-0x840(%rbp)
jne    1538 <main+0x278>
mov    0x2a82(%rip),%rax
mov    (%rax),%edi
lea    0xafd(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    -0x840(%rbp),%rdi
mov    -0x838(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x840(%rbp),%rdi
lea    0xae4(%rip),%rsi
call   11a0 <strcat@plt>
mov    -0x840(%rbp),%rdi
mov    0x2a8c(%rip),%rax
mov    (%rax),%esi
mov    0x2a73(%rip),%rax
or     (%rax),%esi
mov    0x2a52(%rip),%rax
or     (%rax),%esi
mov    $0x124,%edx
mov    $0x0,%al
call   1150 <open@plt>
mov    %eax,-0x818(%rbp)
cmpl   $0x0,-0x818(%rbp)
jge    15b5 <main+0x2f5>
mov    -0x840(%rbp),%rdi
call   1170 <perror@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    -0x818(%rbp),%edi
lea    0xa80(%rip),%rsi
call   1140 <fdopen@plt>
mov    %rax,-0x828(%rbp)
cmpq   $0x0,-0x828(%rbp)
jne    15f2 <main+0x332>
lea    0xa62(%rip),%rdi
call   1170 <perror@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    -0x838(%rbp),%rdi
mov    0x29c8(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1150 <open@plt>
mov    %eax,-0x818(%rbp)
cmpl   $0x0,-0x818(%rbp)
jle    1690 <main+0x3d0>
mov    -0x818(%rbp),%edi
lea    -0x850(%rbp),%rsi
call   11d0 <fstat@plt>
cmp    $0x0,%rax
jne    1659 <main+0x399>
mov    -0x850(%rbp),%eax
mov    %eax,-0x868(%rbp)
movq   $0x0,-0x870(%rbp)
movl   $0x1,-0x84c(%rbp)
mov    -0x818(%rbp),%edi
lea    0x99f(%rip),%rsi
call   1140 <fdopen@plt>
mov    %rax,-0x830(%rbp)
cmpq   $0x0,-0x830(%rbp)
jne    168b <main+0x3cb>
mov    -0x818(%rbp),%edi
call   10b0 <close@plt>
jmp    1690 <main+0x3d0>
jmp    16b1 <main+0x3f1>
mov    0x28fc(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x828(%rbp)
movq   $0x0,-0x838(%rbp)
jmp    16b6 <main+0x3f6>
mov    -0x820(%rbp),%rdi
call   10e0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    16d7 <main+0x417>
jmp    1722 <main+0x462>
lea    -0x810(%rbp),%rdi
mov    -0x820(%rbp),%rdx
mov    $0x800,%esi
call   10c0 <fgets@plt>
cmp    $0x0,%rax
jne    16fe <main+0x43e>
jmp    1722 <main+0x462>
lea    -0x810(%rbp),%rdi
call   1130 <substitute_line@plt>
lea    -0x810(%rbp),%rdi
mov    -0x828(%rbp),%rsi
call   10a0 <fputs@plt>
jmp    16b6 <main+0x3f6>
mov    -0x820(%rbp),%rdi
call   1050 <fclose@plt>
cmpq   $0x0,-0x838(%rbp)
je     1944 <main+0x684>
mov    -0x828(%rbp),%rdi
call   1120 <fflush@plt>
mov    -0x828(%rbp),%rdi
call   1080 <rewind@plt>
cmpq   $0x0,-0x830(%rbp)
je     18b4 <main+0x5f4>
mov    -0x830(%rbp),%rdi
mov    -0x828(%rbp),%rsi
call   1100 <compare_file@plt>
cmp    $0x0,%rax
je     18b4 <main+0x5f4>
cmpl   $0x0,-0x844(%rbp)
je     17a1 <main+0x4e1>
mov    -0x838(%rbp),%rsi
lea    0x8b2(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
cmpl   $0x0,-0x848(%rbp)
je     1881 <main+0x5c1>
cmpl   $0x0,-0x844(%rbp)
je     17d0 <main+0x510>
mov    -0x838(%rbp),%rsi
lea    0x89b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x870(%rbp),%rdi
add    $0x10,%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1090 <gettimeofday@plt>
cmp    $0x0,%rax
jge    1804 <main+0x544>
lea    0x888(%rip),%rdi
call   1170 <perror@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
cmpl   $0x0,-0x84c(%rbp)
jne    1832 <main+0x572>
mov    -0x860(%rbp),%rax
mov    %rax,-0x870(%rbp)
mov    -0x858(%rbp),%rax
mov    %rax,-0x868(%rbp)
jmp    1852 <main+0x592>
cmpl   $0x0,-0x844(%rbp)
je     184d <main+0x58d>
lea    0x844(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1852 <main+0x592>
mov    -0x838(%rbp),%rax
mov    %rax,-0x880(%rbp)
mov    -0x830(%rbp),%rdi
call   10f0 <fileno@plt>
mov    -0x880(%rbp),%rdi
mov    %eax,%esi
lea    -0x870(%rbp),%rdx
call   11c0 <set_utimes@plt>
mov    -0x828(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x840(%rbp),%rdi
call   1030 <unlink@plt>
cmp    $0x0,%rax
jge    18af <main+0x5ef>
lea    0x7f6(%rip),%rdi
call   1170 <perror@plt>
jmp    193f <main+0x67f>
cmpl   $0x0,-0x844(%rbp)
je     18d6 <main+0x616>
mov    -0x838(%rbp),%rsi
lea    0x7d8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x828(%rbp),%rdi
call   1050 <fclose@plt>
cmpq   $0x0,-0x830(%rbp)
je     18fc <main+0x63c>
mov    -0x830(%rbp),%rdi
call   1050 <fclose@plt>
movq   $0x0,-0x830(%rbp)
mov    -0x840(%rbp),%rdi
mov    -0x838(%rbp),%rsi
call   1180 <rename@plt>
cmp    $0x0,%rax
jge    193a <main+0x67a>
lea    0x797(%rip),%rdi
call   1170 <perror@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
jmp    193f <main+0x67f>
jmp    1944 <main+0x684>
cmpq   $0x0,-0x830(%rbp)
je     195e <main+0x69e>
mov    -0x830(%rbp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x880,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x848,%rsp
mov    %rsi,%r14
mov    %edi,%r13d
lea    0xd12(%rip),%rdx
call   11a0 <getopt@plt>
mov    0x2cbe(%rip),%rbx
xor    %r12d,%r12d
mov    $0x0,%r15d
cmp    (%rbx),%eax
jne    1373 <main+0xa3>
mov    %r12d,0x4(%rsp)
mov    0x2c9d(%rip),%rbp
mov    0x0(%rbp),%eax
cmp    %r13d,%eax
jge    1439 <main+0x169>
cltq
mov    (%r14,%rax,8),%rdi
lea    0xcd9(%rip),%rsi
call   1170 <fopen@plt>
mov    %rax,%rbx
movslq 0x0(%rbp),%rax
test   %rbx,%rbx
je     170e <main+0x43e>
add    $0x1,%eax
mov    %eax,0x0(%rbp)
cmp    %r13d,%eax
jl     144c <main+0x17c>
mov    0x2c41(%rip),%rax
mov    (%rax),%r13
xor    %r14d,%r14d
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %r12d,%r12d
xor    %eax,%eax
mov    %rax,0x10(%rsp)
jmp    154c <main+0x27c>
lea    0xc86(%rip),%rbp
xor    %r15d,%r15d
xor    %r12d,%r12d
mov    %r14,0x8(%rsp)
jmp    13c0 <main+0xf0>
nopw   0x0(%rax,%rax,1)
mov    0x2c09(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xc64(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    %r13d,%edi
mov    %r14,%rsi
mov    %rbp,%rdx
call   11a0 <getopt@plt>
cmp    (%rbx),%eax
je     1307 <main+0x37>
cmp    $0x76,%eax
je     1420 <main+0x150>
cmp    $0x74,%eax
je     1430 <main+0x160>
cmp    $0x66,%eax
jne    1390 <main+0xc0>
mov    %r13d,%r14d
mov    %rbp,%r13
mov    0x2c14(%rip),%rax
mov    (%rax),%rdi
lea    0xc1f(%rip),%rsi
call   1170 <fopen@plt>
test   %rax,%rax
je     16f5 <main+0x425>
mov    %rax,%rbp
mov    %rax,%rdi
call   11f0 <parse_config_file@plt>
mov    %rbp,%rdi
call   1060 <fclose@plt>
mov    %r13,%rbp
mov    %r14d,%r13d
mov    0x8(%rsp),%r14
jmp    13aa <main+0xda>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r12d
jmp    13aa <main+0xda>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r15d
jmp    13aa <main+0xda>
mov    0x2b80(%rip),%rcx
mov    (%rcx),%rbx
cmp    %r13d,%eax
jge    1350 <main+0x80>
cltq
mov    (%r14,%rax,8),%rbp
mov    %rbp,%rdi
call   1070 <strlen@plt>
lea    0x14(%rax),%rdi
call   1120 <malloc@plt>
test   %rax,%rax
je     1714 <main+0x444>
mov    %rax,%r12
mov    %rax,%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
lea    0xbbc(%rip),%rsi
mov    %r12,%rdi
call   11b0 <strcat@plt>
mov    0x2b68(%rip),%rax
mov    0x2b51(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2b2e(%rip),%rax
or     (%rax),%esi
mov    %r12,%rdi
mov    $0x124,%edx
xor    %eax,%eax
call   1160 <open@plt>
test   %eax,%eax
js     1735 <main+0x465>
lea    0xb80(%rip),%rsi
mov    %eax,%edi
call   1150 <fdopen@plt>
test   %rax,%rax
je     173a <main+0x46a>
mov    %rax,%r13
mov    0x2aec(%rip),%rax
mov    (%rax),%esi
mov    %rbp,0x8(%rsp)
mov    %rbp,%rdi
xor    %eax,%eax
call   1160 <open@plt>
test   %eax,%eax
jle    1539 <main+0x269>
mov    %eax,%ebp
lea    0x18(%rsp),%rsi
mov    %eax,%edi
call   11e0 <fstat@plt>
xor    %ecx,%ecx
test   %rax,%rax
jne    151c <main+0x24c>
mov    0x18(%rsp),%eax
mov    %eax,0x28(%rsp)
movq   $0x0,0x20(%rsp)
mov    $0x1,%ecx
mov    %rcx,0x10(%rsp)
lea    0xadd(%rip),%rsi
mov    %ebp,%edi
call   1150 <fdopen@plt>
test   %rax,%rax
je     1542 <main+0x272>
mov    %rax,%r14
jmp    154c <main+0x27c>
xor    %eax,%eax
mov    %rax,0x10(%rsp)
jmp    1549 <main+0x279>
mov    %ebp,%edi
call   10c0 <close@plt>
xor    %r14d,%r14d
mov    %rbx,%rdi
call   10f0 <feof@plt>
test   %eax,%eax
jne    1594 <main+0x2c4>
lea    0x40(%rsp),%rbp
nopl   (%rax)
mov    %rbp,%rdi
mov    $0x800,%esi
mov    %rbx,%rdx
call   10d0 <fgets@plt>
test   %rax,%rax
je     1594 <main+0x2c4>
mov    %rbp,%rdi
call   1140 <substitute_line@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
call   10b0 <fputs@plt>
mov    %rbx,%rdi
call   10f0 <feof@plt>
test   %eax,%eax
je     1560 <main+0x290>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    0x8(%rsp),%rbp
test   %rbp,%rbp
je     1654 <main+0x384>
mov    %r13,%rdi
call   1130 <fflush@plt>
mov    %r13,%rdi
call   1090 <rewind@plt>
test   %r14,%r14
je     1607 <main+0x337>
mov    %r14,%rdi
mov    %r13,%rsi
call   1110 <compare_file@plt>
test   %rax,%rax
je     1607 <main+0x337>
cmpl   $0x0,0x4(%rsp)
je     165b <main+0x38b>
lea    0xa6b(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
test   %r15d,%r15d
je     16b6 <main+0x3e6>
lea    0xa69(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    1660 <main+0x390>
cmpl   $0x0,0x4(%rsp)
je     161f <main+0x34f>
lea    0xa7c(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r13,%rdi
call   1060 <fclose@plt>
test   %r14,%r14
je     1634 <main+0x364>
mov    %r14,%rdi
call   1060 <fclose@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1190 <rename@plt>
test   %rax,%rax
jns    16d3 <main+0x403>
lea    0xa5d(%rip),%rdi
jmp    16ff <main+0x42f>
test   %r14,%r14
jne    16cb <main+0x3fb>
jmp    16d3 <main+0x403>
test   %r15d,%r15d
je     16b6 <main+0x3e6>
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
call   10a0 <gettimeofday@plt>
test   %rax,%rax
js     1743 <main+0x473>
cmpl   $0x0,0x10(%rsp)
je     1694 <main+0x3c4>
cmpl   $0x0,0x4(%rsp)
je     169d <main+0x3cd>
lea    0xa26(%rip),%rdi
call   1050 <puts@plt>
jmp    169d <main+0x3cd>
movaps 0x0(%rbp),%xmm0
movaps %xmm0,0x20(%rsp)
mov    %r14,%rdi
call   1100 <fileno@plt>
lea    0x20(%rsp),%rdx
mov    0x8(%rsp),%rdi
mov    %eax,%esi
call   11d0 <set_utimes@plt>
mov    %r13,%rdi
call   1060 <fclose@plt>
mov    %r12,%rdi
call   1030 <unlink@plt>
test   %rax,%rax
js     16e7 <main+0x417>
mov    %r14,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
add    $0x848,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x99c(%rip),%rdi
call   1180 <perror@plt>
jmp    16cb <main+0x3fb>
mov    0x28f4(%rip),%rax
mov    (%rax),%rdi
call   1180 <perror@plt>
mov    $0x1,%edi
call   11c0 <exit@plt>
mov    (%r14,%rax,8),%rdi
jmp    16ff <main+0x42f>
mov    0x2885(%rip),%rax
mov    (%rax),%edi
lea    0x900(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   11c0 <exit@plt>
mov    %r12,%rdi
jmp    16ff <main+0x42f>
lea    0x904(%rip),%rdi
jmp    16ff <main+0x42f>
lea    0x933(%rip),%rdi
jmp    16ff <main+0x42f>

LLVM IR (-O0):
%struct.stat = type { i32 }
%struct.timeval = type { i64, i32 }
@.str = [5 x i8] c"f:tv\00"
@EOF = global i32 0
@optarg = global i8* null
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [29 x i8] c"%s: [-f config-file] [file]\0A\00"
@optind = global i32 0
@stdin = global i32* null
@.str.3 = [25 x i8] c"Memory error! Exiting.\0A\00"
@.str.4 = [5 x i8] c".new\00"
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@O_RDWR = global i32 0
@.str.5 = [3 x i8] c"w+\00"
@.str.6 = [7 x i8] c"fdopen\00"
@O_RDONLY = global i32 0
@stdout = global i32* null
@.str.7 = [24 x i8] c"No change, keeping %s.\0A\00"
@.str.8 = [25 x i8] c"Updating modtime for %s\0A\00"
@.str.9 = [13 x i8] c"gettimeofday\00"
@.str.10 = [22 x i8] c"Using original atime\0A\00"
@.str.11 = [7 x i8] c"unlink\00"
@.str.12 = [27 x i8] c"Creating or replacing %s.\0A\00"
@.str.13 = [7 x i8] c"rename\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2048 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca %struct.stat
%18 = alloca [2 x %struct.timeval]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %11
store i8* null, i8** %12
store i8* null, i8** %13
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
br label %19
19: ; preds = %53, %2
%20 = load i32, i32* %4
%21 = load i8**, i8*** %5
%22 = call i32 @getopt(i32 %20, i8** %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %22, i32* %7
%23 = load i32, i32* @EOF
%24 = icmp ne i32 %22, %23
br i1 %24, label %25, label %54
25: ; preds = %19
%26 = load i32, i32* %7
switch i32 %26, label %47 [
i32 102, label %27
i32 116, label %41
i32 118, label %44
]
27: ; preds = %25
%28 = load i8*, i8** @optarg
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %29, i32** %9
%30 = load i32*, i32** %9
%31 = icmp ne i32* %30, null
br i1 %31, label %36, label %32
32: ; preds = %27
%33 = load i8*, i8** @optarg
%34 = call i32 @perror(i8* %33)
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %27
%37 = load i32*, i32** %9
%38 = call i32 @parse_config_file(i32* %37)
%39 = load i32*, i32** %9
%40 = call i32 @fclose(i32* %39)
br label %53
41: ; preds = %25
%42 = load i32, i32* %15
%43 = add nsw i32 %42, 1
store i32 %43, i32* %15
br label %53
44: ; preds = %25
%45 = load i32, i32* %14
%46 = add nsw i32 %45, 1
store i32 %46, i32* %14
br label %53
47: ; preds = %25
%48 = load i32, i32* @stderr
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 0
%51 = load i8*, i8** %50
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %51)
br label %53
53: ; preds = %47, %44, %41, %36
br label %19
54: ; preds = %19
%55 = load i32, i32* @optind
%56 = load i32, i32* %4
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %78
58: ; preds = %54
%59 = load i8**, i8*** %5
%60 = load i32, i32* @optind
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8*, i8** %59, i64 %61
%63 = load i8*, i8** %62
%64 = call i32* @fopen(i8* %63, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %64, i32** %9
%65 = load i32*, i32** %9
%66 = icmp ne i32* %65, null
br i1 %66, label %75, label %67
67: ; preds = %58
%68 = load i8**, i8*** %5
%69 = load i32, i32* @optind
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8*, i8** %68, i64 %70
%72 = load i8*, i8** %71
%73 = call i32 @perror(i8* %72)
%74 = call i32 @exit(i32 1)
unreachable
75: ; preds = %58
%76 = load i32, i32* @optind
%77 = add nsw i32 %76, 1
store i32 %77, i32* @optind
br label %80
78: ; preds = %54
%79 = load i32*, i32** @stdin
store i32* %79, i32** %9
br label %80
80: ; preds = %78, %75
%81 = load i32, i32* @optind
%82 = load i32, i32* %4
%83 = icmp slt i32 %81, %82
br i1 %83, label %84, label %155
84: ; preds = %80
%85 = load i8**, i8*** %5
%86 = load i32, i32* @optind
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8*, i8** %85, i64 %87
%89 = load i8*, i8** %88
store i8* %89, i8** %12
%90 = load i8*, i8** %12
%91 = call i64 @strlen(i8* %90)
%92 = add nsw i64 %91, 20
%93 = call i64 @malloc(i64 %92)
%94 = inttoptr i64 %93 to i8*
store i8* %94, i8** %13
%95 = load i8*, i8** %13
%96 = icmp ne i8* %95, null
br i1 %96, label %101, label %97
97: ; preds = %84
%98 = load i32, i32* @stderr
%99 = call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%100 = call i32 @exit(i32 1)
unreachable
101: ; preds = %84
%102 = load i8*, i8** %13
%103 = load i8*, i8** %12
%104 = call i32 @strcpy(i8* %102, i8* %103)
%105 = load i8*, i8** %13
%106 = call i32 @strcat(i8* %105, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%107 = load i8*, i8** %13
%108 = load i32, i32* @O_CREAT
%109 = load i32, i32* @O_TRUNC
%110 = or i32 %108, %109
%111 = load i32, i32* @O_RDWR
%112 = or i32 %110, %111
%113 = call i32 (i8*, i32, ...) @open(i8* %107, i32 %112, i32 292)
store i32 %113, i32* %8
%114 = load i32, i32* %8
%115 = icmp slt i32 %114, 0
br i1 %115, label %116, label %120
116: ; preds = %101
%117 = load i8*, i8** %13
%118 = call i32 @perror(i8* %117)
%119 = call i32 @exit(i32 1)
unreachable
120: ; preds = %101
%121 = load i32, i32* %8
%122 = call i32* @fdopen(i32 %121, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32* %122, i32** %10
%123 = load i32*, i32** %10
%124 = icmp ne i32* %123, null
br i1 %124, label %128, label %125
125: ; preds = %120
%126 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%127 = call i32 @exit(i32 1)
unreachable
128: ; preds = %120
%129 = load i8*, i8** %12
%130 = load i32, i32* @O_RDONLY
%131 = call i32 (i8*, i32, ...) @open(i8* %129, i32 %130)
store i32 %131, i32* %8
%132 = load i32, i32* %8
%133 = icmp sgt i32 %132, 0
br i1 %133, label %134, label %154
134: ; preds = %128
%135 = load i32, i32* %8
%136 = call i64 @fstat(i32 %135, %struct.stat* %17)
%137 = icmp eq i64 %136, 0
br i1 %137, label %138, label %145
138: ; preds = %134
%139 = getelementptr inbounds %struct.stat, %struct.stat* %17, i32 0, i32 0
%140 = load i32, i32* %139
%141 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %18, i64 0, i64 0
%142 = getelementptr inbounds %struct.timeval, %struct.timeval* %141, i32 0, i32 1
store i32 %140, i32* %142
%143 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %18, i64 0, i64 0
%144 = getelementptr inbounds %struct.timeval, %struct.timeval* %143, i32 0, i32 0
store i64 0, i64* %144
store i32 1, i32* %16
br label %145
145: ; preds = %138, %134
%146 = load i32, i32* %8
%147 = call i32* @fdopen(i32 %146, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %147, i32** %11
%148 = load i32*, i32** %11
%149 = icmp ne i32* %148, null
br i1 %149, label %153, label %150
150: ; preds = %145
%151 = load i32, i32* %8
%152 = call i32 @close(i32 %151)
br label %153
153: ; preds = %150, %145
br label %154
154: ; preds = %153, %128
br label %157
155: ; preds = %80
%156 = load i32*, i32** @stdout
store i32* %156, i32** %10
store i8* null, i8** %12
br label %157
157: ; preds = %155, %154
br label %158
158: ; preds = %169, %157
%159 = load i32*, i32** %9
%160 = call i32 @feof(i32* %159)
%161 = icmp ne i32 %160, 0
%162 = xor i1 %161, true
br i1 %162, label %163, label %175
163: ; preds = %158
%164 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%165 = load i32*, i32** %9
%166 = call i32* @fgets(i8* %164, i32 2048, i32* %165)
%167 = icmp eq i32* %166, null
br i1 %167, label %168, label %169
168: ; preds = %163
br label %175
169: ; preds = %163
%170 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%171 = call i32 @substitute_line(i8* %170)
%172 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%173 = load i32*, i32** %10
%174 = call i32 @fputs(i8* %172, i32* %173)
br label %158
175: ; preds = %168, %158
%176 = load i32*, i32** %9
%177 = call i32 @fclose(i32* %176)
%178 = load i8*, i8** %12
%179 = icmp ne i8* %178, null
br i1 %179, label %180, label %267
180: ; preds = %175
%181 = load i32*, i32** %10
%182 = call i32 @fflush(i32* %181)
%183 = load i32*, i32** %10
%184 = call i32 @rewind(i32* %183)
%185 = load i32*, i32** %11
%186 = icmp ne i32* %185, null
br i1 %186, label %187, label %243
187: ; preds = %180
%188 = load i32*, i32** %11
%189 = load i32*, i32** %10
%190 = call i64 @compare_file(i32* %188, i32* %189)
%191 = icmp ne i64 %190, 0
br i1 %191, label %192, label %243
192: ; preds = %187
%193 = load i32, i32* %14
%194 = icmp ne i32 %193, 0
br i1 %194, label %195, label %198
195: ; preds = %192
%196 = load i8*, i8** %12
%197 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i8* %196)
br label %198
198: ; preds = %195, %192
%199 = load i32, i32* %15
%200 = icmp ne i32 %199, 0
br i1 %200, label %201, label %234
201: ; preds = %198
%202 = load i32, i32* %14
%203 = icmp ne i32 %202, 0
br i1 %203, label %204, label %207
204: ; preds = %201
%205 = load i8*, i8** %12
%206 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i8* %205)
br label %207
207: ; preds = %204, %201
%208 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %18, i64 0, i64 1
%209 = call i64 @gettimeofday(%struct.timeval* %208, i32* null)
%210 = icmp slt i64 %209, 0
br i1 %210, label %211, label %214
211: ; preds = %207
%212 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0))
%213 = call i32 @exit(i32 1)
unreachable
214: ; preds = %207
%215 = load i32, i32* %16
%216 = icmp eq i32 %215, 0
br i1 %216, label %217, label %222
217: ; preds = %214
%218 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %18, i64 0, i64 0
%219 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %18, i64 0, i64 1
%220 = bitcast %struct.timeval* %218 to i8*
%221 = bitcast %struct.timeval* %219 to i8*
br label %228
222: ; preds = %214
%223 = load i32, i32* %14
%224 = icmp ne i32 %223, 0
br i1 %224, label %225, label %227
225: ; preds = %222
%226 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
br label %227
227: ; preds = %225, %222
br label %228
228: ; preds = %227, %217
%229 = load i8*, i8** %12
%230 = load i32*, i32** %11
%231 = call i32 @fileno(i32* %230)
%232 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %18, i64 0, i64 0
%233 = call i32 @set_utimes(i8* %229, i32 %231, %struct.timeval* %232)
br label %234
234: ; preds = %228, %198
%235 = load i32*, i32** %10
%236 = call i32 @fclose(i32* %235)
%237 = load i8*, i8** %13
%238 = call i64 @unlink(i8* %237)
%239 = icmp slt i64 %238, 0
br i1 %239, label %240, label %242
240: ; preds = %234
%241 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
br label %242
242: ; preds = %240, %234
br label %266
243: ; preds = %187, %180
%244 = load i32, i32* %14
%245 = icmp ne i32 %244, 0
br i1 %245, label %246, label %249
246: ; preds = %243
%247 = load i8*, i8** %12
%248 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0), i8* %247)
br label %249
249: ; preds = %246, %243
%250 = load i32*, i32** %10
%251 = call i32 @fclose(i32* %250)
%252 = load i32*, i32** %11
%253 = icmp ne i32* %252, null
br i1 %253, label %254, label %257
254: ; preds = %249
%255 = load i32*, i32** %11
%256 = call i32 @fclose(i32* %255)
br label %257
257: ; preds = %254, %249
store i32* null, i32** %11
%258 = load i8*, i8** %13
%259 = load i8*, i8** %12
%260 = call i64 @rename(i8* %258, i8* %259)
%261 = icmp slt i64 %260, 0
br i1 %261, label %262, label %265
262: ; preds = %257
%263 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0))
%264 = call i32 @exit(i32 1)
unreachable
265: ; preds = %257
br label %266
266: ; preds = %265, %242
br label %267
267: ; preds = %266, %175
%268 = load i32*, i32** %11
%269 = icmp ne i32* %268, null
br i1 %269, label %270, label %273
270: ; preds = %267
%271 = load i32*, i32** %11
%272 = call i32 @fclose(i32* %271)
br label %273
273: ; preds = %270, %267
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.timeval = type { i64, i32 }
@.str = [5 x i8] c"f:tv\00"
@EOF = global i32 0
@optarg = global i8* null
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [29 x i8] c"%s: [-f config-file] [file]\0A\00"
@optind = global i32 0
@stdin = global i32* null
@.str.3 = [25 x i8] c"Memory error! Exiting.\0A\00"
@.str.4 = [5 x i8] c".new\00"
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@O_RDWR = global i32 0
@.str.5 = [3 x i8] c"w+\00"
@.str.6 = [7 x i8] c"fdopen\00"
@O_RDONLY = global i32 0
@stdout = global i32* null
@.str.7 = [24 x i8] c"No change, keeping %s.\0A\00"
@.str.8 = [25 x i8] c"Updating modtime for %s\0A\00"
@.str.9 = [13 x i8] c"gettimeofday\00"
@.str.11 = [7 x i8] c"unlink\00"
@.str.12 = [27 x i8] c"Creating or replacing %s.\0A\00"
@.str.13 = [7 x i8] c"rename\00"
@str = [21 x i8] c"Using original atime\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [2048 x i8]
%4 = alloca %struct.stat
%5 = alloca [2 x %struct.timeval]
%6 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%7 = bitcast %struct.stat* %4 to i8*
%8 = bitcast [2 x %struct.timeval]* %5 to i8*
%9 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %41, label %12
12: ; preds = %2, %35
%13 = phi i32 [ %38, %35 ], [ %9, %2 ]
%14 = phi i32 [ %37, %35 ], [ 0, %2 ]
%15 = phi i32 [ %36, %35 ], [ 0, %2 ]
switch i32 %13, label %31 [
i32 102, label %16
i32 116, label %27
i32 118, label %29
]
16: ; preds = %12
%17 = load i8*, i8** @optarg
%18 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i8*, i8** @optarg
%22 = tail call i32 @perror(i8* %21)
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %16
%25 = tail call i32 @parse_config_file(i32* %18)
%26 = tail call i32 @fclose(i32* %18)
br label %35
27: ; preds = %12
%28 = add nsw i32 %14, 1
br label %35
29: ; preds = %12
%30 = add nsw i32 %15, 1
br label %35
31: ; preds = %12
%32 = load i32, i32* @stderr
%33 = load i8*, i8** %1
%34 = tail call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %31, %29, %27, %24
%36 = phi i32 [ %15, %31 ], [ %30, %29 ], [ %15, %27 ], [ %15, %24 ]
%37 = phi i32 [ %14, %31 ], [ %14, %29 ], [ %28, %27 ], [ %14, %24 ]
%38 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%39 = load i32, i32* @EOF
%40 = icmp eq i32 %38, %39
br i1 %40, label %41, label %12
41: ; preds = %35, %2
%42 = phi i32 [ 0, %2 ], [ %36, %35 ]
%43 = phi i32 [ 0, %2 ], [ %37, %35 ]
%44 = load i32, i32* @optind
%45 = icmp slt i32 %44, %0
br i1 %45, label %46, label %61
46: ; preds = %41
%47 = sext i32 %44 to i64
%48 = getelementptr inbounds i8*, i8** %1, i64 %47
%49 = load i8*, i8** %48
%50 = tail call i32* @fopen(i8* %49, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%51 = icmp eq i32* %50, null
%52 = load i32, i32* @optind
br i1 %51, label %53, label %59
53: ; preds = %46
%54 = sext i32 %52 to i64
%55 = getelementptr inbounds i8*, i8** %1, i64 %54
%56 = load i8*, i8** %55
%57 = tail call i32 @perror(i8* %56)
%58 = tail call i32 @exit(i32 1)
unreachable
59: ; preds = %46
%60 = add nsw i32 %52, 1
store i32 %60, i32* @optind
br label %63
61: ; preds = %41
%62 = load i32*, i32** @stdin
br label %63
63: ; preds = %61, %59
%64 = phi i32 [ %60, %59 ], [ %44, %61 ]
%65 = phi i32* [ %50, %59 ], [ %62, %61 ]
%66 = icmp slt i32 %64, %0
br i1 %66, label %67, label %117
67: ; preds = %63
%68 = sext i32 %64 to i64
%69 = getelementptr inbounds i8*, i8** %1, i64 %68
%70 = load i8*, i8** %69
%71 = tail call i64 @strlen(i8* dereferenceable(1) %70)
%72 = add nsw i64 %71, 20
%73 = tail call i64 @malloc(i64 %72)
%74 = inttoptr i64 %73 to i8*
%75 = icmp eq i64 %73, 0
br i1 %75, label %76, label %80
76: ; preds = %67
%77 = load i32, i32* @stderr
%78 = tail call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%79 = tail call i32 @exit(i32 1)
unreachable
80: ; preds = %67
%81 = tail call i32 @strcpy(i8* %74, i8* %70)
%82 = tail call i32 @strcat(i8* %74, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%83 = load i32, i32* @O_CREAT
%84 = load i32, i32* @O_TRUNC
%85 = or i32 %84, %83
%86 = load i32, i32* @O_RDWR
%87 = or i32 %85, %86
%88 = tail call i32 (i8*, i32, ...) @open(i8* %74, i32 %87, i32 292)
%89 = icmp slt i32 %88, 0
br i1 %89, label %90, label %93
90: ; preds = %80
%91 = tail call i32 @perror(i8* %74)
%92 = tail call i32 @exit(i32 1)
unreachable
93: ; preds = %80
%94 = tail call i32* @fdopen(i32 %88, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%95 = icmp eq i32* %94, null
br i1 %95, label %96, label %99
96: ; preds = %93
%97 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%98 = tail call i32 @exit(i32 1)
unreachable
99: ; preds = %93
%100 = load i32, i32* @O_RDONLY
%101 = tail call i32 (i8*, i32, ...) @open(i8* %70, i32 %100)
%102 = icmp sgt i32 %101, 0
br i1 %102, label %103, label %119
103: ; preds = %99
%104 = call i64 @fstat(i32 %101, %struct.stat* %4)
%105 = icmp eq i64 %104, 0
br i1 %105, label %106, label %111
106: ; preds = %103
%107 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%108 = load i32, i32* %107
%109 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %5, i64 0, i64 0, i32 1
store i32 %108, i32* %109
%110 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %5, i64 0, i64 0, i32 0
store i64 0, i64* %110
br label %111
111: ; preds = %106, %103
%112 = phi i32 [ 1, %106 ], [ 0, %103 ]
%113 = tail call i32* @fdopen(i32 %101, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%114 = icmp eq i32* %113, null
br i1 %114, label %115, label %119
115: ; preds = %111
%116 = tail call i32 @close(i32 %101)
br label %119
117: ; preds = %63
%118 = load i32*, i32** @stdout
br label %119
119: ; preds = %99, %115, %111, %117
%120 = phi i32* [ %94, %111 ], [ %94, %115 ], [ %94, %99 ], [ %118, %117 ]
%121 = phi i32* [ %113, %111 ], [ null, %115 ], [ null, %99 ], [ null, %117 ]
%122 = phi i8* [ %70, %111 ], [ %70, %115 ], [ %70, %99 ], [ null, %117 ]
%123 = phi i8* [ %74, %111 ], [ %74, %115 ], [ %74, %99 ], [ null, %117 ]
%124 = phi i32 [ %112, %111 ], [ %112, %115 ], [ 0, %99 ], [ 0, %117 ]
%125 = call i32 @feof(i32* %65)
%126 = icmp eq i32 %125, 0
br i1 %126, label %127, label %135
127: ; preds = %119, %130
%128 = call i32* @fgets(i8* %6, i32 2048, i32* %65)
%129 = icmp eq i32* %128, null
br i1 %129, label %135, label %130
130: ; preds = %127
%131 = call i32 @substitute_line(i8* %6)
%132 = call i32 @fputs(i8* %6, i32* %120)
%133 = call i32 @feof(i32* %65)
%134 = icmp eq i32 %133, 0
br i1 %134, label %127, label %135
135: ; preds = %130, %127, %119
%136 = call i32 @fclose(i32* %65)
%137 = icmp eq i8* %122, null
br i1 %137, label %192, label %138
138: ; preds = %135
%139 = call i32 @fflush(i32* %120)
%140 = call i32 @rewind(i32* %120)
%141 = icmp eq i32* %121, null
br i1 %141, label %178, label %142
142: ; preds = %138
%143 = call i64 @compare_file(i32* %121, i32* %120)
%144 = icmp eq i64 %143, 0
br i1 %144, label %178, label %145
145: ; preds = %142
%146 = icmp eq i32 %42, 0
br i1 %146, label %147, label %149
147: ; preds = %145
%148 = icmp eq i32 %43, 0
br i1 %148, label %172, label %154
149: ; preds = %145
%150 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i8* %122)
%151 = icmp eq i32 %43, 0
br i1 %151, label %172, label %152
152: ; preds = %149
%153 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i8* %122)
br label %154
154: ; preds = %147, %152
%155 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %5, i64 0, i64 1
%156 = call i64 @gettimeofday(%struct.timeval* %155, i32* null)
%157 = icmp slt i64 %156, 0
br i1 %157, label %158, label %161
158: ; preds = %154
%159 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0))
%160 = call i32 @exit(i32 1)
unreachable
161: ; preds = %154
%162 = icmp eq i32 %124, 0
br i1 %162, label %163, label %165
163: ; preds = %161
%164 = bitcast %struct.timeval* %155 to i8*
br label %168
165: ; preds = %161
br i1 %146, label %168, label %166
166: ; preds = %165
%167 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %168
168: ; preds = %165, %166, %163
%169 = call i32 @fileno(i32* %121)
%170 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %5, i64 0, i64 0
%171 = call i32 @set_utimes(i8* %122, i32 %169, %struct.timeval* %170)
br label %172
172: ; preds = %149, %168, %147
%173 = call i32 @fclose(i32* %120)
%174 = call i64 @unlink(i8* %123)
%175 = icmp slt i64 %174, 0
br i1 %175, label %176, label %194
176: ; preds = %172
%177 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
br label %194
178: ; preds = %142, %138
%179 = icmp eq i32 %42, 0
br i1 %179, label %182, label %180
180: ; preds = %178
%181 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0), i8* %122)
br label %182
182: ; preds = %180, %178
%183 = call i32 @fclose(i32* %120)
br i1 %141, label %186, label %184
184: ; preds = %182
%185 = call i32 @fclose(i32* %121)
br label %186
186: ; preds = %184, %182
%187 = call i64 @rename(i8* %123, i8* %122)
%188 = icmp slt i64 %187, 0
br i1 %188, label %189, label %196
189: ; preds = %186
%190 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0))
%191 = call i32 @exit(i32 1)
unreachable
192: ; preds = %135
%193 = icmp eq i32* %121, null
br i1 %193, label %196, label %194
194: ; preds = %172, %176, %192
%195 = call i32 @fclose(i32* %121)
br label %196
196: ; preds = %186, %194, %192
ret i32 0
}