#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*/ buf;
typedef int /*<<< orphan*/ MD4_CTX;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int MD4_DIGEST_LENGTH;
int /*<<< orphan*/ MD4_Final(unsigned char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ MD4_Init(int /*<<< orphan*/ *);
int /*<<< orphan*/ MD4_Update(int /*<<< orphan*/ *, unsigned char *,
                              unsigned long);
int fileno(int /*<<< orphan*/ *);
int /*<<< orphan*/ pt(unsigned char *);
int read(int, unsigned char *, int);
void do_fp(FILE *f) {
  MD4_CTX c;
  unsigned char md[MD4_DIGEST_LENGTH];
  int fd;
  int i;
  static unsigned char buf[1024 * 16];
  fd = fileno(f);
  MD4_Init(&c);
  for (;;) {
    i = read(fd, buf, sizeof(buf));
    if (i <= 0)
      break;
    MD4_Update(&c, buf, (unsigned long)i);
  }
  MD4_Final(&(md[0]), &c);
  pt(md);
}


x86 assembly (clang, -O0):
<do_fp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e85(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <fileno@plt>
mov    %eax,-0x24(%rbp)
lea    -0xc(%rbp),%rdi
call   1050 <MD4_Init@plt>
mov    -0x24(%rbp),%edi
lea    0x2eb9(%rip),%rsi
mov    $0x4000,%edx
call   1060 <read@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jg     11d3 <do_fp+0x73>
jmp    11ec <do_fp+0x8c>
movslq -0x28(%rbp),%rdx
lea    -0xc(%rbp),%rdi
lea    0x2e8e(%rip),%rsi
call   1030 <MD4_Update@plt>
jmp    11ad <do_fp+0x4d>
mov    -0x30(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <MD4_Final@plt>
mov    -0x30(%rbp),%rdi
call   1040 <pt@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_fp>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsp,%r13
mov    0x2e80(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
call   1080 <fileno@plt>
mov    %eax,%r15d
lea    -0x2c(%rbp),%rdi
call   1050 <MD4_Init@plt>
lea    0x2ecd(%rip),%rsi
mov    %r15d,%edi
mov    $0x4000,%edx
call   1060 <read@plt>
test   %eax,%eax
jle    11e1 <do_fp+0x81>
lea    0x2eb5(%rip),%rbx
lea    -0x2c(%rbp),%r12
nop
mov    %eax,%edx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <MD4_Update@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x4000,%edx
call   1060 <read@plt>
test   %eax,%eax
jg     11c0 <do_fp+0x60>
lea    -0x2c(%rbp),%rsi
mov    %r14,%rdi
call   1070 <MD4_Final@plt>
mov    %r14,%rdi
call   1040 <pt@plt>
mov    %r13,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@MD4_DIGEST_LENGTH = global i32 0
@do_fp.buf = internal global [16384 x i8] zeroinitializer
define void @do_fp(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %2
%8 = load i32, i32* @MD4_DIGEST_LENGTH
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %4
%11 = alloca i8, i64 %9
store i64 %9, i64* %5
%12 = load i32*, i32** %2
%13 = call i32 @fileno(i32* %12)
store i32 %13, i32* %6
%14 = call i32 @MD4_Init(i32* %3)
br label %15
15: ; preds = %21, %1
%16 = load i32, i32* %6
%17 = call i32 @read(i32 %16, i8* getelementptr inbounds ([16384 x i8], [16384 x i8]* @do_fp.buf, i64 0, i64 0), i32 16384)
store i32 %17, i32* %7
%18 = load i32, i32* %7
%19 = icmp sle i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %15
br label %25
21: ; preds = %15
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = call i32 @MD4_Update(i32* %3, i8* getelementptr inbounds ([16384 x i8], [16384 x i8]* @do_fp.buf, i64 0, i64 0), i64 %23)
br label %15
25: ; preds = %20
%26 = getelementptr inbounds i8, i8* %11, i64 0
%27 = call i32 @MD4_Final(i8* %26, i32* %3)
%28 = call i32 @pt(i8* %11)
%29 = load i8*, i8** %4
ret void
}

LLVM IR (-O2):
@MD4_DIGEST_LENGTH = global i32 0
@do_fp.buf = internal global [16384 x i8] zeroinitializer
define void @do_fp(i32* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @MD4_DIGEST_LENGTH
%5 = zext i32 %4 to i64
%6 = tail call i8* @llvm.stacksave()
%7 = alloca i8, i64 %5
%8 = tail call i32 @fileno(i32* %0)
%9 = call i32 @MD4_Init(i32* %2)
%10 = call i32 @read(i32 %8, i8* getelementptr inbounds ([16384 x i8], [16384 x i8]* @do_fp.buf, i64 0, i64 0), i32 16384)
%11 = icmp slt i32 %10, 1
br i1 %11, label %18, label %12
12: ; preds = %1, %12
%13 = phi i32 [ %16, %12 ], [ %10, %1 ]
%14 = zext i32 %13 to i64
%15 = call i32 @MD4_Update(i32* %2, i8* getelementptr inbounds ([16384 x i8], [16384 x i8]* @do_fp.buf, i64 0, i64 0), i64 %14)
%16 = call i32 @read(i32 %8, i8* getelementptr inbounds ([16384 x i8], [16384 x i8]* @do_fp.buf, i64 0, i64 0), i32 16384)
%17 = icmp slt i32 %16, 1
br i1 %17, label %18, label %12
18: ; preds = %12, %1
%19 = call i32 @MD4_Final(i8* %7, i32* %2)
%20 = call i32 @pt(i8* %7)
ret void
}