#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 = 0;
  while (i < 26) {
    x = (rot32r8(x) + y) ^ READ_ROUND_KEY_DOUBLE_WORD(rk[i++]);
    y = rot32l3(y) ^ x;
    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    $0x40,%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   $0x1a,-0x2c(%rbp)
jge    11f9 <Encrypt+0xc9>
mov    -0x28(%rbp),%edi
call   1030 <rot32r8@plt>
add    -0x24(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x2c(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
call   1050 <READ_ROUND_KEY_DOUBLE_WORD@plt>
mov    %eax,%ecx
mov    -0x34(%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    -0x28(%rbp),%edi
call   1030 <rot32r8@plt>
add    -0x24(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x2c(%rbp)
movslq %ecx,%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)
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    $0x40,%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),%ebx
mov    0x4(%rdi),%ebp
mov    $0xfffffffffffffffe,%r13
nopl   (%rax)
mov    %ebp,%edi
call   1030 <rot32r8@plt>
lea    (%rax,%rbx,1),%ebp
mov    0x8(%r15,%r13,4),%edi
call   1050 <READ_ROUND_KEY_DOUBLE_WORD@plt>
xor    %eax,%ebp
mov    %ebx,%edi
call   1040 <rot32l3@plt>
mov    %eax,%r12d
xor    %ebp,%r12d
mov    %ebp,%edi
call   1030 <rot32r8@plt>
mov    %eax,%ebx
add    %r12d,%ebx
mov    0xc(%r15,%r13,4),%edi
call   1050 <READ_ROUND_KEY_DOUBLE_WORD@plt>
mov    %eax,%ebp
xor    %ebx,%ebp
mov    %r12d,%edi
call   1040 <rot32l3@plt>
mov    %eax,%ebx
xor    %ebp,%ebx
add    $0x2,%r13
cmp    $0x18,%r13
jb     1150 <Encrypt+0x20>
mov    %ebx,(%r14)
mov    %ebp,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 = %21, %2
%19 = load i32, i32* %9
%20 = icmp slt i32 %19, 26
br i1 %20, label %21, label %54
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 = add nsw i32 %27, 1
store i32 %28, i32* %9
%29 = sext i32 %27 to i64
%30 = getelementptr inbounds i32, i32* %26, i64 %29
%31 = load i32, i32* %30
%32 = call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %31)
%33 = xor i32 %25, %32
store i32 %33, i32* %8
%34 = load i32, i32* %7
%35 = call i32 @rot32l3(i32 %34)
%36 = load i32, i32* %8
%37 = xor i32 %35, %36
store i32 %37, i32* %7
%38 = load i32, i32* %8
%39 = call i32 @rot32r8(i32 %38)
%40 = load i32, i32* %7
%41 = add nsw i32 %39, %40
%42 = load i32*, i32** %6
%43 = load i32, i32* %9
%44 = add nsw i32 %43, 1
store i32 %44, i32* %9
%45 = sext i32 %43 to i64
%46 = getelementptr inbounds i32, i32* %42, i64 %45
%47 = load i32, i32* %46
%48 = call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %47)
%49 = xor i32 %41, %48
store i32 %49, i32* %8
%50 = load i32, i32* %7
%51 = call i32 @rot32l3(i32 %50)
%52 = load i32, i32* %8
%53 = xor i32 %51, %52
store i32 %53, i32* %7
br label %18
54: ; preds = %18
%55 = load i32, i32* %7
%56 = load i32*, i32** %5
%57 = getelementptr inbounds i32, i32* %56, i64 0
store i32 %55, i32* %57
%58 = load i32, i32* %8
%59 = load i32*, i32** %5
%60 = getelementptr inbounds i32, i32* %59, i64 1
store i32 %58, i32* %60
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 ], [ %21, %6 ]
%8 = phi i32 [ %5, %2 ], [ %25, %6 ]
%9 = phi i32 [ %3, %2 ], [ %27, %6 ]
%10 = tail call i32 @rot32r8(i32 %8)
%11 = add nsw i32 %10, %9
%12 = or i64 %7, 1
%13 = getelementptr inbounds i32, i32* %1, i64 %7
%14 = load i32, i32* %13
%15 = tail call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %14)
%16 = xor i32 %15, %11
%17 = tail call i32 @rot32l3(i32 %9)
%18 = xor i32 %17, %16
%19 = tail call i32 @rot32r8(i32 %16)
%20 = add nsw i32 %19, %18
%21 = add nuw nsw i64 %7, 2
%22 = getelementptr inbounds i32, i32* %1, i64 %12
%23 = load i32, i32* %22
%24 = tail call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %23)
%25 = xor i32 %24, %20
%26 = tail call i32 @rot32l3(i32 %18)
%27 = xor i32 %26, %25
%28 = icmp ult i64 %7, 24
br i1 %28, label %6, label %29
29: ; preds = %6
store i32 %27, i32* %0
store i32 %25, i32* %4
ret void
}