#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;

/* Variables and functions */
int /*<<< orphan*/ fail(char *, ...);
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
scalar_t__ md5(char *, int, char *);
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int read_file(char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  static char buf[4096];
  static char data1[(1024 * 1024 * 32)];
  static char data2[(1024 * 1024 * 32)];
  static char md5str1[33];
  static char md5str2[33];
  time_t timestamp;
  int len1, len2;
  int i, cnt;
  if (argc != 3)
    fail("usage: %s [old_file] [new_file]", argv[0]);
  len1 = read_file(data1, argv[1]);
  len2 = read_file(data2, argv[2]);
  if (md5(data1, len1, md5str1) < 0 || md5(data2, len2, md5str2) < 0)
    fail("can't calculate md5");
  if (len1 != len2)
    fail("file length mismatch");
  if (memcmp(data1, data2, len1) == 0)
    fail("file content is same");
  timestamp = time(NULL);
  strftime(buf, 4096, "%Y/%m/%d %H:%M:%S", localtime(&timestamp));
  printf("# patch script: %s -> %s\n", argv[1], argv[2]);
  printf("# generated at %s \n", buf);
  printf("\n");
  printf("# read old file\n");
  printf("<%s\n", argv[1]);
  printf("\n");
  printf("# check input md5sum\n");
  printf("?%s\n", md5str1);
  printf("\n");
  for (i = 0; i < len1; i++)
    if (data1[i] != data2[i]) {
      printf(":%x\n", i);
      cnt = 0;
      while (i < len1 && data1[i] != data2[i]) {
        printf("%02X ", (int)data2[i] & 0xff);
        cnt++;
        if (cnt == 16) {
          printf("\n");
          cnt = 0;
        }
        i++;
      }
      printf("\n");
      if (cnt)
        printf("\n");
    }
  printf("# check output md5sum\n");
  printf("?%s\n", md5str2);
  printf("\n");
  printf("# write new file\n");
  printf(">script_%s\n", argv[2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11b5 <main+0x35>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1040 <fail@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0x3eac(%rip),%rdi
call   1070 <read_file@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0x2003e95(%rip),%rdi
call   1070 <read_file@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%esi
lea    0x3e83(%rip),%rdi
lea    0x4003e7c(%rip),%rdx
call   10a0 <md5@plt>
cmp    $0x0,%rax
jl     1223 <main+0xa3>
mov    -0x1c(%rbp),%esi
lea    0x2003e63(%rip),%rdi
lea    0x4003e8c(%rip),%rdx
call   10a0 <md5@plt>
cmp    $0x0,%rax
jge    1231 <main+0xb1>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1040 <fail@plt>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     124b <main+0xcb>
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1040 <fail@plt>
mov    -0x18(%rbp),%edx
lea    0x3e1b(%rip),%rdi
lea    0x2003e14(%rip),%rsi
call   1060 <memcmp@plt>
cmp    $0x0,%rax
jne    1279 <main+0xf9>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1040 <fail@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %eax,%ecx
lea    0x2dd9(%rip),%rdi
mov    $0x1000,%esi
lea    0xdbb(%rip),%rdx
call   1090 <strftime@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdbd(%rip),%rdi
lea    0x2d9c(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd88(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd92(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd9a(%rip),%rdi
lea    0x4003d39(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd57(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    147b <main+0x2fb>
movslq -0x20(%rbp),%rcx
lea    0x3d06(%rip),%rax
movsbl (%rax,%rcx,1),%eax
movslq -0x20(%rbp),%rdx
lea    0x2003cf7(%rip),%rcx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1468 <main+0x2e8>
mov    -0x20(%rbp),%esi
lea    0xd40(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%ecx
xor    %eax,%eax
cmp    -0x18(%rbp),%ecx
mov    %al,-0x25(%rbp)
jge    13d4 <main+0x254>
movslq -0x20(%rbp),%rcx
lea    0x3cb7(%rip),%rax
movsbl (%rax,%rcx,1),%eax
movslq -0x20(%rbp),%rdx
lea    0x2003ca8(%rip),%rcx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    13e4 <main+0x264>
jmp    143d <main+0x2bd>
movslq -0x20(%rbp),%rcx
lea    0x2003c81(%rip),%rax
movsbl (%rax,%rcx,1),%esi
and    $0xff,%esi
lea    0xcd4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x10,-0x24(%rbp)
jne    142f <main+0x2af>
lea    0xc7b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    139d <main+0x21d>
lea    0xc58(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x24(%rbp)
je     1463 <main+0x2e3>
lea    0xc40(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1468 <main+0x2e8>
jmp    146d <main+0x2ed>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1353 <main+0x1d3>
lea    0xc58(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc3a(%rip),%rdi
lea    0x4003c09(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xbf7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc3e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xc3a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r13
cmp    $0x3,%edi
je     11c8 <main+0x28>
mov    0x0(%r13),%rsi
lea    0xe3f(%rip),%rdi
xor    %eax,%eax
call   1060 <fail@plt>
mov    0x8(%r13),%rsi
lea    0x3ead(%rip),%r14
mov    %r14,%rdi
call   1090 <read_file@plt>
mov    %eax,%ebp
mov    %eax,%r12d
mov    0x10(%r13),%rsi
lea    0x2003e95(%rip),%rdi
call   1090 <read_file@plt>
mov    %eax,%r15d
lea    0x4003e86(%rip),%rdx
mov    %r14,%rdi
mov    %ebp,%esi
call   10c0 <md5@plt>
test   %rax,%rax
js     1224 <main+0x84>
lea    0x2003e70(%rip),%rdi
lea    0x4003e99(%rip),%rdx
mov    %r15d,%esi
call   10c0 <md5@plt>
test   %rax,%rax
jns    1232 <main+0x92>
lea    0xdf5(%rip),%rdi
xor    %eax,%eax
call   1060 <fail@plt>
cmp    %r15d,%r12d
je     1245 <main+0xa5>
lea    0xdf6(%rip),%rdi
xor    %eax,%eax
call   1060 <fail@plt>
lea    0x3e34(%rip),%rdi
lea    0x2003e2d(%rip),%rsi
mov    %r12d,%edx
call   1080 <memcmp@plt>
test   %rax,%rax
jne    126e <main+0xce>
lea    0xde2(%rip),%rdi
xor    %eax,%eax
call   1060 <fail@plt>
xor    %edi,%edi
call   10a0 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1040 <localtime@plt>
lea    0x2df6(%rip),%rbp
lea    0xdcd(%rip),%rdx
mov    %rbp,%rdi
mov    $0x1000,%esi
mov    %eax,%ecx
call   10b0 <strftime@plt>
mov    0x8(%r13),%rsi
mov    0x10(%r13),%rdx
lea    0xdc1(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdcd(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xde7(%rip),%rdi
call   1050 <puts@plt>
mov    %r13,0x10(%rsp)
mov    0x8(%r13),%rsi
lea    0xdb1(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdca(%rip),%rdi
call   1050 <puts@plt>
lea    0xd92(%rip),%rdi
lea    0x4003d68(%rip),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r12d,%r12d
jle    1400 <main+0x260>
lea    0xd6f(%rip),%rbx
xor    %r14d,%r14d
jmp    1357 <main+0x1b7>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
cmp    %r12d,%r14d
jge    1400 <main+0x260>
movslq %r14d,%r13
lea    0x3d1f(%rip),%rax
mov    0x0(%r13,%rax,1),%al
lea    0x2003d13(%rip),%rcx
cmp    0x0(%r13,%rcx,1),%al
je     134a <main+0x1aa>
mov    %rbx,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
cmp    %r12d,%r14d
jge    1340 <main+0x1a0>
xor    %r15d,%r15d
lea    0x3cf0(%rip),%rbp
lea    0x2003ce9(%rip),%rbx
lea    0xd0f(%rip),%r14
jmp    13a9 <main+0x209>
add    $0x1,%r13
cmp    %r13,%r12
je     13de <main+0x23e>
movzbl 0x0(%r13,%rbx,1),%esi
cmp    %sil,0x0(%r13,%rbp,1)
je     13d9 <main+0x239>
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%r15d
cmp    $0x10,%r15d
jne    13a0 <main+0x200>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %r15d,%r15d
jmp    13a0 <main+0x200>
mov    %r13d,%r14d
jmp    13e1 <main+0x241>
mov    %r12d,%r14d
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r15d,%r15d
lea    0xcb3(%rip),%rbx
jne    1340 <main+0x1a0>
jmp    134a <main+0x1aa>
lea    0xcdd(%rip),%rdi
call   1050 <puts@plt>
lea    0xc90(%rip),%rdi
lea    0x4003c96(%rip),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xcc8(%rip),%rdi
call   1050 <puts@plt>
mov    0x10(%rsp),%rax
mov    0x10(%rax),%rsi
lea    0xc6c(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@main.buf = internal global [4096 x i8] zeroinitializer
@main.data1 = internal global [33554432 x i8] zeroinitializer
@main.data2 = internal global [33554432 x i8] zeroinitializer
@main.md5str1 = internal global [33 x i8] zeroinitializer
@main.md5str2 = internal global [33 x i8] zeroinitializer
@.str = [32 x i8] c"usage: %s [old_file] [new_file]\00"
@.str.1 = [20 x i8] c"can't calculate md5\00"
@.str.2 = [21 x i8] c"file length mismatch\00"
@.str.3 = [21 x i8] c"file content is same\00"
@.str.4 = [18 x i8] c"%Y/%m/%d %H:%M:%S\00"
@.str.5 = [26 x i8] c"# patch script: %s -> %s\0A\00"
@.str.6 = [20 x i8] c"# generated at %s \0A\00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [17 x i8] c"# read old file\0A\00"
@.str.9 = [5 x i8] c"<%s\0A\00"
@.str.10 = [22 x i8] c"# check input md5sum\0A\00"
@.str.11 = [5 x i8] c"?%s\0A\00"
@.str.12 = [5 x i8] c":%x\0A\00"
@.str.13 = [6 x i8] c"%02X \00"
@.str.14 = [23 x i8] c"# check output md5sum\0A\00"
@.str.15 = [18 x i8] c"# write new file\0A\00"
@.str.16 = [12 x i8] c">script_%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 i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 3
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %13, %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @read_file(i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data1, i64 0, i64 0), i8* %21)
store i32 %22, i32* %7
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @read_file(i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data2, i64 0, i64 0), i8* %25)
store i32 %26, i32* %8
%27 = load i32, i32* %7
%28 = call i64 @md5(i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data1, i64 0, i64 0), i32 %27, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @main.md5str1, i64 0, i64 0))
%29 = icmp slt i64 %28, 0
br i1 %29, label %34, label %30
30: ; preds = %18
%31 = load i32, i32* %8
%32 = call i64 @md5(i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data2, i64 0, i64 0), i32 %31, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @main.md5str2, i64 0, i64 0))
%33 = icmp slt i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %30, %18
%35 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %36
36: ; preds = %34, %30
%37 = load i32, i32* %7
%38 = load i32, i32* %8
%39 = icmp ne i32 %37, %38
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %42
42: ; preds = %40, %36
%43 = load i32, i32* %7
%44 = call i64 @memcmp(i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data1, i64 0, i64 0), i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data2, i64 0, i64 0), i32 %43)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
br label %48
48: ; preds = %46, %42
%49 = call i32 @time(i32* null)
store i32 %49, i32* %6
%50 = call i32 @localtime(i32* %6)
%51 = call i32 @strftime(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0), i32 4096, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %50)
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 1
%54 = load i8*, i8** %53
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 2
%57 = load i8*, i8** %56
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %54, i8* %57)
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0))
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 1
%64 = load i8*, i8** %63
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* %64)
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @main.md5str1, i64 0, i64 0))
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %9
br label %70
70: ; preds = %132, %48
%71 = load i32, i32* %9
%72 = load i32, i32* %7
%73 = icmp slt i32 %71, %72
br i1 %73, label %74, label %135
74: ; preds = %70
%75 = load i32, i32* %9
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [33554432 x i8], [33554432 x i8]* @main.data1, i64 0, i64 %76
%78 = load i8, i8* %77
%79 = sext i8 %78 to i32
%80 = load i32, i32* %9
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [33554432 x i8], [33554432 x i8]* @main.data2, i64 0, i64 %81
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = icmp ne i32 %79, %84
br i1 %85, label %86, label %131
86: ; preds = %74
%87 = load i32, i32* %9
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i32 %87)
store i32 0, i32* %10
br label %89
89: ; preds = %121, %86
%90 = load i32, i32* %9
%91 = load i32, i32* %7
%92 = icmp slt i32 %90, %91
br i1 %92, label %93, label %105
93: ; preds = %89
%94 = load i32, i32* %9
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [33554432 x i8], [33554432 x i8]* @main.data1, i64 0, i64 %95
%97 = load i8, i8* %96
%98 = sext i8 %97 to i32
%99 = load i32, i32* %9
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [33554432 x i8], [33554432 x i8]* @main.data2, i64 0, i64 %100
%102 = load i8, i8* %101
%103 = sext i8 %102 to i32
%104 = icmp ne i32 %98, %103
br label %105
105: ; preds = %93, %89
%106 = phi i1 [ false, %89 ], [ %104, %93 ]
br i1 %106, label %107, label %124
107: ; preds = %105
%108 = load i32, i32* %9
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [33554432 x i8], [33554432 x i8]* @main.data2, i64 0, i64 %109
%111 = load i8, i8* %110
%112 = sext i8 %111 to i32
%113 = and i32 %112, 255
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 %113)
%115 = load i32, i32* %10
%116 = add nsw i32 %115, 1
store i32 %116, i32* %10
%117 = load i32, i32* %10
%118 = icmp eq i32 %117, 16
br i1 %118, label %119, label %121
119: ; preds = %107
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %10
br label %121
121: ; preds = %119, %107
%122 = load i32, i32* %9
%123 = add nsw i32 %122, 1
store i32 %123, i32* %9
br label %89
124: ; preds = %105
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%126 = load i32, i32* %10
%127 = icmp ne i32 %126, 0
br i1 %127, label %128, label %130
128: ; preds = %124
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %130
130: ; preds = %128, %124
br label %131
131: ; preds = %130, %74
br label %132
132: ; preds = %131
%133 = load i32, i32* %9
%134 = add nsw i32 %133, 1
store i32 %134, i32* %9
br label %70
135: ; preds = %70
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0))
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @main.md5str2, i64 0, i64 0))
%138 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0))
%140 = load i8**, i8*** %5
%141 = getelementptr inbounds i8*, i8** %140, i64 2
%142 = load i8*, i8** %141
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), i8* %142)
ret i32 0
}

LLVM IR (-O2):
@main.buf = internal global [4096 x i8] zeroinitializer
@main.data1 = internal global [33554432 x i8] zeroinitializer
@main.data2 = internal global [33554432 x i8] zeroinitializer
@main.md5str1 = internal global [33 x i8] zeroinitializer
@main.md5str2 = internal global [33 x i8] zeroinitializer
@.str = [32 x i8] c"usage: %s [old_file] [new_file]\00"
@.str.1 = [20 x i8] c"can't calculate md5\00"
@.str.2 = [21 x i8] c"file length mismatch\00"
@.str.3 = [21 x i8] c"file content is same\00"
@.str.4 = [18 x i8] c"%Y/%m/%d %H:%M:%S\00"
@.str.5 = [26 x i8] c"# patch script: %s -> %s\0A\00"
@.str.6 = [20 x i8] c"# generated at %s \0A\00"
@.str.9 = [5 x i8] c"<%s\0A\00"
@.str.11 = [5 x i8] c"?%s\0A\00"
@.str.12 = [5 x i8] c":%x\0A\00"
@.str.13 = [6 x i8] c"%02X \00"
@.str.16 = [12 x i8] c">script_%s\0A\00"
@str = [16 x i8] c"# read old file\00"
@str.17 = [21 x i8] c"# check input md5sum\00"
@str.18 = [22 x i8] c"# check output md5sum\00"
@str.19 = [17 x i8] c"# write new file\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp eq i32 %0, 3
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %9
9: ; preds = %6, %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @read_file(i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data1, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @read_file(i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data2, i64 0, i64 0), i8* %14)
%16 = tail call i64 @md5(i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data1, i64 0, i64 0), i32 %12, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @main.md5str1, i64 0, i64 0))
%17 = icmp slt i64 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %9
%19 = tail call i64 @md5(i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data2, i64 0, i64 0), i32 %15, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @main.md5str2, i64 0, i64 0))
%20 = icmp slt i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18, %9
%22 = tail call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %21, %18
%24 = icmp eq i32 %12, %15
br i1 %24, label %27, label %25
25: ; preds = %23
%26 = tail call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %25, %23
%28 = tail call i64 @memcmp(i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data1, i64 0, i64 0), i8* getelementptr inbounds ([33554432 x i8], [33554432 x i8]* @main.data2, i64 0, i64 0), i32 %12)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = tail call i32 (i8*, ...) @fail(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
br label %32
32: ; preds = %30, %27
%33 = tail call i32 @time(i32* null)
store i32 %33, i32* %3
%34 = call i32 @localtime(i32* %3)
%35 = call i32 @strftime(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0), i32 4096, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %34)
%36 = load i8*, i8** %10
%37 = load i8*, i8** %13
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %36, i8* %37)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buf, i64 0, i64 0))
%40 = call i32 @putchar(i32 10)
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%42 = load i8*, i8** %10
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* %42)
%44 = call i32 @putchar(i32 10)
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.17, i64 0, i64 0))
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @main.md5str1, i64 0, i64 0))
%47 = call i32 @putchar(i32 10)
%48 = icmp sgt i32 %12, 0
br i1 %48, label %49, label %95
49: ; preds = %32
%50 = zext i32 %12 to i64
br label %51
51: ; preds = %49, %91
%52 = phi i32 [ %93, %91 ], [ 0, %49 ]
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [33554432 x i8], [33554432 x i8]* @main.data1, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = getelementptr inbounds [33554432 x i8], [33554432 x i8]* @main.data2, i64 0, i64 %53
%57 = load i8, i8* %56
%58 = icmp eq i8 %55, %57
br i1 %58, label %91, label %59
59: ; preds = %51
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i32 %52)
%61 = icmp slt i32 %52, %12
br i1 %61, label %62, label %88
62: ; preds = %59, %77
%63 = phi i64 [ %79, %77 ], [ %53, %59 ]
%64 = phi i32 [ %78, %77 ], [ 0, %59 ]
%65 = getelementptr inbounds [33554432 x i8], [33554432 x i8]* @main.data1, i64 0, i64 %63
%66 = load i8, i8* %65
%67 = getelementptr inbounds [33554432 x i8], [33554432 x i8]* @main.data2, i64 0, i64 %63
%68 = load i8, i8* %67
%69 = icmp eq i8 %66, %68
br i1 %69, label %81, label %70
70: ; preds = %62
%71 = zext i8 %68 to i32
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 %71)
%73 = add nsw i32 %64, 1
%74 = icmp eq i32 %73, 16
br i1 %74, label %75, label %77
75: ; preds = %70
%76 = call i32 @putchar(i32 10)
br label %77
77: ; preds = %75, %70
%78 = phi i32 [ 0, %75 ], [ %73, %70 ]
%79 = add nsw i64 %63, 1
%80 = icmp eq i64 %79, %50
br i1 %80, label %83, label %62
81: ; preds = %62
%82 = trunc i64 %63 to i32
br label %83
83: ; preds = %77, %81
%84 = phi i32 [ %82, %81 ], [ %12, %77 ]
%85 = phi i32 [ %64, %81 ], [ %78, %77 ]
%86 = call i32 @putchar(i32 10)
%87 = icmp eq i32 %85, 0
br i1 %87, label %91, label %88
88: ; preds = %83, %59
%89 = phi i32 [ %52, %59 ], [ %84, %83 ]
%90 = call i32 @putchar(i32 10)
br label %91
91: ; preds = %88, %51, %83
%92 = phi i32 [ %84, %83 ], [ %52, %51 ], [ %89, %88 ]
%93 = add nsw i32 %92, 1
%94 = icmp slt i32 %93, %12
br i1 %94, label %51, label %95
95: ; preds = %91, %32
%96 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.18, i64 0, i64 0))
%97 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @main.md5str2, i64 0, i64 0))
%98 = call i32 @putchar(i32 10)
%99 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.19, i64 0, i64 0))
%100 = load i8*, i8** %13
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), i8* %100)
ret i32 0
}