#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);
int /*<<< orphan*/ rrr_L(int *);
int /*<<< orphan*/ rrr_sbox(int *);
void rrr_SLK(uint8_t *data, uint8_t *key_part) {
  uint8_t i;
  rrr_sbox(data);
  for (i = 0; i < 4; i++) {
    rrr_L(data + i);
    data[i] ^= READ_ROUND_KEY_BYTE(key_part[i]);
  }
}


x86 assembly (clang, -O0):
<rrr_SLK>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <rrr_sbox@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    119c <rrr_SLK+0x6c>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1050 <rrr_L@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
mov    %eax,%edx
mov    -0x8(%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    1150 <rrr_SLK+0x20>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rrr_SLK>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <rrr_sbox@plt>
mov    %rbx,%rdi
call   1050 <rrr_L@plt>
mov    (%r14),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %eax,(%rbx)
lea    0x4(%rbx),%rdi
call   1050 <rrr_L@plt>
mov    0x4(%r14),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %eax,0x4(%rbx)
lea    0x8(%rbx),%rdi
call   1050 <rrr_L@plt>
mov    0x8(%r14),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %eax,0x8(%rbx)
lea    0xc(%rbx),%rdi
call   1050 <rrr_L@plt>
mov    0xc(%r14),%edi
call   1040 <READ_ROUND_KEY_BYTE@plt>
xor    %eax,0xc(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @rrr_SLK(i32* %0, i32* nocapture %1) {
%3 = tail call i32 @rrr_sbox(i32* %0)
%4 = tail call i32 @rrr_L(i32* %0)
%5 = load i32, i32* %1
%6 = tail call i32 @READ_ROUND_KEY_BYTE(i32 %5)
%7 = load i32, i32* %0
%8 = xor i32 %7, %6
store i32 %8, i32* %0
%9 = getelementptr inbounds i32, i32* %0, i64 1
%10 = tail call i32 @rrr_L(i32* %9)
%11 = getelementptr inbounds i32, i32* %1, i64 1
%12 = load i32, i32* %11
%13 = tail call i32 @READ_ROUND_KEY_BYTE(i32 %12)
%14 = load i32, i32* %9
%15 = xor i32 %14, %13
store i32 %15, i32* %9
%16 = getelementptr inbounds i32, i32* %0, i64 2
%17 = tail call i32 @rrr_L(i32* %16)
%18 = getelementptr inbounds i32, i32* %1, i64 2
%19 = load i32, i32* %18
%20 = tail call i32 @READ_ROUND_KEY_BYTE(i32 %19)
%21 = load i32, i32* %16
%22 = xor i32 %21, %20
store i32 %22, i32* %16
%23 = getelementptr inbounds i32, i32* %0, i64 3
%24 = tail call i32 @rrr_L(i32* %23)
%25 = getelementptr inbounds i32, i32* %1, i64 3
%26 = load i32, i32* %25
%27 = tail call i32 @READ_ROUND_KEY_BYTE(i32 %26)
%28 = load i32, i32* %23
%29 = xor i32 %28, %27
store i32 %29, i32* %23
ret void
}