#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 = in & row_mask;
  for (unsigned int i = 1; 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)
mov    -0x4(%rbp),%eax
and    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jae    11b5 <prince_shift_rows+0xa5>
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     1172 <prince_shift_rows+0x62>
mov    -0x14(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x20(%rbp)
jmp    1182 <prince_shift_rows+0x72>
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    113b <prince_shift_rows+0x2b>
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
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = and i32 %11, %12
store i32 %13, i32* %6
store i32 1, i32* %7
br label %14
14: ; preds = %45, %2
%15 = load i32, i32* %7
%16 = icmp ult i32 %15, 4
br i1 %16, label %17, label %48
17: ; preds = %14
%18 = load i32, i32* %3
%19 = load i32, i32* %5
%20 = load i32, i32* %7
%21 = mul i32 4, %20
%22 = ashr i32 %19, %21
%23 = and i32 %18, %22
store i32 %23, i32* %8
%24 = load i32, i32* %4
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %17
%27 = load i32, i32* %7
%28 = mul i32 %27, 16
br label %33
29: ; preds = %17
%30 = load i32, i32* %7
%31 = mul i32 %30, 16
%32 = sub i32 64, %31
br label %33
33: ; preds = %29, %26
%34 = phi i32 [ %28, %26 ], [ %32, %29 ]
store i32 %34, i32* %9
%35 = load i32, i32* %8
%36 = load i32, i32* %9
%37 = ashr i32 %35, %36
%38 = load i32, i32* %8
%39 = load i32, i32* %9
%40 = sub i32 64, %39
%41 = shl i32 %38, %40
%42 = or i32 %37, %41
%43 = load i32, i32* %6
%44 = or i32 %43, %42
store i32 %44, i32* %6
br label %45
45: ; preds = %33
%46 = load i32, i32* %7
%47 = add i32 %46, 1
store i32 %47, i32* %7
br label %14
48: ; preds = %14
%49 = load i32, i32* %6
ret i32 %49
}

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