#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 unsigned int uint8_t;
struct lcpa_metapack {
  int dummy;
};

/* Variables and functions */
struct lcpa_metapack *lcpa_append_copy(struct lcpa_metapack *, char *, int,
                                       unsigned int *);
void lcpf_qosheaders(struct lcpa_metapack *pack, unsigned int priority,
                     unsigned int eosp, unsigned int ackpol) {
  uint8_t chunk[2];
  chunk[0] = 0;
  chunk[0] = ((priority << 5) | (eosp << 3) | (ackpol << 1));
  chunk[1] = 0;
  pack = lcpa_append_copy(pack, "80211QOSHDR", 2, chunk);
}


x86 assembly (clang, -O0):
<lcpf_qosheaders>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x5,%eax
mov    -0x10(%rbp),%ecx
shl    $0x3,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x1c(%rbp),%rcx
lea    0xea5(%rip),%rsi
mov    $0x2,%edx
call   1030 <lcpa_append_copy@plt>
mov    %rax,-0x8(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcpf_qosheaders>:
push   %rax
shl    $0x5,%esi
shl    $0x3,%edx
or     %esi,%edx
add    %ecx,%ecx
or     %edx,%ecx
mov    %ecx,(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xed1(%rip),%rsi
mov    %rsp,%rcx
mov    $0x2,%edx
call   1030 <lcpa_append_copy@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.lcpa_metapack = type { i32 }
@.str = [12 x i8] c"80211QOSHDR\00"
define void @lcpf_qosheaders(%struct.lcpa_metapack* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.lcpa_metapack*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [2 x i32]
store %struct.lcpa_metapack* %0, %struct.lcpa_metapack** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
store i32 0, i32* %10
%11 = load i32, i32* %6
%12 = shl i32 %11, 5
%13 = load i32, i32* %7
%14 = shl i32 %13, 3
%15 = or i32 %12, %14
%16 = load i32, i32* %8
%17 = shl i32 %16, 1
%18 = or i32 %15, %17
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
store i32 %18, i32* %19
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
store i32 0, i32* %20
%21 = load %struct.lcpa_metapack*, %struct.lcpa_metapack** %5
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%23 = call %struct.lcpa_metapack* @lcpa_append_copy(%struct.lcpa_metapack* %21, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 2, i32* %22)
store %struct.lcpa_metapack* %23, %struct.lcpa_metapack** %5
ret void
}

LLVM IR (-O2):
%struct.lcpa_metapack = type { i32 }
@.str = [12 x i8] c"80211QOSHDR\00"
define void @lcpf_qosheaders(%struct.lcpa_metapack* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [2 x i32]
%6 = bitcast [2 x i32]* %5 to i8*
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%8 = shl i32 %1, 5
%9 = shl i32 %2, 3
%10 = or i32 %9, %8
%11 = shl i32 %3, 1
%12 = or i32 %10, %11
store i32 %12, i32* %7
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
store i32 0, i32* %13
%14 = call %struct.lcpa_metapack* @lcpa_append_copy(%struct.lcpa_metapack* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 2, i32* %7)
ret void
}