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

/* Variables and functions */
int READ_ROUND_CONSTANT_WORD(int);
int READ_ROUND_KEY_WORD(int);
void AddRoundRoundKeyAndRoundConstant(uint8_t *block, uint8_t *roundKey,
                                      const uint8_t *roundConstant) {
  uint8_t i;
  uint16_t *Block = (uint16_t *)block;
  uint16_t *RoundKey = (uint16_t *)roundKey;
  uint16_t *RoundConstant = (uint16_t *)roundConstant;
  for (i = 0; i < 4; i++) {
    Block[i] = Block[i] ^ READ_ROUND_CONSTANT_WORD(RoundConstant[i]);
    Block[i] = Block[i] ^ READ_ROUND_KEY_WORD(RoundKey[i]);
  }
}


x86 assembly (clang, -O0):
<AddRoundRoundKeyAndRoundConstant>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    11c7 <AddRoundRoundKeyAndRoundConstant+0xa7>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x40(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <READ_ROUND_CONSTANT_WORD@plt>
mov    -0x40(%rbp),%edx
xor    %eax,%edx
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
mov    -0x3c(%rbp),%edx
xor    %eax,%edx
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1153 <AddRoundRoundKeyAndRoundConstant+0x33>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AddRoundRoundKeyAndRoundConstant>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%r12d
mov    (%rdx),%edi
call   1030 <READ_ROUND_CONSTANT_WORD@plt>
mov    %eax,%ebp
xor    %r12d,%ebp
mov    %ebp,(%rbx)
mov    (%r14),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
xor    %ebp,%eax
mov    %eax,(%rbx)
mov    0x4(%rbx),%r12d
mov    0x4(%r15),%edi
call   1030 <READ_ROUND_CONSTANT_WORD@plt>
mov    %eax,%ebp
xor    %r12d,%ebp
mov    %ebp,0x4(%rbx)
mov    0x4(%r14),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
xor    %ebp,%eax
mov    %eax,0x4(%rbx)
mov    0x8(%rbx),%r12d
mov    0x8(%r15),%edi
call   1030 <READ_ROUND_CONSTANT_WORD@plt>
mov    %eax,%ebp
xor    %r12d,%ebp
mov    %ebp,0x8(%rbx)
mov    0x8(%r14),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
xor    %ebp,%eax
mov    %eax,0x8(%rbx)
mov    0xc(%rbx),%r12d
mov    0xc(%r15),%edi
call   1030 <READ_ROUND_CONSTANT_WORD@plt>
mov    %eax,%ebp
xor    %r12d,%ebp
mov    %ebp,0xc(%rbx)
mov    0xc(%r14),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
xor    %ebp,%eax
mov    %eax,0xc(%rbx)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @AddRoundRoundKeyAndRoundConstant(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%11 = load i32*, i32** %4
store i32* %11, i32** %8
%12 = load i32*, i32** %5
store i32* %12, i32** %9
%13 = load i32*, i32** %6
store i32* %13, i32** %10
store i32 0, i32* %7
br label %14
14: ; preds = %50, %3
%15 = load i32, i32* %7
%16 = icmp slt i32 %15, 4
br i1 %16, label %17, label %53
17: ; preds = %14
%18 = load i32*, i32** %8
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
%22 = load i32, i32* %21
%23 = load i32*, i32** %10
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
%27 = load i32, i32* %26
%28 = call i32 @READ_ROUND_CONSTANT_WORD(i32 %27)
%29 = xor i32 %22, %28
%30 = load i32*, i32** %8
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
store i32 %29, i32* %33
%34 = load i32*, i32** %8
%35 = load i32, i32* %7
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %34, i64 %36
%38 = load i32, i32* %37
%39 = load i32*, i32** %9
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %39, i64 %41
%43 = load i32, i32* %42
%44 = call i32 @READ_ROUND_KEY_WORD(i32 %43)
%45 = xor i32 %38, %44
%46 = load i32*, i32** %8
%47 = load i32, i32* %7
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i32, i32* %46, i64 %48
store i32 %45, i32* %49
br label %50
50: ; preds = %17
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 1
store i32 %52, i32* %7
br label %14
53: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @AddRoundRoundKeyAndRoundConstant(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = load i32, i32* %0
%5 = load i32, i32* %2
%6 = tail call i32 @READ_ROUND_CONSTANT_WORD(i32 %5)
%7 = xor i32 %6, %4
store i32 %7, i32* %0
%8 = load i32, i32* %1
%9 = tail call i32 @READ_ROUND_KEY_WORD(i32 %8)
%10 = xor i32 %9, %7
store i32 %10, i32* %0
%11 = getelementptr inbounds i32, i32* %0, i64 1
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %2, i64 1
%14 = load i32, i32* %13
%15 = tail call i32 @READ_ROUND_CONSTANT_WORD(i32 %14)
%16 = xor i32 %15, %12
store i32 %16, i32* %11
%17 = getelementptr inbounds i32, i32* %1, i64 1
%18 = load i32, i32* %17
%19 = tail call i32 @READ_ROUND_KEY_WORD(i32 %18)
%20 = xor i32 %19, %16
store i32 %20, i32* %11
%21 = getelementptr inbounds i32, i32* %0, i64 2
%22 = load i32, i32* %21
%23 = getelementptr inbounds i32, i32* %2, i64 2
%24 = load i32, i32* %23
%25 = tail call i32 @READ_ROUND_CONSTANT_WORD(i32 %24)
%26 = xor i32 %25, %22
store i32 %26, i32* %21
%27 = getelementptr inbounds i32, i32* %1, i64 2
%28 = load i32, i32* %27
%29 = tail call i32 @READ_ROUND_KEY_WORD(i32 %28)
%30 = xor i32 %29, %26
store i32 %30, i32* %21
%31 = getelementptr inbounds i32, i32* %0, i64 3
%32 = load i32, i32* %31
%33 = getelementptr inbounds i32, i32* %2, i64 3
%34 = load i32, i32* %33
%35 = tail call i32 @READ_ROUND_CONSTANT_WORD(i32 %34)
%36 = xor i32 %35, %32
store i32 %36, i32* %31
%37 = getelementptr inbounds i32, i32* %1, i64 3
%38 = load i32, i32* %37
%39 = tail call i32 @READ_ROUND_KEY_WORD(i32 %38)
%40 = xor i32 %39, %36
store i32 %40, i32* %31
ret void
}