#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*/ E_P16(unsigned char *, unsigned char *);
int /*<<< orphan*/ SMBOWFencrypt(unsigned char *, unsigned char *,
                                 unsigned char *);
int /*<<< orphan*/ StrnCpy(char *, char *, int);
int /*<<< orphan*/ memset(unsigned char *, char, int);
int /*<<< orphan*/ strupper(char *);
void spa_smb_encrypt(unsigned char *passwd, unsigned char *c8,
                     unsigned char *p24) {
  unsigned char p14[15], p21[21];
  memset(p21, '\0', 21);
  memset(p14, '\0', 14);
  StrnCpy((char *)p14, (char *)passwd, 14);
  strupper((char *)p14);
  E_P16(p14, p21);
  SMBOWFencrypt(p21, c8, p24);
}


x86 assembly (clang, -O0):
<spa_smb_encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x15,%edx
call   1030 <memset@plt>
lea    -0x27(%rbp),%rdi
xor    %esi,%esi
mov    $0xe,%edx
call   1030 <memset@plt>
lea    -0x27(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0xe,%edx
call   1060 <StrnCpy@plt>
lea    -0x27(%rbp),%rdi
call   1050 <strupper@plt>
lea    -0x27(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1070 <E_P16@plt>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <SMBOWFencrypt@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spa_smb_encrypt>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r13
lea    0x10(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x15,%edx
call   1030 <memset@plt>
lea    0x1(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xe,%edx
call   1030 <memset@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0xe,%edx
call   1060 <StrnCpy@plt>
mov    %rbx,%rdi
call   1050 <strupper@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1070 <E_P16@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1040 <SMBOWFencrypt@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @spa_smb_encrypt(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [15 x i8]
%8 = alloca [21 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = getelementptr inbounds [21 x i8], [21 x i8]* %8, i64 0, i64 0
%10 = call i32 @memset(i8* %9, i8 signext 0, i32 21)
%11 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%12 = call i32 @memset(i8* %11, i8 signext 0, i32 14)
%13 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%14 = load i8*, i8** %4
%15 = call i32 @StrnCpy(i8* %13, i8* %14, i32 14)
%16 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%17 = call i32 @strupper(i8* %16)
%18 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%19 = getelementptr inbounds [21 x i8], [21 x i8]* %8, i64 0, i64 0
%20 = call i32 @E_P16(i8* %18, i8* %19)
%21 = getelementptr inbounds [21 x i8], [21 x i8]* %8, i64 0, i64 0
%22 = load i8*, i8** %5
%23 = load i8*, i8** %6
%24 = call i32 @SMBOWFencrypt(i8* %21, i8* %22, i8* %23)
ret void
}

LLVM IR (-O2):
define void @spa_smb_encrypt(i8* %0, i8* %1, i8* %2) {
%4 = alloca [15 x i8]
%5 = alloca [21 x i8]
%6 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
%8 = call i32 @memset(i8* %7, i8 signext 0, i32 21)
%9 = call i32 @memset(i8* %6, i8 signext 0, i32 14)
%10 = call i32 @StrnCpy(i8* %6, i8* %0, i32 14)
%11 = call i32 @strupper(i8* %6)
%12 = call i32 @E_P16(i8* %6, i8* %7)
%13 = call i32 @SMBOWFencrypt(i8* %7, i8* %1, i8* %2)
ret void
}