#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*/ free(unsigned char *);
unsigned char *generate_multi_part_message(int, int, int /*<<< orphan*/,
                                           unsigned long long *);
unsigned char *read_from_file(char *, unsigned long long *);
int run_test(unsigned char const *, unsigned char const *,
             unsigned long long const, unsigned char *, unsigned long long,
             unsigned char *, unsigned long long, unsigned char const *);
int test2Parts1() {
  const unsigned long long hlen = 24;
  const unsigned char k[16] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
                               0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
  const unsigned char h[24] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
                               0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
                               0xde, 0xad, 0xbe, 0xef, 0xde, 0xaf, 0xba, 0xbe};
  unsigned long long mlen;
  unsigned char *m = generate_multi_part_message(2, 1, 0, &mlen);
  unsigned long long clen;
  unsigned char *c =
      read_from_file("testvectors/aes128poetv2aes4_128_128_2_1.txt", &clen);
  const unsigned char t[16] = {0x3B, 0x5E, 0xAF, 0x59, 0x25, 0xD9, 0xA6, 0xBB,
                               0x84, 0x3B, 0x61, 0xF2, 0x93, 0x5B, 0xC4, 0x41};
  const int result = run_test(k, h, hlen, m, mlen, c, clen, t);
  free(m);
  free(c);
  return result;
}


x86 assembly (clang, -O0):
<test2Parts1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movq   $0x18,-0x8(%rbp)
mov    0xea6(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea3(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xead(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    $0x2,%edi
mov    $0x1,%esi
xor    %edx,%edx
lea    -0x48(%rbp),%rcx
call   1050 <generate_multi_part_message@plt>
mov    %rax,-0x50(%rbp)
lea    0xe8e(%rip),%rdi
lea    -0x58(%rbp),%rsi
call   1040 <read_from_file@plt>
mov    %rax,-0x60(%rbp)
mov    0xe52(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xe4f(%rip),%rax
mov    %rax,-0x68(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    -0x50(%rbp),%rcx
mov    -0x48(%rbp),%r8
mov    -0x60(%rbp),%r9
mov    -0x58(%rbp),%r10
lea    -0x70(%rbp),%rax
mov    $0x18,%edx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1060 <run_test@plt>
mov    %eax,-0x74(%rbp)
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    -0x74(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2Parts1>:
push   %rbp
push   %r14
push   %rbx
sub    $0x50,%rsp
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xec5(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movabs $0xbebaafdeefbeadde,%rax
af ba be
mov    %rax,0x30(%rsp)
lea    0x8(%rsp),%rcx
mov    $0x2,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1050 <generate_multi_part_message@plt>
mov    %rax,%r14
lea    0xea9(%rip),%rdi
mov    %rsp,%rsi
call   1040 <read_from_file@plt>
mov    %rax,%rbx
movaps 0xe6f(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    0x8(%rsp),%r8
lea    0x10(%rsp),%rax
lea    0x40(%rsp),%rdi
lea    0x20(%rsp),%rsi
mov    $0x18,%edx
mov    %r14,%rcx
mov    %rbx,%r9
push   %rax
push   0x8(%rsp)
call   1060 <run_test@plt>
add    $0x10,%rsp
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.test2Parts1.k = [16 x i8] c"\00\11\223DUfw\88\99\AA\BB\CC\DD\EE\FF"
@__const.test2Parts1.h = [24 x i8] c"\00\11\223DUfw\88\99\AA\BB\CC\DD\EE\FF\DE\AD\BE\EF\DE\AF\BA\BE"
@.str = [45 x i8] c"testvectors/aes128poetv2aes4_128_128_2_1.txt\00"
@__const.test2Parts1.t = [16 x i8] c";^\AFY%\D9\A6\BB\84;a\F2\93[\C4A"
define i32 @test2Parts1() {
%1 = alloca i64
%2 = alloca [16 x i8]
%3 = alloca [24 x i8]
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca [16 x i8]
%9 = alloca i32
store i64 24, i64* %1
%10 = bitcast [16 x i8]* %2 to i8*
%11 = bitcast [24 x i8]* %3 to i8*
%12 = call i8* @generate_multi_part_message(i32 2, i32 1, i32 0, i64* %4)
store i8* %12, i8** %5
%13 = call i8* @read_from_file(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i64* %6)
store i8* %13, i8** %7
%14 = bitcast [16 x i8]* %8 to i8*
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%16 = getelementptr inbounds [24 x i8], [24 x i8]* %3, i64 0, i64 0
%17 = load i8*, i8** %5
%18 = load i64, i64* %4
%19 = load i8*, i8** %7
%20 = load i64, i64* %6
%21 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%22 = call i32 @run_test(i8* %15, i8* %16, i64 24, i8* %17, i64 %18, i8* %19, i64 %20, i8* %21)
store i32 %22, i32* %9
%23 = load i8*, i8** %5
%24 = call i32 @free(i8* %23)
%25 = load i8*, i8** %7
%26 = call i32 @free(i8* %25)
%27 = load i32, i32* %9
ret i32 %27
}

LLVM IR (-O2):
@__const.test2Parts1.k = [16 x i8] c"\00\11\223DUfw\88\99\AA\BB\CC\DD\EE\FF"
@__const.test2Parts1.h = [24 x i8] c"\00\11\223DUfw\88\99\AA\BB\CC\DD\EE\FF\DE\AD\BE\EF\DE\AF\BA\BE"
@.str = [45 x i8] c"testvectors/aes128poetv2aes4_128_128_2_1.txt\00"
@__const.test2Parts1.t = [16 x i8] c";^\AFY%\D9\A6\BB\84;a\F2\93[\C4A"
define i32 @test2Parts1() {
%1 = alloca [16 x i8]
%2 = alloca [24 x i8]
%3 = alloca i64
%4 = alloca i64
%5 = alloca [16 x i8]
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%8 = bitcast i64* %3 to i8*
%9 = call i8* @generate_multi_part_message(i32 2, i32 1, i32 0, i64* %3)
%10 = bitcast i64* %4 to i8*
%11 = call i8* @read_from_file(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i64* %4)
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%13 = load i64, i64* %3
%14 = load i64, i64* %4
%15 = call i32 @run_test(i8* %6, i8* %7, i64 24, i8* %9, i64 %13, i8* %11, i64 %14, i8* %12)
%16 = call i32 @free(i8* %9)
%17 = call i32 @free(i8* %11)
ret i32 %15
}