#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*/ DesEncrypt(unsigned char *, char *, unsigned char *);
int /*<<< orphan*/ MD4_DIGEST_LENGTH;
int /*<<< orphan*/ memcpy(char *, unsigned char *, int /*<<< orphan*/);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
void ChallengeResponse(unsigned char *chl, unsigned char *hash,
                       unsigned char *resp) {
  char ZPasswordHash[21];
  memset(ZPasswordHash, 0, sizeof ZPasswordHash);
  memcpy(ZPasswordHash, hash, MD4_DIGEST_LENGTH);
  DesEncrypt(chl, ZPasswordHash + 0, resp + 0);
  DesEncrypt(chl, ZPasswordHash + 7, resp + 8);
  DesEncrypt(chl, ZPasswordHash + 14, resp + 16);
}


x86 assembly (clang, -O0):
<ChallengeResponse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x15,%edx
call   1030 <memset@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2e95(%rip),%rax
mov    (%rax),%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <DesEncrypt@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
add    $0x7,%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
call   1050 <DesEncrypt@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
add    $0xe,%rsi
mov    -0x18(%rbp),%rdx
add    $0x10,%rdx
call   1050 <DesEncrypt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ChallengeResponse>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsp,%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x15,%edx
call   1030 <memset@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <memcpy@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <DesEncrypt@plt>
lea    0x7(%rsp),%rsi
lea    0x8(%rbx),%rdx
mov    %r14,%rdi
call   1050 <DesEncrypt@plt>
lea    0xe(%rsp),%rsi
add    $0x10,%rbx
mov    %r14,%rdi
mov    %rbx,%rdx
call   1050 <DesEncrypt@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@MD4_DIGEST_LENGTH = global i32 0
define void @ChallengeResponse(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [21 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = getelementptr inbounds [21 x i8], [21 x i8]* %7, i64 0, i64 0
%9 = call i32 @memset(i8* %8, i32 0, i32 21)
%10 = getelementptr inbounds [21 x i8], [21 x i8]* %7, i64 0, i64 0
%11 = load i8*, i8** %5
%12 = load i32, i32* @MD4_DIGEST_LENGTH
%13 = call i32 @memcpy(i8* %10, i8* %11, i32 %12)
%14 = load i8*, i8** %4
%15 = getelementptr inbounds [21 x i8], [21 x i8]* %7, i64 0, i64 0
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8*, i8** %6
%18 = getelementptr inbounds i8, i8* %17, i64 0
%19 = call i32 @DesEncrypt(i8* %14, i8* %16, i8* %18)
%20 = load i8*, i8** %4
%21 = getelementptr inbounds [21 x i8], [21 x i8]* %7, i64 0, i64 0
%22 = getelementptr inbounds i8, i8* %21, i64 7
%23 = load i8*, i8** %6
%24 = getelementptr inbounds i8, i8* %23, i64 8
%25 = call i32 @DesEncrypt(i8* %20, i8* %22, i8* %24)
%26 = load i8*, i8** %4
%27 = getelementptr inbounds [21 x i8], [21 x i8]* %7, i64 0, i64 0
%28 = getelementptr inbounds i8, i8* %27, i64 14
%29 = load i8*, i8** %6
%30 = getelementptr inbounds i8, i8* %29, i64 16
%31 = call i32 @DesEncrypt(i8* %26, i8* %28, i8* %30)
ret void
}

LLVM IR (-O2):
@MD4_DIGEST_LENGTH = global i32 0
define void @ChallengeResponse(i8* %0, i8* %1, i8* %2) {
%4 = alloca [21 x i8]
%5 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 21)
%7 = load i32, i32* @MD4_DIGEST_LENGTH
%8 = call i32 @memcpy(i8* %5, i8* %1, i32 %7)
%9 = call i32 @DesEncrypt(i8* %0, i8* %5, i8* %2)
%10 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 7
%11 = getelementptr inbounds i8, i8* %2, i64 8
%12 = call i32 @DesEncrypt(i8* %0, i8* %10, i8* %11)
%13 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 14
%14 = getelementptr inbounds i8, i8* %2, i64 16
%15 = call i32 @DesEncrypt(i8* %0, i8* %13, i8* %14)
ret void
}