#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 /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ be32dec(int /*<<< orphan*/ const *);
void be32dec_vect(uint32_t *dst, const uint8_t *src, size_t len) {
  size_t i;
  assert(len % 4 == 0);
  for (i = 0; i < len / 4; i++)
    dst[i] = be32dec(src + i * 4);
}


x86 assembly (clang, -O0):
<be32dec_vect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
and    $0x3,%rax
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
shr    $0x2,%rcx
cmp    %rcx,%rax
jae    11a0 <be32dec_vect+0x80>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rax
shl    $0x2,%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <be32dec@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1155 <be32dec_vect+0x35>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<be32dec_vect>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%r15
xor    %edi,%edi
test   $0x3,%r14b
sete   %dil
call   1040 <assert@plt>
cmp    $0x4,%r14
jb     1169 <be32dec_vect+0x49>
shr    $0x2,%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r12,%rdi
call   1030 <be32dec@plt>
mov    %eax,(%r15,%rbx,4)
add    $0x1,%rbx
add    $0x10,%r12
cmp    %rbx,%r14
jne    1150 <be32dec_vect+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @be32dec_vect(i32* %0, i32* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i64
store i32* %0, i32** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
%8 = load i64, i64* %6
%9 = urem i64 %8, 4
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
store i64 0, i64* %7
br label %13
13: ; preds = %27, %3
%14 = load i64, i64* %7
%15 = load i64, i64* %6
%16 = udiv i64 %15, 4
%17 = icmp ult i64 %14, %16
br i1 %17, label %18, label %30
18: ; preds = %13
%19 = load i32*, i32** %5
%20 = load i64, i64* %7
%21 = mul i64 %20, 4
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = call i32 @be32dec(i32* %22)
%24 = load i32*, i32** %4
%25 = load i64, i64* %7
%26 = getelementptr inbounds i32, i32* %24, i64 %25
store i32 %23, i32* %26
br label %27
27: ; preds = %18
%28 = load i64, i64* %7
%29 = add i64 %28, 1
store i64 %29, i64* %7
br label %13
30: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @be32dec_vect(i32* nocapture writeonly %0, i32* %1, i64 %2) {
%4 = and i64 %2, 3
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = icmp ult i64 %2, 4
br i1 %8, label %19, label %9
9: ; preds = %3
%10 = lshr i64 %2, 2
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ %17, %11 ], [ 0, %9 ]
%13 = shl i64 %12, 2
%14 = getelementptr inbounds i32, i32* %1, i64 %13
%15 = tail call i32 @be32dec(i32* %14)
%16 = getelementptr inbounds i32, i32* %0, i64 %12
store i32 %15, i32* %16
%17 = add nuw nsw i64 %12, 1
%18 = icmp eq i64 %17, %10
br i1 %18, label %19, label %11
19: ; preds = %11, %3
ret void
}