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

/* Variables and functions */
int READ_ROUND_KEY_DOUBLE_WORD(int const);
int rot32l3(int);
int rot32r8(int);
void Encrypt(uint8_t *block, uint8_t *roundKeys) {
  uint32_t *block32 = (uint32_t *)block;
  const uint32_t *rk = (uint32_t *)roundKeys;
  uint32_t y = block32[0];
  uint32_t x = block32[1];
  uint8_t i;
  for (i = 0; i < 27; ++i) {
    x = (rot32r8(x) + y) ^ READ_ROUND_KEY_DOUBLE_WORD(rk[i]);
    y = rot32l3(y) ^ x;
  }
  block32[0] = y;
  block32[1] = x;
}


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,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x1b,-0x2c(%rbp)
jge    11b8 <Encrypt+0x88>
mov    -0x28(%rbp),%edi
call   1030 <rot32r8@plt>
add    -0x24(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1050 <READ_ROUND_KEY_DOUBLE_WORD@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
xor    %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%edi
call   1040 <rot32l3@plt>
xor    -0x28(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    116a <Encrypt+0x3a>
mov    -0x24(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Encrypt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    (%rdi),%ebp
mov    0x4(%rdi),%ebx
xor    %r13d,%r13d
nopl   0x0(%rax)
mov    %ebx,%edi
call   1030 <rot32r8@plt>
mov    %eax,%r12d
add    %ebp,%r12d
mov    (%r15,%r13,4),%edi
call   1050 <READ_ROUND_KEY_DOUBLE_WORD@plt>
mov    %eax,%ebx
xor    %r12d,%ebx
mov    %ebp,%edi
call   1040 <rot32l3@plt>
mov    %eax,%ebp
xor    %ebx,%ebp
add    $0x1,%r13
cmp    $0x1b,%r13
jne    1150 <Encrypt+0x20>
mov    %ebp,(%r14)
mov    %ebx,0x4(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
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
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%10 = load i32*, i32** %3
store i32* %10, i32** %5
%11 = load i32*, i32** %4
store i32* %11, i32** %6
%12 = load i32*, i32** %5
%13 = getelementptr inbounds i32, i32* %12, i64 0
%14 = load i32, i32* %13
store i32 %14, i32* %7
%15 = load i32*, i32** %5
%16 = getelementptr inbounds i32, i32* %15, i64 1
%17 = load i32, i32* %16
store i32 %17, i32* %8
store i32 0, i32* %9
br label %18
18: ; preds = %37, %2
%19 = load i32, i32* %9
%20 = icmp slt i32 %19, 27
br i1 %20, label %21, label %40
21: ; preds = %18
%22 = load i32, i32* %8
%23 = call i32 @rot32r8(i32 %22)
%24 = load i32, i32* %7
%25 = add nsw i32 %23, %24
%26 = load i32*, i32** %6
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %26, i64 %28
%30 = load i32, i32* %29
%31 = call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %30)
%32 = xor i32 %25, %31
store i32 %32, i32* %8
%33 = load i32, i32* %7
%34 = call i32 @rot32l3(i32 %33)
%35 = load i32, i32* %8
%36 = xor i32 %34, %35
store i32 %36, i32* %7
br label %37
37: ; preds = %21
%38 = load i32, i32* %9
%39 = add nsw i32 %38, 1
store i32 %39, i32* %9
br label %18
40: ; preds = %18
%41 = load i32, i32* %7
%42 = load i32*, i32** %5
%43 = getelementptr inbounds i32, i32* %42, i64 0
store i32 %41, i32* %43
%44 = load i32, i32* %8
%45 = load i32*, i32** %5
%46 = getelementptr inbounds i32, i32* %45, i64 1
store i32 %44, i32* %46
ret void
}

LLVM IR (-O2):
define void @Encrypt(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
br label %6
6: ; preds = %2, %6
%7 = phi i64 [ 0, %2 ], [ %18, %6 ]
%8 = phi i32 [ %5, %2 ], [ %15, %6 ]
%9 = phi i32 [ %3, %2 ], [ %17, %6 ]
%10 = tail call i32 @rot32r8(i32 %8)
%11 = add nsw i32 %10, %9
%12 = getelementptr inbounds i32, i32* %1, i64 %7
%13 = load i32, i32* %12
%14 = tail call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %13)
%15 = xor i32 %14, %11
%16 = tail call i32 @rot32l3(i32 %9)
%17 = xor i32 %16, %15
%18 = add nuw nsw i64 %7, 1
%19 = icmp eq i64 %18, 27
br i1 %19, label %20, label %6
20: ; preds = %6
store i32 %17, i32* %0
store i32 %15, i32* %4
ret void
}