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

/* Variables and functions */
int /*<<< orphan*/ des(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                       int /*<<< orphan*/ *);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
void lm_create_response(const uint8_t lanman[16], const uint8_t challenge[8],
                        uint8_t result[24]) {
  size_t i;
  uint8_t password1[7];
  uint8_t password2[7];
  uint8_t password3[7];
  uint8_t hash1[8];
  uint8_t hash2[8];
  uint8_t hash3[8];
  memset(password1, 0, 7);
  memset(password2, 0, 7);
  memset(password3, 0, 7);
  for (i = 0; i < 7; i++) {
    password1[i] = lanman[i];
    password2[i] = lanman[i + 7];
    password3[i] = (i + 14 < 16) ? lanman[i + 14] : 0;
  }
  des(password1, challenge, hash1);
  des(password2, challenge, hash2);
  des(password3, challenge, hash3);
  memcpy(result + 0, hash1, 8);
  memcpy(result + 8, hash2, 8);
  memcpy(result + 16, hash3, 8);
}


x86 assembly (clang, -O0):
<lm_create_response>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1040 <memset@plt>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1040 <memset@plt>
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1040 <memset@plt>
movq   $0x0,-0x20(%rbp)
cmpq   $0x7,-0x20(%rbp)
jae    1206 <lm_create_response+0xd6>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    0x1c(%rax,%rcx,4),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,-0x60(%rbp,%rax,4)
mov    -0x20(%rbp),%rax
add    $0xe,%rax
cmp    $0x10,%rax
jae    11da <lm_create_response+0xaa>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    0x38(%rax,%rcx,4),%eax
mov    %eax,-0xe4(%rbp)
jmp    11e7 <lm_create_response+0xb7>
xor    %eax,%eax
mov    %eax,-0xe4(%rbp)
jmp    11e7 <lm_create_response+0xb7>
mov    -0xe4(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,-0x80(%rbp,%rax,4)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    117f <lm_create_response+0x4f>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
call   1030 <des@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
call   1030 <des@plt>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
call   1030 <des@plt>
mov    -0x18(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x8,%edx
call   1050 <memcpy@plt>
mov    -0x18(%rbp),%rdi
add    $0x20,%rdi
lea    -0xc0(%rbp),%rsi
mov    $0x8,%edx
call   1050 <memcpy@plt>
mov    -0x18(%rbp),%rdi
add    $0x40,%rdi
lea    -0xe0(%rbp),%rsi
mov    $0x8,%edx
call   1050 <memcpy@plt>
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lm_create_response>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%rbp
lea    0x40(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1040 <memset@plt>
lea    0x20(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1040 <memset@plt>
mov    %rsp,%r13
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1040 <memset@plt>
movups 0x0(%rbp),%xmm0
movups 0xc(%rbp),%xmm1
movups %xmm1,0x4c(%rsp)
movaps %xmm0,0x40(%rsp)
movups 0x1c(%rbp),%xmm0
movups 0x28(%rbp),%xmm1
movaps %xmm0,0x20(%rsp)
movups %xmm1,0x2c(%rsp)
mov    0x38(%rbp),%eax
mov    %eax,(%rsp)
mov    0x3c(%rbp),%eax
mov    %eax,0x4(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rsp)
movl   $0x0,0x18(%rsp)
lea    0xa0(%rsp),%rbp
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbp,%rdx
call   1030 <des@plt>
lea    0x80(%rsp),%r15
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <des@plt>
lea    0x60(%rsp),%r12
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1030 <des@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x8,%edx
call   1050 <memcpy@plt>
lea    0x20(%rbx),%rdi
mov    %r15,%rsi
mov    $0x8,%edx
call   1050 <memcpy@plt>
add    $0x40,%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x8,%edx
call   1050 <memcpy@plt>
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @lm_create_response(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i64
%8 = alloca [7 x i32]
%9 = alloca [7 x i32]
%10 = alloca [7 x i32]
%11 = alloca [8 x i32]
%12 = alloca [8 x i32]
%13 = alloca [8 x i32]
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%14 = getelementptr inbounds [7 x i32], [7 x i32]* %8, i64 0, i64 0
%15 = call i32 @memset(i32* %14, i32 0, i32 7)
%16 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 0
%17 = call i32 @memset(i32* %16, i32 0, i32 7)
%18 = getelementptr inbounds [7 x i32], [7 x i32]* %10, i64 0, i64 0
%19 = call i32 @memset(i32* %18, i32 0, i32 7)
store i64 0, i64* %7
br label %20
20: ; preds = %51, %3
%21 = load i64, i64* %7
%22 = icmp ult i64 %21, 7
br i1 %22, label %23, label %54
23: ; preds = %20
%24 = load i32*, i32** %4
%25 = load i64, i64* %7
%26 = getelementptr inbounds i32, i32* %24, i64 %25
%27 = load i32, i32* %26
%28 = load i64, i64* %7
%29 = getelementptr inbounds [7 x i32], [7 x i32]* %8, i64 0, i64 %28
store i32 %27, i32* %29
%30 = load i32*, i32** %4
%31 = load i64, i64* %7
%32 = add i64 %31, 7
%33 = getelementptr inbounds i32, i32* %30, i64 %32
%34 = load i32, i32* %33
%35 = load i64, i64* %7
%36 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 %35
store i32 %34, i32* %36
%37 = load i64, i64* %7
%38 = add i64 %37, 14
%39 = icmp ult i64 %38, 16
br i1 %39, label %40, label %46
40: ; preds = %23
%41 = load i32*, i32** %4
%42 = load i64, i64* %7
%43 = add i64 %42, 14
%44 = getelementptr inbounds i32, i32* %41, i64 %43
%45 = load i32, i32* %44
br label %47
46: ; preds = %23
br label %47
47: ; preds = %46, %40
%48 = phi i32 [ %45, %40 ], [ 0, %46 ]
%49 = load i64, i64* %7
%50 = getelementptr inbounds [7 x i32], [7 x i32]* %10, i64 0, i64 %49
store i32 %48, i32* %50
br label %51
51: ; preds = %47
%52 = load i64, i64* %7
%53 = add i64 %52, 1
store i64 %53, i64* %7
br label %20
54: ; preds = %20
%55 = getelementptr inbounds [7 x i32], [7 x i32]* %8, i64 0, i64 0
%56 = load i32*, i32** %5
%57 = getelementptr inbounds [8 x i32], [8 x i32]* %11, i64 0, i64 0
%58 = call i32 @des(i32* %55, i32* %56, i32* %57)
%59 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 0
%60 = load i32*, i32** %5
%61 = getelementptr inbounds [8 x i32], [8 x i32]* %12, i64 0, i64 0
%62 = call i32 @des(i32* %59, i32* %60, i32* %61)
%63 = getelementptr inbounds [7 x i32], [7 x i32]* %10, i64 0, i64 0
%64 = load i32*, i32** %5
%65 = getelementptr inbounds [8 x i32], [8 x i32]* %13, i64 0, i64 0
%66 = call i32 @des(i32* %63, i32* %64, i32* %65)
%67 = load i32*, i32** %6
%68 = getelementptr inbounds i32, i32* %67, i64 0
%69 = getelementptr inbounds [8 x i32], [8 x i32]* %11, i64 0, i64 0
%70 = call i32 @memcpy(i32* %68, i32* %69, i32 8)
%71 = load i32*, i32** %6
%72 = getelementptr inbounds i32, i32* %71, i64 8
%73 = getelementptr inbounds [8 x i32], [8 x i32]* %12, i64 0, i64 0
%74 = call i32 @memcpy(i32* %72, i32* %73, i32 8)
%75 = load i32*, i32** %6
%76 = getelementptr inbounds i32, i32* %75, i64 16
%77 = getelementptr inbounds [8 x i32], [8 x i32]* %13, i64 0, i64 0
%78 = call i32 @memcpy(i32* %76, i32* %77, i32 8)
ret void
}

LLVM IR (-O2):
define void @lm_create_response(i32* nocapture %0, i32* %1, i32* %2) {
%4 = bitcast i32* %0 to i8*
%5 = alloca [7 x i32]
%6 = bitcast [7 x i32]* %5 to i8*
%7 = alloca [7 x i32]
%8 = bitcast [7 x i32]* %7 to i8*
%9 = alloca [7 x i32]
%10 = alloca [8 x i32]
%11 = alloca [8 x i32]
%12 = alloca [8 x i32]
%13 = bitcast [7 x i32]* %9 to i8*
%14 = bitcast [8 x i32]* %10 to i8*
%15 = bitcast [8 x i32]* %11 to i8*
%16 = bitcast [8 x i32]* %12 to i8*
%17 = getelementptr inbounds [7 x i32], [7 x i32]* %5, i64 0, i64 0
%18 = call i32 @memset(i32* %17, i32 0, i32 7)
%19 = getelementptr inbounds [7 x i32], [7 x i32]* %7, i64 0, i64 0
%20 = call i32 @memset(i32* %19, i32 0, i32 7)
%21 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 0
%22 = call i32 @memset(i32* %21, i32 0, i32 7)
%23 = getelementptr i32, i32* %0, i64 7
%24 = bitcast i32* %23 to i8*
%25 = getelementptr inbounds i32, i32* %0, i64 14
%26 = load i32, i32* %25
store i32 %26, i32* %21
%27 = getelementptr inbounds i32, i32* %0, i64 15
%28 = load i32, i32* %27
%29 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 1
store i32 %28, i32* %29
%30 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 2
%31 = getelementptr inbounds [8 x i32], [8 x i32]* %10, i64 0, i64 0
%32 = bitcast i32* %30 to i8*
%33 = call i32 @des(i32* %17, i32* %1, i32* %31)
%34 = getelementptr inbounds [8 x i32], [8 x i32]* %11, i64 0, i64 0
%35 = call i32 @des(i32* %19, i32* %1, i32* %34)
%36 = getelementptr inbounds [8 x i32], [8 x i32]* %12, i64 0, i64 0
%37 = call i32 @des(i32* %21, i32* %1, i32* %36)
%38 = call i32 @memcpy(i32* %2, i32* %31, i32 8)
%39 = getelementptr inbounds i32, i32* %2, i64 8
%40 = call i32 @memcpy(i32* %39, i32* %34, i32 8)
%41 = getelementptr inbounds i32, i32* %2, i64 16
%42 = call i32 @memcpy(i32* %41, i32* %36, i32 8)
ret void
}