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

/* Variables and functions */
int UINT64_C(int);
uint64_t prince_shift_rows(const uint64_t in, int inverse) {
  const uint64_t row_mask = UINT64_C(0xF000F000F000F000);
  uint64_t shift_rows_out = 0;
  for (unsigned int i = 0; i < 4; i++) {
    const uint64_t row = in & (row_mask >> (4 * i));
    const unsigned int shift = inverse ? i * 16 : 64 - i * 16;
    shift_rows_out |= (row >> shift) | (row << (64 - shift));
  }
  return shift_rows_out;
}


x86 assembly (clang, -O0):
<prince_shift_rows>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0xf000f000,%edi
call   1030 <UINT64_C@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jae    11b3 <prince_shift_rows+0xa3>
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1170 <prince_shift_rows+0x60>
mov    -0x14(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x20(%rbp)
jmp    1180 <prince_shift_rows+0x70>
mov    -0x14(%rbp),%ecx
shl    $0x4,%ecx
mov    $0x40,%eax
sub    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sar    %cl,%eax
mov    -0x18(%rbp),%edx
mov    $0x40,%ecx
sub    -0x1c(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <prince_shift_rows+0x29>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prince_shift_rows>:
mov    $0xf000f000,%edi
jmp    1030 <UINT64_C@plt>

LLVM IR (-O0):
define i32 @prince_shift_rows(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%10 = call i32 @UINT64_C(i32 -268374016)
store i32 %10, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
br label %11
11: ; preds = %42, %2
%12 = load i32, i32* %7
%13 = icmp ult i32 %12, 4
br i1 %13, label %14, label %45
14: ; preds = %11
%15 = load i32, i32* %3
%16 = load i32, i32* %5
%17 = load i32, i32* %7
%18 = mul i32 4, %17
%19 = ashr i32 %16, %18
%20 = and i32 %15, %19
store i32 %20, i32* %8
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %14
%24 = load i32, i32* %7
%25 = mul i32 %24, 16
br label %30
26: ; preds = %14
%27 = load i32, i32* %7
%28 = mul i32 %27, 16
%29 = sub i32 64, %28
br label %30
30: ; preds = %26, %23
%31 = phi i32 [ %25, %23 ], [ %29, %26 ]
store i32 %31, i32* %9
%32 = load i32, i32* %8
%33 = load i32, i32* %9
%34 = ashr i32 %32, %33
%35 = load i32, i32* %8
%36 = load i32, i32* %9
%37 = sub i32 64, %36
%38 = shl i32 %35, %37
%39 = or i32 %34, %38
%40 = load i32, i32* %6
%41 = or i32 %40, %39
store i32 %41, i32* %6
br label %42
42: ; preds = %30
%43 = load i32, i32* %7
%44 = add i32 %43, 1
store i32 %44, i32* %7
br label %11
45: ; preds = %11
%46 = load i32, i32* %6
ret i32 %46
}

LLVM IR (-O2):
define i32 @prince_shift_rows(i32 %0, i32 %1) {
%3 = tail call i32 @UINT64_C(i32 -268374016)
ret i32 poison
}