#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 inv_shift_rows(uint8_t *state) {
  uint8_t temp;
  temp = state[1 * 4 + 3];
  state[1 * 4 + 3] = state[1 * 4 + 2];
  state[1 * 4 + 2] = state[1 * 4 + 1];
  state[1 * 4 + 1] = state[1 * 4 + 0];
  state[1 * 4 + 0] = temp;
  temp = state[2 * 4 + 0];
  state[2 * 4 + 0] = state[2 * 4 + 2];
  state[2 * 4 + 2] = temp;
  temp = state[2 * 4 + 1];
  state[2 * 4 + 1] = state[2 * 4 + 3];
  state[2 * 4 + 3] = temp;
  temp = state[3 * 4 + 0];
  state[3 * 4 + 0] = state[3 * 4 + 1];
  state[3 * 4 + 1] = state[3 * 4 + 2];
  state[3 * 4 + 2] = state[3 * 4 + 3];
  state[3 * 4 + 3] = temp;
}


x86 assembly (clang, -O0):
<inv_shift_rows>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x1c(%rax)
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x18(%rax)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x28(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x20(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x28(%rax)
mov    -0x8(%rbp),%rax
mov    0x24(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2c(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x24(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x2c(%rax)
mov    -0x8(%rbp),%rax
mov    0x30(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x34(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x30(%rax)
mov    -0x8(%rbp),%rax
mov    0x38(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x34(%rax)
mov    -0x8(%rbp),%rax
mov    0x3c(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x38(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x3c(%rax)
pop    %rbp
ret

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

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

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