#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);
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;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  FILE *fp1, *fp2;
  char *prog = argv[0];
  char line1[1000], line2[1000];
  char *p1, *p2;
  int i;
  if (argc == 3) {
    if ((fp1 = fopen(*++argv, "r")) == NULL) {
      fprintf(stderr, "%s: can't open %s\n", prog, *argv);
      exit(1);
    }
    if ((fp2 = fopen(*++argv, "r")) == NULL) {
      fprintf(stderr, "%s: can't open %s\n", prog, *argv);
      exit(1);
    }
    while ((p1 = fgets(line1, 1000, fp1)) != NULL &&
           (p2 = fgets(line2, 1000, fp2)) != NULL)
      if (strcmp(line1, line2)) {
        printf("<\t%s\n>\t%s\n", line1, line2);
        printf("%d", i);
        return 0;
      }
    if (p1 == NULL)
      if (fgets(line2, 1000, fp2) == NULL)
        printf("same file\n");
      else
        printf(">\t%s\n", line2);
    else
      printf("<\t%s\n", line1);
  } else
    printf("bad argument\n");
  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)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    1380 <main+0x220>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe58(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11e5 <main+0x85>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xe2c(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe01(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    123c <main+0xdc>
mov    0x2dc7(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xdd5(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
jmp    1241 <main+0xe1>
lea    -0x410(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x3e8,%esi
call   1040 <fgets@plt>
mov    %rax,%rcx
mov    %rcx,-0x808(%rbp)
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x815(%rbp)
je     129b <main+0x13b>
lea    -0x800(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x3e8,%esi
call   1040 <fgets@plt>
mov    %rax,-0x810(%rbp)
cmp    $0x0,%rax
setne  %al
mov    %al,-0x815(%rbp)
mov    -0x815(%rbp),%al
test   $0x1,%al
jne    12ae <main+0x14e>
jmp    130c <main+0x1ac>
lea    -0x410(%rbp),%rdi
lea    -0x800(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1307 <main+0x1a7>
lea    -0x410(%rbp),%rsi
lea    -0x800(%rbp),%rdx
lea    0xd35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x814(%rbp),%esi
lea    0xd2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1395 <main+0x235>
jmp    1241 <main+0xe1>
cmpq   $0x0,-0x808(%rbp)
jne    1366 <main+0x206>
lea    -0x800(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x3e8,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
jne    134c <main+0x1ec>
lea    0xce3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1361 <main+0x201>
lea    -0x800(%rbp),%rsi
lea    0xcc0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    137b <main+0x21b>
lea    -0x410(%rbp),%rsi
lea    0xcba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    138e <main+0x22e>
lea    0xcad(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7e0,%rsp
cmp    $0x3,%edi
jne    1246 <main+0xd6>
mov    %rsi,%r12
mov    (%rsi),%r15
mov    0x8(%rsi),%rdi
lea    0xe66(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     1297 <main+0x127>
mov    %rax,%r14
mov    0x10(%r12),%rdi
lea    0xe49(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     12a7 <main+0x137>
mov    %rax,%r13
lea    0x3f0(%rsp),%r15
mov    %rsp,%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    $0x3e8,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
mov    %rax,%rbx
mov    %r12,%rdi
mov    $0x3e8,%esi
mov    %r13,%rdx
call   1050 <fgets@plt>
test   %rbx,%rbx
je     1254 <main+0xe4>
test   %rax,%rax
je     1265 <main+0xf5>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11e0 <main+0x70>
lea    0xdf1(%rip),%rdi
lea    0x3f0(%rsp),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xde3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    127b <main+0x10b>
lea    0xddc(%rip),%rdi
call   1030 <puts@plt>
jmp    127b <main+0x10b>
test   %rax,%rax
je     128e <main+0x11e>
lea    0xdba(%rip),%rdi
mov    %rsp,%rsi
jmp    1274 <main+0x104>
lea    0xdb7(%rip),%rdi
lea    0x3f0(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xda1(%rip),%rdi
jmp    124d <main+0xdd>
mov    0x2d42(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r12),%rcx
jmp    12b5 <main+0x145>
mov    0x2d32(%rip),%rax
mov    (%rax),%edi
mov    0x10(%r12),%rcx
lea    0xd46(%rip),%rsi
mov    %r15,%rdx
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [19 x i8] c"%s: can't open %s\0A\00"
@.str.2 = [11 x i8] c"<\09%s\0A>\09%s\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [11 x i8] c"same file\0A\00"
@.str.5 = [6 x i8] c">\09%s\0A\00"
@.str.6 = [6 x i8] c"<\09%s\0A\00"
@.str.7 = [14 x i8] c"bad argument\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 i8*
%9 = alloca [1000 x i8]
%10 = alloca [1000 x i8]
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
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** %8
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 3
br i1 %18, label %19, label %88
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i32 1
store i8** %21, i8*** %5
%22 = load i8*, i8** %21
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %23, i32** %6
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %32
25: ; preds = %19
%26 = load i32, i32* @stderr
%27 = load i8*, i8** %8
%28 = load i8**, i8*** %5
%29 = load i8*, i8** %28
%30 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %27, i8* %29)
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %19
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i32 1
store i8** %34, i8*** %5
%35 = load i8*, i8** %34
%36 = call i32* @fopen(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %36, i32** %7
%37 = icmp eq i32* %36, null
br i1 %37, label %38, label %45
38: ; preds = %32
%39 = load i32, i32* @stderr
%40 = load i8*, i8** %8
%41 = load i8**, i8*** %5
%42 = load i8*, i8** %41
%43 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %40, i8* %42)
%44 = call i32 @exit(i32 1)
unreachable
45: ; preds = %32
br label %46
46: ; preds = %69, %45
%47 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%48 = load i32*, i32** %6
%49 = call i8* @fgets(i8* %47, i32 1000, i32* %48)
store i8* %49, i8** %11
%50 = icmp ne i8* %49, null
br i1 %50, label %51, label %56
51: ; preds = %46
%52 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
%53 = load i32*, i32** %7
%54 = call i8* @fgets(i8* %52, i32 1000, i32* %53)
store i8* %54, i8** %12
%55 = icmp ne i8* %54, null
br label %56
56: ; preds = %51, %46
%57 = phi i1 [ false, %46 ], [ %55, %51 ]
br i1 %57, label %58, label %70
58: ; preds = %56
%59 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%60 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
%61 = call i64 @strcmp(i8* %59, i8* %60)
%62 = icmp ne i64 %61, 0
br i1 %62, label %63, label %69
63: ; preds = %58
%64 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%65 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %64, i8* %65)
%67 = load i32, i32* %13
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %67)
store i32 0, i32* %3
br label %91
69: ; preds = %58
br label %46
70: ; preds = %56
%71 = load i8*, i8** %11
%72 = icmp eq i8* %71, null
br i1 %72, label %73, label %84
73: ; preds = %70
%74 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
%75 = load i32*, i32** %7
%76 = call i8* @fgets(i8* %74, i32 1000, i32* %75)
%77 = icmp eq i8* %76, null
br i1 %77, label %78, label %80
78: ; preds = %73
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %83
80: ; preds = %73
%81 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %81)
br label %83
83: ; preds = %80, %78
br label %87
84: ; preds = %70
%85 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %85)
br label %87
87: ; preds = %84, %83
br label %90
88: ; preds = %2
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
br label %90
90: ; preds = %88, %87
store i32 0, i32* %3
br label %91
91: ; preds = %90, %63
%92 = load i32, i32* %3
ret i32 %92
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [19 x i8] c"%s: can't open %s\0A\00"
@.str.2 = [11 x i8] c"<\09%s\0A>\09%s\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.5 = [6 x i8] c">\09%s\0A\00"
@.str.6 = [6 x i8] c"<\09%s\0A\00"
@str = [13 x i8] c"bad argument\00"
@str.8 = [10 x i8] c"same file\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
%5 = load i8*, i8** %1
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%8 = icmp eq i32 %0, 3
br i1 %8, label %9, label %48
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %19
14: ; preds = %9
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %10
%17 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %5, i8* %16)
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %9
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = tail call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %29
24: ; preds = %19
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %20
%27 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %5, i8* %26)
%28 = tail call i32 @exit(i32 1)
unreachable
29: ; preds = %19, %35
%30 = call i8* @fgets(i8* %6, i32 1000, i32* %12)
%31 = icmp eq i8* %30, null
%32 = call i8* @fgets(i8* %7, i32 1000, i32* %22)
%33 = icmp eq i8* %32, null
br i1 %31, label %41, label %34
34: ; preds = %29
br i1 %33, label %46, label %35
35: ; preds = %34
%36 = call i64 @strcmp(i8* %6, i8* %7)
%37 = icmp eq i64 %36, 0
br i1 %37, label %29, label %38
38: ; preds = %35
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %6, i8* %7)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 undef)
br label %50
41: ; preds = %29
br i1 %33, label %42, label %44
42: ; preds = %41
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.8, i64 0, i64 0))
br label %50
44: ; preds = %41
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %7)
br label %50
46: ; preds = %34
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %6)
br label %50
48: ; preds = %2
%49 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %50
50: ; preds = %48, %42, %44, %46, %38
ret i32 0
}