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

/* Variables and functions */
scalar_t__ mp2vseqdx_get_color(int const *);
uint8_t mp2vseqdx_get_vertical(const uint8_t *p_mp2vseqdx) {
  unsigned int base = mp2vseqdx_get_color(p_mp2vseqdx) ? 8 : 5;
  return ((p_mp2vseqdx[base + 1] & 0x1) << 13) | (p_mp2vseqdx[base + 2] << 5) |
         (p_mp2vseqdx[base + 3] >> 3);
}


x86 assembly (clang, -O0):
<mp2vseqdx_get_vertical>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mp2vseqdx_get_color@plt>
mov    %rax,%rdx
mov    $0x5,%eax
mov    $0x8,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,4),%eax
and    $0x1,%eax
shl    $0xd,%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x2,%edx
mov    %edx,%edx
mov    (%rcx,%rdx,4),%ecx
shl    $0x5,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x3,%edx
mov    %edx,%edx
mov    (%rcx,%rdx,4),%ecx
sar    $0x3,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp2vseqdx_get_vertical>:
push   %rbx
mov    %rdi,%rbx
call   1030 <mp2vseqdx_get_color@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    (%rcx,%rcx,2),%ecx
add    $0x5,%ecx
mov    0x4(%rbx,%rcx,4),%edx
mov    0xc(%rbx,%rcx,4),%eax
and    $0x1,%edx
shl    $0xd,%edx
or     $0x2,%ecx
mov    (%rbx,%rcx,4),%ecx
shl    $0x5,%ecx
or     %edx,%ecx
sar    $0x3,%eax
or     %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @mp2vseqdx_get_vertical(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i64 @mp2vseqdx_get_color(i32* %4)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 8, i32 5
store i32 %8, i32* %3
%9 = load i32*, i32** %2
%10 = load i32, i32* %3
%11 = add i32 %10, 1
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %9, i64 %12
%14 = load i32, i32* %13
%15 = and i32 %14, 1
%16 = shl i32 %15, 13
%17 = load i32*, i32** %2
%18 = load i32, i32* %3
%19 = add i32 %18, 2
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %17, i64 %20
%22 = load i32, i32* %21
%23 = shl i32 %22, 5
%24 = or i32 %16, %23
%25 = load i32*, i32** %2
%26 = load i32, i32* %3
%27 = add i32 %26, 3
%28 = zext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %25, i64 %28
%30 = load i32, i32* %29
%31 = ashr i32 %30, 3
%32 = or i32 %24, %31
ret i32 %32
}

LLVM IR (-O2):
define i32 @mp2vseqdx_get_vertical(i32* %0) {
%2 = tail call i64 @mp2vseqdx_get_color(i32* %0)
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 5, i32 8
%5 = add nuw nsw i32 %4, 1
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = load i32, i32* %7
%9 = shl i32 %8, 13
%10 = and i32 %9, 8192
%11 = or i32 %4, 2
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %0, i64 %12
%14 = load i32, i32* %13
%15 = shl i32 %14, 5
%16 = or i32 %10, %15
%17 = add nuw nsw i32 %4, 3
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %0, i64 %18
%20 = load i32, i32* %19
%21 = ashr i32 %20, 3
%22 = or i32 %16, %21
ret i32 %22
}