#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 */

/* Variables and functions */
unsigned int load32(unsigned char const *);
void kexp(unsigned int *st, const unsigned int counter,
          const unsigned char *nonce, const unsigned char *key) {
  st[0] = 0x61707865;
  st[1] = 0x3320646e;
  st[2] = 0x79622d32;
  st[3] = 0x6b206574;
  st[4] = load32(key);
  st[5] = load32(key + 4);
  st[6] = load32(key + 8);
  st[7] = load32(key + 12);
  st[8] = load32(key + 16);
  st[9] = load32(key + 20);
  st[10] = load32(key + 24);
  st[11] = load32(key + 28);
  st[12] = counter;
  st[13] = load32(nonce);
  st[14] = load32(nonce + 4);
  st[15] = load32(nonce + 8);
}


x86 assembly (clang, -O0):
<kexp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x61707865,(%rax)
mov    -0x8(%rbp),%rax
movl   $0x3320646e,0x4(%rax)
mov    -0x8(%rbp),%rax
movl   $0x79622d32,0x8(%rax)
mov    -0x8(%rbp),%rax
movl   $0x6b206574,0xc(%rax)
mov    -0x20(%rbp),%rdi
call   1030 <load32@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x20(%rbp),%rdi
add    $0x4,%rdi
call   1030 <load32@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    -0x20(%rbp),%rdi
add    $0x8,%rdi
call   1030 <load32@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x18(%rax)
mov    -0x20(%rbp),%rdi
add    $0xc,%rdi
call   1030 <load32@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x1c(%rax)
mov    -0x20(%rbp),%rdi
add    $0x10,%rdi
call   1030 <load32@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x20(%rax)
mov    -0x20(%rbp),%rdi
add    $0x14,%rdi
call   1030 <load32@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x24(%rax)
mov    -0x20(%rbp),%rdi
add    $0x18,%rdi
call   1030 <load32@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x28(%rax)
mov    -0x20(%rbp),%rdi
add    $0x1c,%rdi
call   1030 <load32@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x2c(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x30(%rax)
mov    -0x18(%rbp),%rdi
call   1030 <load32@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x34(%rax)
mov    -0x18(%rbp),%rdi
add    $0x4,%rdi
call   1030 <load32@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x38(%rax)
mov    -0x18(%rbp),%rdi
add    $0x8,%rdi
call   1030 <load32@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x3c(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kexp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbp
mov    %rdx,%r14
mov    %esi,%r15d
mov    %rdi,%rbx
movaps 0xed6(%rip),%xmm0
movups %xmm0,(%rdi)
mov    %rcx,%rdi
call   1030 <load32@plt>
mov    %eax,0x10(%rbx)
lea    0x4(%rbp),%rdi
call   1030 <load32@plt>
mov    %eax,0x14(%rbx)
lea    0x8(%rbp),%rdi
call   1030 <load32@plt>
mov    %eax,0x18(%rbx)
lea    0xc(%rbp),%rdi
call   1030 <load32@plt>
mov    %eax,0x1c(%rbx)
lea    0x10(%rbp),%rdi
call   1030 <load32@plt>
mov    %eax,0x20(%rbx)
lea    0x14(%rbp),%rdi
call   1030 <load32@plt>
mov    %eax,0x24(%rbx)
lea    0x18(%rbp),%rdi
call   1030 <load32@plt>
mov    %eax,0x28(%rbx)
add    $0x1c,%rbp
mov    %rbp,%rdi
call   1030 <load32@plt>
mov    %eax,0x2c(%rbx)
mov    %r15d,0x30(%rbx)
mov    %r14,%rdi
call   1030 <load32@plt>
mov    %eax,0x34(%rbx)
lea    0x4(%r14),%rdi
call   1030 <load32@plt>
mov    %eax,0x38(%rbx)
add    $0x8,%r14
mov    %r14,%rdi
call   1030 <load32@plt>
mov    %eax,0x3c(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @kexp(i32* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32*, i32** %5
%10 = getelementptr inbounds i32, i32* %9, i64 0
store i32 1634760805, i32* %10
%11 = load i32*, i32** %5
%12 = getelementptr inbounds i32, i32* %11, i64 1
store i32 857760878, i32* %12
%13 = load i32*, i32** %5
%14 = getelementptr inbounds i32, i32* %13, i64 2
store i32 2036477234, i32* %14
%15 = load i32*, i32** %5
%16 = getelementptr inbounds i32, i32* %15, i64 3
store i32 1797285236, i32* %16
%17 = load i8*, i8** %8
%18 = call i32 @load32(i8* %17)
%19 = load i32*, i32** %5
%20 = getelementptr inbounds i32, i32* %19, i64 4
store i32 %18, i32* %20
%21 = load i8*, i8** %8
%22 = getelementptr inbounds i8, i8* %21, i64 4
%23 = call i32 @load32(i8* %22)
%24 = load i32*, i32** %5
%25 = getelementptr inbounds i32, i32* %24, i64 5
store i32 %23, i32* %25
%26 = load i8*, i8** %8
%27 = getelementptr inbounds i8, i8* %26, i64 8
%28 = call i32 @load32(i8* %27)
%29 = load i32*, i32** %5
%30 = getelementptr inbounds i32, i32* %29, i64 6
store i32 %28, i32* %30
%31 = load i8*, i8** %8
%32 = getelementptr inbounds i8, i8* %31, i64 12
%33 = call i32 @load32(i8* %32)
%34 = load i32*, i32** %5
%35 = getelementptr inbounds i32, i32* %34, i64 7
store i32 %33, i32* %35
%36 = load i8*, i8** %8
%37 = getelementptr inbounds i8, i8* %36, i64 16
%38 = call i32 @load32(i8* %37)
%39 = load i32*, i32** %5
%40 = getelementptr inbounds i32, i32* %39, i64 8
store i32 %38, i32* %40
%41 = load i8*, i8** %8
%42 = getelementptr inbounds i8, i8* %41, i64 20
%43 = call i32 @load32(i8* %42)
%44 = load i32*, i32** %5
%45 = getelementptr inbounds i32, i32* %44, i64 9
store i32 %43, i32* %45
%46 = load i8*, i8** %8
%47 = getelementptr inbounds i8, i8* %46, i64 24
%48 = call i32 @load32(i8* %47)
%49 = load i32*, i32** %5
%50 = getelementptr inbounds i32, i32* %49, i64 10
store i32 %48, i32* %50
%51 = load i8*, i8** %8
%52 = getelementptr inbounds i8, i8* %51, i64 28
%53 = call i32 @load32(i8* %52)
%54 = load i32*, i32** %5
%55 = getelementptr inbounds i32, i32* %54, i64 11
store i32 %53, i32* %55
%56 = load i32, i32* %6
%57 = load i32*, i32** %5
%58 = getelementptr inbounds i32, i32* %57, i64 12
store i32 %56, i32* %58
%59 = load i8*, i8** %7
%60 = call i32 @load32(i8* %59)
%61 = load i32*, i32** %5
%62 = getelementptr inbounds i32, i32* %61, i64 13
store i32 %60, i32* %62
%63 = load i8*, i8** %7
%64 = getelementptr inbounds i8, i8* %63, i64 4
%65 = call i32 @load32(i8* %64)
%66 = load i32*, i32** %5
%67 = getelementptr inbounds i32, i32* %66, i64 14
store i32 %65, i32* %67
%68 = load i8*, i8** %7
%69 = getelementptr inbounds i8, i8* %68, i64 8
%70 = call i32 @load32(i8* %69)
%71 = load i32*, i32** %5
%72 = getelementptr inbounds i32, i32* %71, i64 15
store i32 %70, i32* %72
ret void
}

LLVM IR (-O2):
define void @kexp(i32* nocapture writeonly %0, i32 %1, i8* %2, i8* %3) {
%5 = bitcast i32* %0 to <4 x i32>*
store <4 x i32> <i32 1634760805, i32 857760878, i32 2036477234, i32 1797285236>, <4 x i32>* %5
%6 = tail call i32 @load32(i8* %3)
%7 = getelementptr inbounds i32, i32* %0, i64 4
store i32 %6, i32* %7
%8 = getelementptr inbounds i8, i8* %3, i64 4
%9 = tail call i32 @load32(i8* %8)
%10 = getelementptr inbounds i32, i32* %0, i64 5
store i32 %9, i32* %10
%11 = getelementptr inbounds i8, i8* %3, i64 8
%12 = tail call i32 @load32(i8* %11)
%13 = getelementptr inbounds i32, i32* %0, i64 6
store i32 %12, i32* %13
%14 = getelementptr inbounds i8, i8* %3, i64 12
%15 = tail call i32 @load32(i8* %14)
%16 = getelementptr inbounds i32, i32* %0, i64 7
store i32 %15, i32* %16
%17 = getelementptr inbounds i8, i8* %3, i64 16
%18 = tail call i32 @load32(i8* %17)
%19 = getelementptr inbounds i32, i32* %0, i64 8
store i32 %18, i32* %19
%20 = getelementptr inbounds i8, i8* %3, i64 20
%21 = tail call i32 @load32(i8* %20)
%22 = getelementptr inbounds i32, i32* %0, i64 9
store i32 %21, i32* %22
%23 = getelementptr inbounds i8, i8* %3, i64 24
%24 = tail call i32 @load32(i8* %23)
%25 = getelementptr inbounds i32, i32* %0, i64 10
store i32 %24, i32* %25
%26 = getelementptr inbounds i8, i8* %3, i64 28
%27 = tail call i32 @load32(i8* %26)
%28 = getelementptr inbounds i32, i32* %0, i64 11
store i32 %27, i32* %28
%29 = getelementptr inbounds i32, i32* %0, i64 12
store i32 %1, i32* %29
%30 = tail call i32 @load32(i8* %2)
%31 = getelementptr inbounds i32, i32* %0, i64 13
store i32 %30, i32* %31
%32 = getelementptr inbounds i8, i8* %2, i64 4
%33 = tail call i32 @load32(i8* %32)
%34 = getelementptr inbounds i32, i32* %0, i64 14
store i32 %33, i32* %34
%35 = getelementptr inbounds i8, i8* %2, i64 8
%36 = tail call i32 @load32(i8* %35)
%37 = getelementptr inbounds i32, i32* %0, i64 15
store i32 %36, i32* %37
ret void
}