#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  FILE *fp1;
  FILE *fp2;
  char line1[10000];
  char line2[10000];
  char *prog = argv[0];
  int linenum = 0;
  char *c, *d;
  if (argc < 3) {
    printf("Too few arguments\n");
    return -1;
  } else if (argc == 3) {
    if ((fp1 = fopen(*++argv, "r")) == NULL) {
      fprintf(stderr, "%s: couldn't open %s file\n", prog, *argv);
      exit(1);
    } else if ((fp2 = fopen(*++argv, "r")) == NULL) {
      fprintf(stderr, "%s: couldn't open %s file\n", prog, *argv);
      exit(2);
    } else {
      do {
        c = fgets(line1, 10000, fp1);
        d = fgets(line2, 10000, fp2);
        linenum++;
      } while (!strcmp(line1, line2) && (c != NULL || d != NULL));
      fclose(fp1);
      fclose(fp2);
      if (c == d) {
        printf("Files are identical\n");
        return 0;
      } else {
        printf("File differ in line %d and they "
               "were:\nFile1:\n%s----------------------------------------------"
               "-\nFile2:\n%s",
               linenum, line1, line2);
        return 0;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4e70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x4e48(%rbp)
movl   $0x0,-0x4e4c(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11c5 <main+0x55>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13b0 <main+0x240>
cmpl   $0x3,-0x8(%rbp)
jne    13a4 <main+0x234>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe2a(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1229 <main+0xb9>
mov    0x2ddd(%rip),%rax
mov    (%rax),%edi
mov    -0x4e48(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xdfb(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xdd0(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1283 <main+0x113>
mov    0x2d83(%rip),%rax
mov    (%rax),%edi
mov    -0x4e48(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xda1(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   1090 <exit@plt>
jmp    1288 <main+0x118>
lea    -0x2730(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x2710,%esi
call   1050 <fgets@plt>
mov    %rax,-0x4e58(%rbp)
lea    -0x4e40(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x2710,%esi
call   1050 <fgets@plt>
mov    %rax,-0x4e60(%rbp)
mov    -0x4e4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4e4c(%rbp)
lea    -0x2730(%rbp),%rdi
lea    -0x4e40(%rbp),%rsi
call   1060 <strcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x4e61(%rbp)
jne    1328 <main+0x1b8>
mov    $0x1,%al
cmpq   $0x0,-0x4e58(%rbp)
mov    %al,-0x4e62(%rbp)
jne    131c <main+0x1ac>
cmpq   $0x0,-0x4e60(%rbp)
setne  %al
mov    %al,-0x4e62(%rbp)
mov    -0x4e62(%rbp),%al
mov    %al,-0x4e61(%rbp)
mov    -0x4e61(%rbp),%al
test   $0x1,%al
jne    1288 <main+0x118>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4e58(%rbp),%rax
cmp    -0x4e60(%rbp),%rax
jne    1376 <main+0x206>
lea    0xccd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13b0 <main+0x240>
mov    -0x4e4c(%rbp),%esi
lea    -0x2730(%rbp),%rdx
lea    -0x4e40(%rbp),%rcx
lea    0xcb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13b0 <main+0x240>
jmp    13a9 <main+0x239>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4e70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4e38,%rsp
cmp    $0x2,%edi
jg     11ac <main+0x2c>
lea    0xefd(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebp
jmp    129a <main+0x11a>
xor    %ebp,%ebp
cmp    $0x3,%edi
jne    129a <main+0x11a>
mov    %rsi,%rbx
mov    (%rsi),%r12
mov    0x8(%rsi),%rdi
lea    0xe38(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     12ae <main+0x12e>
mov    0x10(%rbx),%rdi
lea    0xe1a(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     12d4 <main+0x154>
mov    %rax,%r13
mov    $0x1,%eax
lea    0x2720(%rsp),%r12
lea    0x10(%rsp),%rbp
nopl   0x0(%rax)
mov    %eax,%ebx
mov    %r12,%rdi
mov    $0x2710,%esi
mov    0x8(%rsp),%rdx
call   1060 <fgets@plt>
mov    %rax,%r14
mov    %rbp,%rdi
mov    $0x2710,%esi
mov    %r13,%rdx
call   1060 <fgets@plt>
mov    %rax,%r15
mov    %r12,%rdi
mov    %rbp,%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
jne    1254 <main+0xd4>
lea    0x1(%rbx),%eax
mov    %r14,%rcx
or     %r15,%rcx
jne    1210 <main+0x90>
mov    0x8(%rsp),%rdi
call   1040 <fclose@plt>
mov    %r13,%rdi
call   1040 <fclose@plt>
cmp    %r15,%r14
je     128c <main+0x10c>
lea    0xdab(%rip),%rdi
xor    %ebp,%ebp
lea    0x2720(%rsp),%rdx
lea    0x10(%rsp),%rcx
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    129a <main+0x11a>
lea    0xdf3(%rip),%rdi
call   1030 <puts@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x4e38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d2b(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rcx
lea    0xd40(%rip),%rsi
mov    %r12,%rdx
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    0x2d05(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbx),%rcx
lea    0xd1a(%rip),%rsi
mov    %r12,%rdx
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Too few arguments\0A\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [27 x i8] c"%s: couldn't open %s file\0A\00"
@.str.3 = [21 x i8] c"Files are identical\0A\00"
@.str.4 = [105 x i8] c"File differ in line %d and they were:\0AFile1:\0A%s-----------------------------------------------\0AFile2:\0A%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 [10000 x i8]
%9 = alloca [10000 x i8]
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
store i8* %16, i8** %10
store i32 0, i32* %11
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 3
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %92
21: ; preds = %2
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 3
br i1 %23, label %24, label %90
24: ; preds = %21
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i32 1
store i8** %26, i8*** %5
%27 = load i8*, i8** %26
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %28, i32** %6
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %37
30: ; preds = %24
%31 = load i32, i32* @stderr
%32 = load i8*, i8** %10
%33 = load i8**, i8*** %5
%34 = load i8*, i8** %33
%35 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %32, i8* %34)
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %24
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i32 1
store i8** %39, i8*** %5
%40 = load i8*, i8** %39
%41 = call i32* @fopen(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %41, i32** %7
%42 = icmp eq i32* %41, null
br i1 %42, label %43, label %50
43: ; preds = %37
%44 = load i32, i32* @stderr
%45 = load i8*, i8** %10
%46 = load i8**, i8*** %5
%47 = load i8*, i8** %46
%48 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %45, i8* %47)
%49 = call i32 @exit(i32 2)
unreachable
50: ; preds = %37
br label %51
51: ; preds = %73, %50
%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** %12
%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** %13
%58 = load i32, i32* %11
%59 = add nsw i32 %58, 1
store i32 %59, i32* %11
br label %60
60: ; preds = %51
%61 = getelementptr inbounds [10000 x i8], [10000 x i8]* %8, i64 0, i64 0
%62 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%63 = call i32 @strcmp(i8* %61, i8* %62)
%64 = icmp ne i32 %63, 0
br i1 %64, label %73, label %65
65: ; preds = %60
%66 = load i8*, i8** %12
%67 = icmp ne i8* %66, null
br i1 %67, label %71, label %68
68: ; preds = %65
%69 = load i8*, i8** %13
%70 = icmp ne i8* %69, null
br label %71
71: ; preds = %68, %65
%72 = phi i1 [ true, %65 ], [ %70, %68 ]
br label %73
73: ; preds = %71, %60
%74 = phi i1 [ false, %60 ], [ %72, %71 ]
br i1 %74, label %51, label %75
75: ; preds = %73
%76 = load i32*, i32** %6
%77 = call i32 @fclose(i32* %76)
%78 = load i32*, i32** %7
%79 = call i32 @fclose(i32* %78)
%80 = load i8*, i8** %12
%81 = load i8*, i8** %13
%82 = icmp eq i8* %80, %81
br i1 %82, label %83, label %85
83: ; preds = %75
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %92
85: ; preds = %75
%86 = load i32, i32* %11
%87 = getelementptr inbounds [10000 x i8], [10000 x i8]* %8, i64 0, i64 0
%88 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 0
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str.4, i64 0, i64 0), i32 %86, i8* %87, i8* %88)
store i32 0, i32* %3
br label %92
90: ; preds = %21
br label %91
91: ; preds = %90
store i32 0, i32* %3
br label %92
92: ; preds = %91, %85, %83, %19
%93 = load i32, i32* %3
ret i32 %93
}

LLVM IR (-O2):
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [27 x i8] c"%s: couldn't open %s file\0A\00"
@.str.4 = [105 x i8] c"File differ in line %d and they were:\0AFile1:\0A%s-----------------------------------------------\0AFile2:\0A%s\00"
@str = [20 x i8] c"Files are identical\00"
@str.5 = [18 x i8] c"Too few arguments\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 = load i8*, i8** %1
%8 = icmp slt i32 %0, 3
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.5, i64 0, i64 0))
br label %52
11: ; preds = %2
%12 = icmp eq i32 %0, 3
br i1 %12, label %13, label %52
13: ; preds = %11
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %23
18: ; preds = %13
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %14
%21 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %7, i8* %20)
%22 = tail call i32 @exit(i32 1)
unreachable
23: ; preds = %13
%24 = getelementptr inbounds i8*, i8** %1, i64 2
%25 = load i8*, i8** %24
%26 = tail call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %33
28: ; preds = %23
%29 = load i32, i32* @stderr
%30 = load i8*, i8** %24
%31 = tail call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %7, i8* %30)
%32 = tail call i32 @exit(i32 2)
unreachable
33: ; preds = %23, %40
%34 = phi i32 [ %37, %40 ], [ 0, %23 ]
%35 = call i8* @fgets(i8* %5, i32 10000, i32* %16)
%36 = call i8* @fgets(i8* %6, i32 10000, i32* %26)
%37 = add nuw nsw i32 %34, 1
%38 = call i32 @strcmp(i8* %5, i8* %6)
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %44
40: ; preds = %33
%41 = icmp ne i8* %35, null
%42 = icmp ne i8* %36, null
%43 = or i1 %41, %42
br i1 %43, label %33, label %44
44: ; preds = %33, %40
%45 = call i32 @fclose(i32* %16)
%46 = call i32 @fclose(i32* %26)
%47 = icmp eq i8* %35, %36
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %52
50: ; preds = %44
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([105 x i8], [105 x i8]* @.str.4, i64 0, i64 0), i32 %37, i8* %5, i8* %6)
br label %52
52: ; preds = %11, %50, %48, %9
%53 = phi i32 [ -1, %9 ], [ 0, %48 ], [ 0, %50 ], [ 0, %11 ]
ret i32 %53
}