#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 */

/* Variables and functions */
int /*<<< orphan*/ md5_sum(unsigned char *, int, unsigned char *);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
void hash_special(unsigned char *pwd, unsigned char *chaldata,
                  unsigned char *mda) {
  unsigned char md_pwd[16];
  unsigned char challenge[16];
  int i;
  memset(md_pwd, 0, 16);
  md5_sum(pwd, 16, md_pwd);
  memset(challenge, 0, 16);
  for (i = 0; i < 16; i++)
    challenge[i] = chaldata[i] ^ md_pwd[i];
  memset(mda, 0, 16);
  md5_sum(challenge, 16, mda);
}


x86 assembly (clang, -O0):
<hash_special>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rdx
mov    $0x10,%esi
call   1030 <md5_sum@plt>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0x10,-0x44(%rbp)
jge    11a6 <hash_special+0x86>
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
movslq -0x44(%rbp),%rcx
movzbl -0x30(%rbp,%rcx,1),%ecx
xor    %ecx,%eax
mov    %al,%cl
movslq -0x44(%rbp),%rax
mov    %cl,-0x40(%rbp,%rax,1)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    116d <hash_special+0x4d>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
lea    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x10,%esi
call   1030 <md5_sum@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_special>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x10(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
mov    %r12,%rdx
call   1030 <md5_sum@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
movups (%r14),%xmm0
xorps  0x10(%rsp),%xmm0
movaps %xmm0,(%rsp)
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
mov    %r15,%rdx
call   1030 <md5_sum@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @hash_special(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [16 x i8]
%8 = alloca [16 x i8]
%9 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%10 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%11 = call i32 @memset(i8* %10, i32 0, i32 16)
%12 = load i8*, i8** %4
%13 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%14 = call i32 @md5_sum(i8* %12, i32 16, i8* %13)
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%16 = call i32 @memset(i8* %15, i32 0, i32 16)
store i32 0, i32* %9
br label %17
17: ; preds = %37, %3
%18 = load i32, i32* %9
%19 = icmp slt i32 %18, 16
br i1 %19, label %20, label %40
20: ; preds = %17
%21 = load i8*, i8** %5
%22 = load i32, i32* %9
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = xor i32 %26, %31
%33 = trunc i32 %32 to i8
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 %35
store i8 %33, i8* %36
br label %37
37: ; preds = %20
%38 = load i32, i32* %9
%39 = add nsw i32 %38, 1
store i32 %39, i32* %9
br label %17
40: ; preds = %17
%41 = load i8*, i8** %6
%42 = call i32 @memset(i8* %41, i32 0, i32 16)
%43 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%44 = load i8*, i8** %6
%45 = call i32 @md5_sum(i8* %43, i32 16, i8* %44)
ret void
}

LLVM IR (-O2):
define void @hash_special(i8* %0, i8* nocapture %1, i8* %2) {
%4 = alloca <16 x i8>
%5 = alloca <16 x i8>
%6 = getelementptr inbounds <16 x i8>, <16 x i8>* %4, i64 0, i64 0
%7 = getelementptr inbounds <16 x i8>, <16 x i8>* %5, i64 0, i64 0
%8 = call i32 @memset(i8* %6, i32 0, i32 16)
%9 = call i32 @md5_sum(i8* %0, i32 16, i8* %6)
%10 = call i32 @memset(i8* %7, i32 0, i32 16)
%11 = bitcast i8* %1 to <16 x i8>*
%12 = load <16 x i8>, <16 x i8>* %11
%13 = load <16 x i8>, <16 x i8>* %4
%14 = xor <16 x i8> %13, %12
store <16 x i8> %14, <16 x i8>* %5
%15 = call i32 @memset(i8* %2, i32 0, i32 16)
%16 = call i32 @md5_sum(i8* %7, i32 16, i8* %2)
ret void
}