#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*/ line;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
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 *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ sscanf(char *, char *, int *, int *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ stdout;
char *strdup(char *);
int strlen(char *);
char *strstr(char *, char *);
int main(int argc, char **argv) {
  int i;
  char line[512];
  if (argc < 2 || argc % 2 != 1) {
    fprintf(stderr, "usage: %s search1 replace1 ..\n", argv[0]);
    exit(1);
  }
  for (i = 1 + 1; i < argc; i += 2) {
    if (argv[i][0] == '@') {
      int len, off = 1;
      FILE *f;
      if (argv[i][1] == '@') {
        off++;
      }
      f = fopen(argv[i] + off, "r");
      if (f == NULL) {
        fprintf(stderr, "unable to read %s\n", argv[i] + off);
        exit(1);
      }
      line[0] = '\0';
      fgets(line, sizeof(line), f);
      fclose(f);
      len = strlen(line);
      if (len) {
        line[len - 1] = '\0';
      }
      if (off > 1) {
        int x = 0, y = 0, z = 0;
        sscanf(line, "%d.%d.%d", &x, &y, &z);
        sprintf(line, "%d", x * 100000 + y * 1000 + z);
      }
      argv[i] = strdup(line);
    }
  }
  while (fgets(line, sizeof(line), stdin) != NULL) {
    int found = 0;
    for (i = 1; i < argc; i += 2) {
      char *p = strstr(line, argv[i]);
      if (p != NULL) {
        fwrite(line, p - line, 1, stdout);
        fputs(argv[i + 1], stdout);
        p += strlen(argv[i]);
        fputs(p, stdout);
        found = 1;
        break;
      }
    }
    if (!found) {
      fputs(line, stdout);
    }
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     11f7 <main+0x37>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
je     121d <main+0x5d>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdf2(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    13f3 <main+0x233>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x40,%eax
jne    13e0 <main+0x220>
movl   $0x1,-0x228(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl 0x1(%rax),%eax
cmp    $0x40,%eax
jne    127a <main+0xba>
mov    -0x228(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x228(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
movslq -0x228(%rbp),%rax
add    %rax,%rdi
lea    0xd88(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x230(%rbp)
cmpq   $0x0,-0x230(%rbp)
jne    12e6 <main+0x126>
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
movslq -0x228(%rbp),%rax
add    %rax,%rdx
lea    0xd4a(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
movb   $0x0,-0x220(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0x230(%rbp),%rdx
mov    $0x200,%esi
call   1060 <fgets@plt>
mov    -0x230(%rbp),%rdi
call   1030 <fclose@plt>
lea    -0x220(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x224(%rbp)
cmpl   $0x0,-0x224(%rbp)
je     1343 <main+0x183>
mov    -0x224(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0x220(%rbp,%rax,1)
cmpl   $0x1,-0x228(%rbp)
jle    13c5 <main+0x205>
movl   $0x0,-0x234(%rbp)
movl   $0x0,-0x238(%rbp)
movl   $0x0,-0x23c(%rbp)
lea    -0x220(%rbp),%rdi
lea    0xcb8(%rip),%rsi
lea    -0x234(%rbp),%rdx
lea    -0x238(%rbp),%rcx
lea    -0x23c(%rbp),%r8
call   1080 <sscanf@plt>
lea    -0x220(%rbp),%rdi
imul   $0x186a0,-0x234(%rbp),%edx
imul   $0x3e8,-0x238(%rbp),%eax
add    %eax,%edx
add    -0x23c(%rbp),%edx
lea    0xc7a(%rip),%rsi
call   10a0 <sprintf@plt>
lea    -0x220(%rbp),%rdi
call   10d0 <strdup@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    13e5 <main+0x225>
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    1224 <main+0x64>
jmp    13f8 <main+0x238>
lea    -0x220(%rbp),%rdi
mov    0x2be2(%rip),%rax
mov    (%rax),%rdx
mov    $0x200,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     1538 <main+0x378>
movl   $0x0,-0x240(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1511 <main+0x351>
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   10e0 <strstr@plt>
mov    %rax,-0x248(%rbp)
cmpq   $0x0,-0x248(%rbp)
je     14fe <main+0x33e>
lea    -0x220(%rbp),%rdi
mov    -0x248(%rbp),%rax
lea    -0x220(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%esi
mov    0x2b48(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%edx
call   10c0 <fwrite@plt>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2b24(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x248(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x248(%rbp)
mov    -0x248(%rbp),%rdi
mov    0x2ae8(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
movl   $0x1,-0x240(%rbp)
jmp    1511 <main+0x351>
jmp    1503 <main+0x343>
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    142e <main+0x26e>
cmpl   $0x0,-0x240(%rbp)
jne    1533 <main+0x373>
lea    -0x220(%rbp),%rdi
mov    0x2aa4(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
jmp    13f8 <main+0x238>
xor    %edi,%edi
call   10b0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
mov    %rsi,%rbp
cmp    $0x2,%edi
jl     1318 <main+0x158>
mov    %edi,%r15d
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
and    $0xfffffffe,%eax
mov    %edi,%ecx
sub    %eax,%ecx
cmp    $0x1,%ecx
jne    1318 <main+0x158>
cmp    $0x3,%r15d
jb     133b <main+0x17b>
mov    $0x2,%r14d
lea    0x20(%rsp),%r13
mov    %rbp,0x10(%rsp)
jmp    123a <main+0x7a>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13,%rdi
call   10d0 <strdup@plt>
mov    %rax,0x0(%rbp,%r14,8)
add    $0x2,%r14
cmp    %r15d,%r14d
jge    133b <main+0x17b>
mov    0x0(%rbp,%r14,8),%rax
cmpb   $0x40,(%rax)
jne    122d <main+0x6d>
mov    %r15d,%ebp
movzbl 0x1(%rax),%r15d
xor    %ebx,%ebx
cmp    $0x40,%r15b
sete   %bl
lea    (%rax,%rbx,1),%rdi
add    $0x1,%rdi
lea    0xdbb(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     140f <main+0x24f>
mov    %rax,%r12
movb   $0x0,0x20(%rsp)
mov    %r13,%rdi
mov    $0x200,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
mov    %r12,%rdi
call   1030 <fclose@plt>
mov    %r13,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
je     12a6 <main+0xe6>
cltq
movb   $0x0,-0x1(%rax,%r13,1)
cmp    $0x40,%r15b
mov    %ebp,%r15d
mov    0x10(%rsp),%rbp
jne    1220 <main+0x60>
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
mov    %r13,%rdi
lea    0xd5a(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
call   1080 <sscanf@plt>
imul   $0x186a0,0xc(%rsp),%eax
imul   $0x3e8,0x8(%rsp),%edx
add    %eax,%edx
add    0x4(%rsp),%edx
mov    %r13,%rdi
lea    0xd2c(%rip),%rsi
call   10a0 <sprintf@plt>
jmp    1220 <main+0x60>
mov    0x2cb9(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0xcd4(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    0x2ca6(%rip),%rax
mov    (%rax),%rdx
lea    0x20(%rsp),%r13
mov    %r13,%rdi
mov    $0x200,%esi
call   1060 <fgets@plt>
test   %rax,%rax
jne    1363 <main+0x1a3>
xor    %edi,%edi
call   10b0 <exit@plt>
movslq %r15d,%rax
mov    %rax,0x18(%rsp)
mov    $0x1,%r14d
mov    0x2c58(%rip),%r12
jmp    13ed <main+0x22d>
nopw   0x0(%rax,%rax,1)
mov    %rax,%rbx
mov    %r14d,%r15d
mov    %ebx,%esi
sub    %r13d,%esi
mov    (%r12),%ecx
mov    %r13,%rdi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
add    $0x1,%r14d
mov    0x0(%rbp,%r14,8),%rdi
mov    (%r12),%esi
call   1050 <fputs@plt>
mov    0x0(%rbp,%r15,8),%rdi
call   1040 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
mov    (%r12),%esi
call   1050 <fputs@plt>
mov    0x2c1a(%rip),%rax
mov    (%rax),%rdx
mov    %r13,%rdi
mov    $0x200,%esi
call   1060 <fgets@plt>
mov    $0x1,%r14d
test   %rax,%rax
je     135c <main+0x19c>
mov    0x0(%rbp,%r14,8),%rsi
mov    %r13,%rdi
call   10e0 <strstr@plt>
test   %rax,%rax
jne    1380 <main+0x1c0>
add    $0x2,%r14
mov    %r13,%rdi
cmp    0x18(%rsp),%r14
jl     13ed <main+0x22d>
jmp    13be <main+0x1fe>
add    $0x1,%rbx
mov    0x2bbe(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rsp),%rax
add    (%rax,%r14,8),%rbx
lea    0xbf5(%rip),%rsi
mov    %rbx,%rdx
jmp    132c <main+0x16c>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"usage: %s search1 replace1 ..\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"unable to read %s\0A\00"
@.str.3 = [9 x i8] c"%d.%d.%d\00"
@.str.4 = [3 x i8] c"%d\00"
@stdin = global i32* null
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [512 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 2
br i1 %17, label %22, label %18
18: ; preds = %2
%19 = load i32, i32* %4
%20 = srem i32 %19, 2
%21 = icmp ne i32 %20, 1
br i1 %21, label %22, label %29
22: ; preds = %18, %2
%23 = load i32, i32* @stderr
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %26)
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %18
store i32 2, i32* %6
br label %30
30: ; preds = %120, %29
%31 = load i32, i32* %6
%32 = load i32, i32* %4
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %123
34: ; preds = %30
%35 = load i8**, i8*** %5
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %35, i64 %37
%39 = load i8*, i8** %38
%40 = getelementptr inbounds i8, i8* %39, i64 0
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 64
br i1 %43, label %44, label %119
44: ; preds = %34
store i32 1, i32* %9
%45 = load i8**, i8*** %5
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %45, i64 %47
%49 = load i8*, i8** %48
%50 = getelementptr inbounds i8, i8* %49, i64 1
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 64
br i1 %53, label %54, label %57
54: ; preds = %44
%55 = load i32, i32* %9
%56 = add nsw i32 %55, 1
store i32 %56, i32* %9
br label %57
57: ; preds = %54, %44
%58 = load i8**, i8*** %5
%59 = load i32, i32* %6
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8*, i8** %58, i64 %60
%62 = load i8*, i8** %61
%63 = load i32, i32* %9
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8, i8* %62, i64 %64
%66 = call i32* @fopen(i8* %65, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %66, i32** %10
%67 = load i32*, i32** %10
%68 = icmp eq i32* %67, null
br i1 %68, label %69, label %81
69: ; preds = %57
%70 = load i32, i32* @stderr
%71 = load i8**, i8*** %5
%72 = load i32, i32* %6
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8*, i8** %71, i64 %73
%75 = load i8*, i8** %74
%76 = load i32, i32* %9
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8, i8* %75, i64 %77
%79 = call i32 @fprintf(i32 %70, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %78)
%80 = call i32 @exit(i32 1)
unreachable
81: ; preds = %57
%82 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
store i8 0, i8* %82
%83 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%84 = load i32*, i32** %10
%85 = call i32* @fgets(i8* %83, i32 512, i32* %84)
%86 = load i32*, i32** %10
%87 = call i32 @fclose(i32* %86)
%88 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%89 = call i32 @strlen(i8* %88)
store i32 %89, i32* %8
%90 = load i32, i32* %8
%91 = icmp ne i32 %90, 0
br i1 %91, label %92, label %97
92: ; preds = %81
%93 = load i32, i32* %8
%94 = sub nsw i32 %93, 1
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 %95
store i8 0, i8* %96
br label %97
97: ; preds = %92, %81
%98 = load i32, i32* %9
%99 = icmp sgt i32 %98, 1
br i1 %99, label %100, label %112
100: ; preds = %97
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
%101 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%102 = call i32 @sscanf(i8* %101, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* %11, i32* %12, i32* %13)
%103 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%104 = load i32, i32* %11
%105 = mul nsw i32 %104, 100000
%106 = load i32, i32* %12
%107 = mul nsw i32 %106, 1000
%108 = add nsw i32 %105, %107
%109 = load i32, i32* %13
%110 = add nsw i32 %108, %109
%111 = call i32 @sprintf(i8* %103, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %110)
br label %112
112: ; preds = %100, %97
%113 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%114 = call i8* @strdup(i8* %113)
%115 = load i8**, i8*** %5
%116 = load i32, i32* %6
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds i8*, i8** %115, i64 %117
store i8* %114, i8** %118
br label %119
119: ; preds = %112, %34
br label %120
120: ; preds = %119
%121 = load i32, i32* %6
%122 = add nsw i32 %121, 2
store i32 %122, i32* %6
br label %30
123: ; preds = %30
br label %124
124: ; preds = %185, %123
%125 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%126 = load i32*, i32** @stdin
%127 = call i32* @fgets(i8* %125, i32 512, i32* %126)
%128 = icmp ne i32* %127, null
br i1 %128, label %129, label %186
129: ; preds = %124
store i32 0, i32* %14
store i32 1, i32* %6
br label %130
130: ; preds = %175, %129
%131 = load i32, i32* %6
%132 = load i32, i32* %4
%133 = icmp slt i32 %131, %132
br i1 %133, label %134, label %178
134: ; preds = %130
%135 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%136 = load i8**, i8*** %5
%137 = load i32, i32* %6
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds i8*, i8** %136, i64 %138
%140 = load i8*, i8** %139
%141 = call i8* @strstr(i8* %135, i8* %140)
store i8* %141, i8** %15
%142 = load i8*, i8** %15
%143 = icmp ne i8* %142, null
br i1 %143, label %144, label %174
144: ; preds = %134
%145 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%146 = load i8*, i8** %15
%147 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%148 = ptrtoint i8* %146 to i64
%149 = ptrtoint i8* %147 to i64
%150 = sub i64 %148, %149
%151 = trunc i64 %150 to i32
%152 = load i32, i32* @stdout
%153 = call i32 @fwrite(i8* %145, i32 %151, i32 1, i32 %152)
%154 = load i8**, i8*** %5
%155 = load i32, i32* %6
%156 = add nsw i32 %155, 1
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds i8*, i8** %154, i64 %157
%159 = load i8*, i8** %158
%160 = load i32, i32* @stdout
%161 = call i32 @fputs(i8* %159, i32 %160)
%162 = load i8**, i8*** %5
%163 = load i32, i32* %6
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds i8*, i8** %162, i64 %164
%166 = load i8*, i8** %165
%167 = call i32 @strlen(i8* %166)
%168 = load i8*, i8** %15
%169 = sext i32 %167 to i64
%170 = getelementptr inbounds i8, i8* %168, i64 %169
store i8* %170, i8** %15
%171 = load i8*, i8** %15
%172 = load i32, i32* @stdout
%173 = call i32 @fputs(i8* %171, i32 %172)
store i32 1, i32* %14
br label %178
174: ; preds = %134
br label %175
175: ; preds = %174
%176 = load i32, i32* %6
%177 = add nsw i32 %176, 2
store i32 %177, i32* %6
br label %130
178: ; preds = %144, %130
%179 = load i32, i32* %14
%180 = icmp ne i32 %179, 0
br i1 %180, label %185, label %181
181: ; preds = %178
%182 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%183 = load i32, i32* @stdout
%184 = call i32 @fputs(i8* %182, i32 %183)
br label %185
185: ; preds = %181, %178
br label %124
186: ; preds = %124
%187 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"usage: %s search1 replace1 ..\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"unable to read %s\0A\00"
@.str.3 = [9 x i8] c"%d.%d.%d\00"
@.str.4 = [3 x i8] c"%d\00"
@stdin = global i32* null
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [512 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%8 = icmp sgt i32 %0, 1
%9 = srem i32 %0, 2
%10 = icmp eq i32 %9, 1
%11 = and i1 %8, %10
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = icmp ugt i32 %0, 2
br i1 %13, label %14, label %23
14: ; preds = %12
%15 = bitcast i32* %4 to i8*
%16 = bitcast i32* %5 to i8*
%17 = bitcast i32* %6 to i8*
br label %30
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %1
%21 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = tail call i32 @exit(i32 1)
unreachable
23: ; preds = %72, %12
%24 = load i32*, i32** @stdin
%25 = call i32* @fgets(i8* %7, i32 512, i32* %24)
%26 = icmp eq i32* %25, null
br i1 %26, label %112, label %27
27: ; preds = %23
%28 = ptrtoint [512 x i8]* %3 to i64
%29 = sext i32 %0 to i64
br label %76
30: ; preds = %14, %72
%31 = phi i64 [ 2, %14 ], [ %73, %72 ]
%32 = getelementptr inbounds i8*, i8** %1, i64 %31
%33 = load i8*, i8** %32
%34 = load i8, i8* %33
%35 = icmp eq i8 %34, 64
br i1 %35, label %36, label %72
36: ; preds = %30
%37 = getelementptr inbounds i8, i8* %33, i64 1
%38 = load i8, i8* %37
%39 = icmp eq i8 %38, 64
%40 = select i1 %39, i64 2, i64 1
%41 = getelementptr inbounds i8, i8* %33, i64 %40
%42 = call i32* @fopen(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%43 = icmp eq i32* %42, null
br i1 %43, label %44, label %50
44: ; preds = %36
%45 = load i32, i32* @stderr
%46 = load i8*, i8** %32
%47 = getelementptr inbounds i8, i8* %46, i64 %40
%48 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %47)
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %36
store i8 0, i8* %7
%51 = call i32* @fgets(i8* %7, i32 512, i32* %42)
%52 = call i32 @fclose(i32* %42)
%53 = call i32 @strlen(i8* %7)
%54 = icmp eq i32 %53, 0
br i1 %54, label %59, label %55
55: ; preds = %50
%56 = add nsw i32 %53, -1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 %57
store i8 0, i8* %58
br label %59
59: ; preds = %55, %50
br i1 %39, label %60, label %70
60: ; preds = %59
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%61 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* %4, i32* %5, i32* %6)
%62 = load i32, i32* %4
%63 = mul nsw i32 %62, 100000
%64 = load i32, i32* %5
%65 = mul nsw i32 %64, 1000
%66 = add nsw i32 %65, %63
%67 = load i32, i32* %6
%68 = add nsw i32 %66, %67
%69 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %68)
br label %70
70: ; preds = %60, %59
%71 = call i8* @strdup(i8* %7)
store i8* %71, i8** %32
br label %72
72: ; preds = %30, %70
%73 = add nuw i64 %31, 2
%74 = trunc i64 %73 to i32
%75 = icmp slt i32 %74, %0
br i1 %75, label %30, label %23
76: ; preds = %85, %27
%77 = phi i64 [ 1, %27 ], [ %86, %85 ]
%78 = getelementptr inbounds i8*, i8** %1, i64 %77
%79 = load i8*, i8** %78
%80 = call i8* @strstr(i8* %7, i8* dereferenceable(1) %79)
%81 = icmp eq i8* %80, null
br i1 %81, label %82, label %87
82: ; preds = %76
%83 = add nuw nsw i64 %77, 2
%84 = icmp slt i64 %83, %29
br i1 %84, label %85, label %105
85: ; preds = %82, %105
%86 = phi i64 [ %83, %82 ], [ 1, %105 ]
br label %76
87: ; preds = %76
%88 = and i64 %77, 4294967295
%89 = getelementptr inbounds i8*, i8** %1, i64 %88
%90 = ptrtoint i8* %80 to i64
%91 = sub i64 %90, %28
%92 = trunc i64 %91 to i32
%93 = load i32, i32* @stdout
%94 = call i32 @fwrite(i8* %7, i32 %92, i32 1, i32 %93)
%95 = add nuw nsw i64 %77, 1
%96 = and i64 %95, 4294967295
%97 = getelementptr inbounds i8*, i8** %1, i64 %96
%98 = load i8*, i8** %97
%99 = load i32, i32* @stdout
%100 = call i32 @fputs(i8* %98, i32 %99)
%101 = load i8*, i8** %89
%102 = call i32 @strlen(i8* %101)
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i8, i8* %80, i64 %103
br label %105
105: ; preds = %82, %87
%106 = phi i8* [ %104, %87 ], [ %7, %82 ]
%107 = load i32, i32* @stdout
%108 = call i32 @fputs(i8* %106, i32 %107)
%109 = load i32*, i32** @stdin
%110 = call i32* @fgets(i8* %7, i32 512, i32* %109)
%111 = icmp eq i32* %110, null
br i1 %111, label %112, label %85
112: ; preds = %105, %23
%113 = call i32 @exit(i32 0)
unreachable
}