void nt_lm_owf_gen(char *pwd, unsigned char nt_p16[16], unsigned char p16[16]) {
  char passwd[130];
  memset(passwd, '\0', 130);
  safe_strcpy(passwd, pwd, sizeof(passwd) - 1);
  memset(nt_p16, '\0', 16);
  E_md4hash((unsigned char *)passwd, nt_p16);
  passwd[14] = '\0';
  strupper(passwd);
  memset(p16, '\0', 16);
  E_P16((unsigned char *)passwd, (unsigned char *)p16);
  memset(passwd, '\0', sizeof(passwd));
}


x86 assembly (clang, -O0):
<nt_lm_owf_gen>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x82,%edx
call   1030 <memset@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x81,%edx
mov    $0x0,%al
call   1060 <safe_strcpy@plt>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <E_md4hash@plt>
movb   $0x0,-0x92(%rbp)
lea    -0xa0(%rbp),%rdi
mov    $0x0,%al
call   1050 <strupper@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1070 <E_P16@plt>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x82,%edx
call   1030 <memset@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nt_lm_owf_gen>:
push   %r15
push   %r14
push   %rbx
sub    $0x90,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%rsi
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movw   $0x0,0x80(%rsp)
mov    %rsp,%r15
mov    $0x81,%edx
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <safe_strcpy@plt>
xorps  %xmm0,%xmm0
movups %xmm0,(%rbx)
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <E_md4hash@plt>
movb   $0x0,0xe(%rsp)
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <strupper@plt>
xorps  %xmm0,%xmm0
movups %xmm0,(%r14)
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <E_P16@plt>
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @nt_lm_owf_gen(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [130 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = getelementptr inbounds [130 x i8], [130 x i8]* %7, i64 0, i64 0
%9 = getelementptr inbounds [130 x i8], [130 x i8]* %7, i64 0, i64 0
%10 = load i8*, i8** %4
%11 = call i32 (i8*, i8*, i64, ...) bitcast (i32 (...)* @safe_strcpy to i32 (i8*, i8*, i64, ...)*)(i8* %9, i8* %10, i64 129)
%12 = load i8*, i8** %5
%13 = getelementptr inbounds [130 x i8], [130 x i8]* %7, i64 0, i64 0
%14 = load i8*, i8** %5
%15 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @E_md4hash to i32 (i8*, i8*, ...)*)(i8* %13, i8* %14)
%16 = getelementptr inbounds [130 x i8], [130 x i8]* %7, i64 0, i64 14
store i8 0, i8* %16
%17 = getelementptr inbounds [130 x i8], [130 x i8]* %7, i64 0, i64 0
%18 = call i32 (i8*, ...) bitcast (i32 (...)* @strupper to i32 (i8*, ...)*)(i8* %17)
%19 = load i8*, i8** %6
%20 = getelementptr inbounds [130 x i8], [130 x i8]* %7, i64 0, i64 0
%21 = load i8*, i8** %6
%22 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @E_P16 to i32 (i8*, i8*, ...)*)(i8* %20, i8* %21)
%23 = getelementptr inbounds [130 x i8], [130 x i8]* %7, i64 0, i64 0
ret void
}

LLVM IR (-O2):
define void @nt_lm_owf_gen(i8* %0, i8* %1, i8* %2) {
%4 = alloca [130 x i8]
%5 = getelementptr inbounds [130 x i8], [130 x i8]* %4, i64 0, i64 0
%6 = call i32 (i8*, i8*, i64, ...) bitcast (i32 (...)* @safe_strcpy to i32 (i8*, i8*, i64, ...)*)(i8* %5, i8* %0, i64 129)
%7 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @E_md4hash to i32 (i8*, i8*, ...)*)(i8* %5, i8* %1)
%8 = getelementptr inbounds [130 x i8], [130 x i8]* %4, i64 0, i64 14
store i8 0, i8* %8
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @strupper to i32 (i8*, ...)*)(i8* %5)
%10 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @E_P16 to i32 (i8*, i8*, ...)*)(i8* %5, i8* %2)
ret void
}