#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 */
int /*<<< orphan*/ DecompressBlockBC1Internal(int const *, unsigned char *, int,
                                              int const *);
void DecompressBlockBC1(uint32_t x, uint32_t y, uint32_t stride,
                        const uint8_t *blockStorage, unsigned char *image) {
  static const uint8_t const_alpha[] = {255, 255, 255, 255, 255, 255, 255, 255,
                                        255, 255, 255, 255, 255, 255, 255, 255};
  DecompressBlockBC1Internal(blockStorage,
                             image + x * sizeof(uint32_t) + (y * stride),
                             stride, const_alpha);
}


x86 assembly (clang, -O0):
<DecompressBlockBC1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
cltq
add    %rax,%rsi
mov    -0xc(%rbp),%edx
lea    0xeae(%rip),%rcx
call   1030 <DecompressBlockBC1Internal@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DecompressBlockBC1>:
movslq %edi,%rax
lea    (%r8,%rax,4),%rax
imul   %edx,%esi
movslq %esi,%rsi
add    %rax,%rsi
lea    0xed9(%rip),%rax
mov    %rcx,%rdi
mov    %rax,%rcx
jmp    1030 <DecompressBlockBC1Internal@plt>

LLVM IR (-O0):
@DecompressBlockBC1.const_alpha = internal constant [16 x i32] [i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255]
define void @DecompressBlockBC1(i32 %0, i32 %1, i32 %2, i32* %3, i8* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i8*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32* %3, i32** %9
store i8* %4, i8** %10
%11 = load i32*, i32** %9
%12 = load i8*, i8** %10
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 4
%16 = getelementptr inbounds i8, i8* %12, i64 %15
%17 = load i32, i32* %7
%18 = load i32, i32* %8
%19 = mul nsw i32 %17, %18
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %16, i64 %20
%22 = load i32, i32* %8
%23 = call i32 @DecompressBlockBC1Internal(i32* %11, i8* %21, i32 %22, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @DecompressBlockBC1.const_alpha, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@DecompressBlockBC1.const_alpha = internal constant [16 x i32] [i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255]
define void @DecompressBlockBC1(i32 %0, i32 %1, i32 %2, i32* %3, i8* %4) {
%6 = sext i32 %0 to i64
%7 = shl nsw i64 %6, 2
%8 = getelementptr inbounds i8, i8* %4, i64 %7
%9 = mul nsw i32 %2, %1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = tail call i32 @DecompressBlockBC1Internal(i32* %3, i8* %11, i32 %2, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @DecompressBlockBC1.const_alpha, i64 0, i64 0))
ret void
}