#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 /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_load_si128(int /*<<< orphan*/ const *);
int /*<<< orphan*/ aes_genkey_sub(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                  int);
void aes_genkey(const __m128i *memory, __m128i *k0, __m128i *k1, __m128i *k2,
                __m128i *k3, __m128i *k4, __m128i *k5, __m128i *k6, __m128i *k7,
                __m128i *k8, __m128i *k9) {
  __m128i xout0 = _mm_load_si128(memory);
  __m128i xout2 = _mm_load_si128(memory + 1);
  *k0 = xout0;
  *k1 = xout2;
  aes_genkey_sub(&xout0, &xout2, 0x1);
  *k2 = xout0;
  *k3 = xout2;
  aes_genkey_sub(&xout0, &xout2, 0x2);
  *k4 = xout0;
  *k5 = xout2;
  aes_genkey_sub(&xout0, &xout2, 0x4);
  *k6 = xout0;
  *k7 = xout2;
  aes_genkey_sub(&xout0, &xout2, 0x8);
  *k8 = xout0;
  *k9 = xout2;
}


x86 assembly (clang, -O0):
<aes_genkey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <_mm_load_si128@plt>
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
call   1030 <_mm_load_si128@plt>
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
lea    -0x34(%rbp),%rdi
lea    -0x38(%rbp),%rsi
mov    $0x1,%edx
call   1040 <aes_genkey_sub@plt>
mov    -0x34(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
lea    -0x34(%rbp),%rdi
lea    -0x38(%rbp),%rsi
mov    $0x2,%edx
call   1040 <aes_genkey_sub@plt>
mov    -0x34(%rbp),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
lea    -0x34(%rbp),%rdi
lea    -0x38(%rbp),%rsi
mov    $0x4,%edx
call   1040 <aes_genkey_sub@plt>
mov    -0x34(%rbp),%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%ecx
mov    0x20(%rbp),%rax
mov    %ecx,(%rax)
lea    -0x34(%rbp),%rdi
lea    -0x38(%rbp),%rsi
mov    $0x8,%edx
call   1040 <aes_genkey_sub@plt>
mov    -0x34(%rbp),%ecx
mov    0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%ecx
mov    0x30(%rbp),%rax
mov    %ecx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aes_genkey>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,%r15
mov    %rcx,%r13
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1030 <_mm_load_si128@plt>
mov    %eax,%r14d
mov    %eax,0xc(%rsp)
add    $0x4,%rbp
mov    %rbp,%rdi
call   1030 <_mm_load_si128@plt>
mov    %eax,0x8(%rsp)
mov    %r14d,(%rbx)
mov    %eax,(%r12)
lea    0xc(%rsp),%rbx
lea    0x8(%rsp),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x1,%edx
call   1040 <aes_genkey_sub@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x0(%r13)
mov    0x8(%rsp),%eax
mov    %eax,(%r15)
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x2,%edx
call   1040 <aes_genkey_sub@plt>
mov    0xc(%rsp),%eax
mov    0x10(%rsp),%rcx
mov    %eax,(%rcx)
mov    0x8(%rsp),%eax
mov    0x50(%rsp),%rcx
mov    %eax,(%rcx)
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x4,%edx
call   1040 <aes_genkey_sub@plt>
mov    0xc(%rsp),%eax
mov    0x58(%rsp),%rcx
mov    %eax,(%rcx)
mov    0x8(%rsp),%eax
mov    0x60(%rsp),%rcx
mov    %eax,(%rcx)
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x8,%edx
call   1040 <aes_genkey_sub@plt>
mov    0xc(%rsp),%eax
mov    0x68(%rsp),%rcx
mov    %eax,(%rcx)
mov    0x8(%rsp),%eax
mov    0x70(%rsp),%rcx
mov    %eax,(%rcx)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @aes_genkey(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10) {
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca i32*
%20 = alloca i32*
%21 = alloca i32*
%22 = alloca i32*
%23 = alloca i32
%24 = alloca i32
store i32* %0, i32** %12
store i32* %1, i32** %13
store i32* %2, i32** %14
store i32* %3, i32** %15
store i32* %4, i32** %16
store i32* %5, i32** %17
store i32* %6, i32** %18
store i32* %7, i32** %19
store i32* %8, i32** %20
store i32* %9, i32** %21
store i32* %10, i32** %22
%25 = load i32*, i32** %12
%26 = call i32 @_mm_load_si128(i32* %25)
store i32 %26, i32* %23
%27 = load i32*, i32** %12
%28 = getelementptr inbounds i32, i32* %27, i64 1
%29 = call i32 @_mm_load_si128(i32* %28)
store i32 %29, i32* %24
%30 = load i32, i32* %23
%31 = load i32*, i32** %13
store i32 %30, i32* %31
%32 = load i32, i32* %24
%33 = load i32*, i32** %14
store i32 %32, i32* %33
%34 = call i32 @aes_genkey_sub(i32* %23, i32* %24, i32 1)
%35 = load i32, i32* %23
%36 = load i32*, i32** %15
store i32 %35, i32* %36
%37 = load i32, i32* %24
%38 = load i32*, i32** %16
store i32 %37, i32* %38
%39 = call i32 @aes_genkey_sub(i32* %23, i32* %24, i32 2)
%40 = load i32, i32* %23
%41 = load i32*, i32** %17
store i32 %40, i32* %41
%42 = load i32, i32* %24
%43 = load i32*, i32** %18
store i32 %42, i32* %43
%44 = call i32 @aes_genkey_sub(i32* %23, i32* %24, i32 4)
%45 = load i32, i32* %23
%46 = load i32*, i32** %19
store i32 %45, i32* %46
%47 = load i32, i32* %24
%48 = load i32*, i32** %20
store i32 %47, i32* %48
%49 = call i32 @aes_genkey_sub(i32* %23, i32* %24, i32 8)
%50 = load i32, i32* %23
%51 = load i32*, i32** %21
store i32 %50, i32* %51
%52 = load i32, i32* %24
%53 = load i32*, i32** %22
store i32 %52, i32* %53
ret void
}

LLVM IR (-O2):
define void @aes_genkey(i32* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4, i32* nocapture writeonly %5, i32* nocapture writeonly %6, i32* nocapture writeonly %7, i32* nocapture writeonly %8, i32* nocapture writeonly %9, i32* nocapture writeonly %10) {
%12 = alloca i32
%13 = alloca i32
%14 = bitcast i32* %12 to i8*
%15 = tail call i32 @_mm_load_si128(i32* %0)
store i32 %15, i32* %12
%16 = bitcast i32* %13 to i8*
%17 = getelementptr inbounds i32, i32* %0, i64 1
%18 = tail call i32 @_mm_load_si128(i32* %17)
store i32 %18, i32* %13
store i32 %15, i32* %1
store i32 %18, i32* %2
%19 = call i32 @aes_genkey_sub(i32* %12, i32* %13, i32 1)
%20 = load i32, i32* %12
store i32 %20, i32* %3
%21 = load i32, i32* %13
store i32 %21, i32* %4
%22 = call i32 @aes_genkey_sub(i32* %12, i32* %13, i32 2)
%23 = load i32, i32* %12
store i32 %23, i32* %5
%24 = load i32, i32* %13
store i32 %24, i32* %6
%25 = call i32 @aes_genkey_sub(i32* %12, i32* %13, i32 4)
%26 = load i32, i32* %12
store i32 %26, i32* %7
%27 = load i32, i32* %13
store i32 %27, i32* %8
%28 = call i32 @aes_genkey_sub(i32* %12, i32* %13, i32 8)
%29 = load i32, i32* %12
store i32 %29, i32* %9
%30 = load i32, i32* %13
store i32 %30, i32* %10
ret void
}