#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*/ MD4(unsigned char *, size_t, unsigned char *);
int strlen(char *);
void hashNTH(char *plaintxt, unsigned char *hash) {
  char pwdUTF[32] = {0};
  unsigned int j;
  for (j = 0; j < strlen(plaintxt) && 2 * j < 32; j++) {
    pwdUTF[2 * j] = plaintxt[j];
  }
  MD4((unsigned char *)pwdUTF, (size_t)(2 * strlen(plaintxt)), hash);
}


x86 assembly (clang, -O0):
<hashNTH>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x3c(%rbp),%ecx
mov    %eax,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x35(%rbp)
jae    1187 <hashNTH+0x57>
mov    -0x34(%rbp),%eax
shl    $0x1,%eax
cmp    $0x20,%eax
setb   %al
mov    %al,-0x35(%rbp)
mov    -0x35(%rbp),%al
test   $0x1,%al
jne    1197 <hashNTH+0x67>
jmp    11bb <hashNTH+0x8b>
mov    -0x8(%rbp),%rax
mov    -0x34(%rbp),%ecx
mov    (%rax,%rcx,1),%cl
mov    -0x34(%rbp),%eax
shl    $0x1,%eax
mov    %eax,%eax
mov    %cl,-0x30(%rbp,%rax,1)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1157 <hashNTH+0x27>
lea    -0x30(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x48(%rbp),%rdi
shl    $0x1,%eax
movslq %eax,%rsi
mov    -0x10(%rbp),%rdx
call   1030 <MD4@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashNTH>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
call   1040 <strlen@plt>
test   %eax,%eax
je     1174 <hashNTH+0x54>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%eax
mov    %al,(%rsp,%rbx,2)
lea    0x1(%rbx),%r12
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %eax,%eax
cmp    %rax,%r12
jae    1174 <hashNTH+0x54>
cmp    $0xf,%rbx
mov    %r12,%rbx
jb     1150 <hashNTH+0x30>
mov    %r15,%rdi
call   1040 <strlen@plt>
add    %eax,%eax
movslq %eax,%rsi
mov    %rsp,%rdi
mov    %r14,%rdx
call   1030 <MD4@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @hashNTH(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [32 x i8]
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = bitcast [32 x i8]* %5 to i8*
store i32 0, i32* %6
br label %8
8: ; preds = %29, %2
%9 = load i32, i32* %6
%10 = load i8*, i8** %3
%11 = call i32 @strlen(i8* %10)
%12 = icmp ult i32 %9, %11
br i1 %12, label %13, label %17
13: ; preds = %8
%14 = load i32, i32* %6
%15 = mul i32 2, %14
%16 = icmp ult i32 %15, 32
br label %17
17: ; preds = %13, %8
%18 = phi i1 [ false, %8 ], [ %16, %13 ]
br i1 %18, label %19, label %32
19: ; preds = %17
%20 = load i8*, i8** %3
%21 = load i32, i32* %6
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = load i32, i32* %6
%26 = mul i32 2, %25
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 %27
store i8 %24, i8* %28
br label %29
29: ; preds = %19
%30 = load i32, i32* %6
%31 = add i32 %30, 1
store i32 %31, i32* %6
br label %8
32: ; preds = %17
%33 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%34 = load i8*, i8** %3
%35 = call i32 @strlen(i8* %34)
%36 = mul nsw i32 2, %35
%37 = sext i32 %36 to i64
%38 = load i8*, i8** %4
%39 = call i32 @MD4(i8* %33, i64 %37, i8* %38)
ret void
}

LLVM IR (-O2):
define void @hashNTH(i8* %0, i8* %1) {
%3 = alloca [32 x i8]
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @strlen(i8* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %20, label %7
7: ; preds = %2, %7
%8 = phi i64 [ %13, %7 ], [ 0, %2 ]
%9 = phi i64 [ %17, %7 ], [ 0, %2 ]
%10 = getelementptr inbounds i8, i8* %0, i64 %8
%11 = load i8, i8* %10
%12 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 %9
store i8 %11, i8* %12
%13 = add nuw nsw i64 %8, 1
%14 = tail call i32 @strlen(i8* %0)
%15 = zext i32 %14 to i64
%16 = icmp ult i64 %13, %15
%17 = add nuw nsw i64 %9, 2
%18 = icmp ult i64 %8, 15
%19 = and i1 %16, %18
br i1 %19, label %7, label %20
20: ; preds = %7, %2
%21 = tail call i32 @strlen(i8* %0)
%22 = shl nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = call i32 @MD4(i8* %4, i64 %23, i8* %1)
ret void
}