#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 */
typedef struct TYPE_6__ TYPE_3__;
typedef struct TYPE_5__ TYPE_2__;
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;
struct TYPE_6__ {
  int offset;
};
struct TYPE_5__ {
  int offset;
};
struct TYPE_4__ {
  int offset;
};
struct fb_var_screeninfo {
  TYPE_3__ blue;
  TYPE_2__ green;
  TYPE_1__ red;
};

/* Variables and functions */
uint32_t pixel_color(uint8_t r, uint8_t g, uint8_t b,
                     struct fb_var_screeninfo *vinfo) {
  return (r << vinfo->red.offset) | (g << vinfo->green.offset) |
         (b << vinfo->blue.offset);
}


x86 assembly (clang, -O0):
<pixel_color>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    %cl,%eax
mov    -0x8(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    (%rcx),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pixel_color>:
mov    %rcx,%rax
mov    0x8(%rcx),%cl
shl    %cl,%edi
mov    (%rax),%r8b
mov    0x4(%rax),%cl
shl    %cl,%esi
or     %edi,%esi
mov    %r8d,%ecx
shl    %cl,%edx
or     %esi,%edx
mov    %edx,%eax
ret

LLVM IR (-O0):
%struct.fb_var_screeninfo = type { %struct.TYPE_6__, %struct.TYPE_5__, %struct.TYPE_4__ }
%struct.TYPE_6__ = type { i32 }
%struct.TYPE_5__ = type { i32 }
%struct.TYPE_4__ = type { i32 }
define i32 @pixel_color(i32 %0, i32 %1, i32 %2, %struct.fb_var_screeninfo* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.fb_var_screeninfo*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store %struct.fb_var_screeninfo* %3, %struct.fb_var_screeninfo** %8
%9 = load i32, i32* %5
%10 = load %struct.fb_var_screeninfo*, %struct.fb_var_screeninfo** %8
%11 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %10, i32 0, i32 2
%12 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = shl i32 %9, %13
%15 = load i32, i32* %6
%16 = load %struct.fb_var_screeninfo*, %struct.fb_var_screeninfo** %8
%17 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %16, i32 0, i32 1
%18 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %17, i32 0, i32 0
%19 = load i32, i32* %18
%20 = shl i32 %15, %19
%21 = or i32 %14, %20
%22 = load i32, i32* %7
%23 = load %struct.fb_var_screeninfo*, %struct.fb_var_screeninfo** %8
%24 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %23, i32 0, i32 0
%25 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %24, i32 0, i32 0
%26 = load i32, i32* %25
%27 = shl i32 %22, %26
%28 = or i32 %21, %27
ret i32 %28
}

LLVM IR (-O2):
%struct.fb_var_screeninfo = type { %struct.TYPE_6__, %struct.TYPE_5__, %struct.TYPE_4__ }
%struct.TYPE_6__ = type { i32 }
%struct.TYPE_5__ = type { i32 }
%struct.TYPE_4__ = type { i32 }
define i32 @pixel_color(i32 %0, i32 %1, i32 %2, %struct.fb_var_screeninfo* nocapture %3) {
%5 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %3, i64 0, i32 2, i32 0
%6 = load i32, i32* %5
%7 = shl i32 %0, %6
%8 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %3, i64 0, i32 1, i32 0
%9 = load i32, i32* %8
%10 = shl i32 %1, %9
%11 = or i32 %10, %7
%12 = getelementptr inbounds %struct.fb_var_screeninfo, %struct.fb_var_screeninfo* %3, i64 0, i32 0, i32 0
%13 = load i32, i32* %12
%14 = shl i32 %2, %13
%15 = or i32 %11, %14
ret i32 %15
}