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

/* Variables and functions */
int /*<<< orphan*/ TigerKDF_ClientHashPassword(int /*<<< orphan*/ *, int,
                                               int /*<<< orphan*/ *, int,
                                               int /*<<< orphan*/ *, int, int,
                                               int, int /*<<< orphan*/,
                                               int /*<<< orphan*/ *, int, int,
                                               int, int);
int /*<<< orphan*/
TigerKDF_HashPassword(int /*<<< orphan*/ *, int, int /*<<< orphan*/ *, int,
                      int /*<<< orphan*/ *, int, int, int, int /*<<< orphan*/,
                      int /*<<< orphan*/ *, int, int, int, int);
int /*<<< orphan*/ TigerKDF_ServerHashPassword(int /*<<< orphan*/ *, int,
                                               int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ memcmp(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ stderr;
void verifyClientServer(void) {
  uint8_t hash1[32];
  if (!TigerKDF_ClientHashPassword(hash1, 32, (uint8_t *)"password", 8,
                                   (uint8_t *)"salt", 4, 1024 * 1024, 4096, 0,
                                   (uint8_t *)"data", 4, 16384, 2, 2)) {
    fprintf(stderr, "Password hashing failed!\n");
    exit(1);
  }
  TigerKDF_ServerHashPassword(hash1, 32, 0);
  uint8_t hash2[32];
  if (!TigerKDF_HashPassword(hash2, 32, (uint8_t *)"password", 8,
                             (uint8_t *)"salt", 4, 1024 * 1024, 4096, 0,
                             (uint8_t *)"data", 4, 16384, 2, 2)) {
    fprintf(stderr, "Password hashing failed!\n");
    exit(1);
  }
  if (memcmp(hash1, hash2, 32)) {
    fprintf(stderr, "Password client/server got wrong answer!\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<verifyClientServer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
lea    -0x80(%rbp),%rdi
mov    $0x20,%esi
lea    0xe85(%rip),%rdx
mov    $0x8,%ecx
lea    0xe82(%rip),%r8
mov    $0x4,%r9d
xor    %eax,%eax
lea    0xe78(%rip),%rax
movl   $0x100000,(%rsp)
movl   $0x1000,0x8(%rsp)
movl   $0x0,0x10(%rsp)
mov    %rax,0x18(%rsp)
movl   $0x4,0x20(%rsp)
movl   $0x4000,0x28(%rsp)
movl   $0x2,0x30(%rsp)
movl   $0x2,0x38(%rsp)
call   1030 <TigerKDF_ClientHashPassword@plt>
cmp    $0x0,%eax
jne    11ff <verifyClientServer+0x9f>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
lea    0xe23(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    -0x80(%rbp),%rdi
mov    $0x20,%esi
xor    %edx,%edx
call   1040 <TigerKDF_ServerHashPassword@plt>
lea    -0x100(%rbp),%rdi
mov    $0x20,%esi
lea    0xdde(%rip),%rdx
mov    $0x8,%ecx
lea    0xddb(%rip),%r8
mov    $0x4,%r9d
xor    %eax,%eax
lea    0xdd1(%rip),%rax
movl   $0x100000,(%rsp)
movl   $0x1000,0x8(%rsp)
movl   $0x0,0x10(%rsp)
mov    %rax,0x18(%rsp)
movl   $0x4,0x20(%rsp)
movl   $0x4000,0x28(%rsp)
movl   $0x2,0x30(%rsp)
movl   $0x2,0x38(%rsp)
call   1050 <TigerKDF_HashPassword@plt>
cmp    $0x0,%eax
jne    12a6 <verifyClientServer+0x146>
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
lea    0xd7c(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    -0x80(%rbp),%rdi
lea    -0x100(%rbp),%rsi
mov    $0x20,%edx
call   1060 <memcmp@plt>
cmp    $0x0,%rax
je     12e4 <verifyClientServer+0x184>
mov    0x2d14(%rip),%rax
mov    (%rax),%edi
lea    0xd58(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verifyClientServer>:
push   %rbx
sub    $0x100,%rsp
lea    0xe9f(%rip),%rbx
lea    0xe8a(%rip),%rdx
lea    0xe8c(%rip),%r8
mov    %rsp,%rdi
mov    $0x20,%esi
mov    $0x8,%ecx
mov    $0x4,%r9d
push   $0x2
push   $0x2
push   $0x4000
push   $0x4
push   %rbx
push   $0x0
push   $0x1000
push   $0x100000
call   1030 <TigerKDF_ClientHashPassword@plt>
add    $0x40,%rsp
test   %eax,%eax
je     1232 <verifyClientServer+0xd2>
mov    %rsp,%rdi
mov    $0x20,%esi
xor    %edx,%edx
call   1040 <TigerKDF_ServerHashPassword@plt>
lea    0xe35(%rip),%rdx
lea    0xe37(%rip),%r8
lea    0x80(%rsp),%rdi
mov    $0x20,%esi
mov    $0x8,%ecx
mov    $0x4,%r9d
push   $0x2
push   $0x2
push   $0x4000
push   $0x4
push   %rbx
push   $0x0
push   $0x1000
push   $0x100000
call   1050 <TigerKDF_HashPassword@plt>
add    $0x40,%rsp
test   %eax,%eax
je     1232 <verifyClientServer+0xd2>
mov    %rsp,%rdi
lea    0x80(%rsp),%rsi
mov    $0x20,%edx
call   1060 <memcmp@plt>
test   %rax,%rax
jne    1244 <verifyClientServer+0xe4>
add    $0x100,%rsp
pop    %rbx
ret
mov    0x2da7(%rip),%rax
mov    (%rax),%edi
lea    0xdd1(%rip),%rsi
jmp    1254 <verifyClientServer+0xf4>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
lea    0xdd9(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"password\00"
@.str.1 = [5 x i8] c"salt\00"
@.str.2 = [5 x i8] c"data\00"
@stderr = global i32 0
@.str.3 = [26 x i8] c"Password hashing failed!\0A\00"
@.str.4 = [42 x i8] c"Password client/server got wrong answer!\0A\00"
define void @verifyClientServer() {
%1 = alloca [32 x i32]
%2 = alloca [32 x i32]
%3 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 0
%4 = call i32 @TigerKDF_ClientHashPassword(i32* %3, i32 32, i32* bitcast ([9 x i8]* @.str to i32*), i32 8, i32* bitcast ([5 x i8]* @.str.1 to i32*), i32 4, i32 1048576, i32 4096, i32 0, i32* bitcast ([5 x i8]* @.str.2 to i32*), i32 4, i32 16384, i32 2, i32 2)
%5 = icmp ne i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %0
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %0
%11 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 0
%12 = call i32 @TigerKDF_ServerHashPassword(i32* %11, i32 32, i32 0)
%13 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 0
%14 = call i32 @TigerKDF_HashPassword(i32* %13, i32 32, i32* bitcast ([9 x i8]* @.str to i32*), i32 8, i32* bitcast ([5 x i8]* @.str.1 to i32*), i32 4, i32 1048576, i32 4096, i32 0, i32* bitcast ([5 x i8]* @.str.2 to i32*), i32 4, i32 16384, i32 2, i32 2)
%15 = icmp ne i32 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %10
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %10
%21 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 0
%22 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 0
%23 = call i64 @memcmp(i32* %21, i32* %22, i32 32)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %20
%26 = load i32, i32* @stderr
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %20
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"password\00"
@.str.1 = [5 x i8] c"salt\00"
@.str.2 = [5 x i8] c"data\00"
@stderr = global i32 0
@.str.3 = [26 x i8] c"Password hashing failed!\0A\00"
@.str.4 = [42 x i8] c"Password client/server got wrong answer!\0A\00"
define void @verifyClientServer() {
%1 = alloca [32 x i32]
%2 = alloca [32 x i32]
%3 = bitcast [32 x i32]* %1 to i8*
%4 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 0
%5 = call i32 @TigerKDF_ClientHashPassword(i32* %4, i32 32, i32* bitcast ([9 x i8]* @.str to i32*), i32 8, i32* bitcast ([5 x i8]* @.str.1 to i32*), i32 4, i32 1048576, i32 4096, i32 0, i32* bitcast ([5 x i8]* @.str.2 to i32*), i32 4, i32 16384, i32 2, i32 2)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %0
%12 = call i32 @TigerKDF_ServerHashPassword(i32* %4, i32 32, i32 0)
%13 = bitcast [32 x i32]* %2 to i8*
%14 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 0
%15 = call i32 @TigerKDF_HashPassword(i32* %14, i32 32, i32* bitcast ([9 x i8]* @.str to i32*), i32 8, i32* bitcast ([5 x i8]* @.str.1 to i32*), i32 4, i32 1048576, i32 4096, i32 0, i32* bitcast ([5 x i8]* @.str.2 to i32*), i32 4, i32 16384, i32 2, i32 2)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %11
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %11
%22 = call i64 @memcmp(i32* %4, i32* %14, i32 32)
%23 = icmp eq i64 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %21
%25 = load i32, i32* @stderr
%26 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %21
ret void
}