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

/* Variables and functions */
void sr(uint8_t *arr) {
  uint8_t out[33];
  out[0] = arr[0];
  out[1] = arr[1];
  out[2] = arr[2];
  out[3] = arr[3];
  out[4] = arr[5];
  out[5] = arr[6];
  out[6] = arr[7];
  out[7] = arr[4];
  out[8] = arr[10];
  out[9] = arr[11];
  out[10] = arr[8];
  out[11] = arr[9];
  out[12] = arr[15];
  out[13] = arr[12];
  out[14] = arr[13];
  out[15] = arr[14];
  for (int i = 0; i < 16; i++) {
    arr[i] = out[i];
  }
}


x86 assembly (clang, -O0):
<sr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x90(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x88(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x84(%rbp)
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%eax
mov    %eax,-0x80(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%eax
mov    %eax,-0x78(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%eax
mov    %eax,-0x74(%rbp)
mov    -0x8(%rbp),%rax
mov    0x28(%rax),%eax
mov    %eax,-0x70(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2c(%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%eax
mov    %eax,-0x68(%rbp)
mov    -0x8(%rbp),%rax
mov    0x24(%rax),%eax
mov    %eax,-0x64(%rbp)
mov    -0x8(%rbp),%rax
mov    0x3c(%rax),%eax
mov    %eax,-0x60(%rbp)
mov    -0x8(%rbp),%rax
mov    0x30(%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x8(%rbp),%rax
mov    0x34(%rax),%eax
mov    %eax,-0x58(%rbp)
mov    -0x8(%rbp),%rax
mov    0x38(%rax),%eax
mov    %eax,-0x54(%rbp)
movl   $0x0,-0x94(%rbp)
cmpl   $0x10,-0x94(%rbp)
jge    11fe <sr+0xfe>
movslq -0x94(%rbp),%rax
mov    -0x90(%rbp,%rax,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x94(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    11c1 <sr+0xc1>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sr>:
movdqu 0x10(%rdi),%xmm0
movdqu 0x20(%rdi),%xmm1
movdqu 0x30(%rdi),%xmm2
pshufd $0x39,%xmm0,%xmm0
movdqu %xmm0,0x10(%rdi)
pshufd $0x4e,%xmm1,%xmm0
movdqu %xmm0,0x20(%rdi)
pshufd $0x93,%xmm2,%xmm0
movdqu %xmm0,0x30(%rdi)
ret

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

LLVM IR (-O2):
define void @sr(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 4
%3 = bitcast i32* %2 to <4 x i32>*
%4 = load <4 x i32>, <4 x i32>* %3
%5 = getelementptr inbounds i32, i32* %0, i64 8
%6 = bitcast i32* %5 to <4 x i32>*
%7 = load <4 x i32>, <4 x i32>* %6
%8 = getelementptr inbounds i32, i32* %0, i64 12
%9 = bitcast i32* %8 to <4 x i32>*
%10 = load <4 x i32>, <4 x i32>* %9
%11 = shufflevector <4 x i32> %4, <4 x i32> poison, <4 x i32> <i32 1, i32 2, i32 3, i32 0>
%12 = bitcast i32* %2 to <4 x i32>*
store <4 x i32> %11, <4 x i32>* %12
%13 = shufflevector <4 x i32> %7, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
%14 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> %13, <4 x i32>* %14
%15 = shufflevector <4 x i32> %10, <4 x i32> poison, <4 x i32> <i32 3, i32 0, i32 1, i32 2>
%16 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> %15, <4 x i32>* %16
ret void
}