#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 char uint8_t;

/* Variables and functions */
int /*<<< orphan*/ MD5(char *, size_t, char *);
int /*<<< orphan*/ memcpy(char *, char const *, int);
size_t strlen(char const *);
void FillMD5Area(uint8_t digest[], uint8_t id, const char passwd[],
                 const uint8_t srcMD5[]) {
  uint8_t msgbuf[128];
  size_t msglen;
  size_t passlen;
  passlen = strlen(passwd);
  msglen = 1 + passlen + 16;
  msgbuf[0] = id;
  memcpy(msgbuf + 1, passwd, passlen);
  memcpy(msgbuf + 1 + passlen, srcMD5, 16);
  (void)MD5(msgbuf, msglen, digest);
}


x86 assembly (clang, -O0):
<FillMD5Area>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0xb0(%rbp)
mov    -0xb0(%rbp),%rax
add    $0x1,%rax
add    $0x10,%rax
mov    %rax,-0xa8(%rbp)
mov    -0x9(%rbp),%al
mov    %al,-0xa0(%rbp)
lea    -0xa0(%rbp),%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rsi
mov    -0xb0(%rbp),%rax
mov    %eax,%edx
call   1040 <memcpy@plt>
lea    -0xa0(%rbp),%rdi
add    $0x1,%rdi
add    -0xb0(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x10,%edx
call   1040 <memcpy@plt>
lea    -0xa0(%rbp),%rdi
mov    -0xa8(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1050 <MD5@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FillMD5Area>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%r12d
mov    %rdi,%r15
mov    %rdx,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbp
lea    0x11(%rax),%r13
mov    %r12b,(%rsp)
lea    0x1(%rsp),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
lea    (%rsp,%rbp,1),%rdi
add    $0x1,%rdi
mov    %r14,%rsi
mov    $0x10,%edx
call   1040 <memcpy@plt>
mov    %rsp,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
call   1050 <MD5@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @FillMD5Area(i8* %0, i8 signext %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [128 x i8]
%10 = alloca i64
%11 = alloca i64
store i8* %0, i8** %5
store i8 %1, i8* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%12 = load i8*, i8** %7
%13 = call i64 @strlen(i8* %12)
store i64 %13, i64* %11
%14 = load i64, i64* %11
%15 = add i64 1, %14
%16 = add i64 %15, 16
store i64 %16, i64* %10
%17 = load i8, i8* %6
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
store i8 %17, i8* %18
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%20 = getelementptr inbounds i8, i8* %19, i64 1
%21 = load i8*, i8** %7
%22 = load i64, i64* %11
%23 = trunc i64 %22 to i32
%24 = call i32 @memcpy(i8* %20, i8* %21, i32 %23)
%25 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = load i64, i64* %11
%28 = getelementptr inbounds i8, i8* %26, i64 %27
%29 = load i8*, i8** %8
%30 = call i32 @memcpy(i8* %28, i8* %29, i32 16)
%31 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%32 = load i64, i64* %10
%33 = load i8*, i8** %5
%34 = call i32 @MD5(i8* %31, i64 %32, i8* %33)
ret void
}

LLVM IR (-O2):
define void @FillMD5Area(i8* %0, i8 signext %1, i8* %2, i8* %3) {
%5 = alloca [128 x i8]
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%7 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%8 = add i64 %7, 17
store i8 %1, i8* %6
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 1
%10 = trunc i64 %7 to i32
%11 = call i32 @memcpy(i8* %9, i8* %2, i32 %10)
%12 = getelementptr inbounds i8, i8* %9, i64 %7
%13 = call i32 @memcpy(i8* %12, i8* %3, i32 16)
%14 = call i32 @MD5(i8* %6, i64 %8, i8* %0)
ret void
}