#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  FILE *fp1, *fp2;
  char line1[1000], line2[1000];
  char *filename1, *filename2;
  if (argc != 3) {
    printf("error: program must be called with two arguments\n");
    return 1;
  }
  filename1 = *++argv;
  filename2 = *++argv;
  if ((fp1 = fopen(filename1, "r")) == NULL) {
    fprintf(stderr, "can't open %s\n", filename1);
    return 1;
  }
  if ((fp2 = fopen(filename2, "r")) == NULL) {
    fprintf(stderr, "can't open %s\n", filename2);
    return 1;
  }
  while (fgets(line1, 1000, fp1) != NULL && fgets(line2, 1000, fp2) != NULL) {
    if (strcmp(line1, line2) != 0) {
      printf("%s: %s", filename1, line1);
      printf("%s: %s", filename2, line2);
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     118d <main+0x3d>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    131d <main+0x1cd>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rax
mov    %rax,-0x808(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rax
mov    %rax,-0x810(%rbp)
mov    -0x808(%rbp),%rdi
lea    0xe63(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    120a <main+0xba>
mov    0x2df7(%rip),%rax
mov    (%rax),%edi
mov    -0x808(%rbp),%rdx
lea    0xe3b(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    131d <main+0x1cd>
mov    -0x810(%rbp),%rdi
lea    0xe1a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1253 <main+0x103>
mov    0x2dae(%rip),%rax
mov    (%rax),%edi
mov    -0x810(%rbp),%rdx
lea    0xdf2(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    131d <main+0x1cd>
jmp    1258 <main+0x108>
lea    -0x410(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x3e8,%esi
call   1040 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x811(%rbp)
je     12a4 <main+0x154>
lea    -0x800(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x3e8,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x811(%rbp)
mov    -0x811(%rbp),%al
test   $0x1,%al
jne    12b7 <main+0x167>
jmp    1316 <main+0x1c6>
lea    -0x410(%rbp),%rdi
lea    -0x800(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1311 <main+0x1c1>
mov    -0x808(%rbp),%rsi
lea    -0x410(%rbp),%rdx
lea    0xd5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x810(%rbp),%rsi
lea    -0x800(%rbp),%rdx
lea    0xd3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1316 <main+0x1c6>
jmp    1258 <main+0x108>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7e8,%rsp
cmp    $0x3,%edi
jne    1246 <main+0xe6>
mov    0x8(%rsi),%r15
mov    0x10(%rsi),%rbp
lea    0xe77(%rip),%rsi
mov    %r15,%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     1254 <main+0xf4>
mov    %rax,%rbx
lea    0xe5c(%rip),%rsi
mov    %rbp,%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     1269 <main+0x109>
mov    %rax,%r12
mov    %rbp,0x8(%rsp)
lea    0x400(%rsp),%r13
lea    0x10(%rsp),%r14
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %r13,%rdi
mov    $0x3e8,%esi
mov    %rbx,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     1286 <main+0x126>
mov    %r14,%rdi
mov    $0x3e8,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     1286 <main+0x126>
mov    %r13,%rdi
mov    %r14,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11d0 <main+0x70>
lea    0xdf8(%rip),%rbx
xor    %ebp,%ebp
lea    0x400(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
mov    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1286 <main+0x126>
lea    0xdcb(%rip),%rdi
call   1030 <puts@plt>
jmp    1281 <main+0x121>
mov    0x2d85(%rip),%rax
mov    (%rax),%edi
lea    0xd9e(%rip),%rsi
mov    %r15,%rdx
jmp    127c <main+0x11c>
mov    0x2d70(%rip),%rax
mov    (%rax),%edi
lea    0xd89(%rip),%rsi
mov    %rbp,%rdx
call   1070 <fprintf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x7e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [50 x i8] c"error: program must be called with two arguments\0A\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [15 x i8] c"can't open %s\0A\00"
@.str.3 = [7 x i8] c"%s: %s\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 [1000 x i8]
%9 = alloca [1000 x i8]
%10 = alloca i8*
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 3
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %65
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i32 1
store i8** %18, i8*** %5
%19 = load i8*, i8** %18
store i8* %19, i8** %10
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i32 1
store i8** %21, i8*** %5
%22 = load i8*, i8** %21
store i8* %22, i8** %11
%23 = load i8*, i8** %10
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %24, i32** %6
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %30
26: ; preds = %16
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %10
%29 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %28)
store i32 1, i32* %3
br label %65
30: ; preds = %16
%31 = load i8*, i8** %11
%32 = call i32* @fopen(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %32, i32** %7
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %38
34: ; preds = %30
%35 = load i32, i32* @stderr
%36 = load i8*, i8** %11
%37 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %36)
store i32 1, i32* %3
br label %65
38: ; preds = %30
br label %39
39: ; preds = %63, %38
%40 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%41 = load i32*, i32** %6
%42 = call i32* @fgets(i8* %40, i32 1000, i32* %41)
%43 = icmp ne i32* %42, null
br i1 %43, label %44, label %49
44: ; preds = %39
%45 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%46 = load i32*, i32** %7
%47 = call i32* @fgets(i8* %45, i32 1000, i32* %46)
%48 = icmp ne i32* %47, null
br label %49
49: ; preds = %44, %39
%50 = phi i1 [ false, %39 ], [ %48, %44 ]
br i1 %50, label %51, label %64
51: ; preds = %49
%52 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%53 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%54 = call i64 @strcmp(i8* %52, i8* %53)
%55 = icmp ne i64 %54, 0
br i1 %55, label %56, label %63
56: ; preds = %51
%57 = load i8*, i8** %10
%58 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %57, i8* %58)
%60 = load i8*, i8** %11
%61 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %60, i8* %61)
br label %64
63: ; preds = %51
br label %39
64: ; preds = %56, %49
store i32 0, i32* %3
br label %65
65: ; preds = %64, %34, %26, %14
%66 = load i32, i32* %3
ret i32 %66
}

LLVM IR (-O2):
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [15 x i8] c"can't open %s\0A\00"
@.str.3 = [7 x i8] c"%s: %s\00"
@str = [49 x i8] c"error: program must be called with two arguments\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 3
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
br label %38
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %20
17: ; preds = %10
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %12)
br label %38
20: ; preds = %10
%21 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load i32, i32* @stderr
%25 = tail call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %14)
br label %38
26: ; preds = %20, %32
%27 = call i32* @fgets(i8* %5, i32 1000, i32* %15)
%28 = icmp eq i32* %27, null
br i1 %28, label %38, label %29
29: ; preds = %26
%30 = call i32* @fgets(i8* %6, i32 1000, i32* %21)
%31 = icmp eq i32* %30, null
br i1 %31, label %38, label %32
32: ; preds = %29
%33 = call i64 @strcmp(i8* %5, i8* %6)
%34 = icmp eq i64 %33, 0
br i1 %34, label %26, label %35
35: ; preds = %32
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %12, i8* %5)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %14, i8* %6)
br label %38
38: ; preds = %29, %26, %35, %23, %17, %8
%39 = phi i32 [ 1, %8 ], [ 1, %17 ], [ 1, %23 ], [ 0, %35 ], [ 0, %26 ], [ 0, %29 ]
ret i32 %39
}