#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ md5_signature(unsigned char *, unsigned int,
                                 unsigned char *);
uint32_t hash_md5(const char *key, size_t key_length) {
  unsigned char results[16];
  md5_signature((unsigned char *)key, (unsigned int)key_length, results);
  return ((uint32_t)(results[3] & 0xFF) << 24) |
         ((uint32_t)(results[2] & 0xFF) << 16) |
         ((uint32_t)(results[1] & 0xFF) << 8) | (results[0] & 0xFF);
}


x86 assembly (clang, -O0):
<hash_md5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %eax,%esi
lea    -0x20(%rbp),%rdx
call   1030 <md5_signature@plt>
movzbl -0x1d(%rbp),%eax
and    $0xff,%eax
shl    $0x18,%eax
movzbl -0x1e(%rbp),%ecx
and    $0xff,%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x1f(%rbp),%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x20(%rbp),%ecx
and    $0xff,%ecx
or     %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_md5>:
sub    $0x18,%rsp
mov    %rsp,%rdx
call   1030 <md5_signature@plt>
mov    (%rsp),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @hash_md5(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca [16 x i8]
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = trunc i64 %7 to i32
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%10 = call i32 @md5_signature(i8* %6, i32 %8, i8* %9)
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 3
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = and i32 %13, 255
%15 = shl i32 %14, 24
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 2
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = and i32 %18, 255
%20 = shl i32 %19, 16
%21 = or i32 %15, %20
%22 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 1
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = and i32 %24, 255
%26 = shl i32 %25, 8
%27 = or i32 %21, %26
%28 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = and i32 %30, 255
%32 = or i32 %27, %31
ret i32 %32
}

LLVM IR (-O2):
define i32 @hash_md5(i8* %0, i64 %1) {
%3 = alloca [16 x i8]
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%5 = trunc i64 %1 to i32
%6 = call i32 @md5_signature(i8* %0, i32 %5, i8* %4)
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 3
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = shl nuw i32 %9, 24
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 2
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = shl nuw nsw i32 %13, 16
%15 = or i32 %14, %10
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 1
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = shl nuw nsw i32 %18, 8
%20 = or i32 %15, %19
%21 = load i8, i8* %4
%22 = zext i8 %21 to i32
%23 = or i32 %20, %22
ret i32 %23
}