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

/* Variables and functions */
uint32_t bech32_polymod_step(uint32_t pre) {
  uint8_t b = pre >> 25;
  return ((pre & 0x1FFFFFF) << 5) ^ (-((b >> 0) & 1) & 0x3b6a57b2UL) ^
         (-((b >> 1) & 1) & 0x26508e6dUL) ^ (-((b >> 2) & 1) & 0x1ea119faUL) ^
         (-((b >> 3) & 1) & 0x3d4233ddUL) ^ (-((b >> 4) & 1) & 0x2a1462b3UL);
}


x86 assembly (clang, -O0):
<bech32_polymod_step>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x19,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1ffffff,%eax
shl    $0x5,%eax
cltq
mov    -0x8(%rbp),%edx
sar    $0x0,%edx
and    $0x1,%edx
xor    %ecx,%ecx
sub    %edx,%ecx
movslq %ecx,%rcx
and    $0x3b6a57b2,%rcx
xor    %rcx,%rax
mov    -0x8(%rbp),%edx
sar    $0x1,%edx
and    $0x1,%edx
xor    %ecx,%ecx
sub    %edx,%ecx
movslq %ecx,%rcx
and    $0x26508e6d,%rcx
xor    %rcx,%rax
mov    -0x8(%rbp),%edx
sar    $0x2,%edx
and    $0x1,%edx
xor    %ecx,%ecx
sub    %edx,%ecx
movslq %ecx,%rcx
and    $0x1ea119fa,%rcx
xor    %rcx,%rax
mov    -0x8(%rbp),%edx
sar    $0x3,%edx
and    $0x1,%edx
xor    %ecx,%ecx
sub    %edx,%ecx
movslq %ecx,%rcx
and    $0x3d4233dd,%rcx
xor    %rcx,%rax
mov    -0x8(%rbp),%edx
sar    $0x4,%edx
and    $0x1,%edx
xor    %ecx,%ecx
sub    %edx,%ecx
movslq %ecx,%rcx
and    $0x2a1462b3,%rcx
xor    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bech32_polymod_step>:
mov    %edi,%eax
shr    $0x19,%eax
mov    %edi,%ecx
shl    $0x5,%ecx
and    $0x3fffffe0,%ecx
and    $0x1,%eax
neg    %eax
and    $0x3b6a57b2,%eax
xor    %ecx,%eax
mov    %edi,%edx
shr    $0x1a,%edx
and    $0x1,%edx
neg    %edx
and    $0x26508e6d,%edx
mov    %edi,%ecx
shr    $0x1b,%ecx
and    $0x1,%ecx
neg    %ecx
and    $0x1ea119fa,%ecx
xor    %edx,%ecx
xor    %eax,%ecx
mov    %edi,%eax
shr    $0x1c,%eax
and    $0x1,%eax
neg    %eax
and    $0x3d4233dd,%eax
shr    $0x1d,%edi
and    $0x1,%edi
neg    %edi
and    $0x2a1462b3,%edi
xor    %edi,%eax
xor    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @bech32_polymod_step(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 25
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = and i32 %6, 33554431
%8 = shl i32 %7, 5
%9 = sext i32 %8 to i64
%10 = load i32, i32* %3
%11 = ashr i32 %10, 0
%12 = and i32 %11, 1
%13 = sub nsw i32 0, %12
%14 = sext i32 %13 to i64
%15 = and i64 %14, 996825010
%16 = xor i64 %9, %15
%17 = load i32, i32* %3
%18 = ashr i32 %17, 1
%19 = and i32 %18, 1
%20 = sub nsw i32 0, %19
%21 = sext i32 %20 to i64
%22 = and i64 %21, 642813549
%23 = xor i64 %16, %22
%24 = load i32, i32* %3
%25 = ashr i32 %24, 2
%26 = and i32 %25, 1
%27 = sub nsw i32 0, %26
%28 = sext i32 %27 to i64
%29 = and i64 %28, 513874426
%30 = xor i64 %23, %29
%31 = load i32, i32* %3
%32 = ashr i32 %31, 3
%33 = and i32 %32, 1
%34 = sub nsw i32 0, %33
%35 = sext i32 %34 to i64
%36 = and i64 %35, 1027748829
%37 = xor i64 %30, %36
%38 = load i32, i32* %3
%39 = ashr i32 %38, 4
%40 = and i32 %39, 1
%41 = sub nsw i32 0, %40
%42 = sext i32 %41 to i64
%43 = and i64 %42, 705979059
%44 = xor i64 %37, %43
%45 = trunc i64 %44 to i32
ret i32 %45
}

LLVM IR (-O2):
define i32 @bech32_polymod_step(i32 %0) {
%2 = lshr i32 %0, 25
%3 = shl i32 %0, 5
%4 = and i32 %3, 1073741792
%5 = and i32 %2, 1
%6 = sub nsw i32 0, %5
%7 = and i32 %6, 996825010
%8 = xor i32 %7, %4
%9 = lshr i32 %0, 26
%10 = and i32 %9, 1
%11 = sub nsw i32 0, %10
%12 = and i32 %11, 642813549
%13 = xor i32 %8, %12
%14 = lshr i32 %0, 27
%15 = and i32 %14, 1
%16 = sub nsw i32 0, %15
%17 = and i32 %16, 513874426
%18 = xor i32 %13, %17
%19 = lshr i32 %0, 28
%20 = and i32 %19, 1
%21 = sub nsw i32 0, %20
%22 = and i32 %21, 1027748829
%23 = xor i32 %18, %22
%24 = lshr i32 %0, 29
%25 = and i32 %24, 1
%26 = sub nsw i32 0, %25
%27 = and i32 %26, 705979059
%28 = xor i32 %23, %27
ret i32 %28
}