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

/* Variables and functions */
int /*<<< orphan*/ E_P16(unsigned char *, unsigned char *);
int /*<<< orphan*/ E_md4hash(unsigned char *, unsigned char *);
int /*<<< orphan*/ StrnCpy(char *, char *, int);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ strupper(char *);
void nt_lm_owf_gen(char *pwd, char *nt_p16, char *p16) {
  char passwd[130];
  StrnCpy(passwd, pwd, sizeof(passwd) - 1);
  memset(nt_p16, '\0', 16);
  E_md4hash((unsigned char *)passwd, (unsigned char *)nt_p16);
  passwd[14] = '\0';
  strupper(passwd);
  memset(p16, '\0', 16);
  E_P16((unsigned char *)passwd, (unsigned char *)p16);
  bzero(passwd, 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
mov    -0x8(%rbp),%rsi
mov    $0x81,%edx
call   1070 <StrnCpy@plt>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <E_md4hash@plt>
movb   $0x0,-0x92(%rbp)
lea    -0xa0(%rbp),%rdi
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
call   1080 <E_P16@plt>
lea    -0xa0(%rbp),%rdi
mov    $0x82,%esi
call   1060 <bzero@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,%r15
mov    %rsi,%rbx
mov    %rdi,%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x81,%edx
call   1060 <StrnCpy@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <E_md4hash@plt>
movb   $0x0,0xe(%rsp)
mov    %r14,%rdi
call   1050 <strupper@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <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 = load i8*, i8** %4
%10 = call i32 @StrnCpy(i8* %8, i8* %9, i32 129)
%11 = load i8*, i8** %5
%12 = call i32 @memset(i8* %11, i8 signext 0, i32 16)
%13 = getelementptr inbounds [130 x i8], [130 x i8]* %7, i64 0, i64 0
%14 = load i8*, i8** %5
%15 = call i32 @E_md4hash(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 @strupper(i8* %17)
%19 = load i8*, i8** %6
%20 = call i32 @memset(i8* %19, i8 signext 0, i32 16)
%21 = getelementptr inbounds [130 x i8], [130 x i8]* %7, i64 0, i64 0
%22 = load i8*, i8** %6
%23 = call i32 @E_P16(i8* %21, i8* %22)
%24 = getelementptr inbounds [130 x i8], [130 x i8]* %7, i64 0, i64 0
%25 = call i32 @bzero(i8* %24, i32 130)
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 @StrnCpy(i8* %5, i8* %0, i32 129)
%7 = call i32 @memset(i8* %1, i8 signext 0, i32 16)
%8 = call i32 @E_md4hash(i8* %5, i8* %1)
%9 = getelementptr inbounds [130 x i8], [130 x i8]* %4, i64 0, i64 14
store i8 0, i8* %9
%10 = call i32 @strupper(i8* %5)
%11 = call i32 @memset(i8* %2, i8 signext 0, i32 16)
%12 = call i32 @E_P16(i8* %5, i8* %2)
ret void
}