#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;

/* Variables and functions */
void invShiftRow(uint8_t state[4][4]) {
  uint8_t i, j;
  uint8_t tmp[4];
  for (i = 1; i < 4; i++) {
    for (j = 0; j < 4; j++) {
      tmp[j] = state[i][j];
    }
    for (j = 0; j < 4; j++) {
      state[i][j] = tmp[(j + (4 - i)) & 3];
    }
  }
}


x86 assembly (clang, -O0):
<invShiftRow>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    11b4 <invShiftRow+0xb4>
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    1156 <invShiftRow+0x56>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
movslq -0x10(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1120 <invShiftRow+0x20>
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    11a1 <invShiftRow+0xa1>
mov    -0x10(%rbp),%eax
mov    $0x4,%ecx
sub    -0xc(%rbp),%ecx
add    %ecx,%eax
and    $0x3,%eax
cltq
mov    -0x20(%rbp,%rax,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115d <invShiftRow+0x5d>
jmp    11a6 <invShiftRow+0xa6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <invShiftRow+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<invShiftRow>:
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 @invShiftRow([4 x i32]* %0) {
%2 = alloca [4 x i32]*
%3 = alloca i32
%4 = alloca i32
%5 = alloca [4 x i32]
store [4 x i32]* %0, [4 x i32]** %2
store i32 1, i32* %3
br label %6
6: ; preds = %52, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %55
9: ; preds = %6
store i32 0, i32* %4
br label %10
10: ; preds = %25, %9
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 4
br i1 %12, label %13, label %28
13: ; preds = %10
%14 = load [4 x i32]*, [4 x i32]** %2
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %14, i64 %16
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [4 x i32], [4 x i32]* %17, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 %23
store i32 %21, i32* %24
br label %25
25: ; preds = %13
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %10
28: ; preds = %10
store i32 0, i32* %4
br label %29
29: ; preds = %48, %28
%30 = load i32, i32* %4
%31 = icmp slt i32 %30, 4
br i1 %31, label %32, label %51
32: ; preds = %29
%33 = load i32, i32* %4
%34 = load i32, i32* %3
%35 = sub nsw i32 4, %34
%36 = add nsw i32 %33, %35
%37 = and i32 %36, 3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = load [4 x i32]*, [4 x i32]** %2
%42 = load i32, i32* %3
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [4 x i32], [4 x i32]* %41, i64 %43
%45 = load i32, i32* %4
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [4 x i32], [4 x i32]* %44, i64 0, i64 %46
store i32 %40, i32* %47
br label %48
48: ; preds = %32
%49 = load i32, i32* %4
%50 = add nsw i32 %49, 1
store i32 %50, i32* %4
br label %29
51: ; preds = %29
br label %52
52: ; preds = %51
%53 = load i32, i32* %3
%54 = add nsw i32 %53, 1
store i32 %54, i32* %3
br label %6
55: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @invShiftRow([4 x i32]* nocapture %0) {
%2 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 1, i64 0
%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 [4 x i32], [4 x i32]* %0, i64 2, i64 0
%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 [4 x i32], [4 x i32]* %0, i64 3, i64 0
%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
}