#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 uint8_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ TigerKDF_HashPassword(int *, int, int *, int, int *, int,
                                         int, int, int, int *, int, int, int,
                                         int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ print_hex(char *, int *, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stderr;
void test_output(uint8_t hashlen, uint8_t *pwd, uint32_t pwdlen, uint8_t *salt,
                 uint8_t saltlen, uint8_t *data, uint32_t datalen,
                 uint32_t memlen, uint32_t multipliesPerBlock, uint8_t garlic,
                 uint32_t blocklen, uint32_t parallelism,
                 uint32_t repetitions) {
  uint8_t hash[hashlen];
  print_hex("Password: ", pwd, pwdlen);
  print_hex("Salt: ", salt, saltlen);
  print_hex("Associated data:", data, datalen);
  printf("Memlen: %u\n", memlen);
  printf("MultipliesPerBlock: %u\n", multipliesPerBlock);
  printf("Garlic: %u\n", garlic);
  printf("Blocklen: %u\n", blocklen);
  printf("Parallelism: %u\n", parallelism);
  printf("Repetitions: %u\n", repetitions);
  if (!TigerKDF_HashPassword(hash, hashlen, pwd, pwdlen, salt, saltlen, memlen,
                             multipliesPerBlock, garlic, data, datalen,
                             blocklen, parallelism, repetitions)) {
    fprintf(stderr, "Password hashing failed!\n");
    exit(1);
  }
  print_hex("\nOutput: ", hash, hashlen);
  puts("\n\n");
}


x86 assembly (clang, -O0):
<test_output>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x2c(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %edx,-0x3c(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %r8d,-0x4c(%rbp)
mov    %r9,-0x58(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x60(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x70(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x68(%rbp)
mov    -0x38(%rbp),%rsi
mov    -0x3c(%rbp),%edx
lea    0xe2f(%rip),%rdi
call   1070 <print_hex@plt>
mov    -0x48(%rbp),%rsi
mov    -0x4c(%rbp),%edx
lea    0xe27(%rip),%rdi
call   1070 <print_hex@plt>
mov    -0x58(%rbp),%rsi
mov    0x10(%rbp),%edx
lea    0xe1b(%rip),%rdi
call   1070 <print_hex@plt>
mov    0x18(%rbp),%esi
lea    0xe1d(%rip),%rdi
call   1040 <printf@plt>
mov    0x20(%rbp),%esi
lea    0xe1a(%rip),%rdi
call   1040 <printf@plt>
mov    0x28(%rbp),%esi
lea    0xe23(%rip),%rdi
call   1040 <printf@plt>
mov    0x30(%rbp),%esi
lea    0xe20(%rip),%rdi
call   1040 <printf@plt>
mov    0x38(%rbp),%esi
lea    0xe1f(%rip),%rdi
call   1040 <printf@plt>
mov    0x40(%rbp),%esi
lea    0xe21(%rip),%rdi
call   1040 <printf@plt>
mov    -0x70(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x38(%rbp),%rdx
mov    -0x3c(%rbp),%ecx
mov    -0x48(%rbp),%r8
mov    -0x4c(%rbp),%r9d
mov    0x18(%rbp),%r13d
mov    0x20(%rbp),%r12d
mov    0x28(%rbp),%r15d
mov    -0x58(%rbp),%r14
mov    0x10(%rbp),%ebx
mov    0x30(%rbp),%r11d
mov    0x38(%rbp),%r10d
mov    0x40(%rbp),%eax
sub    $0x40,%rsp
mov    %r13d,(%rsp)
mov    %r12d,0x8(%rsp)
mov    %r15d,0x10(%rsp)
mov    %r14,0x18(%rsp)
mov    %ebx,0x20(%rsp)
mov    %r11d,0x28(%rsp)
mov    %r10d,0x30(%rsp)
mov    %eax,0x38(%rsp)
call   1050 <TigerKDF_HashPassword@plt>
add    $0x40,%rsp
cmp    $0x0,%eax
jne    12e4 <test_output+0x184>
mov    0x2d14(%rip),%rax
mov    (%rax),%edi
lea    0xdae(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x70(%rbp),%rsi
mov    -0x2c(%rbp),%edx
lea    0xdab(%rip),%rdi
call   1070 <print_hex@plt>
lea    0xda9(%rip),%rdi
call   1030 <puts@plt>
mov    -0x60(%rbp),%rax
mov    %rax,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_output>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,%r12
mov    %r9,-0x40(%rbp)
mov    %r8d,%r14d
mov    %r8d,-0x2c(%rbp)
mov    %rcx,%r13
mov    %rcx,-0x38(%rbp)
mov    %edx,-0x30(%rbp)
mov    %rsi,-0x48(%rbp)
mov    %edi,%ebx
mov    %edi,%eax
mov    %rsp,%r15
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
lea    0xe53(%rip),%rdi
call   1070 <print_hex@plt>
lea    0xe52(%rip),%rdi
mov    %r13,%rsi
mov    %r14d,%edx
call   1070 <print_hex@plt>
lea    0xe47(%rip),%rdi
mov    %r12,%rsi
mov    0x10(%rbp),%edx
call   1070 <print_hex@plt>
lea    0xe46(%rip),%rdi
mov    0x18(%rbp),%esi
call   1040 <printf@plt>
lea    0xe43(%rip),%rdi
mov    0x20(%rbp),%esi
call   1040 <printf@plt>
lea    0xe4c(%rip),%rdi
mov    0x28(%rbp),%esi
call   1040 <printf@plt>
lea    0xe49(%rip),%rdi
mov    0x30(%rbp),%r12d
mov    %r12d,%esi
call   1040 <printf@plt>
lea    0xe44(%rip),%rdi
mov    0x38(%rbp),%r13d
mov    %r13d,%esi
call   1040 <printf@plt>
lea    0xe42(%rip),%rdi
mov    0x40(%rbp),%r14d
mov    %r14d,%esi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    -0x48(%rbp),%rdx
mov    -0x30(%rbp),%ecx
mov    -0x38(%rbp),%r8
mov    -0x2c(%rbp),%r9d
push   %r14
push   %r13
push   %r12
mov    0x10(%rbp),%eax
push   %rax
push   -0x40(%rbp)
mov    0x28(%rbp),%eax
push   %rax
mov    0x20(%rbp),%eax
push   %rax
mov    0x18(%rbp),%eax
push   %rax
call   1050 <TigerKDF_HashPassword@plt>
add    $0x40,%rsp
test   %eax,%eax
je     12a2 <test_output+0x142>
lea    0xe20(%rip),%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1070 <print_hex@plt>
lea    0xe19(%rip),%rdi
call   1030 <puts@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d37(%rip),%rax
mov    (%rax),%edi
lea    0xdd1(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"Password: \00"
@.str.1 = [7 x i8] c"Salt: \00"
@.str.2 = [17 x i8] c"Associated data:\00"
@.str.3 = [12 x i8] c"Memlen: %u\0A\00"
@.str.4 = [24 x i8] c"MultipliesPerBlock: %u\0A\00"
@.str.5 = [12 x i8] c"Garlic: %u\0A\00"
@.str.6 = [14 x i8] c"Blocklen: %u\0A\00"
@.str.7 = [17 x i8] c"Parallelism: %u\0A\00"
@.str.8 = [17 x i8] c"Repetitions: %u\0A\00"
@stderr = global i32 0
@.str.9 = [26 x i8] c"Password hashing failed!\0A\00"
@.str.10 = [10 x i8] c"\0AOutput: \00"
@.str.11 = [3 x i8] c"\0A\0A\00"
define void @test_output(i32 %0, i32* %1, i32 %2, i32* %3, i32 %4, i32* %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12) {
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32
%17 = alloca i32*
%18 = alloca i32
%19 = alloca i32*
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i8*
%28 = alloca i64
store i32 %0, i32* %14
store i32* %1, i32** %15
store i32 %2, i32* %16
store i32* %3, i32** %17
store i32 %4, i32* %18
store i32* %5, i32** %19
store i32 %6, i32* %20
store i32 %7, i32* %21
store i32 %8, i32* %22
store i32 %9, i32* %23
store i32 %10, i32* %24
store i32 %11, i32* %25
store i32 %12, i32* %26
%29 = load i32, i32* %14
%30 = zext i32 %29 to i64
%31 = call i8* @llvm.stacksave()
store i8* %31, i8** %27
%32 = alloca i32, i64 %30
store i64 %30, i64* %28
%33 = load i32*, i32** %15
%34 = load i32, i32* %16
%35 = call i32 @print_hex(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %33, i32 %34)
%36 = load i32*, i32** %17
%37 = load i32, i32* %18
%38 = call i32 @print_hex(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %36, i32 %37)
%39 = load i32*, i32** %19
%40 = load i32, i32* %20
%41 = call i32 @print_hex(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32* %39, i32 %40)
%42 = load i32, i32* %21
%43 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %22
%45 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %23
%47 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %24
%49 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %25
%51 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i32 %50)
%52 = load i32, i32* %26
%53 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i32 %52)
%54 = load i32, i32* %14
%55 = load i32*, i32** %15
%56 = load i32, i32* %16
%57 = load i32*, i32** %17
%58 = load i32, i32* %18
%59 = load i32, i32* %21
%60 = load i32, i32* %22
%61 = load i32, i32* %23
%62 = load i32*, i32** %19
%63 = load i32, i32* %20
%64 = load i32, i32* %24
%65 = load i32, i32* %25
%66 = load i32, i32* %26
%67 = call i32 @TigerKDF_HashPassword(i32* %32, i32 %54, i32* %55, i32 %56, i32* %57, i32 %58, i32 %59, i32 %60, i32 %61, i32* %62, i32 %63, i32 %64, i32 %65, i32 %66)
%68 = icmp ne i32 %67, 0
br i1 %68, label %73, label %69
69: ; preds = %13
%70 = load i32, i32* @stderr
%71 = call i32 @fprintf(i32 %70, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %13
%74 = load i32, i32* %14
%75 = call i32 @print_hex(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32* %32, i32 %74)
%76 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%77 = load i8*, i8** %27
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"Password: \00"
@.str.1 = [7 x i8] c"Salt: \00"
@.str.2 = [17 x i8] c"Associated data:\00"
@.str.3 = [12 x i8] c"Memlen: %u\0A\00"
@.str.4 = [24 x i8] c"MultipliesPerBlock: %u\0A\00"
@.str.5 = [12 x i8] c"Garlic: %u\0A\00"
@.str.6 = [14 x i8] c"Blocklen: %u\0A\00"
@.str.7 = [17 x i8] c"Parallelism: %u\0A\00"
@.str.8 = [17 x i8] c"Repetitions: %u\0A\00"
@stderr = global i32 0
@.str.9 = [26 x i8] c"Password hashing failed!\0A\00"
@.str.10 = [10 x i8] c"\0AOutput: \00"
@.str.11 = [3 x i8] c"\0A\0A\00"
define void @test_output(i32 %0, i32* %1, i32 %2, i32* %3, i32 %4, i32* %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12) {
%14 = zext i32 %0 to i64
%15 = alloca i32, i64 %14
%16 = tail call i32 @print_hex(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %1, i32 %2)
%17 = tail call i32 @print_hex(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32 %4)
%18 = tail call i32 @print_hex(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32* %5, i32 %6)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %8)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %9)
%22 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %10)
%23 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i32 %11)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i32 %12)
%25 = call i32 @TigerKDF_HashPassword(i32* %15, i32 %0, i32* %1, i32 %2, i32* %3, i32 %4, i32 %7, i32 %8, i32 %9, i32* %5, i32 %6, i32 %10, i32 %11, i32 %12)
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %13
%28 = load i32, i32* @stderr
%29 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %13
%32 = call i32 @print_hex(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32* %15, i32 %0)
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
ret void
}