#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*/ int8_t;
typedef int /*<<< orphan*/ int32_t;
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_setr_epi32(int /*<<< orphan*/ const,
                                  int /*<<< orphan*/ const,
                                  int /*<<< orphan*/ const,
                                  int /*<<< orphan*/ const);
__m128i load_8bit_4x4_to_1_reg_sse2(const void *const src,
                                    const int byte_stride) {
  return _mm_setr_epi32(*(const int32_t *)((int8_t *)src + 0 * byte_stride),
                        *(const int32_t *)((int8_t *)src + 1 * byte_stride),
                        *(const int32_t *)((int8_t *)src + 2 * byte_stride),
                        *(const int32_t *)((int8_t *)src + 3 * byte_stride));
}


x86 assembly (clang, -O0):
<load_8bit_4x4_to_1_reg_sse2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x0,-0xc(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x0,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
imul   $0x3,-0xc(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%ecx
call   1030 <_mm_setr_epi32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_8bit_4x4_to_1_reg_sse2>:
mov    (%rdi),%eax
movslq %esi,%rcx
mov    (%rdi,%rcx,4),%esi
lea    (%rcx,%rcx,1),%edx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%edx
lea    (%rcx,%rcx,2),%ecx
movslq %ecx,%rcx
mov    (%rdi,%rcx,4),%ecx
mov    %eax,%edi
jmp    1030 <_mm_setr_epi32@plt>

LLVM IR (-O0):
define i32 @load_8bit_4x4_to_1_reg_sse2(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %4
%8 = mul nsw i32 0, %7
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %6, i64 %9
%11 = load i32, i32* %10
%12 = load i8*, i8** %3
%13 = bitcast i8* %12 to i32*
%14 = load i32, i32* %4
%15 = mul nsw i32 1, %14
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %13, i64 %16
%18 = load i32, i32* %17
%19 = load i8*, i8** %3
%20 = bitcast i8* %19 to i32*
%21 = load i32, i32* %4
%22 = mul nsw i32 2, %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %20, i64 %23
%25 = load i32, i32* %24
%26 = load i8*, i8** %3
%27 = bitcast i8* %26 to i32*
%28 = load i32, i32* %4
%29 = mul nsw i32 3, %28
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %27, i64 %30
%32 = load i32, i32* %31
%33 = call i32 @_mm_setr_epi32(i32 %11, i32 %18, i32 %25, i32 %32)
ret i32 %33
}

LLVM IR (-O2):
define i32 @load_8bit_4x4_to_1_reg_sse2(i8* nocapture %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i32, i32* %3, i64 %5
%7 = load i32, i32* %6
%8 = shl nsw i32 %1, 1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %3, i64 %9
%11 = load i32, i32* %10
%12 = mul nsw i32 %1, 3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %3, i64 %13
%15 = load i32, i32* %14
%16 = tail call i32 @_mm_setr_epi32(i32 %4, i32 %7, i32 %11, i32 %15)
ret i32 %16
}