#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 /*<<< orphan*/ decode_block4x4_11bits(int, unsigned int *, int);
int draw_block4x4_rg11_eac(const unsigned char *bitstring,
                           unsigned int *image_buffer, int flags) {
  uint64_t red_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];
  decode_block4x4_11bits(red_qword, image_buffer, 0);
  uint64_t green_qword =
      ((uint64_t)bitstring[8] << 56) | ((uint64_t)bitstring[9] << 48) |
      ((uint64_t)bitstring[10] << 40) | ((uint64_t)bitstring[11] << 32) |
      ((uint64_t)bitstring[12] << 24) | ((uint64_t)bitstring[13] << 16) |
      ((uint64_t)bitstring[14] << 8) | bitstring[15];
  decode_block4x4_11bits(green_qword, image_buffer, 1);
  return 1;
}


x86 assembly (clang, -O0):
<draw_block4x4_rg11_eac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
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
xor    %edx,%edx
call   1030 <decode_block4x4_11bits@plt>
mov    -0x8(%rbp),%rax
movzbl 0x8(%rax),%eax
mov    $0x38,%ecx
shl    %cl,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x9(%rcx),%edx
mov    $0x30,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0xa(%rcx),%edx
mov    $0x28,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0xb(%rcx),%edx
mov    $0x20,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0xc(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0xd(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0xe(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0xf(%rcx),%ecx
or     %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1030 <decode_block4x4_11bits@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_block4x4_rg11_eac>:
push   %rbx
mov    %rsi,%rbx
xor    %edx,%edx
call   1030 <decode_block4x4_11bits@plt>
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <decode_block4x4_11bits@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @draw_block4x4_rg11_eac(i8* %0, i32* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 56
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 48
%19 = or i32 %13, %18
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i64 2
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = shl i32 %23, 40
%25 = or i32 %19, %24
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i64 3
%28 = load i8, i8* %27
%29 = zext i8 %28 to i32
%30 = shl i32 %29, 32
%31 = or i32 %25, %30
%32 = load i8*, i8** %4
%33 = getelementptr inbounds i8, i8* %32, i64 4
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = shl i32 %35, 24
%37 = or i32 %31, %36
%38 = load i8*, i8** %4
%39 = getelementptr inbounds i8, i8* %38, i64 5
%40 = load i8, i8* %39
%41 = zext i8 %40 to i32
%42 = shl i32 %41, 16
%43 = or i32 %37, %42
%44 = load i8*, i8** %4
%45 = getelementptr inbounds i8, i8* %44, i64 6
%46 = load i8, i8* %45
%47 = zext i8 %46 to i32
%48 = shl i32 %47, 8
%49 = or i32 %43, %48
%50 = load i8*, i8** %4
%51 = getelementptr inbounds i8, i8* %50, i64 7
%52 = load i8, i8* %51
%53 = zext i8 %52 to i32
%54 = or i32 %49, %53
store i32 %54, i32* %7
%55 = load i32, i32* %7
%56 = load i32*, i32** %5
%57 = call i32 @decode_block4x4_11bits(i32 %55, i32* %56, i32 0)
%58 = load i8*, i8** %4
%59 = getelementptr inbounds i8, i8* %58, i64 8
%60 = load i8, i8* %59
%61 = zext i8 %60 to i32
%62 = shl i32 %61, 56
%63 = load i8*, i8** %4
%64 = getelementptr inbounds i8, i8* %63, i64 9
%65 = load i8, i8* %64
%66 = zext i8 %65 to i32
%67 = shl i32 %66, 48
%68 = or i32 %62, %67
%69 = load i8*, i8** %4
%70 = getelementptr inbounds i8, i8* %69, i64 10
%71 = load i8, i8* %70
%72 = zext i8 %71 to i32
%73 = shl i32 %72, 40
%74 = or i32 %68, %73
%75 = load i8*, i8** %4
%76 = getelementptr inbounds i8, i8* %75, i64 11
%77 = load i8, i8* %76
%78 = zext i8 %77 to i32
%79 = shl i32 %78, 32
%80 = or i32 %74, %79
%81 = load i8*, i8** %4
%82 = getelementptr inbounds i8, i8* %81, i64 12
%83 = load i8, i8* %82
%84 = zext i8 %83 to i32
%85 = shl i32 %84, 24
%86 = or i32 %80, %85
%87 = load i8*, i8** %4
%88 = getelementptr inbounds i8, i8* %87, i64 13
%89 = load i8, i8* %88
%90 = zext i8 %89 to i32
%91 = shl i32 %90, 16
%92 = or i32 %86, %91
%93 = load i8*, i8** %4
%94 = getelementptr inbounds i8, i8* %93, i64 14
%95 = load i8, i8* %94
%96 = zext i8 %95 to i32
%97 = shl i32 %96, 8
%98 = or i32 %92, %97
%99 = load i8*, i8** %4
%100 = getelementptr inbounds i8, i8* %99, i64 15
%101 = load i8, i8* %100
%102 = zext i8 %101 to i32
%103 = or i32 %98, %102
store i32 %103, i32* %8
%104 = load i32, i32* %8
%105 = load i32*, i32** %5
%106 = call i32 @decode_block4x4_11bits(i32 %104, i32* %105, i32 1)
ret i32 1
}

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