#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;

/* Variables and functions */
int /*<<< orphan*/ earworm_aesenc_round(int *, int const *);
scalar_t__ memcmp(int *, int const *, size_t);
int /*<<< orphan*/ memcpy(int *, int const *, size_t);
int test_aesenc_round() {
  static const uint8_t state_input[((size_t)16)] = {
      0x5d, 0x47, 0x53, 0x5d, 0x72, 0x6f, 0x74, 0x63,
      0x65, 0x56, 0x74, 0x73, 0x65, 0x54, 0x5b, 0x7b};
  static const uint8_t roundkey[((size_t)16)] = {
      0x5d, 0x6e, 0x6f, 0x72, 0x65, 0x75, 0x47, 0x5b,
      0x29, 0x79, 0x61, 0x68, 0x53, 0x28, 0x69, 0x48};
  static const uint8_t expected_result[((size_t)16)] = {
      0x95, 0xe5, 0xd7, 0xde, 0x58, 0x4b, 0x10, 0x8b,
      0xc5, 0xa3, 0xdb, 0x9f, 0x2f, 0x1c, 0x31, 0xa8};
  uint8_t state[((size_t)16)];
  memcpy(state, state_input, ((size_t)16));
  earworm_aesenc_round(state, roundkey);
  if (memcmp(state, expected_result, ((size_t)16)) == 0)
    return 0;
  else
    return -1;
}


x86 assembly (clang, -O0):
<test_aesenc_round>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x50(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x10,%edx
call   1050 <memcpy@plt>
lea    -0x50(%rbp),%rdi
lea    0xee8(%rip),%rsi
call   1030 <earworm_aesenc_round@plt>
lea    -0x50(%rbp),%rdi
lea    0xf18(%rip),%rsi
mov    $0x10,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
jne    1188 <test_aesenc_round+0x58>
movl   $0x0,-0x4(%rbp)
jmp    118f <test_aesenc_round+0x5f>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_aesenc_round>:
push   %rbx
sub    $0x40,%rsp
lea    0xec4(%rip),%rsi
mov    %rsp,%rbx
mov    $0x10,%edx
mov    %rbx,%rdi
call   1050 <memcpy@plt>
lea    0xeed(%rip),%rsi
mov    %rbx,%rdi
call   1030 <earworm_aesenc_round@plt>
lea    0xf1e(%rip),%rsi
mov    $0x10,%edx
mov    %rbx,%rdi
call   1040 <memcmp@plt>
neg    %rax
sbb    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@test_aesenc_round.state_input = internal constant [16 x i32] [i32 93, i32 71, i32 83, i32 93, i32 114, i32 111, i32 116, i32 99, i32 101, i32 86, i32 116, i32 115, i32 101, i32 84, i32 91, i32 123]
@test_aesenc_round.roundkey = internal constant [16 x i32] [i32 93, i32 110, i32 111, i32 114, i32 101, i32 117, i32 71, i32 91, i32 41, i32 121, i32 97, i32 104, i32 83, i32 40, i32 105, i32 72]
@test_aesenc_round.expected_result = internal constant [16 x i32] [i32 149, i32 229, i32 215, i32 222, i32 88, i32 75, i32 16, i32 139, i32 197, i32 163, i32 219, i32 159, i32 47, i32 28, i32 49, i32 168]
define i32 @test_aesenc_round() {
%1 = alloca i32
%2 = alloca [16 x i32]
%3 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%4 = call i32 @memcpy(i32* %3, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @test_aesenc_round.state_input, i64 0, i64 0), i64 16)
%5 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%6 = call i32 @earworm_aesenc_round(i32* %5, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @test_aesenc_round.roundkey, i64 0, i64 0))
%7 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%8 = call i64 @memcmp(i32* %7, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @test_aesenc_round.expected_result, i64 0, i64 0), i64 16)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %0
store i32 0, i32* %1
br label %12
11: ; preds = %0
store i32 -1, i32* %1
br label %12
12: ; preds = %11, %10
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@test_aesenc_round.state_input = internal constant [16 x i32] [i32 93, i32 71, i32 83, i32 93, i32 114, i32 111, i32 116, i32 99, i32 101, i32 86, i32 116, i32 115, i32 101, i32 84, i32 91, i32 123]
@test_aesenc_round.roundkey = internal constant [16 x i32] [i32 93, i32 110, i32 111, i32 114, i32 101, i32 117, i32 71, i32 91, i32 41, i32 121, i32 97, i32 104, i32 83, i32 40, i32 105, i32 72]
@test_aesenc_round.expected_result = internal constant [16 x i32] [i32 149, i32 229, i32 215, i32 222, i32 88, i32 75, i32 16, i32 139, i32 197, i32 163, i32 219, i32 159, i32 47, i32 28, i32 49, i32 168]
define i32 @test_aesenc_round() {
%1 = alloca [16 x i32]
%2 = bitcast [16 x i32]* %1 to i8*
%3 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 0
%4 = call i32 @memcpy(i32* %3, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @test_aesenc_round.state_input, i64 0, i64 0), i64 16)
%5 = call i32 @earworm_aesenc_round(i32* %3, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @test_aesenc_round.roundkey, i64 0, i64 0))
%6 = call i64 @memcmp(i32* %3, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @test_aesenc_round.expected_result, i64 0, i64 0), i64 16)
%7 = icmp ne i64 %6, 0
%8 = sext i1 %7 to i32
ret i32 %8
}