#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 */

/* Variables and functions */
int convert_bit_range(unsigned int, int, int);
void rgb_888_from_565(unsigned int c, int *r, int *g, int *b) {
  *r = convert_bit_range((c >> 11) & 31, 5, 8);
  *g = convert_bit_range((c >> 05) & 63, 6, 8);
  *b = convert_bit_range((c >> 00) & 31, 5, 8);
}


x86 assembly (clang, -O0):
<rgb_888_from_565>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
shr    $0xb,%edi
and    $0x1f,%edi
mov    $0x5,%esi
mov    $0x8,%edx
call   1030 <convert_bit_range@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
shr    $0x5,%edi
and    $0x3f,%edi
mov    $0x6,%esi
mov    $0x8,%edx
call   1030 <convert_bit_range@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
shr    $0x0,%edi
and    $0x1f,%edi
mov    $0x5,%esi
mov    $0x8,%edx
call   1030 <convert_bit_range@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgb_888_from_565>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %edi,%ebp
shr    $0xb,%edi
and    $0x1f,%edi
mov    $0x5,%esi
mov    $0x8,%edx
call   1030 <convert_bit_range@plt>
mov    %eax,(%rbx)
mov    %ebp,%edi
shr    $0x5,%edi
and    $0x3f,%edi
mov    $0x6,%esi
mov    $0x8,%edx
call   1030 <convert_bit_range@plt>
mov    %eax,(%r15)
and    $0x1f,%ebp
mov    %ebp,%edi
mov    $0x5,%esi
mov    $0x8,%edx
call   1030 <convert_bit_range@plt>
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @rgb_888_from_565(i32 %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i32, i32* %5
%10 = lshr i32 %9, 11
%11 = and i32 %10, 31
%12 = call i32 @convert_bit_range(i32 %11, i32 5, i32 8)
%13 = load i32*, i32** %6
store i32 %12, i32* %13
%14 = load i32, i32* %5
%15 = lshr i32 %14, 5
%16 = and i32 %15, 63
%17 = call i32 @convert_bit_range(i32 %16, i32 6, i32 8)
%18 = load i32*, i32** %7
store i32 %17, i32* %18
%19 = load i32, i32* %5
%20 = lshr i32 %19, 0
%21 = and i32 %20, 31
%22 = call i32 @convert_bit_range(i32 %21, i32 5, i32 8)
%23 = load i32*, i32** %8
store i32 %22, i32* %23
ret void
}

LLVM IR (-O2):
define void @rgb_888_from_565(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = lshr i32 %0, 11
%6 = and i32 %5, 31
%7 = tail call i32 @convert_bit_range(i32 %6, i32 5, i32 8)
store i32 %7, i32* %1
%8 = lshr i32 %0, 5
%9 = and i32 %8, 63
%10 = tail call i32 @convert_bit_range(i32 %9, i32 6, i32 8)
store i32 %10, i32* %2
%11 = and i32 %0, 31
%12 = tail call i32 @convert_bit_range(i32 %11, i32 5, i32 8)
store i32 %12, i32* %3
ret void
}