#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 ShiftRows(uint8_t InValue[]) {
  uint8_t TempValue[16];
  uint8_t i;
  for (i = 0; i < 16; i++) {
    TempValue[i] = InValue[i];
  }
  for (i = 0; i < 16; i++) {
    InValue[i] = TempValue[(i + ((i % 4) * 4)) % 16];
  }
}


x86 assembly (clang, -O0):
<ShiftRows>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0x10,-0x54(%rbp)
jge    113a <ShiftRows+0x3a>
mov    -0x8(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    110f <ShiftRows+0xf>
movl   $0x0,-0x54(%rbp)
cmpl   $0x10,-0x54(%rbp)
jge    118c <ShiftRows+0x8c>
mov    -0x54(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x58(%rbp),%eax
shl    $0x2,%edx
add    %edx,%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
mov    -0x50(%rbp,%rax,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1141 <ShiftRows+0x41>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShiftRows>:
push   %rbp
push   %r15
push   %r14
push   %rbx
mov    0x4(%rdi),%r8d
mov    0x8(%rdi),%r10d
mov    0xc(%rdi),%r14d
mov    0x14(%rdi),%esi
mov    0x18(%rdi),%r9d
mov    0x1c(%rdi),%r11d
mov    0x24(%rdi),%ecx
mov    0x28(%rdi),%eax
mov    0x2c(%rdi),%r15d
mov    0x34(%rdi),%ebp
mov    0x38(%rdi),%edx
mov    0x3c(%rdi),%ebx
mov    %esi,0x4(%rdi)
mov    %eax,0x8(%rdi)
mov    %ebx,0xc(%rdi)
mov    %ecx,0x14(%rdi)
mov    %edx,0x18(%rdi)
mov    %r14d,0x1c(%rdi)
mov    %ebp,0x24(%rdi)
mov    %r10d,0x28(%rdi)
mov    %r11d,0x2c(%rdi)
mov    %r8d,0x34(%rdi)
mov    %r9d,0x38(%rdi)
mov    %r15d,0x3c(%rdi)
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @ShiftRows(i32* %0) {
%2 = alloca i32*
%3 = alloca [16 x i32]
%4 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %4
br label %5
5: ; preds = %17, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 16
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = load i32*, i32** %2
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %9, i64 %11
%13 = load i32, i32* %12
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %15
store i32 %13, i32* %16
br label %17
17: ; preds = %8
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %5
20: ; preds = %5
store i32 0, i32* %4
br label %21
21: ; preds = %38, %20
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 16
br i1 %23, label %24, label %41
24: ; preds = %21
%25 = load i32, i32* %4
%26 = load i32, i32* %4
%27 = srem i32 %26, 4
%28 = mul nsw i32 %27, 4
%29 = add nsw i32 %25, %28
%30 = srem i32 %29, 16
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = load i32*, i32** %2
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %34, i64 %36
store i32 %33, i32* %37
br label %38
38: ; preds = %24
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %21
41: ; preds = %21
ret void
}

LLVM IR (-O2):
define void @ShiftRows(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
%4 = getelementptr inbounds i32, i32* %0, i64 2
%5 = load i32, i32* %4
%6 = getelementptr inbounds i32, i32* %0, i64 3
%7 = load i32, i32* %6
%8 = getelementptr inbounds i32, i32* %0, i64 5
%9 = load i32, i32* %8
%10 = getelementptr inbounds i32, i32* %0, i64 6
%11 = load i32, i32* %10
%12 = getelementptr inbounds i32, i32* %0, i64 7
%13 = load i32, i32* %12
%14 = getelementptr inbounds i32, i32* %0, i64 9
%15 = load i32, i32* %14
%16 = getelementptr inbounds i32, i32* %0, i64 10
%17 = load i32, i32* %16
%18 = getelementptr inbounds i32, i32* %0, i64 11
%19 = load i32, i32* %18
%20 = getelementptr inbounds i32, i32* %0, i64 13
%21 = load i32, i32* %20
%22 = getelementptr inbounds i32, i32* %0, i64 14
%23 = load i32, i32* %22
%24 = getelementptr inbounds i32, i32* %0, i64 15
%25 = load i32, i32* %24
store i32 %9, i32* %2
store i32 %17, i32* %4
store i32 %25, i32* %6
store i32 %15, i32* %8
store i32 %23, i32* %10
store i32 %7, i32* %12
store i32 %21, i32* %14
store i32 %5, i32* %16
store i32 %13, i32* %18
store i32 %3, i32* %20
store i32 %11, i32* %22
store i32 %19, i32* %24
ret void
}