#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 /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ READ_ROUND_KEY_WORD(int /*<<< orphan*/);
int /*<<< orphan*/ round_f(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
void Encrypt(uint8_t *block, uint8_t *roundKeys) {
  uint8_t i;
  uint16_t *Block = (uint16_t *)block;
  uint16_t *RoundKeys = (uint16_t *)roundKeys;
  for (i = 0; i < 8; i++) {
    round_f(Block, &RoundKeys[32 * i]);
  }
  for (i = 0; i < 8; i++) {
    Block[i] ^= READ_ROUND_KEY_WORD(RoundKeys[32 * 8 + i]);
  }
}


x86 assembly (clang, -O0):
<Encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    117b <Encrypt+0x5b>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x14(%rbp),%eax
shl    $0x5,%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
call   1030 <round_f@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <Encrypt+0x27>
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    11c2 <Encrypt+0xa2>
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x100,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
xor    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1182 <Encrypt+0x62>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Encrypt>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
call   1030 <round_f@plt>
lea    0x80(%rbx),%rsi
mov    %r14,%rdi
call   1030 <round_f@plt>
lea    0x100(%rbx),%rsi
mov    %r14,%rdi
call   1030 <round_f@plt>
lea    0x180(%rbx),%rsi
mov    %r14,%rdi
call   1030 <round_f@plt>
lea    0x200(%rbx),%rsi
mov    %r14,%rdi
call   1030 <round_f@plt>
lea    0x280(%rbx),%rsi
mov    %r14,%rdi
call   1030 <round_f@plt>
lea    0x300(%rbx),%rsi
mov    %r14,%rdi
call   1030 <round_f@plt>
lea    0x380(%rbx),%rsi
mov    %r14,%rdi
call   1030 <round_f@plt>
mov    0x400(%rbx),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
xor    %eax,(%r14)
mov    0x404(%rbx),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
xor    %eax,0x4(%r14)
mov    0x408(%rbx),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
xor    %eax,0x8(%r14)
mov    0x40c(%rbx),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
xor    %eax,0xc(%r14)
mov    0x410(%rbx),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
xor    %eax,0x10(%r14)
mov    0x414(%rbx),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
xor    %eax,0x14(%r14)
mov    0x418(%rbx),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
xor    %eax,0x18(%r14)
mov    0x41c(%rbx),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
xor    %eax,0x1c(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @Encrypt(i32* %0, i32* %1) {
%3 = tail call i32 @round_f(i32* %0, i32* %1)
%4 = getelementptr inbounds i32, i32* %1, i64 32
%5 = tail call i32 @round_f(i32* %0, i32* %4)
%6 = getelementptr inbounds i32, i32* %1, i64 64
%7 = tail call i32 @round_f(i32* %0, i32* %6)
%8 = getelementptr inbounds i32, i32* %1, i64 96
%9 = tail call i32 @round_f(i32* %0, i32* %8)
%10 = getelementptr inbounds i32, i32* %1, i64 128
%11 = tail call i32 @round_f(i32* %0, i32* %10)
%12 = getelementptr inbounds i32, i32* %1, i64 160
%13 = tail call i32 @round_f(i32* %0, i32* %12)
%14 = getelementptr inbounds i32, i32* %1, i64 192
%15 = tail call i32 @round_f(i32* %0, i32* %14)
%16 = getelementptr inbounds i32, i32* %1, i64 224
%17 = tail call i32 @round_f(i32* %0, i32* %16)
%18 = getelementptr inbounds i32, i32* %1, i64 256
%19 = load i32, i32* %18
%20 = tail call i32 @READ_ROUND_KEY_WORD(i32 %19)
%21 = load i32, i32* %0
%22 = xor i32 %21, %20
store i32 %22, i32* %0
%23 = getelementptr inbounds i32, i32* %1, i64 257
%24 = load i32, i32* %23
%25 = tail call i32 @READ_ROUND_KEY_WORD(i32 %24)
%26 = getelementptr inbounds i32, i32* %0, i64 1
%27 = load i32, i32* %26
%28 = xor i32 %27, %25
store i32 %28, i32* %26
%29 = getelementptr inbounds i32, i32* %1, i64 258
%30 = load i32, i32* %29
%31 = tail call i32 @READ_ROUND_KEY_WORD(i32 %30)
%32 = getelementptr inbounds i32, i32* %0, i64 2
%33 = load i32, i32* %32
%34 = xor i32 %33, %31
store i32 %34, i32* %32
%35 = getelementptr inbounds i32, i32* %1, i64 259
%36 = load i32, i32* %35
%37 = tail call i32 @READ_ROUND_KEY_WORD(i32 %36)
%38 = getelementptr inbounds i32, i32* %0, i64 3
%39 = load i32, i32* %38
%40 = xor i32 %39, %37
store i32 %40, i32* %38
%41 = getelementptr inbounds i32, i32* %1, i64 260
%42 = load i32, i32* %41
%43 = tail call i32 @READ_ROUND_KEY_WORD(i32 %42)
%44 = getelementptr inbounds i32, i32* %0, i64 4
%45 = load i32, i32* %44
%46 = xor i32 %45, %43
store i32 %46, i32* %44
%47 = getelementptr inbounds i32, i32* %1, i64 261
%48 = load i32, i32* %47
%49 = tail call i32 @READ_ROUND_KEY_WORD(i32 %48)
%50 = getelementptr inbounds i32, i32* %0, i64 5
%51 = load i32, i32* %50
%52 = xor i32 %51, %49
store i32 %52, i32* %50
%53 = getelementptr inbounds i32, i32* %1, i64 262
%54 = load i32, i32* %53
%55 = tail call i32 @READ_ROUND_KEY_WORD(i32 %54)
%56 = getelementptr inbounds i32, i32* %0, i64 6
%57 = load i32, i32* %56
%58 = xor i32 %57, %55
store i32 %58, i32* %56
%59 = getelementptr inbounds i32, i32* %1, i64 263
%60 = load i32, i32* %59
%61 = tail call i32 @READ_ROUND_KEY_WORD(i32 %60)
%62 = getelementptr inbounds i32, i32* %0, i64 7
%63 = load i32, i32* %62
%64 = xor i32 %63, %61
store i32 %64, i32* %62
ret void
}