#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;
typedef int uint64_t;
typedef unsigned char const uint32_t;

/* Variables and functions */
uint64_t expansion_permutation(uint32_t block) {
  static const unsigned char e_template[48] = {
      32, 1,  2,  3,  4,  5,  4,  5,  6,  7,  8,  9,  8,  9,  10, 11,
      12, 13, 12, 13, 14, 15, 16, 17, 16, 17, 18, 19, 20, 21, 20, 21,
      22, 23, 24, 25, 24, 25, 26, 27, 28, 29, 28, 29, 30, 31, 32, 1,
  };
  uint32_t block_mask = 0x80000000;
  uint64_t e_mask = 0x800000000000;
  uint64_t new_block = 0;
  uint8_t i;
  for (i = 0; i < 48; i++) {
    block &(block_mask >> e_template[i] - 1) ? new_block |= e_mask >> i : 0;
  }
  return new_block;
}


x86 assembly (clang, -O0):
<expansion_permutation>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x0,-0x2(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x30,-0x10(%rbp)
jge    117a <expansion_permutation+0x7a>
movzbl -0x1(%rbp),%eax
movslq -0x10(%rbp),%rdx
lea    0xec4(%rip),%rcx
movzbl (%rcx,%rdx,1),%ecx
sub    $0x1,%ecx
xor    %edx,%edx
sar    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1167 <expansion_permutation+0x67>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
sar    %cl,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    116c <expansion_permutation+0x6c>
jmp    116c <expansion_permutation+0x6c>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1123 <expansion_permutation+0x23>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<expansion_permutation>:
xor    %eax,%eax
ret

LLVM IR (-O0):
@expansion_permutation.e_template = internal constant [48 x i8] c" \01\02\03\04\05\04\05\06\07\08\09\08\09\0A\0B\0C\0D\0C\0D\0E\0F\10\11\10\11\12\13\14\15\14\15\16\17\18\19\18\19\1A\1B\1C\1D\1C\1D\1E\1F \01"
define i32 @expansion_permutation(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %2
store i8 0, i8* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %31, %1
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 48
br i1 %9, label %10, label %34
10: ; preds = %7
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [48 x i8], [48 x i8]* @expansion_permutation.e_template, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = sub nsw i32 %17, 1
%19 = ashr i32 0, %18
%20 = and i32 %12, %19
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %10
%23 = load i32, i32* %4
%24 = load i32, i32* %6
%25 = ashr i32 %23, %24
%26 = load i32, i32* %5
%27 = or i32 %26, %25
store i32 %27, i32* %5
br label %29
28: ; preds = %10
br label %29
29: ; preds = %28, %22
%30 = phi i32 [ %27, %22 ], [ 0, %28 ]
br label %31
31: ; preds = %29
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %7
34: ; preds = %7
%35 = load i32, i32* %5
ret i32 %35
}

LLVM IR (-O2):
define i32 @expansion_permutation(i8 zeroext %0) {
ret i32 0
}