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

/* Variables and functions */
int READ_ROUND_KEY_DOUBLE_WORD(int);
int rot32l8(int);
int rot32r8(int);
int /*<<< orphan*/ speckey(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
void round_f(uint32_t *left, uint32_t *right, uint32_t *roundKeys) {
  uint32_t temp;
  uint8_t i;
  uint16_t *b0_l = (uint16_t *)left;
  uint16_t *b0_r = (uint16_t *)left + 1;
  uint16_t *b1_l = (uint16_t *)right;
  uint16_t *b1_r = (uint16_t *)right + 1;
  for (i = 0; i < 3; i++) {
    *left ^= READ_ROUND_KEY_DOUBLE_WORD(roundKeys[i]);
    speckey(b0_l, b0_r);
  }
  for (i = 0; i < 3; i++) {
    *right ^= READ_ROUND_KEY_DOUBLE_WORD(roundKeys[i + 3]);
    speckey(b1_l, b1_r);
  }
  temp = *left;
  *right ^= *left ^ rot32l8(*left) ^ rot32r8(*left);
  *left = *right;
  *right = temp;
}


x86 assembly (clang, -O0):
<round_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    11c2 <round_f+0x82>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1060 <READ_ROUND_KEY_DOUBLE_WORD@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <speckey@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1183 <round_f+0x43>
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    120d <round_f+0xcd>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
call   1060 <READ_ROUND_KEY_DOUBLE_WORD@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1040 <speckey@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11c9 <round_f+0x89>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1050 <rot32l8@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
xor    %ecx,%eax
mov    %eax,-0x44(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <rot32r8@plt>
mov    -0x44(%rbp),%ecx
xor    %eax,%ecx
mov    -0x10(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_f>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x4(%rdi),%r12
mov    (%rdx),%edi
call   1060 <READ_ROUND_KEY_DOUBLE_WORD@plt>
xor    %eax,(%rbx)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <speckey@plt>
mov    0x4(%r15),%edi
call   1060 <READ_ROUND_KEY_DOUBLE_WORD@plt>
xor    %eax,(%rbx)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <speckey@plt>
mov    0x8(%r15),%edi
call   1060 <READ_ROUND_KEY_DOUBLE_WORD@plt>
xor    %eax,(%rbx)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <speckey@plt>
lea    0x4(%r14),%r12
mov    0xc(%r15),%edi
call   1060 <READ_ROUND_KEY_DOUBLE_WORD@plt>
xor    %eax,(%r14)
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <speckey@plt>
mov    0x10(%r15),%edi
call   1060 <READ_ROUND_KEY_DOUBLE_WORD@plt>
xor    %eax,(%r14)
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <speckey@plt>
mov    0x14(%r15),%edi
call   1060 <READ_ROUND_KEY_DOUBLE_WORD@plt>
xor    %eax,(%r14)
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <speckey@plt>
mov    (%rbx),%r15d
mov    %r15d,%edi
call   1050 <rot32l8@plt>
mov    %eax,%ebp
xor    %r15d,%ebp
mov    (%rbx),%edi
call   1030 <rot32r8@plt>
xor    %ebp,%eax
xor    (%r14),%eax
mov    %eax,(%rbx)
mov    %r15d,(%r14)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @round_f(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%13 = load i32*, i32** %4
store i32* %13, i32** %9
%14 = load i32*, i32** %4
%15 = getelementptr inbounds i32, i32* %14, i64 1
store i32* %15, i32** %10
%16 = load i32*, i32** %5
store i32* %16, i32** %11
%17 = load i32*, i32** %5
%18 = getelementptr inbounds i32, i32* %17, i64 1
store i32* %18, i32** %12
store i32 0, i32* %8
br label %19
19: ; preds = %35, %3
%20 = load i32, i32* %8
%21 = icmp slt i32 %20, 3
br i1 %21, label %22, label %38
22: ; preds = %19
%23 = load i32*, i32** %6
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
%27 = load i32, i32* %26
%28 = call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %27)
%29 = load i32*, i32** %4
%30 = load i32, i32* %29
%31 = xor i32 %30, %28
store i32 %31, i32* %29
%32 = load i32*, i32** %9
%33 = load i32*, i32** %10
%34 = call i32 @speckey(i32* %32, i32* %33)
br label %35
35: ; preds = %22
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
store i32 %37, i32* %8
br label %19
38: ; preds = %19
store i32 0, i32* %8
br label %39
39: ; preds = %56, %38
%40 = load i32, i32* %8
%41 = icmp slt i32 %40, 3
br i1 %41, label %42, label %59
42: ; preds = %39
%43 = load i32*, i32** %6
%44 = load i32, i32* %8
%45 = add nsw i32 %44, 3
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %43, i64 %46
%48 = load i32, i32* %47
%49 = call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %48)
%50 = load i32*, i32** %5
%51 = load i32, i32* %50
%52 = xor i32 %51, %49
store i32 %52, i32* %50
%53 = load i32*, i32** %11
%54 = load i32*, i32** %12
%55 = call i32 @speckey(i32* %53, i32* %54)
br label %56
56: ; preds = %42
%57 = load i32, i32* %8
%58 = add nsw i32 %57, 1
store i32 %58, i32* %8
br label %39
59: ; preds = %39
%60 = load i32*, i32** %4
%61 = load i32, i32* %60
store i32 %61, i32* %7
%62 = load i32*, i32** %4
%63 = load i32, i32* %62
%64 = load i32*, i32** %4
%65 = load i32, i32* %64
%66 = call i32 @rot32l8(i32 %65)
%67 = xor i32 %63, %66
%68 = load i32*, i32** %4
%69 = load i32, i32* %68
%70 = call i32 @rot32r8(i32 %69)
%71 = xor i32 %67, %70
%72 = load i32*, i32** %5
%73 = load i32, i32* %72
%74 = xor i32 %73, %71
store i32 %74, i32* %72
%75 = load i32*, i32** %5
%76 = load i32, i32* %75
%77 = load i32*, i32** %4
store i32 %76, i32* %77
%78 = load i32, i32* %7
%79 = load i32*, i32** %5
store i32 %78, i32* %79
ret void
}

LLVM IR (-O2):
define void @round_f(i32* %0, i32* %1, i32* nocapture %2) {
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %2
%6 = tail call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %5)
%7 = load i32, i32* %0
%8 = xor i32 %7, %6
store i32 %8, i32* %0
%9 = tail call i32 @speckey(i32* %0, i32* %4)
%10 = getelementptr inbounds i32, i32* %2, i64 1
%11 = load i32, i32* %10
%12 = tail call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %11)
%13 = load i32, i32* %0
%14 = xor i32 %13, %12
store i32 %14, i32* %0
%15 = tail call i32 @speckey(i32* %0, i32* %4)
%16 = getelementptr inbounds i32, i32* %2, i64 2
%17 = load i32, i32* %16
%18 = tail call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %17)
%19 = load i32, i32* %0
%20 = xor i32 %19, %18
store i32 %20, i32* %0
%21 = tail call i32 @speckey(i32* %0, i32* %4)
%22 = getelementptr inbounds i32, i32* %1, i64 1
%23 = getelementptr inbounds i32, i32* %2, i64 3
%24 = load i32, i32* %23
%25 = tail call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %24)
%26 = load i32, i32* %1
%27 = xor i32 %26, %25
store i32 %27, i32* %1
%28 = tail call i32 @speckey(i32* %1, i32* %22)
%29 = getelementptr inbounds i32, i32* %2, i64 4
%30 = load i32, i32* %29
%31 = tail call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %30)
%32 = load i32, i32* %1
%33 = xor i32 %32, %31
store i32 %33, i32* %1
%34 = tail call i32 @speckey(i32* %1, i32* %22)
%35 = getelementptr inbounds i32, i32* %2, i64 5
%36 = load i32, i32* %35
%37 = tail call i32 @READ_ROUND_KEY_DOUBLE_WORD(i32 %36)
%38 = load i32, i32* %1
%39 = xor i32 %38, %37
store i32 %39, i32* %1
%40 = tail call i32 @speckey(i32* %1, i32* %22)
%41 = load i32, i32* %0
%42 = tail call i32 @rot32l8(i32 %41)
%43 = xor i32 %42, %41
%44 = load i32, i32* %0
%45 = tail call i32 @rot32r8(i32 %44)
%46 = xor i32 %43, %45
%47 = load i32, i32* %1
%48 = xor i32 %46, %47
store i32 %48, i32* %0
store i32 %41, i32* %1
ret void
}