#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 */

/* Variables and functions */
int compare_blocks(char *, char *, size_t);
scalar_t__ strlen(char *);
int rsync(char *str_file1, char *str_file2, size_t size_rd) {
  int ret;
  if (!str_file1 || !str_file2 || !(size_rd > 0))
    return -1;
  if (strlen(str_file1) != strlen(str_file2))
    return -1;
  ret = compare_blocks(str_file1, str_file2, size_rd);
  return ret;
}


x86 assembly (clang, -O0):
<rsync>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1155 <rsync+0x35>
cmpq   $0x0,-0x18(%rbp)
je     1155 <rsync+0x35>
cmpq   $0x0,-0x20(%rbp)
ja     1161 <rsync+0x41>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ad <rsync+0x8d>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
je     1193 <rsync+0x73>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ad <rsync+0x8d>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <compare_blocks@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rsync>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     116e <rsync+0x4e>
mov    %rsi,%r15
test   %rsi,%rsi
je     116e <rsync+0x4e>
mov    %rdx,%r14
test   %rdx,%rdx
je     116e <rsync+0x4e>
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rax,%r12
mov    %r15,%rdi
call   1030 <strlen@plt>
cmp    %rax,%r12
jne    116e <rsync+0x4e>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <compare_blocks@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @rsync(i8* %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %17
11: ; preds = %3
%12 = load i8*, i8** %6
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i64, i64* %7
%16 = icmp ugt i64 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %14, %11, %3
store i32 -1, i32* %4
br label %31
18: ; preds = %14
%19 = load i8*, i8** %5
%20 = call i64 @strlen(i8* %19)
%21 = load i8*, i8** %6
%22 = call i64 @strlen(i8* %21)
%23 = icmp ne i64 %20, %22
br i1 %23, label %24, label %25
24: ; preds = %18
store i32 -1, i32* %4
br label %31
25: ; preds = %18
%26 = load i8*, i8** %5
%27 = load i8*, i8** %6
%28 = load i64, i64* %7
%29 = call i32 @compare_blocks(i8* %26, i8* %27, i64 %28)
store i32 %29, i32* %8
%30 = load i32, i32* %8
store i32 %30, i32* %4
br label %31
31: ; preds = %25, %24, %17
%32 = load i32, i32* %4
ret i32 %32
}

LLVM IR (-O2):
define i32 @rsync(i8* %0, i8* %1, i64 %2) {
%4 = icmp ne i8* %0, null
%5 = icmp ne i8* %1, null
%6 = and i1 %4, %5
%7 = icmp ne i64 %2, 0
%8 = and i1 %6, %7
br i1 %8, label %9, label %15
9: ; preds = %3
%10 = tail call i64 @strlen(i8* %0)
%11 = tail call i64 @strlen(i8* %1)
%12 = icmp eq i64 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = tail call i32 @compare_blocks(i8* %0, i8* %1, i64 %2)
br label %15
15: ; preds = %9, %3, %13
%16 = phi i32 [ %14, %13 ], [ -1, %3 ], [ -1, %9 ]
ret i32 %16
}