#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 */
struct JtR_FEAL8_CTX {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ meta_encrypt_repro(unsigned char *, unsigned char *,
                                      struct JtR_FEAL8_CTX *);
int /*<<< orphan*/ meta_keysch_repro(unsigned char, unsigned char *,
                                     unsigned char *, int *,
                                     struct JtR_FEAL8_CTX *);
int /*<<< orphan*/ rnd_srand(unsigned char, int *);
void generate_hash(unsigned char *password, unsigned char seed,
                   unsigned char *result_hash, int *g_seed,
                   struct JtR_FEAL8_CTX *ctx) {
  unsigned char meta_keysch_result[64];
  unsigned char meta_encrypt_result[64];
  rnd_srand(seed, g_seed);
  meta_keysch_repro(seed, password, meta_keysch_result, g_seed, ctx);
  meta_encrypt_repro(meta_keysch_result, meta_encrypt_result, ctx);
  memcpy(result_hash, meta_encrypt_result + 64 - 28, 28);
}


x86 assembly (clang, -O0):
<generate_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x9(%rbp),%al
mov    -0x20(%rbp),%rsi
movzbl %al,%edi
call   1060 <rnd_srand@plt>
mov    -0x9(%rbp),%al
mov    -0x8(%rbp),%rsi
lea    -0x70(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
movzbl %al,%edi
call   1040 <meta_keysch_repro@plt>
lea    -0x70(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <meta_encrypt_repro@plt>
mov    -0x18(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
add    $0x40,%rsi
add    $0xffffffffffffffe4,%rsi
mov    $0x1c,%edx
call   1050 <memcpy@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_hash>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r8,%r14
mov    %rcx,%rbx
mov    %rdx,%r15
mov    %esi,%ebp
mov    %rdi,%r12
mov    %esi,%edi
mov    %rcx,%rsi
call   1060 <rnd_srand@plt>
lea    0x40(%rsp),%r13
mov    %ebp,%edi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %r14,%r8
call   1040 <meta_keysch_repro@plt>
mov    %rsp,%rsi
mov    %r13,%rdi
mov    %r14,%rdx
call   1030 <meta_encrypt_repro@plt>
lea    0x24(%rsp),%rsi
mov    %r15,%rdi
mov    $0x1c,%edx
call   1050 <memcpy@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.JtR_FEAL8_CTX = type { i32 }
define void @generate_hash(i8* %0, i8 zeroext %1, i8* %2, i32* %3, %struct.JtR_FEAL8_CTX* %4) {
%6 = alloca i8*
%7 = alloca i8
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca %struct.JtR_FEAL8_CTX*
%11 = alloca [64 x i8]
%12 = alloca [64 x i8]
store i8* %0, i8** %6
store i8 %1, i8* %7
store i8* %2, i8** %8
store i32* %3, i32** %9
store %struct.JtR_FEAL8_CTX* %4, %struct.JtR_FEAL8_CTX** %10
%13 = load i8, i8* %7
%14 = load i32*, i32** %9
%15 = call i32 @rnd_srand(i8 zeroext %13, i32* %14)
%16 = load i8, i8* %7
%17 = load i8*, i8** %6
%18 = getelementptr inbounds [64 x i8], [64 x i8]* %11, i64 0, i64 0
%19 = load i32*, i32** %9
%20 = load %struct.JtR_FEAL8_CTX*, %struct.JtR_FEAL8_CTX** %10
%21 = call i32 @meta_keysch_repro(i8 zeroext %16, i8* %17, i8* %18, i32* %19, %struct.JtR_FEAL8_CTX* %20)
%22 = getelementptr inbounds [64 x i8], [64 x i8]* %11, i64 0, i64 0
%23 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%24 = load %struct.JtR_FEAL8_CTX*, %struct.JtR_FEAL8_CTX** %10
%25 = call i32 @meta_encrypt_repro(i8* %22, i8* %23, %struct.JtR_FEAL8_CTX* %24)
%26 = load i8*, i8** %8
%27 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%28 = getelementptr inbounds i8, i8* %27, i64 64
%29 = getelementptr inbounds i8, i8* %28, i64 -28
%30 = call i32 @memcpy(i8* %26, i8* %29, i32 28)
ret void
}

LLVM IR (-O2):
%struct.JtR_FEAL8_CTX = type { i32 }
define void @generate_hash(i8* %0, i8 zeroext %1, i8* %2, i32* %3, %struct.JtR_FEAL8_CTX* %4) {
%6 = alloca [64 x i8]
%7 = alloca [64 x i8]
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%9 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%10 = tail call i32 @rnd_srand(i8 zeroext %1, i32* %3)
%11 = call i32 @meta_keysch_repro(i8 zeroext %1, i8* %0, i8* %8, i32* %3, %struct.JtR_FEAL8_CTX* %4)
%12 = call i32 @meta_encrypt_repro(i8* %8, i8* %9, %struct.JtR_FEAL8_CTX* %4)
%13 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 36
%14 = call i32 @memcpy(i8* %2, i8* %13, i32 28)
ret void
}