#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 READ_ROUND_KEY_BYTE(int);
void Whitening(uint8_t *block, uint8_t *roundKey) {
  uint8_t i;
  for (i = 0; i < 8; i++) {
    block[i] = block[i] ^ READ_ROUND_KEY_BYTE(roundKey[i]);
  }
}


x86 assembly (clang, -O0):
<Whitening>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    116d <Whitening+0x5d>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <READ_ROUND_KEY_BYTE@plt>
mov    -0x18(%rbp),%edx
xor    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <Whitening+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Whitening>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%ebp
mov    (%rsi),%edi
call   1030 <READ_ROUND_KEY_BYTE@plt>
xor    %ebp,%eax
mov    %eax,(%rbx)
mov    0x4(%rbx),%ebp
mov    0x4(%r14),%edi
call   1030 <READ_ROUND_KEY_BYTE@plt>
xor    %ebp,%eax
mov    %eax,0x4(%rbx)
mov    0x8(%rbx),%ebp
mov    0x8(%r14),%edi
call   1030 <READ_ROUND_KEY_BYTE@plt>
xor    %ebp,%eax
mov    %eax,0x8(%rbx)
mov    0xc(%rbx),%ebp
mov    0xc(%r14),%edi
call   1030 <READ_ROUND_KEY_BYTE@plt>
xor    %ebp,%eax
mov    %eax,0xc(%rbx)
mov    0x10(%rbx),%ebp
mov    0x10(%r14),%edi
call   1030 <READ_ROUND_KEY_BYTE@plt>
xor    %ebp,%eax
mov    %eax,0x10(%rbx)
mov    0x14(%rbx),%ebp
mov    0x14(%r14),%edi
call   1030 <READ_ROUND_KEY_BYTE@plt>
xor    %ebp,%eax
mov    %eax,0x14(%rbx)
mov    0x18(%rbx),%ebp
mov    0x18(%r14),%edi
call   1030 <READ_ROUND_KEY_BYTE@plt>
xor    %ebp,%eax
mov    %eax,0x18(%rbx)
mov    0x1c(%rbx),%ebp
mov    0x1c(%r14),%edi
call   1030 <READ_ROUND_KEY_BYTE@plt>
xor    %ebp,%eax
mov    %eax,0x1c(%rbx)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @Whitening(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
store i32 0, i32* %5
br label %6
6: ; preds = %26, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 8
br i1 %8, label %9, label %29
9: ; preds = %6
%10 = load i32*, i32** %3
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %10, i64 %12
%14 = load i32, i32* %13
%15 = load i32*, i32** %4
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
%19 = load i32, i32* %18
%20 = call i32 @READ_ROUND_KEY_BYTE(i32 %19)
%21 = xor i32 %14, %20
%22 = load i32*, i32** %3
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
store i32 %21, i32* %25
br label %26
26: ; preds = %9
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %6
29: ; preds = %6
ret void
}

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