#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*/ P_layer(int /*<<< orphan*/ *);
int /*<<< orphan*/ READ_ROUND_KEY_WORD(int /*<<< orphan*/);
int /*<<< orphan*/ S_layer(int /*<<< orphan*/ *);
void round_function(uint16_t *data, uint16_t *rkey) {
  uint8_t i;
  for (i = 0; i < 4; i++)
    data[i] ^= READ_ROUND_KEY_WORD(rkey[i]);
  S_layer(data);
  P_layer(data);
}


x86 assembly (clang, -O0):
<round_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    117f <round_function+0x4f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1040 <READ_ROUND_KEY_WORD@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    1147 <round_function+0x17>
mov    -0x8(%rbp),%rdi
call   1030 <S_layer@plt>
mov    -0x8(%rbp),%rdi
call   1050 <P_layer@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_function>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rsi),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
xor    %eax,(%rbx)
mov    0x4(%r14),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
xor    %eax,0x4(%rbx)
mov    0x8(%r14),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
xor    %eax,0x8(%rbx)
mov    0xc(%r14),%edi
call   1040 <READ_ROUND_KEY_WORD@plt>
xor    %eax,0xc(%rbx)
mov    %rbx,%rdi
call   1030 <S_layer@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <P_layer@plt>

LLVM IR (-O0):
define void @round_function(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 = %22, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %25
9: ; preds = %6
%10 = load i32*, i32** %4
%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 = call i32 @READ_ROUND_KEY_WORD(i32 %14)
%16 = load i32*, i32** %3
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
%20 = load i32, i32* %19
%21 = xor i32 %20, %15
store i32 %21, i32* %19
br label %22
22: ; preds = %9
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %6
25: ; preds = %6
%26 = load i32*, i32** %3
%27 = call i32 @S_layer(i32* %26)
%28 = load i32*, i32** %3
%29 = call i32 @P_layer(i32* %28)
ret void
}

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