#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 uint64_t;

/* Variables and functions */
int decode_block4x4_11bits_signed(int, unsigned int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ memset(unsigned int *, int /*<<< orphan*/, int);
int draw_block4x4_signed_r11_eac(const unsigned char *bitstring,
                                 unsigned int *image_buffer, int flags) {
  memset(image_buffer, 0, 64);
  uint64_t qword =
      ((uint64_t)bitstring[0] << 56) | ((uint64_t)bitstring[1] << 48) |
      ((uint64_t)bitstring[2] << 40) | ((uint64_t)bitstring[3] << 32) |
      ((uint64_t)bitstring[4] << 24) | ((uint64_t)bitstring[5] << 16) |
      ((uint64_t)bitstring[6] << 8) | bitstring[7];
  return decode_block4x4_11bits_signed(qword, image_buffer, 0, flags);
}


x86 assembly (clang, -O0):
<draw_block4x4_signed_r11_eac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    $0x38,%ecx
shl    %cl,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%edx
mov    $0x30,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%edx
mov    $0x28,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%edx
mov    $0x20,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x4(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x5(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x6(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x7(%rcx),%ecx
or     %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%ecx
xor    %edx,%edx
call   1030 <decode_block4x4_11bits_signed@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_block4x4_signed_r11_eac>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
mov    %rbx,%rsi
xor    %edx,%edx
mov    %ebp,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <decode_block4x4_11bits_signed@plt>

LLVM IR (-O0):
define i32 @draw_block4x4_signed_r11_eac(i8* %0, i32* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%8 = load i32*, i32** %5
%9 = call i32 @memset(i32* %8, i32 0, i32 64)
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = shl i32 %13, 56
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 48
%20 = or i32 %14, %19
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i64 2
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = shl i32 %24, 40
%26 = or i32 %20, %25
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i64 3
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = shl i32 %30, 32
%32 = or i32 %26, %31
%33 = load i8*, i8** %4
%34 = getelementptr inbounds i8, i8* %33, i64 4
%35 = load i8, i8* %34
%36 = zext i8 %35 to i32
%37 = shl i32 %36, 24
%38 = or i32 %32, %37
%39 = load i8*, i8** %4
%40 = getelementptr inbounds i8, i8* %39, i64 5
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = shl i32 %42, 16
%44 = or i32 %38, %43
%45 = load i8*, i8** %4
%46 = getelementptr inbounds i8, i8* %45, i64 6
%47 = load i8, i8* %46
%48 = zext i8 %47 to i32
%49 = shl i32 %48, 8
%50 = or i32 %44, %49
%51 = load i8*, i8** %4
%52 = getelementptr inbounds i8, i8* %51, i64 7
%53 = load i8, i8* %52
%54 = zext i8 %53 to i32
%55 = or i32 %50, %54
store i32 %55, i32* %7
%56 = load i32, i32* %7
%57 = load i32*, i32** %5
%58 = load i32, i32* %6
%59 = call i32 @decode_block4x4_11bits_signed(i32 %56, i32* %57, i32 0, i32 %58)
ret i32 %59
}

LLVM IR (-O2):
define i32 @draw_block4x4_signed_r11_eac(i8* nocapture readnone %0, i32* %1, i32 %2) {
%4 = tail call i32 @memset(i32* %1, i32 0, i32 64)
%5 = tail call i32 @decode_block4x4_11bits_signed(i32 poison, i32* %1, i32 0, i32 %2)
ret i32 %5
}