#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*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, char *, char *);
scalar_t__ strcmp(char *, char *);
int main() {
  FILE *f1 = fopen("a.out", "r");
  FILE *f2 = fopen("c.out", "r");
  FILE *f3 = fopen("r.out", "w");
  char str1[100], str2[100];
  int i = 1;
  while (fgets(str1, 100, f1) && fgets(str2, 100, f2)) {
    if (strcmp(str1, str2) != 0) {
      fprintf(f3, "Line : %d:\n%s\n%s\n", i, str1, str2);
    }
    i++;
  }
  fclose(f1);
  fclose(f2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
lea    0xe96(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe88(%rip),%rdi
lea    0xe7f(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe77(%rip),%rdi
lea    0xe76(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
movl   $0x1,-0x104(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x64,%esi
call   1040 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x105(%rbp)
je     11fd <main+0xad>
lea    -0x100(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x64,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x105(%rbp)
mov    -0x105(%rbp),%al
test   $0x1,%al
jne    1210 <main+0xc0>
jmp    1265 <main+0x115>
lea    -0x90(%rbp),%rdi
lea    -0x100(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1251 <main+0x101>
mov    -0x20(%rbp),%rdi
mov    -0x104(%rbp),%edx
lea    -0x90(%rbp),%rcx
lea    -0x100(%rbp),%r8
lea    0xdca(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x104(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x104(%rbp)
jmp    11b1 <main+0x61>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
lea    0xe98(%rip),%rdi
lea    0xe97(%rip),%rbx
mov    %rbx,%rsi
call   1070 <fopen@plt>
mov    %rax,%r12
lea    0xe87(%rip),%rdi
mov    %rbx,%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
lea    0xe7b(%rip),%rdi
lea    0xe7a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r15
mov    %rsp,%rdi
mov    $0x64,%esi
mov    %r12,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1226 <main+0xd6>
mov    $0x1,%ebp
lea    0x70(%rsp),%r13
mov    %rsp,%rbx
jmp    11e8 <main+0x98>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r12,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1226 <main+0xd6>
mov    %r13,%rdi
mov    $0x64,%esi
mov    %r14,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1226 <main+0xd6>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11d0 <main+0x80>
mov    %r15,%rdi
lea    0xdff(%rip),%rsi
mov    %ebp,%edx
mov    %rbx,%rcx
mov    %r13,%r8
call   1060 <fprintf@plt>
jmp    11d0 <main+0x80>
mov    %r12,%rdi
call   1030 <fclose@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"a.out\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"c.out\00"
@.str.3 = [6 x i8] c"r.out\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [18 x i8] c"Line : %d:\0A%s\0A%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [100 x i8]
%6 = alloca [100 x i8]
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %2
%9 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %3
%10 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %10, i32** %4
store i32 1, i32* %7
br label %11
11: ; preds = %34, %0
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%13 = load i32*, i32** %2
%14 = call i64 @fgets(i8* %12, i32 100, i32* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %11
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%18 = load i32*, i32** %3
%19 = call i64 @fgets(i8* %17, i32 100, i32* %18)
%20 = icmp ne i64 %19, 0
br label %21
21: ; preds = %16, %11
%22 = phi i1 [ false, %11 ], [ %20, %16 ]
br i1 %22, label %23, label %37
23: ; preds = %21
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%26 = call i64 @strcmp(i8* %24, i8* %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %34
28: ; preds = %23
%29 = load i32*, i32** %4
%30 = load i32, i32* %7
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%33 = call i32 @fprintf(i32* %29, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %30, i8* %31, i8* %32)
br label %34
34: ; preds = %28, %23
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %11
37: ; preds = %21
%38 = load i32*, i32** %2
%39 = call i32 @fclose(i32* %38)
%40 = load i32*, i32** %3
%41 = call i32 @fclose(i32* %40)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"a.out\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"c.out\00"
@.str.3 = [6 x i8] c"r.out\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [18 x i8] c"Line : %d:\0A%s\0A%s\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = call i64 @fgets(i8* %6, i32 100, i32* %3)
%9 = icmp eq i64 %8, 0
br i1 %9, label %23, label %10
10: ; preds = %0, %19
%11 = phi i32 [ %20, %19 ], [ 1, %0 ]
%12 = call i64 @fgets(i8* %7, i32 100, i32* %4)
%13 = icmp eq i64 %12, 0
br i1 %13, label %23, label %14
14: ; preds = %10
%15 = call i64 @strcmp(i8* %6, i8* %7)
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %11, i8* %6, i8* %7)
br label %19
19: ; preds = %17, %14
%20 = add nuw nsw i32 %11, 1
%21 = call i64 @fgets(i8* %6, i32 100, i32* %3)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %10
23: ; preds = %10, %19, %0
%24 = call i32 @fclose(i32* %3)
%25 = call i32 @fclose(i32* %4)
ret i32 0
}