#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 */
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int confronto_file(FILE *f1, FILE *f2) {
  char buf1[1024], buf2[1024];
  char *pa, *pb;
  int ret;
  pa = fgets(buf1, 1024, f1);
  pb = fgets(buf2, 1024, f2);
  while (ret && pa && pb) {
    ret = !strncmp(buf1, buf2, 1024);
    pa = fgets(buf1, 1024, f1);
    pb = fgets(buf2, 1024, f2);
  }
  return (ret && pa == NULL && pb == NULL);
}


x86 assembly (clang, -O0):
<confronto_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x830,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x400,%esi
call   1040 <fgets@plt>
mov    %rax,-0x818(%rbp)
lea    -0x810(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x400,%esi
call   1040 <fgets@plt>
mov    %rax,-0x820(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x824(%rbp)
mov    %al,-0x825(%rbp)
je     11a7 <confronto_file+0x87>
xor    %eax,%eax
cmpq   $0x0,-0x818(%rbp)
mov    %al,-0x825(%rbp)
je     11a7 <confronto_file+0x87>
cmpq   $0x0,-0x820(%rbp)
setne  %al
mov    %al,-0x825(%rbp)
mov    -0x825(%rbp),%al
test   $0x1,%al
jne    11ba <confronto_file+0x9a>
jmp    1222 <confronto_file+0x102>
lea    -0x410(%rbp),%rdi
lea    -0x810(%rbp),%rsi
mov    $0x400,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x824(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x400,%esi
call   1040 <fgets@plt>
mov    %rax,-0x818(%rbp)
lea    -0x810(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x400,%esi
call   1040 <fgets@plt>
mov    %rax,-0x820(%rbp)
jmp    116b <confronto_file+0x4b>
xor    %eax,%eax
cmpl   $0x0,-0x824(%rbp)
mov    %al,-0x826(%rbp)
je     125e <confronto_file+0x13e>
xor    %eax,%eax
cmpq   $0x0,-0x818(%rbp)
mov    %al,-0x826(%rbp)
jne    125e <confronto_file+0x13e>
cmpq   $0x0,-0x820(%rbp)
sete   %al
mov    %al,-0x826(%rbp)
mov    -0x826(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x830,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<confronto_file>:
push   %rbx
sub    $0x800,%rsp
mov    %rsi,%rbx
mov    %rdi,%rdx
lea    0x400(%rsp),%rdi
mov    $0x400,%esi
call   1030 <fgets@plt>
mov    %rsp,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   1030 <fgets@plt>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @confronto_file(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [1024 x i8]
%6 = alloca [1024 x i8]
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%11 = load i32*, i32** %3
%12 = call i8* @fgets(i8* %10, i32 1024, i32* %11)
store i8* %12, i8** %7
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%14 = load i32*, i32** %4
%15 = call i8* @fgets(i8* %13, i32 1024, i32* %14)
store i8* %15, i8** %8
br label %16
16: ; preds = %27, %2
%17 = load i32, i32* %9
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load i8*, i8** %7
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i8*, i8** %8
%24 = icmp ne i8* %23, null
br label %25
25: ; preds = %22, %19, %16
%26 = phi i1 [ false, %19 ], [ false, %16 ], [ %24, %22 ]
br i1 %26, label %27, label %40
27: ; preds = %25
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%30 = call i32 @strncmp(i8* %28, i8* %29, i32 1024)
%31 = icmp ne i32 %30, 0
%32 = xor i1 %31, true
%33 = zext i1 %32 to i32
store i32 %33, i32* %9
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%35 = load i32*, i32** %3
%36 = call i8* @fgets(i8* %34, i32 1024, i32* %35)
store i8* %36, i8** %7
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%38 = load i32*, i32** %4
%39 = call i8* @fgets(i8* %37, i32 1024, i32* %38)
store i8* %39, i8** %8
br label %16
40: ; preds = %25
%41 = load i32, i32* %9
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %49
43: ; preds = %40
%44 = load i8*, i8** %7
%45 = icmp eq i8* %44, null
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = load i8*, i8** %8
%48 = icmp eq i8* %47, null
br label %49
49: ; preds = %46, %43, %40
%50 = phi i1 [ false, %43 ], [ false, %40 ], [ %48, %46 ]
%51 = zext i1 %50 to i32
ret i32 %51
}

LLVM IR (-O2):
define i32 @confronto_file(i32* nocapture %0, i32* 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 = call i8* @fgets(i8* %5, i32 1024, i32* %0)
%8 = call i8* @fgets(i8* %6, i32 1024, i32* %1)
ret i32 0
}