#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);
scalar_t__ ferror(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  FILE *fp;
  char line_1[1024];
  char line_2[1024];
  char *prog = argv[0];
  if (argc == 1) {
    while (1) {
      if ((fgets(line_1, 1024, stdin) != NULL) &&
          (fgets(line_2, 1024, stdin) != NULL)) {
        if (strcmp(line_1, line_2) != 0) {
          fputs(line_1, stdout);
          fputs(line_2, stdout);
          break;
        }
      } else {
        break;
      }
    }
  } else {
    if ((fp = fopen(*++argv, "r")) == NULL) {
      fprintf(stderr, "%s: can't open %s\n", prog, *argv);
      exit(1);
    } else {
      FILE *fp_2;
      if (*++argv == NULL) {
        fp_2 = stdin;
      } else if ((fp_2 = fopen(*argv, "r")) == NULL) {
        fprintf(stderr, "%s: can't open %s\n", prog, *argv);
        exit(1);
      }
      while (1) {
        if ((fgets(line_1, 1024, fp) != NULL) &&
            (fgets(line_2, 1024, fp_2) != NULL)) {
          if (strcmp(line_1, line_2) != 0) {
            fputs(line_1, stdout);
            fputs(line_2, stdout);
            break;
          }
        } else {
          break;
        }
      }
    }
  }
  if (ferror(stdout)) {
    fprintf(stderr, "%s: error writing stdout\n", prog);
    exit(2);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x830,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x828(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1250 <main+0xe0>
jmp    11a6 <main+0x36>
lea    -0x420(%rbp),%rdi
mov    0x2e34(%rip),%rax
mov    (%rax),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     1241 <main+0xd1>
lea    -0x820(%rbp),%rdi
mov    0x2e0f(%rip),%rax
mov    (%rax),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     1241 <main+0xd1>
lea    -0x420(%rbp),%rdi
lea    -0x820(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     123c <main+0xcc>
lea    -0x420(%rbp),%rdi
mov    0x2db5(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
lea    -0x820(%rbp),%rdi
mov    0x2da0(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
jmp    124b <main+0xdb>
jmp    1246 <main+0xd6>
jmp    124b <main+0xdb>
jmp    11a6 <main+0x36>
jmp    13df <main+0x26f>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xd96(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    12ac <main+0x13c>
mov    0x2d54(%rip),%rax
mov    (%rax),%edi
mov    -0x828(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xd67(%rip),%rsi
mov    $0x0,%al
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)
cmpq   $0x0,0x8(%rax)
jne    12dc <main+0x16c>
mov    0x2d1b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x830(%rbp)
jmp    1334 <main+0x1c4>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd16(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x830(%rbp)
cmp    $0x0,%rax
jne    132f <main+0x1bf>
mov    0x2cd1(%rip),%rax
mov    (%rax),%edi
mov    -0x828(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xce4(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    1334 <main+0x1c4>
jmp    1339 <main+0x1c9>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     13cb <main+0x25b>
lea    -0x820(%rbp),%rdi
mov    -0x830(%rbp),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     13cb <main+0x25b>
lea    -0x420(%rbp),%rdi
lea    -0x820(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     13c6 <main+0x256>
lea    -0x420(%rbp),%rdi
mov    0x2c2b(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
lea    -0x820(%rbp),%rdi
mov    0x2c16(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
jmp    13d5 <main+0x265>
jmp    13d0 <main+0x260>
jmp    13d5 <main+0x265>
jmp    1339 <main+0x1c9>
jmp    13da <main+0x26a>
jmp    13df <main+0x26f>
mov    0x2bea(%rip),%rax
mov    (%rax),%edi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     141f <main+0x2af>
mov    0x2bda(%rip),%rax
mov    (%rax),%edi
mov    -0x828(%rbp),%rdx
lea    0xc07(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   1090 <exit@plt>
xor    %edi,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x800,%rsp
mov    (%rsi),%r14
cmp    $0x1,%edi
jne    11e9 <main+0x79>
mov    0x2e59(%rip),%r12
lea    0x400(%rsp),%r15
mov    %rsp,%rbx
nopw   0x0(%rax,%rax,1)
mov    (%r12),%rdx
mov    %r15,%rdi
mov    $0x400,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     12da <main+0x16a>
mov    (%r12),%rdx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     12da <main+0x16a>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11a0 <main+0x30>
jmp    12ba <main+0x14a>
mov    %rsi,%r12
mov    0x8(%rsi),%rdi
lea    0xe09(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
jne    1211 <main+0xa1>
mov    0x2dd0(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r12),%rcx
jmp    124c <main+0xdc>
mov    %rax,%r15
mov    0x10(%r12),%rdi
test   %rdi,%rdi
jne    122a <main+0xba>
mov    0x2dc3(%rip),%rax
mov    (%rax),%r13
jmp    1267 <main+0xf7>
lea    0xdcf(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r13
test   %rax,%rax
jne    1267 <main+0xf7>
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
mov    0x10(%r12),%rcx
lea    0xdaf(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    0x400(%rsp),%r12
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     12da <main+0x16a>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r13,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     12da <main+0x16a>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1280 <main+0x110>
mov    0x2d0f(%rip),%rbx
mov    (%rbx),%esi
lea    0x400(%rsp),%rdi
call   1040 <fputs@plt>
mov    (%rbx),%esi
mov    %rsp,%rdi
call   1040 <fputs@plt>
mov    0x2cef(%rip),%rax
mov    (%rax),%edi
call   1030 <ferror@plt>
test   %rax,%rax
jne    12f4 <main+0x184>
xor    %edi,%edi
call   1090 <exit@plt>
mov    0x2cdd(%rip),%rax
mov    (%rax),%edi
lea    0xd11(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   1090 <exit@plt>

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

LLVM IR (-O2):
@stdin = global i32* null
@stdout = global i32 0
@.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 = [26 x i8] c"%s: error writing stdout\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = load i8*, i8** %1
%8 = icmp eq i32 %0, 1
br i1 %8, label %9, label %20
9: ; preds = %2, %17
%10 = load i32*, i32** @stdin
%11 = call i32* @fgets(i8* %5, i32 1024, i32* %10)
%12 = icmp eq i32* %11, null
br i1 %12, label %60, label %13
13: ; preds = %9
%14 = load i32*, i32** @stdin
%15 = call i32* @fgets(i8* %6, i32 1024, i32* %14)
%16 = icmp eq i32* %15, null
br i1 %16, label %60, label %17
17: ; preds = %13
%18 = call i64 @strcmp(i8* %5, i8* %6)
%19 = icmp eq i64 %18, 0
br i1 %19, label %9, label %55
20: ; preds = %2
%21 = getelementptr inbounds i8*, i8** %1, i64 1
%22 = load i8*, i8** %21
%23 = tail call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %30
25: ; preds = %20
%26 = load i32, i32* @stderr
%27 = load i8*, i8** %21
%28 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %7, i8* %27)
%29 = tail call i32 @exit(i32 1)
unreachable
30: ; preds = %20
%31 = getelementptr inbounds i8*, i8** %1, i64 2
%32 = load i8*, i8** %31
%33 = icmp eq i8* %32, null
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = load i32*, i32** @stdin
br label %44
36: ; preds = %30
%37 = tail call i32* @fopen(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %44
39: ; preds = %36
%40 = load i32, i32* @stderr
%41 = load i8*, i8** %31
%42 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %7, i8* %41)
%43 = tail call i32 @exit(i32 1)
unreachable
44: ; preds = %36, %34
%45 = phi i32* [ %35, %34 ], [ %37, %36 ]
br label %46
46: ; preds = %52, %44
%47 = call i32* @fgets(i8* %5, i32 1024, i32* %23)
%48 = icmp eq i32* %47, null
br i1 %48, label %60, label %49
49: ; preds = %46
%50 = call i32* @fgets(i8* %6, i32 1024, i32* %45)
%51 = icmp eq i32* %50, null
br i1 %51, label %60, label %52
52: ; preds = %49
%53 = call i64 @strcmp(i8* %5, i8* %6)
%54 = icmp eq i64 %53, 0
br i1 %54, label %46, label %55
55: ; preds = %52, %17
%56 = load i32, i32* @stdout
%57 = call i32 @fputs(i8* %5, i32 %56)
%58 = load i32, i32* @stdout
%59 = call i32 @fputs(i8* %6, i32 %58)
br label %60
60: ; preds = %49, %46, %13, %9, %55
%61 = load i32, i32* @stdout
%62 = call i64 @ferror(i32 %61)
%63 = icmp eq i64 %62, 0
br i1 %63, label %68, label %64
64: ; preds = %60
%65 = load i32, i32* @stderr
%66 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%67 = call i32 @exit(i32 2)
unreachable
68: ; preds = %60
%69 = call i32 @exit(i32 0)
unreachable
}