#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*/ DecompressBlockDXT1Internal(int const *, int *, int,
                                               int const *);
void DecompressBlockDXT1(uint32_t x, uint32_t y, uint32_t width,
                         const uint8_t *blockStorage, uint32_t *image) {
  static const uint8_t const_alpha[] = {255, 255, 255, 255, 255, 255, 255, 255,
                                        255, 255, 255, 255, 255, 255, 255, 255};
  DecompressBlockDXT1Internal(blockStorage, image + x + (y * width), width,
                              const_alpha);
}


x86 assembly (clang, -O0):
<DecompressBlockDXT1>:
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
shl    $0x2,%rax
add    %rax,%rsi
mov    -0xc(%rbp),%edx
lea    0xeaa(%rip),%rcx
call   1030 <DecompressBlockDXT1Internal@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@DecompressBlockDXT1.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 @DecompressBlockDXT1(i32 %0, i32 %1, i32 %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32* %3, i32** %9
store i32* %4, i32** %10
%11 = load i32*, i32** %9
%12 = load i32*, i32** %10
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %7
%17 = load i32, i32* %8
%18 = mul nsw i32 %16, %17
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %15, i64 %19
%21 = load i32, i32* %8
%22 = call i32 @DecompressBlockDXT1Internal(i32* %11, i32* %20, i32 %21, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @DecompressBlockDXT1.const_alpha, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@DecompressBlockDXT1.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 @DecompressBlockDXT1(i32 %0, i32 %1, i32 %2, i32* %3, i32* %4) {
%6 = sext i32 %0 to i64
%7 = getelementptr inbounds i32, i32* %4, i64 %6
%8 = mul nsw i32 %2, %1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %7, i64 %9
%11 = tail call i32 @DecompressBlockDXT1Internal(i32* %3, i32* %10, i32 %2, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @DecompressBlockDXT1.const_alpha, i64 0, i64 0))
ret void
}