#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 */
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  int /*<<< orphan*/ *data;
};
typedef TYPE_1__ MD5_CTX;

/* Variables and functions */
int /*<<< orphan*/ MD5_DIGEST_LENGTH;
int /*<<< orphan*/ MD5_Init(TYPE_1__ *);
int /*<<< orphan*/ MD5_Update(TYPE_1__ *, char *, unsigned int);
scalar_t__ memcmp(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                  int /*<<< orphan*/);
unsigned int strlen(char *);
int compare_blocks(char *str_file1, char *str_file2, size_t size_rd) {
  unsigned int len1, len2;
  unsigned int cpt1 = 0, cpt2 = 0;
  MD5_CTX ctx1, ctx2;
  MD5_Init(&ctx1);
  MD5_Init(&ctx2);
  len1 = strlen(str_file1);
  len2 = strlen(str_file2);
  while (len1 > cpt1 || len2 > cpt2) {
    MD5_Update(&ctx1, str_file1 + cpt1,
               ((cpt1 + size_rd) > len1 ? len1 - cpt1 : size_rd));
    MD5_Update(&ctx2, str_file2 + cpt2,
               ((cpt2 + size_rd) > len2 ? len2 - cpt2 : size_rd));
    if (memcmp(&ctx1.data[0], &ctx2.data[0], MD5_DIGEST_LENGTH) != 0 ||
        memcmp(&ctx1.data[1], &ctx2.data[1], MD5_DIGEST_LENGTH) != 0 ||
        memcmp(&ctx1.data[2], &ctx2.data[2], MD5_DIGEST_LENGTH) != 0 ||
        memcmp(&ctx1.data[3], &ctx2.data[3], MD5_DIGEST_LENGTH) != 0)
      return -1;
    cpt1 += size_rd;
    cpt2 += size_rd;
  }
  return 0;
}


x86 assembly (clang, -O0):
<compare_blocks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
lea    -0x38(%rbp),%rdi
call   1050 <MD5_Init@plt>
lea    -0x40(%rbp),%rdi
call   1050 <MD5_Init@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%ecx
mov    $0x1,%al
cmp    -0x2c(%rbp),%ecx
mov    %al,-0x41(%rbp)
ja     11a9 <compare_blocks+0x69>
mov    -0x28(%rbp),%eax
cmp    -0x30(%rbp),%eax
seta   %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    11b9 <compare_blocks+0x79>
jmp    1316 <compare_blocks+0x1d6>
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x2c(%rbp),%eax
add    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
cmp    %rcx,%rax
jbe    11eb <compare_blocks+0xab>
mov    -0x24(%rbp),%eax
sub    -0x2c(%rbp),%eax
mov    %eax,%eax
mov    %rax,-0x58(%rbp)
jmp    11f3 <compare_blocks+0xb3>
mov    -0x20(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rax
mov    %eax,%edx
lea    -0x38(%rbp),%rdi
call   1060 <MD5_Update@plt>
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
mov    -0x30(%rbp),%eax
add    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
cmp    %rcx,%rax
jbe    1238 <compare_blocks+0xf8>
mov    -0x28(%rbp),%eax
sub    -0x30(%rbp),%eax
mov    %eax,%eax
mov    %rax,-0x68(%rbp)
jmp    1240 <compare_blocks+0x100>
mov    -0x20(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x60(%rbp),%rsi
mov    -0x68(%rbp),%rax
mov    %eax,%edx
lea    -0x40(%rbp),%rdi
call   1060 <MD5_Update@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    0x2d7e(%rip),%rax
mov    (%rax),%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
jne    12eb <compare_blocks+0x1ab>
mov    -0x38(%rbp),%rdi
add    $0x4,%rdi
mov    -0x40(%rbp),%rsi
add    $0x4,%rsi
mov    0x2d56(%rip),%rax
mov    (%rax),%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
jne    12eb <compare_blocks+0x1ab>
mov    -0x38(%rbp),%rdi
add    $0x8,%rdi
mov    -0x40(%rbp),%rsi
add    $0x8,%rsi
mov    0x2d2e(%rip),%rax
mov    (%rax),%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
jne    12eb <compare_blocks+0x1ab>
mov    -0x38(%rbp),%rdi
add    $0xc,%rdi
mov    -0x40(%rbp),%rsi
add    $0xc,%rsi
mov    0x2d06(%rip),%rax
mov    (%rax),%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
je     12f7 <compare_blocks+0x1b7>
movl   $0xffffffff,-0x4(%rbp)
jmp    131d <compare_blocks+0x1dd>
mov    -0x20(%rbp),%rcx
mov    -0x2c(%rbp),%eax
add    %rcx,%rax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rcx
mov    -0x30(%rbp),%eax
add    %rcx,%rax
mov    %eax,-0x30(%rbp)
jmp    118c <compare_blocks+0x4c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_blocks>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdx,0x20(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbp
lea    0x8(%rsp),%rdi
call   1050 <MD5_Init@plt>
mov    %rsp,%rdi
call   1050 <MD5_Init@plt>
mov    %rbp,0x38(%rsp)
mov    %rbp,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r14,0x40(%rsp)
mov    %r14,%rdi
call   1030 <strlen@plt>
xor    %r13d,%r13d
mov    %ebp,0x18(%rsp)
mov    %eax,0x14(%rsp)
or     %eax,%ebp
je     12bd <compare_blocks+0x17d>
mov    0x18(%rsp),%edx
mov    %edx,%eax
mov    %rax,0x30(%rsp)
mov    0x14(%rsp),%r15d
mov    %r15d,%eax
mov    %rax,0x28(%rsp)
xor    %eax,%eax
mov    0x2e25(%rip),%rbp
mov    %edx,%ecx
nopl   (%rax)
mov    %eax,0x1c(%rsp)
mov    %rbp,%r13
mov    %eax,%ebp
mov    0x38(%rsp),%rax
lea    (%rax,%rbp,1),%rsi
mov    0x20(%rsp),%rbx
lea    (%rbx,%rbp,1),%r14
cmp    0x30(%rsp),%r14
mov    %ebx,%edx
mov    %ecx,%r12d
cmova  %ecx,%edx
lea    0x8(%rsp),%rdi
call   1060 <MD5_Update@plt>
add    0x40(%rsp),%rbp
cmp    0x28(%rsp),%r14
mov    %ebx,%edx
mov    %r15d,%ebx
cmova  %r15d,%edx
mov    %rsp,%rdi
mov    %rbp,%rsi
mov    %r13,%rbp
call   1060 <MD5_Update@plt>
mov    0x8(%rsp),%rdi
mov    (%rsp),%rsi
mov    0x0(%r13),%edx
call   1040 <memcmp@plt>
mov    $0xffffffff,%r13d
test   %rax,%rax
jne    12bd <compare_blocks+0x17d>
mov    0x8(%rsp),%rdi
add    $0x4,%rdi
mov    (%rsp),%rsi
add    $0x4,%rsi
mov    0x0(%rbp),%edx
call   1040 <memcmp@plt>
test   %rax,%rax
jne    12bd <compare_blocks+0x17d>
mov    0x8(%rsp),%rdi
add    $0x8,%rdi
mov    (%rsp),%rsi
add    $0x8,%rsi
mov    0x0(%rbp),%edx
call   1040 <memcmp@plt>
test   %rax,%rax
jne    12bd <compare_blocks+0x17d>
mov    0x8(%rsp),%rdi
add    $0xc,%rdi
mov    (%rsp),%rsi
add    $0xc,%rsi
mov    0x0(%rbp),%edx
call   1040 <memcmp@plt>
test   %rax,%rax
jne    12bd <compare_blocks+0x17d>
mov    %r12d,%ecx
mov    0x20(%rsp),%rdx
sub    %edx,%ecx
mov    0x1c(%rsp),%eax
add    %edx,%eax
mov    %ebx,%r15d
sub    %edx,%r15d
cmp    %r14d,0x18(%rsp)
ja     11c0 <compare_blocks+0x80>
cmp    %r14d,0x14(%rsp)
ja     11c0 <compare_blocks+0x80>
xor    %r13d,%r13d
mov    %r13d,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { i32* }
@MD5_DIGEST_LENGTH = global i32 0
define i32 @compare_blocks(i8* %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.TYPE_4__
%13 = alloca %struct.TYPE_4__
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i32 0, i32* %10
store i32 0, i32* %11
%14 = call i32 @MD5_Init(%struct.TYPE_4__* %12)
%15 = call i32 @MD5_Init(%struct.TYPE_4__* %13)
%16 = load i8*, i8** %5
%17 = call i32 @strlen(i8* %16)
store i32 %17, i32* %8
%18 = load i8*, i8** %6
%19 = call i32 @strlen(i8* %18)
store i32 %19, i32* %9
br label %20
20: ; preds = %115, %3
%21 = load i32, i32* %8
%22 = load i32, i32* %10
%23 = icmp ugt i32 %21, %22
br i1 %23, label %28, label %24
24: ; preds = %20
%25 = load i32, i32* %9
%26 = load i32, i32* %11
%27 = icmp ugt i32 %25, %26
br label %28
28: ; preds = %24, %20
%29 = phi i1 [ true, %20 ], [ %27, %24 ]
br i1 %29, label %30, label %126
30: ; preds = %28
%31 = load i8*, i8** %5
%32 = load i32, i32* %10
%33 = zext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = load i32, i32* %10
%36 = zext i32 %35 to i64
%37 = load i64, i64* %7
%38 = add i64 %36, %37
%39 = load i32, i32* %8
%40 = zext i32 %39 to i64
%41 = icmp ugt i64 %38, %40
br i1 %41, label %42, label %47
42: ; preds = %30
%43 = load i32, i32* %8
%44 = load i32, i32* %10
%45 = sub i32 %43, %44
%46 = zext i32 %45 to i64
br label %49
47: ; preds = %30
%48 = load i64, i64* %7
br label %49
49: ; preds = %47, %42
%50 = phi i64 [ %46, %42 ], [ %48, %47 ]
%51 = trunc i64 %50 to i32
%52 = call i32 @MD5_Update(%struct.TYPE_4__* %12, i8* %34, i32 %51)
%53 = load i8*, i8** %6
%54 = load i32, i32* %11
%55 = zext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %53, i64 %55
%57 = load i32, i32* %11
%58 = zext i32 %57 to i64
%59 = load i64, i64* %7
%60 = add i64 %58, %59
%61 = load i32, i32* %9
%62 = zext i32 %61 to i64
%63 = icmp ugt i64 %60, %62
br i1 %63, label %64, label %69
64: ; preds = %49
%65 = load i32, i32* %9
%66 = load i32, i32* %11
%67 = sub i32 %65, %66
%68 = zext i32 %67 to i64
br label %71
69: ; preds = %49
%70 = load i64, i64* %7
br label %71
71: ; preds = %69, %64
%72 = phi i64 [ %68, %64 ], [ %70, %69 ]
%73 = trunc i64 %72 to i32
%74 = call i32 @MD5_Update(%struct.TYPE_4__* %13, i8* %56, i32 %73)
%75 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %12, i32 0, i32 0
%76 = load i32*, i32** %75
%77 = getelementptr inbounds i32, i32* %76, i64 0
%78 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %13, i32 0, i32 0
%79 = load i32*, i32** %78
%80 = getelementptr inbounds i32, i32* %79, i64 0
%81 = load i32, i32* @MD5_DIGEST_LENGTH
%82 = call i64 @memcmp(i32* %77, i32* %80, i32 %81)
%83 = icmp ne i64 %82, 0
br i1 %83, label %114, label %84
84: ; preds = %71
%85 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %12, i32 0, i32 0
%86 = load i32*, i32** %85
%87 = getelementptr inbounds i32, i32* %86, i64 1
%88 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %13, i32 0, i32 0
%89 = load i32*, i32** %88
%90 = getelementptr inbounds i32, i32* %89, i64 1
%91 = load i32, i32* @MD5_DIGEST_LENGTH
%92 = call i64 @memcmp(i32* %87, i32* %90, i32 %91)
%93 = icmp ne i64 %92, 0
br i1 %93, label %114, label %94
94: ; preds = %84
%95 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %12, i32 0, i32 0
%96 = load i32*, i32** %95
%97 = getelementptr inbounds i32, i32* %96, i64 2
%98 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %13, i32 0, i32 0
%99 = load i32*, i32** %98
%100 = getelementptr inbounds i32, i32* %99, i64 2
%101 = load i32, i32* @MD5_DIGEST_LENGTH
%102 = call i64 @memcmp(i32* %97, i32* %100, i32 %101)
%103 = icmp ne i64 %102, 0
br i1 %103, label %114, label %104
104: ; preds = %94
%105 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %12, i32 0, i32 0
%106 = load i32*, i32** %105
%107 = getelementptr inbounds i32, i32* %106, i64 3
%108 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %13, i32 0, i32 0
%109 = load i32*, i32** %108
%110 = getelementptr inbounds i32, i32* %109, i64 3
%111 = load i32, i32* @MD5_DIGEST_LENGTH
%112 = call i64 @memcmp(i32* %107, i32* %110, i32 %111)
%113 = icmp ne i64 %112, 0
br i1 %113, label %114, label %115
114: ; preds = %104, %94, %84, %71
store i32 -1, i32* %4
br label %127
115: ; preds = %104
%116 = load i64, i64* %7
%117 = load i32, i32* %10
%118 = zext i32 %117 to i64
%119 = add i64 %118, %116
%120 = trunc i64 %119 to i32
store i32 %120, i32* %10
%121 = load i64, i64* %7
%122 = load i32, i32* %11
%123 = zext i32 %122 to i64
%124 = add i64 %123, %121
%125 = trunc i64 %124 to i32
store i32 %125, i32* %11
br label %20
126: ; preds = %28
store i32 0, i32* %4
br label %127
127: ; preds = %126, %114
%128 = load i32, i32* %4
ret i32 %128
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i32* }
@MD5_DIGEST_LENGTH = global i32 0
define i32 @compare_blocks(i8* %0, i8* %1, i64 %2) {
%4 = alloca %struct.TYPE_4__
%5 = alloca %struct.TYPE_4__
%6 = bitcast %struct.TYPE_4__* %4 to i8*
%7 = bitcast %struct.TYPE_4__* %5 to i8*
%8 = call i32 @MD5_Init(%struct.TYPE_4__* %4)
%9 = call i32 @MD5_Init(%struct.TYPE_4__* %5)
%10 = call i32 @strlen(i8* %0)
%11 = call i32 @strlen(i8* %1)
%12 = icmp ne i32 %10, 0
%13 = icmp ne i32 %11, 0
%14 = select i1 %12, i1 true, i1 %13
br i1 %14, label %15, label %72
15: ; preds = %3
%16 = zext i32 %10 to i64
%17 = zext i32 %11 to i64
%18 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i64 0, i32 0
%19 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %5, i64 0, i32 0
br label %24
20: ; preds = %63
%21 = icmp ugt i32 %10, %71
%22 = icmp ugt i32 %11, %71
%23 = select i1 %21, i1 true, i1 %22
br i1 %23, label %24, label %72
24: ; preds = %15, %20
%25 = phi i32 [ 0, %15 ], [ %71, %20 ]
%26 = zext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %0, i64 %26
%28 = add i64 %26, %2
%29 = icmp ugt i64 %28, %16
%30 = sub i32 %10, %25
%31 = zext i32 %30 to i64
%32 = select i1 %29, i64 %31, i64 %2
%33 = trunc i64 %32 to i32
%34 = call i32 @MD5_Update(%struct.TYPE_4__* %4, i8* %27, i32 %33)
%35 = getelementptr inbounds i8, i8* %1, i64 %26
%36 = icmp ugt i64 %28, %17
%37 = sub i32 %11, %25
%38 = zext i32 %37 to i64
%39 = select i1 %36, i64 %38, i64 %2
%40 = trunc i64 %39 to i32
%41 = call i32 @MD5_Update(%struct.TYPE_4__* %5, i8* %35, i32 %40)
%42 = load i32*, i32** %18
%43 = load i32*, i32** %19
%44 = load i32, i32* @MD5_DIGEST_LENGTH
%45 = call i64 @memcmp(i32* %42, i32* %43, i32 %44)
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %72
47: ; preds = %24
%48 = load i32*, i32** %18
%49 = getelementptr inbounds i32, i32* %48, i64 1
%50 = load i32*, i32** %19
%51 = getelementptr inbounds i32, i32* %50, i64 1
%52 = load i32, i32* @MD5_DIGEST_LENGTH
%53 = call i64 @memcmp(i32* %49, i32* %51, i32 %52)
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %72
55: ; preds = %47
%56 = load i32*, i32** %18
%57 = getelementptr inbounds i32, i32* %56, i64 2
%58 = load i32*, i32** %19
%59 = getelementptr inbounds i32, i32* %58, i64 2
%60 = load i32, i32* @MD5_DIGEST_LENGTH
%61 = call i64 @memcmp(i32* %57, i32* %59, i32 %60)
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %72
63: ; preds = %55
%64 = load i32*, i32** %18
%65 = getelementptr inbounds i32, i32* %64, i64 3
%66 = load i32*, i32** %19
%67 = getelementptr inbounds i32, i32* %66, i64 3
%68 = load i32, i32* @MD5_DIGEST_LENGTH
%69 = call i64 @memcmp(i32* %65, i32* %67, i32 %68)
%70 = icmp eq i64 %69, 0
%71 = trunc i64 %28 to i32
br i1 %70, label %20, label %72
72: ; preds = %63, %55, %47, %24, %20, %3
%73 = phi i32 [ 0, %3 ], [ 0, %20 ], [ -1, %24 ], [ -1, %47 ], [ -1, %55 ], [ -1, %63 ]
ret i32 %73
}