#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*/ fclose(int /*<<< orphan*/ *);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ printf(char *, char *, int, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  FILE *fp1, *fp2;
  char line1[10000], line2[10000];
  char *f1 = NULL, *f2 = NULL;
  int line_cnt;
  if (argc != 3) {
    fprintf(stderr, "Usage: %s file1 file2\n", argv[0]);
    return 1;
  }
  line_cnt = 1;
  if ((fp1 = fopen(argv[1], "r")) == NULL ||
      (fp2 = fopen(argv[2], "r")) == NULL) {
    fprintf(stderr, "%s: Error: could not open file %s\n", argv[0],
            (!fp1 ? argv[1] : argv[2]));
    return 1;
  }
  for (f1 = fgets(line1, 10000, fp1), f2 = fgets(line2, 10000, fp2); f1 && f2;
       f1 = fgets(line1, 10000, fp1), f2 = fgets(line2, 10000, fp2),
      line_cnt++) {
    if (strcmp(f1, f2))
      break;
  }
  if (f1)
    printf("[%s] line %d: %s\n", argv[1], line_cnt, line1);
  if (f2)
    printf("[%s] line %d: %s\n", argv[2], line_cnt, line2);
  fclose(fp1);
  fclose(fp2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4e80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x4e48(%rbp)
movq   $0x0,-0x4e50(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11c3 <main+0x63>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe50(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13e6 <main+0x286>
movl   $0x1,-0x4e54(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3b(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1211 <main+0xb1>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe19(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    128a <main+0x12a>
mov    0x2dc8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4e64(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x4e60(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    124d <main+0xed>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x4e70(%rbp)
jmp    125c <main+0xfc>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x4e70(%rbp)
mov    -0x4e60(%rbp),%rdx
mov    -0x4e64(%rbp),%edi
mov    -0x4e70(%rbp),%rcx
lea    0xda2(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13e6 <main+0x286>
lea    -0x2730(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x2710,%esi
call   1050 <fgets@plt>
mov    %rax,-0x4e48(%rbp)
lea    -0x4e40(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x2710,%esi
call   1050 <fgets@plt>
mov    %rax,-0x4e50(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x4e48(%rbp)
mov    %al,-0x4e71(%rbp)
je     12e9 <main+0x189>
cmpq   $0x0,-0x4e50(%rbp)
setne  %al
mov    %al,-0x4e71(%rbp)
mov    -0x4e71(%rbp),%al
test   $0x1,%al
jne    12fc <main+0x19c>
jmp    136f <main+0x20f>
mov    -0x4e48(%rbp),%rdi
mov    -0x4e50(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     131e <main+0x1be>
jmp    136f <main+0x20f>
jmp    1323 <main+0x1c3>
lea    -0x2730(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x2710,%esi
call   1050 <fgets@plt>
mov    %rax,-0x4e48(%rbp)
lea    -0x4e40(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x2710,%esi
call   1050 <fgets@plt>
mov    %rax,-0x4e50(%rbp)
mov    -0x4e54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4e54(%rbp)
jmp    12c2 <main+0x162>
cmpq   $0x0,-0x4e48(%rbp)
je     139e <main+0x23e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x4e54(%rbp),%edx
lea    -0x2730(%rbp),%rcx
lea    0xca3(%rip),%rdi
call   1040 <printf@plt>
cmpq   $0x0,-0x4e50(%rbp)
je     13cd <main+0x26d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x4e54(%rbp),%edx
lea    -0x4e40(%rbp),%rcx
lea    0xc74(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4e80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4e28,%rsp
mov    %rsi,%r14
cmp    $0x3,%edi
jne    1273 <main+0x113>
mov    0x8(%r14),%rdi
lea    0xe8f(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r12
test   %rax,%rax
je     1294 <main+0x134>
mov    0x10(%r14),%rdi
lea    0xe73(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     1294 <main+0x134>
mov    %rax,%r15
mov    %rsp,%rdi
mov    $0x2710,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %rax,%rbx
lea    0x2710(%rsp),%rdi
mov    $0x2710,%esi
mov    %r15,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
setne  %r13b
mov    $0x1,%ebp
test   %rbx,%rbx
setne  %cl
je     1253 <main+0xf3>
test   %rax,%rax
je     1253 <main+0xf3>
mov    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rax,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    12c2 <main+0x162>
mov    %rsp,%rdi
mov    $0x2710,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %rax,%rbx
lea    0x2710(%rsp),%rdi
mov    $0x2710,%esi
mov    %r15,%rdx
call   1050 <fgets@plt>
add    $0x1,%ebp
test   %rax,%rax
setne  %r13b
test   %rbx,%rbx
setne  %cl
je     1253 <main+0xf3>
test   %rax,%rax
jne    1200 <main+0xa0>
test   %cl,%cl
je     126c <main+0x10c>
mov    0x8(%r14),%rsi
lea    0xdda(%rip),%rdi
mov    %rsp,%rcx
mov    %ebp,%edx
call   1040 <printf@plt>
test   %r13b,%r13b
jne    12d7 <main+0x177>
jmp    12f1 <main+0x191>
mov    0x2d66(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xd7a(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%eax
jmp    1303 <main+0x1a3>
xor    %eax,%eax
test   %r12,%r12
setne  %al
mov    0x2d3d(%rip),%rcx
mov    (%rcx),%edi
mov    (%r14),%rdx
mov    0x8(%r14,%rax,8),%rcx
lea    0xd65(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%eax
jmp    1303 <main+0x1a3>
mov    0x8(%r14),%rsi
lea    0xd6f(%rip),%rdi
mov    %rsp,%rcx
mov    %ebp,%edx
call   1040 <printf@plt>
mov    0x10(%r14),%rsi
lea    0xd5a(%rip),%rdi
lea    0x2710(%rsp),%rcx
mov    %ebp,%edx
call   1040 <printf@plt>
mov    %r12,%rdi
call   1030 <fclose@plt>
mov    %r15,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x4e28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"Usage: %s file1 file2\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [35 x i8] c"%s: Error: could not open file %s\0A\00"
@.str.3 = [18 x i8] c"[%s] line %d: %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 [10000 x i8]
%9 = alloca [10000 x i8]
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %10
store i8* null, i8** %11
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 3
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %19)
store i32 1, i32* %3
br label %107
21: ; preds = %2
store i32 1, i32* %12
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %25, i32** %6
%26 = icmp eq i32* %25, null
br i1 %26, label %33, label %27
27: ; preds = %21
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %31, i32** %7
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %51
33: ; preds = %27, %21
%34 = load i32, i32* @stderr
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 0
%37 = load i8*, i8** %36
%38 = load i32*, i32** %6
%39 = icmp ne i32* %38, null
br i1 %39, label %44, label %40
40: ; preds = %33
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
br label %48
44: ; preds = %33
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 2
%47 = load i8*, i8** %46
br label %48
48: ; preds = %44, %40
%49 = phi i8* [ %43, %40 ], [ %47, %44 ]
%50 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* %37, i8* %49)
store i32 1, i32* %3
br label %107
51: ; preds = %27
%52 = getelementptr inbounds [10000 x i8], [10000 x i8]* %8, i64 0, i64 0
%53 = load i32*, i32** %6
%54 = call i8* @fgets(i8* %52, i32 10000, i32* %53)
store i8* %54, i8** %10
%55 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%56 = load i32*, i32** %7
%57 = call i8* @fgets(i8* %55, i32 10000, i32* %56)
store i8* %57, i8** %11
br label %58
58: ; preds = %73, %51
%59 = load i8*, i8** %10
%60 = icmp ne i8* %59, null
br i1 %60, label %61, label %64
61: ; preds = %58
%62 = load i8*, i8** %11
%63 = icmp ne i8* %62, null
br label %64
64: ; preds = %61, %58
%65 = phi i1 [ false, %58 ], [ %63, %61 ]
br i1 %65, label %66, label %82
66: ; preds = %64
%67 = load i8*, i8** %10
%68 = load i8*, i8** %11
%69 = call i64 @strcmp(i8* %67, i8* %68)
%70 = icmp ne i64 %69, 0
br i1 %70, label %71, label %72
71: ; preds = %66
br label %82
72: ; preds = %66
br label %73
73: ; preds = %72
%74 = getelementptr inbounds [10000 x i8], [10000 x i8]* %8, i64 0, i64 0
%75 = load i32*, i32** %6
%76 = call i8* @fgets(i8* %74, i32 10000, i32* %75)
store i8* %76, i8** %10
%77 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%78 = load i32*, i32** %7
%79 = call i8* @fgets(i8* %77, i32 10000, i32* %78)
store i8* %79, i8** %11
%80 = load i32, i32* %12
%81 = add nsw i32 %80, 1
store i32 %81, i32* %12
br label %58
82: ; preds = %71, %64
%83 = load i8*, i8** %10
%84 = icmp ne i8* %83, null
br i1 %84, label %85, label %92
85: ; preds = %82
%86 = load i8**, i8*** %5
%87 = getelementptr inbounds i8*, i8** %86, i64 1
%88 = load i8*, i8** %87
%89 = load i32, i32* %12
%90 = getelementptr inbounds [10000 x i8], [10000 x i8]* %8, i64 0, i64 0
%91 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %88, i32 %89, i8* %90)
br label %92
92: ; preds = %85, %82
%93 = load i8*, i8** %11
%94 = icmp ne i8* %93, null
br i1 %94, label %95, label %102
95: ; preds = %92
%96 = load i8**, i8*** %5
%97 = getelementptr inbounds i8*, i8** %96, i64 2
%98 = load i8*, i8** %97
%99 = load i32, i32* %12
%100 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%101 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %98, i32 %99, i8* %100)
br label %102
102: ; preds = %95, %92
%103 = load i32*, i32** %6
%104 = call i32 @fclose(i32* %103)
%105 = load i32*, i32** %7
%106 = call i32 @fclose(i32* %105)
store i32 0, i32* %3
br label %107
107: ; preds = %102, %48, %15
%108 = load i32, i32* %3
ret i32 %108
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"Usage: %s file1 file2\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [35 x i8] c"%s: Error: could not open file %s\0A\00"
@.str.3 = [18 x i8] c"[%s] line %d: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [10000 x i8]
%4 = alloca [10000 x i8]
%5 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 3
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %66
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %14, 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 %22, label %17
17: ; preds = %12
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = tail call i32* @fopen(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %29
22: ; preds = %17, %12
%23 = load i32, i32* @stderr
%24 = load i8*, i8** %1
%25 = getelementptr inbounds i8*, i8** %1, i64 2
%26 = select i1 %16, i8** %13, i8** %25
%27 = load i8*, i8** %26
%28 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* %24, i8* %27)
br label %66
29: ; preds = %17
%30 = call i8* @fgets(i8* %5, i32 10000, i32* %15)
%31 = call i8* @fgets(i8* %6, i32 10000, i32* %20)
%32 = icmp ne i8* %30, null
%33 = icmp ne i8* %31, null
%34 = and i1 %32, %33
br i1 %34, label %35, label %51
35: ; preds = %29, %44
%36 = phi i32 [ %47, %44 ], [ 1, %29 ]
%37 = phi i8* [ %46, %44 ], [ %31, %29 ]
%38 = phi i8* [ %45, %44 ], [ %30, %29 ]
%39 = call i64 @strcmp(i8* %38, i8* %37)
%40 = icmp eq i64 %39, 0
br i1 %40, label %44, label %41
41: ; preds = %35
%42 = load i8*, i8** %13
%43 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %42, i32 %36, i8* %5)
br label %59
44: ; preds = %35
%45 = call i8* @fgets(i8* %5, i32 10000, i32* %15)
%46 = call i8* @fgets(i8* %6, i32 10000, i32* %20)
%47 = add nuw nsw i32 %36, 1
%48 = icmp ne i8* %45, null
%49 = icmp ne i8* %46, null
%50 = and i1 %48, %49
br i1 %50, label %35, label %51
51: ; preds = %44, %29
%52 = phi i32 [ 1, %29 ], [ %47, %44 ]
%53 = phi i1 [ %32, %29 ], [ %48, %44 ]
%54 = phi i1 [ %33, %29 ], [ %49, %44 ]
br i1 %53, label %55, label %58
55: ; preds = %51
%56 = load i8*, i8** %13
%57 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %56, i32 %52, i8* %5)
br i1 %54, label %59, label %63
58: ; preds = %51
br i1 %54, label %59, label %63
59: ; preds = %41, %55, %58
%60 = phi i32 [ %52, %55 ], [ %52, %58 ], [ %36, %41 ]
%61 = load i8*, i8** %18
%62 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %61, i32 %60, i8* %6)
br label %63
63: ; preds = %55, %59, %58
%64 = call i32 @fclose(i32* %15)
%65 = call i32 @fclose(i32* %20)
br label %66
66: ; preds = %63, %22, %8
%67 = phi i32 [ 1, %8 ], [ 1, %22 ], [ 0, %63 ]
ret i32 %67
}