#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 */

/* Variables and functions */
unsigned int ConvertStrToInt(char *, int, int);
int HashURL(char *pStr) {
  unsigned int C1, C2, T1, T2;
  C1 = ConvertStrToInt(pStr, 0x1505, 0x21);
  C2 = ConvertStrToInt(pStr, 0, 0x1003F);
  C1 >>= 2;
  C1 = ((C1 >> 4) & 0x3FFFFC0) | (C1 & 0x3F);
  C1 = ((C1 >> 4) & 0x3FFC00) | (C1 & 0x3FF);
  C1 = ((C1 >> 4) & 0x3C000) | (C1 & 0x3FFF);
  T1 = (C1 & 0x3C0) << 4;
  T1 |= C1 & 0x3C;
  T1 = (T1 << 2) | (C2 & 0xF0F);
  T2 = (C1 & 0xFFFFC000) << 4;
  T2 |= C1 & 0x3C00;
  T2 = (T2 << 0xA) | (C2 & 0xF0F0000);
  return (T1 | T2);
}


x86 assembly (clang, -O0):
<HashURL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1505,%esi
mov    $0x21,%edx
call   1030 <ConvertStrToInt@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x1003f,%edx
call   1030 <ConvertStrToInt@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x4,%eax
and    $0x3ffffc0,%eax
mov    -0xc(%rbp),%ecx
and    $0x3f,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x4,%eax
and    $0x3ffc00,%eax
mov    -0xc(%rbp),%ecx
and    $0x3ff,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x4,%eax
and    $0x3c000,%eax
mov    -0xc(%rbp),%ecx
and    $0x3fff,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x3c0,%eax
shl    $0x4,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
and    $0x3c,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x2,%eax
mov    -0x10(%rbp),%ecx
and    $0xf0f,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
and    $0xffffc000,%eax
shl    $0x4,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
and    $0x3c00,%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
shl    $0xa,%eax
mov    -0x10(%rbp),%ecx
and    $0xf0f0000,%ecx
or     %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HashURL>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x1505,%esi
mov    $0x21,%edx
call   1030 <ConvertStrToInt@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1003f,%edx
call   1030 <ConvertStrToInt@plt>
mov    %eax,%ecx
and    $0xf0f,%ecx
and    $0xf0f0000,%eax
and    $0xf0f0f0f0,%ebp
or     %ecx,%ebp
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @HashURL(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i32 @ConvertStrToInt(i8* %7, i32 5381, i32 33)
store i32 %8, i32* %3
%9 = load i8*, i8** %2
%10 = call i32 @ConvertStrToInt(i8* %9, i32 0, i32 65599)
store i32 %10, i32* %4
%11 = load i32, i32* %3
%12 = lshr i32 %11, 2
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = lshr i32 %13, 4
%15 = and i32 %14, 67108800
%16 = load i32, i32* %3
%17 = and i32 %16, 63
%18 = or i32 %15, %17
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = lshr i32 %19, 4
%21 = and i32 %20, 4193280
%22 = load i32, i32* %3
%23 = and i32 %22, 1023
%24 = or i32 %21, %23
store i32 %24, i32* %3
%25 = load i32, i32* %3
%26 = lshr i32 %25, 4
%27 = and i32 %26, 245760
%28 = load i32, i32* %3
%29 = and i32 %28, 16383
%30 = or i32 %27, %29
store i32 %30, i32* %3
%31 = load i32, i32* %3
%32 = and i32 %31, 960
%33 = shl i32 %32, 4
store i32 %33, i32* %5
%34 = load i32, i32* %3
%35 = and i32 %34, 60
%36 = load i32, i32* %5
%37 = or i32 %36, %35
store i32 %37, i32* %5
%38 = load i32, i32* %5
%39 = shl i32 %38, 2
%40 = load i32, i32* %4
%41 = and i32 %40, 3855
%42 = or i32 %39, %41
store i32 %42, i32* %5
%43 = load i32, i32* %3
%44 = and i32 %43, -16384
%45 = shl i32 %44, 4
store i32 %45, i32* %6
%46 = load i32, i32* %3
%47 = and i32 %46, 15360
%48 = load i32, i32* %6
%49 = or i32 %48, %47
store i32 %49, i32* %6
%50 = load i32, i32* %6
%51 = shl i32 %50, 10
%52 = load i32, i32* %4
%53 = and i32 %52, 252641280
%54 = or i32 %51, %53
store i32 %54, i32* %6
%55 = load i32, i32* %5
%56 = load i32, i32* %6
%57 = or i32 %55, %56
ret i32 %57
}

LLVM IR (-O2):
define i32 @HashURL(i8* %0) {
%2 = tail call i32 @ConvertStrToInt(i8* %0, i32 5381, i32 33)
%3 = tail call i32 @ConvertStrToInt(i8* %0, i32 0, i32 65599)
%4 = and i32 %3, 3855
%5 = and i32 %3, 252641280
%6 = and i32 %2, -252645136
%7 = or i32 %6, %4
%8 = or i32 %7, %5
ret i32 %8
}