#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 decodelong(uint8_t *buff, int len) {
  int n = 0;
  int b4, b2, b1;
  uint32_t data = 0;
  uint32_t end = 0;
  for (n = 0; n < len - 1; n++) {
    b4 = ((buff[n] & 0x7d) & (4 << 4)) >> 4;
    b2 = ((buff[n] & 0x7d) & (2 << 2)) >> 2;
    b1 = ((buff[n] & 0x7d) & 1);
    data |= (b1 | b2 | b4) << (n * 3);
  }
  b2 = ((buff[len - 1] & 0x7d) & (2 << 2)) >> 2;
  b1 = ((buff[len - 1] & 0x7d) & 1) >> 0;
  end = (b1 | b2) << 30;
  data |= end;
  return 0;
}


x86 assembly (clang, -O0):
<decodelong>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    119d <decodelong+0x9d>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
and    $0x7d,%eax
and    $0x40,%eax
sar    $0x4,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
and    $0x7d,%eax
and    $0x8,%eax
sar    $0x2,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
and    $0x7d,%eax
and    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
or     -0x18(%rbp),%eax
or     -0x14(%rbp),%eax
imul   $0x3,-0x10(%rbp),%ecx
shl    %cl,%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1127 <decodelong+0x27>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
and    $0x7d,%eax
and    $0x8,%eax
sar    $0x2,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
and    $0x7d,%eax
and    $0x1,%eax
sar    $0x0,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
or     -0x18(%rbp),%eax
shl    $0x1e,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @decodelong(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
%10 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %5
br label %11
11: ; preds = %50, %2
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = sub nsw i32 %13, 1
%15 = icmp slt i32 %12, %14
br i1 %15, label %16, label %53
16: ; preds = %11
%17 = load i32*, i32** %3
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = load i32, i32* %20
%22 = and i32 %21, 125
%23 = and i32 %22, 64
%24 = ashr i32 %23, 4
store i32 %24, i32* %6
%25 = load i32*, i32** %3
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
%29 = load i32, i32* %28
%30 = and i32 %29, 125
%31 = and i32 %30, 8
%32 = ashr i32 %31, 2
store i32 %32, i32* %7
%33 = load i32*, i32** %3
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %33, i64 %35
%37 = load i32, i32* %36
%38 = and i32 %37, 125
%39 = and i32 %38, 1
store i32 %39, i32* %8
%40 = load i32, i32* %8
%41 = load i32, i32* %7
%42 = or i32 %40, %41
%43 = load i32, i32* %6
%44 = or i32 %42, %43
%45 = load i32, i32* %5
%46 = mul nsw i32 %45, 3
%47 = shl i32 %44, %46
%48 = load i32, i32* %9
%49 = or i32 %48, %47
store i32 %49, i32* %9
br label %50
50: ; preds = %16
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
br label %11
53: ; preds = %11
%54 = load i32*, i32** %3
%55 = load i32, i32* %4
%56 = sub nsw i32 %55, 1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i32, i32* %54, i64 %57
%59 = load i32, i32* %58
%60 = and i32 %59, 125
%61 = and i32 %60, 8
%62 = ashr i32 %61, 2
store i32 %62, i32* %7
%63 = load i32*, i32** %3
%64 = load i32, i32* %4
%65 = sub nsw i32 %64, 1
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i32, i32* %63, i64 %66
%68 = load i32, i32* %67
%69 = and i32 %68, 125
%70 = and i32 %69, 1
%71 = ashr i32 %70, 0
store i32 %71, i32* %8
%72 = load i32, i32* %8
%73 = load i32, i32* %7
%74 = or i32 %72, %73
%75 = shl i32 %74, 30
store i32 %75, i32* %10
%76 = load i32, i32* %10
%77 = load i32, i32* %9
%78 = or i32 %77, %76
store i32 %78, i32* %9
ret i32 0
}

LLVM IR (-O2):
define i32 @decodelong(i32* nocapture readnone %0, i32 %1) {
ret i32 0
}