#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 */
struct MD5Context {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ MD5Init(struct MD5Context *);
int /*<<< orphan*/ MD5Update(struct MD5Context *, unsigned char *, int);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int MDfile0(struct MD5Context *mdContext, FILE *inFile) {
  int bytes;
  unsigned char buffer[1024];
  MD5Init(mdContext);
  while ((bytes = fread(buffer, 1, 1024, inFile)) != 0)
    MD5Update(mdContext, buffer, bytes);
  return 0;
}


x86 assembly (clang, -O0):
<MDfile0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <MD5Init@plt>
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   1040 <fread@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     118a <MDfile0+0x5a>
mov    -0x8(%rbp),%rdi
lea    -0x420(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <MD5Update@plt>
jmp    114c <MDfile0+0x1c>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MDfile0>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
call   1050 <MD5Init@plt>
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
test   %eax,%eax
je     1196 <MDfile0+0x66>
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <MD5Update@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
test   %eax,%eax
jne    1170 <MDfile0+0x40>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.MD5Context = type { i32 }
define i32 @MDfile0(%struct.MD5Context* %0, i32* %1) {
%3 = alloca %struct.MD5Context*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca [1024 x i8]
store %struct.MD5Context* %0, %struct.MD5Context** %3
store i32* %1, i32** %4
%7 = load %struct.MD5Context*, %struct.MD5Context** %3
%8 = call i32 @MD5Init(%struct.MD5Context* %7)
br label %9
9: ; preds = %14, %2
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%11 = load i32*, i32** %4
%12 = call i32 @fread(i8* %10, i32 1, i32 1024, i32* %11)
store i32 %12, i32* %5
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %9
%15 = load %struct.MD5Context*, %struct.MD5Context** %3
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%17 = load i32, i32* %5
%18 = call i32 @MD5Update(%struct.MD5Context* %15, i8* %16, i32 %17)
br label %9
19: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
%struct.MD5Context = type { i32 }
define i32 @MDfile0(%struct.MD5Context* %0, i32* nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @MD5Init(%struct.MD5Context* %0)
%6 = call i32 @fread(i8* %4, i32 1, i32 1024, i32* %1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %2, %8
%9 = phi i32 [ %11, %8 ], [ %6, %2 ]
%10 = call i32 @MD5Update(%struct.MD5Context* %0, i8* %4, i32 %9)
%11 = call i32 @fread(i8* %4, i32 1, i32 1024, i32* %1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %8
13: ; preds = %8, %2
ret i32 0
}