#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*/ nxt128_128_test(unsigned char *);
int /*<<< orphan*/ nxt128_192_test(unsigned char *);
int /*<<< orphan*/ nxt128_256_test(unsigned char *);
int /*<<< orphan*/ nxt128_64_test(unsigned char *);
int /*<<< orphan*/ nxt128_vect_cmp(unsigned char *, unsigned char *);
int /*<<< orphan*/ nxt64_128_test(unsigned char *);
int /*<<< orphan*/ nxt64_192_test(unsigned char *);
int /*<<< orphan*/ nxt64_256_test(unsigned char *);
int /*<<< orphan*/ nxt64_64_test(unsigned char *);
int /*<<< orphan*/ nxt64_vect_cmp(unsigned char *, unsigned char *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  unsigned char *vectors64[] = {
      (unsigned char *)"200e1f5847d8a2ce", (unsigned char *)"b85d6b766dce952e",
      (unsigned char *)"2741d7963406daca", (unsigned char *)"8a4edfbc36bef7f6"};
  unsigned char *vectors128[] = {
      (unsigned char *)"1eecbc7deb66e7dae1a7876d90c0b239",
      (unsigned char *)"849e0f0682f50cd588ae073006a10bee",
      (unsigned char *)"5934214ecba2d5fd58c261b28261b1bc",
      (unsigned char *)"45ccb1030f67b768247f530266bc4996"};
  unsigned char ct64[8];
  unsigned char ct128[16];
  printf("IDEA NXT Test Vectors:\n\n");
  printf("NXT64 64 bits key:\n");
  nxt64_64_test(ct64);
  nxt64_vect_cmp(vectors64[0], ct64);
  printf("NXT64 128 bits key:\n");
  nxt64_128_test(ct64);
  nxt64_vect_cmp(vectors64[1], ct64);
  printf("NXT64 192 bits key:\n");
  nxt64_192_test(ct64);
  nxt64_vect_cmp(vectors64[2], ct64);
  printf("NXT64 256 bits key:\n");
  nxt64_256_test(ct64);
  nxt64_vect_cmp(vectors64[3], ct64);
  printf("NXT128 64 bits key:\n");
  nxt128_64_test(ct128);
  nxt128_vect_cmp(vectors128[0], ct128);
  printf("NXT128 128 bits key:\n");
  nxt128_128_test(ct128);
  nxt128_vect_cmp(vectors128[1], ct128);
  printf("NXT128 192 bits key:\n");
  nxt128_192_test(ct128);
  nxt128_vect_cmp(vectors128[2], ct128);
  printf("NXT128 256 bits key:\n");
  nxt128_256_test(ct128);
  nxt128_vect_cmp(vectors128[3], ct128);
  printf("\nAll tests passed\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2c1a(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2c17(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2c14(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2c11(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2c0e(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0x2c0b(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0x2c08(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2c05(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xeaa(%rip),%rdi
call   1060 <printf@plt>
lea    0xeb7(%rip),%rdi
call   1060 <printf@plt>
lea    -0x58(%rbp),%rdi
call   1030 <nxt64_64_test@plt>
mov    -0x30(%rbp),%rdi
lea    -0x58(%rbp),%rsi
call   1040 <nxt64_vect_cmp@plt>
lea    0xea9(%rip),%rdi
call   1060 <printf@plt>
lea    -0x58(%rbp),%rdi
call   10b0 <nxt64_128_test@plt>
mov    -0x28(%rbp),%rdi
lea    -0x58(%rbp),%rsi
call   1040 <nxt64_vect_cmp@plt>
lea    0xe9c(%rip),%rdi
call   1060 <printf@plt>
lea    -0x58(%rbp),%rdi
call   10a0 <nxt64_192_test@plt>
mov    -0x20(%rbp),%rdi
lea    -0x58(%rbp),%rsi
call   1040 <nxt64_vect_cmp@plt>
lea    0xe8f(%rip),%rdi
call   1060 <printf@plt>
lea    -0x58(%rbp),%rdi
call   1070 <nxt64_256_test@plt>
mov    -0x18(%rbp),%rdi
lea    -0x58(%rbp),%rsi
call   1040 <nxt64_vect_cmp@plt>
lea    0xe82(%rip),%rdi
call   1060 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1080 <nxt128_64_test@plt>
mov    -0x50(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   10d0 <nxt128_vect_cmp@plt>
lea    0xe75(%rip),%rdi
call   1060 <printf@plt>
lea    -0x70(%rbp),%rdi
call   10c0 <nxt128_128_test@plt>
mov    -0x48(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   10d0 <nxt128_vect_cmp@plt>
lea    0xe69(%rip),%rdi
call   1060 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1090 <nxt128_192_test@plt>
mov    -0x40(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   10d0 <nxt128_vect_cmp@plt>
lea    0xe5d(%rip),%rdi
call   1060 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1050 <nxt128_256_test@plt>
mov    -0x38(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   10d0 <nxt128_vect_cmp@plt>
lea    0xe51(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xf0c(%rip),%rdi
call   1050 <puts@plt>
lea    0xf18(%rip),%rdi
call   1050 <puts@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <nxt64_64_test@plt>
lea    0xe1f(%rip),%rdi
mov    %rbx,%rsi
call   1040 <nxt64_vect_cmp@plt>
lea    0xf03(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   10b0 <nxt64_128_test@plt>
lea    0xe0d(%rip),%rdi
mov    %rbx,%rsi
call   1040 <nxt64_vect_cmp@plt>
lea    0xef4(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   10a0 <nxt64_192_test@plt>
lea    0xdfb(%rip),%rdi
mov    %rbx,%rsi
call   1040 <nxt64_vect_cmp@plt>
lea    0xee5(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1070 <nxt64_256_test@plt>
lea    0xde9(%rip),%rdi
mov    %rbx,%rsi
call   1040 <nxt64_vect_cmp@plt>
lea    0xed6(%rip),%rdi
call   1050 <puts@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <nxt128_64_test@plt>
lea    0xdd2(%rip),%rdi
mov    %rbx,%rsi
call   10d0 <nxt128_vect_cmp@plt>
lea    0xec2(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   10c0 <nxt128_128_test@plt>
lea    0xdd0(%rip),%rdi
mov    %rbx,%rsi
call   10d0 <nxt128_vect_cmp@plt>
lea    0xeb4(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1090 <nxt128_192_test@plt>
lea    0xdce(%rip),%rdi
mov    %rbx,%rsi
call   10d0 <nxt128_vect_cmp@plt>
lea    0xea6(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1060 <nxt128_256_test@plt>
lea    0xdcc(%rip),%rdi
mov    %rbx,%rsi
call   10d0 <nxt128_vect_cmp@plt>
lea    0xe98(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"200e1f5847d8a2ce\00"
@.str.1 = [17 x i8] c"b85d6b766dce952e\00"
@.str.2 = [17 x i8] c"2741d7963406daca\00"
@.str.3 = [17 x i8] c"8a4edfbc36bef7f6\00"
@__const.main.vectors64 = [4 x i8*] [i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [33 x i8] c"1eecbc7deb66e7dae1a7876d90c0b239\00"
@.str.5 = [33 x i8] c"849e0f0682f50cd588ae073006a10bee\00"
@.str.6 = [33 x i8] c"5934214ecba2d5fd58c261b28261b1bc\00"
@.str.7 = [33 x i8] c"45ccb1030f67b768247f530266bc4996\00"
@__const.main.vectors128 = [4 x i8*] [i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i32 0, i32 0)]
@.str.8 = [25 x i8] c"IDEA NXT Test Vectors:\0A\0A\00"
@.str.9 = [20 x i8] c"NXT64 64 bits key:\0A\00"
@.str.10 = [21 x i8] c"NXT64 128 bits key:\0A\00"
@.str.11 = [21 x i8] c"NXT64 192 bits key:\0A\00"
@.str.12 = [21 x i8] c"NXT64 256 bits key:\0A\00"
@.str.13 = [21 x i8] c"NXT128 64 bits key:\0A\00"
@.str.14 = [22 x i8] c"NXT128 128 bits key:\0A\00"
@.str.15 = [22 x i8] c"NXT128 192 bits key:\0A\00"
@.str.16 = [22 x i8] c"NXT128 256 bits key:\0A\00"
@.str.17 = [19 x i8] c"\0AAll tests passed\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8*]
%3 = alloca [4 x i8*]
%4 = alloca [8 x i8]
%5 = alloca [16 x i8]
store i32 0, i32* %1
%6 = bitcast [4 x i8*]* %2 to i8*
%7 = bitcast [4 x i8*]* %3 to i8*
%8 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%11 = call i32 @nxt64_64_test(i8* %10)
%12 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
%13 = load i8*, i8** %12
%14 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%15 = call i32 @nxt64_vect_cmp(i8* %13, i8* %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0))
%17 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%18 = call i32 @nxt64_128_test(i8* %17)
%19 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 1
%20 = load i8*, i8** %19
%21 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%22 = call i32 @nxt64_vect_cmp(i8* %20, i8* %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0))
%24 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%25 = call i32 @nxt64_192_test(i8* %24)
%26 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 2
%27 = load i8*, i8** %26
%28 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%29 = call i32 @nxt64_vect_cmp(i8* %27, i8* %28)
%30 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0))
%31 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%32 = call i32 @nxt64_256_test(i8* %31)
%33 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 3
%34 = load i8*, i8** %33
%35 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%36 = call i32 @nxt64_vect_cmp(i8* %34, i8* %35)
%37 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0))
%38 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%39 = call i32 @nxt128_64_test(i8* %38)
%40 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%41 = load i8*, i8** %40
%42 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%43 = call i32 @nxt128_vect_cmp(i8* %41, i8* %42)
%44 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0))
%45 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%46 = call i32 @nxt128_128_test(i8* %45)
%47 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 1
%48 = load i8*, i8** %47
%49 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%50 = call i32 @nxt128_vect_cmp(i8* %48, i8* %49)
%51 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.15, i64 0, i64 0))
%52 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%53 = call i32 @nxt128_192_test(i8* %52)
%54 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 2
%55 = load i8*, i8** %54
%56 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%57 = call i32 @nxt128_vect_cmp(i8* %55, i8* %56)
%58 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.16, i64 0, i64 0))
%59 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%60 = call i32 @nxt128_256_test(i8* %59)
%61 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 3
%62 = load i8*, i8** %61
%63 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%64 = call i32 @nxt128_vect_cmp(i8* %62, i8* %63)
%65 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"200e1f5847d8a2ce\00"
@.str.1 = [17 x i8] c"b85d6b766dce952e\00"
@.str.2 = [17 x i8] c"2741d7963406daca\00"
@.str.3 = [17 x i8] c"8a4edfbc36bef7f6\00"
@.str.4 = [33 x i8] c"1eecbc7deb66e7dae1a7876d90c0b239\00"
@.str.5 = [33 x i8] c"849e0f0682f50cd588ae073006a10bee\00"
@.str.6 = [33 x i8] c"5934214ecba2d5fd58c261b28261b1bc\00"
@.str.7 = [33 x i8] c"45ccb1030f67b768247f530266bc4996\00"
@str = [24 x i8] c"IDEA NXT Test Vectors:\0A\00"
@str.18 = [19 x i8] c"NXT64 64 bits key:\00"
@str.19 = [20 x i8] c"NXT64 128 bits key:\00"
@str.20 = [20 x i8] c"NXT64 192 bits key:\00"
@str.21 = [20 x i8] c"NXT64 256 bits key:\00"
@str.22 = [20 x i8] c"NXT128 64 bits key:\00"
@str.23 = [21 x i8] c"NXT128 128 bits key:\00"
@str.24 = [21 x i8] c"NXT128 192 bits key:\00"
@str.25 = [21 x i8] c"NXT128 256 bits key:\00"
@str.26 = [18 x i8] c"\0AAll tests passed\00"
define i32 @main() {
%1 = alloca [8 x i8]
%2 = alloca [16 x i8]
%3 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.18, i64 0, i64 0))
%7 = call i32 @nxt64_64_test(i8* %3)
%8 = call i32 @nxt64_vect_cmp(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %3)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.19, i64 0, i64 0))
%10 = call i32 @nxt64_128_test(i8* %3)
%11 = call i32 @nxt64_vect_cmp(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.20, i64 0, i64 0))
%13 = call i32 @nxt64_192_test(i8* %3)
%14 = call i32 @nxt64_vect_cmp(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.21, i64 0, i64 0))
%16 = call i32 @nxt64_256_test(i8* %3)
%17 = call i32 @nxt64_vect_cmp(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.22, i64 0, i64 0))
%19 = call i32 @nxt128_64_test(i8* %4)
%20 = call i32 @nxt128_vect_cmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.23, i64 0, i64 0))
%22 = call i32 @nxt128_128_test(i8* %4)
%23 = call i32 @nxt128_vect_cmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.24, i64 0, i64 0))
%25 = call i32 @nxt128_192_test(i8* %4)
%26 = call i32 @nxt128_vect_cmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %4)
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.25, i64 0, i64 0))
%28 = call i32 @nxt128_256_test(i8* %4)
%29 = call i32 @nxt128_vect_cmp(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i8* %4)
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.26, i64 0, i64 0))
ret i32 0
}