#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 EOF;
int /*<<< orphan*/ *fopen(char *, char *);
int getc(int /*<<< orphan*/ *);
int file_changed() {
  register FILE *f1, *f2;
  register int c;
  if ((f1 = fopen("init.c", "r")) == NULL ||
      (f2 = fopen("init.c.new", "r")) == NULL)
    return 1;
  while ((c = getc(f1)) == getc(f2)) {
    if (c == EOF)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<file_changed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
lea    0xed1(%rip),%rsi
call   1030 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     116a <file_changed+0x4a>
lea    0xeb9(%rip),%rdi
lea    0xeb0(%rip),%rsi
call   1030 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1176 <file_changed+0x56>
movl   $0x1,-0x4(%rbp)
jmp    11ca <file_changed+0xaa>
jmp    117b <file_changed+0x5b>
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x20(%rbp)
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jne    11c3 <file_changed+0xa3>
mov    -0x1c(%rbp),%eax
mov    0x2e3e(%rip),%rcx
cmp    (%rcx),%eax
jne    11be <file_changed+0x9e>
movl   $0x0,-0x4(%rbp)
jmp    11ca <file_changed+0xaa>
jmp    117b <file_changed+0x5b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_changed>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xed1(%rip),%rdi
lea    0xed1(%rip),%rsi
call   1030 <fopen@plt>
mov    $0x1,%r14d
test   %rax,%rax
je     118f <file_changed+0x6f>
mov    %rax,%r15
lea    0xeb9(%rip),%rdi
lea    0xeb0(%rip),%rsi
call   1030 <fopen@plt>
test   %rax,%rax
je     118f <file_changed+0x6f>
mov    %rax,%rbp
mov    0x2e7d(%rip),%r12
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1040 <getc@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1040 <getc@plt>
cmp    %eax,%ebx
jne    118f <file_changed+0x6f>
cmp    (%r12),%ebx
jne    1170 <file_changed+0x50>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"init.c\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"init.c.new\00"
@EOF = global i32 0
define i32 @file_changed() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %2
%6 = icmp eq i32* %5, null
br i1 %6, label %10, label %7
7: ; preds = %0
%8 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 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* %8, i32** %3
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %11
10: ; preds = %7, %0
store i32 1, i32* %1
br label %25
11: ; preds = %7
br label %12
12: ; preds = %23, %11
%13 = load i32*, i32** %2
%14 = call i32 @getc(i32* %13)
store i32 %14, i32* %4
%15 = load i32*, i32** %3
%16 = call i32 @getc(i32* %15)
%17 = icmp eq i32 %14, %16
br i1 %17, label %18, label %24
18: ; preds = %12
%19 = load i32, i32* %4
%20 = load i32, i32* @EOF
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 0, i32* %1
br label %25
23: ; preds = %18
br label %12
24: ; preds = %12
store i32 1, i32* %1
br label %25
25: ; preds = %24, %22, %10
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
@.str = [7 x i8] c"init.c\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"init.c.new\00"
@EOF = global i32 0
define i32 @file_changed() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %13, label %3
3: ; preds = %0
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %13, label %6
6: ; preds = %3, %10
%7 = tail call i32 @getc(i32* %1)
%8 = tail call i32 @getc(i32* %4)
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %7, %11
br i1 %12, label %13, label %6
13: ; preds = %6, %10, %0, %3
%14 = phi i32 [ 1, %3 ], [ 1, %0 ], [ 1, %6 ], [ 0, %10 ]
ret i32 %14
}