#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  FILE *f, *g;
  int a, b;
  int ra, rb;
  if (argc != 3) {
    fprintf(stderr, "usage %s input1 input2\n", argv[0]);
    return 1;
  }
  if ((f = fopen(argv[1], "r")) == NULL)
    fprintf(stderr, "fail opening %s\n", argv[1]);
  if ((g = fopen(argv[2], "r")) == NULL)
    fprintf(stderr, "fail opening %s\n", argv[2]);
  if (f == NULL || g == NULL)
    exit(1);
  while (1) {
    ra = fscanf(f, "%d", &a);
    rb = fscanf(g, "%d", &b);
    if (ra == EOF || rb == EOF) {
      exit((ra == EOF && rb == EOF) ? 0 : 1);
    }
    if (a != b) {
      exit(1);
    }
  }
  assert(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1187 <main+0x47>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe89(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
add    $0x40,%rsp
pop    %rbp
ret
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe82(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11c6 <main+0x86>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe59(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe43(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1205 <main+0xc5>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xe1a(%rip),%rsi
call   1040 <fprintf@plt>
cmpq   $0x0,-0x18(%rbp)
je     121b <main+0xdb>
cmpq   $0x0,-0x20(%rbp)
jne    1225 <main+0xe5>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    122a <main+0xea>
mov    -0x18(%rbp),%rdi
lea    0xdf6(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   1030 <fscanf@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xddf(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1030 <fscanf@plt>
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
mov    0x2d86(%rip),%rcx
cmp    (%rcx),%eax
je     127c <main+0x13c>
mov    -0x30(%rbp),%eax
mov    0x2d74(%rip),%rcx
cmp    (%rcx),%eax
jne    12ba <main+0x17a>
mov    -0x2c(%rbp),%ecx
xor    %eax,%eax
mov    0x2d60(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x31(%rbp)
jne    12a5 <main+0x165>
mov    -0x30(%rbp),%eax
mov    0x2d4b(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%cl
mov    $0x1,%edi
xor    %eax,%eax
test   $0x1,%cl
cmovne %eax,%edi
call   1060 <exit@plt>
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
je     12d0 <main+0x190>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    122a <main+0xea>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
je     117f <main+0x3f>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe9a(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rbx),%rdi
lea    0xe8e(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
jne    11c4 <main+0x84>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xe72(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x10(%rbx),%rdi
lea    0xe60(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     11dc <main+0x9c>
jmp    11f8 <main+0xb8>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
lea    0xe46(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
jne    1202 <main+0xc2>
add    $0x10,%rbx
mov    0x2df1(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe27(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    %rax,%r15
lea    0xe1f(%rip),%rbx
mov    %rsp,%r13
mov    0x2dd2(%rip),%r12
mov    %r14,%rdi
mov    %rbx,%rsi
lea    0x4(%rsp),%rdx
call   1030 <fscanf@plt>
mov    %eax,%ebp
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
call   1030 <fscanf@plt>
mov    (%r12),%ecx
cmp    %ecx,%ebp
je     124d <main+0x10d>
cmp    %ecx,%eax
je     124d <main+0x10d>
mov    0x4(%rsp),%eax
cmp    (%rsp),%eax
je     1216 <main+0xd6>
jmp    11f8 <main+0xb8>
xor    %ecx,%ebp
xor    %ecx,%eax
xor    %edi,%edi
or     %ebp,%eax
setne  %dil
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"usage %s input1 input2\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [17 x i8] c"fail opening %s\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@EOF = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 3
br i1 %13, label %14, label %20
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %18)
ret i32 1
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %24, i32** %6
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %32
26: ; preds = %20
%27 = load i32, i32* @stderr
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %30)
br label %32
32: ; preds = %26, %20
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 2
%35 = load i8*, i8** %34
%36 = call i32* @fopen(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %36, i32** %7
%37 = icmp eq i32* %36, null
br i1 %37, label %38, label %44
38: ; preds = %32
%39 = load i32, i32* @stderr
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 2
%42 = load i8*, i8** %41
%43 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %42)
br label %44
44: ; preds = %38, %32
%45 = load i32*, i32** %6
%46 = icmp eq i32* %45, null
br i1 %46, label %50, label %47
47: ; preds = %44
%48 = load i32*, i32** %7
%49 = icmp eq i32* %48, null
br i1 %49, label %50, label %52
50: ; preds = %47, %44
%51 = call i32 @exit(i32 1)
unreachable
52: ; preds = %47
br label %53
53: ; preds = %52, %84
%54 = load i32*, i32** %6
%55 = call i32 @fscanf(i32* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %8)
store i32 %55, i32* %10
%56 = load i32*, i32** %7
%57 = call i32 @fscanf(i32* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %9)
store i32 %57, i32* %11
%58 = load i32, i32* %10
%59 = load i32, i32* @EOF
%60 = icmp eq i32 %58, %59
br i1 %60, label %65, label %61
61: ; preds = %53
%62 = load i32, i32* %11
%63 = load i32, i32* @EOF
%64 = icmp eq i32 %62, %63
br i1 %64, label %65, label %78
65: ; preds = %61, %53
%66 = load i32, i32* %10
%67 = load i32, i32* @EOF
%68 = icmp eq i32 %66, %67
br i1 %68, label %69, label %73
69: ; preds = %65
%70 = load i32, i32* %11
%71 = load i32, i32* @EOF
%72 = icmp eq i32 %70, %71
br label %73
73: ; preds = %69, %65
%74 = phi i1 [ false, %65 ], [ %72, %69 ]
%75 = zext i1 %74 to i64
%76 = select i1 %74, i32 0, i32 1
%77 = call i32 @exit(i32 %76)
unreachable
78: ; preds = %61
%79 = load i32, i32* %8
%80 = load i32, i32* %9
%81 = icmp ne i32 %79, %80
br i1 %81, label %82, label %84
82: ; preds = %78
%83 = call i32 @exit(i32 1)
unreachable
84: ; preds = %78
br label %53
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"usage %s input1 input2\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [17 x i8] c"fail opening %s\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = icmp eq i32 %0, 3
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %10)
ret i32 1
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %25
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %13
%20 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = tail call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp eq i32* %23, null
br i1 %24, label %30, label %35
25: ; preds = %12
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
%28 = tail call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %37
30: ; preds = %25, %17
%31 = phi i8** [ %26, %25 ], [ %21, %17 ]
%32 = load i32, i32* @stderr
%33 = load i8*, i8** %31
%34 = tail call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %17, %30
%36 = tail call i32 @exit(i32 1)
unreachable
37: ; preds = %25, %50
%38 = call i32 @fscanf(i32* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%39 = call i32 @fscanf(i32* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%40 = load i32, i32* @EOF
%41 = icmp eq i32 %38, %40
%42 = icmp eq i32 %39, %40
%43 = or i1 %41, %42
br i1 %43, label %44, label %50
44: ; preds = %37
%45 = icmp ne i32 %38, %40
%46 = icmp ne i32 %39, %40
%47 = or i1 %45, %46
%48 = zext i1 %47 to i32
%49 = call i32 @exit(i32 %48)
unreachable
50: ; preds = %37
%51 = load i32, i32* %3
%52 = load i32, i32* %4
%53 = icmp eq i32 %51, %52
br i1 %53, label %37, label %54
54: ; preds = %50
%55 = call i32 @exit(i32 1)
unreachable
}