#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 /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;
struct lcpa_metapack {
  int dummy;
};

/* Variables and functions */
struct lcpa_metapack *lcpa_append_copy(struct lcpa_metapack *, char *, int,
                                       int /*<<< orphan*/ *);
int /*<<< orphan*/ lcpf_80211headers(struct lcpa_metapack *, int /*<<< orphan*/,
                                     int /*<<< orphan*/, int, int,
                                     int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                     int, int);
void lcpf_assocreq(struct lcpa_metapack *pack, uint8_t *dst, uint8_t *src,
                   uint8_t *bssid, int framecontrol, int duration, int fragment,
                   int sequence, uint16_t capabilities, uint16_t listenint) {
  uint8_t chunk[2];
  uint16_t *sixptr = (uint16_t *)chunk;
  lcpf_80211headers(pack, 0, 0, framecontrol, duration, dst, src, bssid, NULL,
                    fragment, sequence);
  *sixptr = capabilities;
  pack = lcpa_append_copy(pack, "ASSOCREQCAPAB", 2, chunk);
  *sixptr = listenint;
  pack = lcpa_append_copy(pack, "ASSOCREQLI", 2, chunk);
}


x86 assembly (clang, -O0):
<lcpf_assocreq>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x68,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9d,-0x30(%rbp)
lea    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x2c(%rbp),%ecx
mov    -0x30(%rbp),%r8d
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%rbx
mov    -0x28(%rbp),%r11
mov    0x10(%rbp),%r10d
mov    0x18(%rbp),%eax
xor    %edx,%edx
xor    %esi,%esi
mov    %edx,%esi
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
movq   $0x0,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %eax,0x20(%rsp)
call   1040 <lcpf_80211headers@plt>
mov    0x20(%rbp),%ecx
mov    -0x40(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
lea    -0x38(%rbp),%rcx
lea    0xe4f(%rip),%rsi
mov    $0x2,%edx
call   1030 <lcpa_append_copy@plt>
mov    %rax,-0x10(%rbp)
mov    0x28(%rbp),%ecx
mov    -0x40(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
lea    -0x38(%rbp),%rcx
lea    0xe37(%rip),%rsi
mov    $0x2,%edx
call   1030 <lcpa_append_copy@plt>
mov    %rax,-0x10(%rbp)
add    $0x68,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcpf_assocreq>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r11
mov    %rdx,%r10
mov    %rsi,%rax
mov    %rdi,%rbx
mov    0x58(%rsp),%r15d
mov    0x50(%rsp),%r14d
mov    0x40(%rsp),%r12d
mov    0x48(%rsp),%ebp
sub    $0x8,%rsp
xor    %esi,%esi
xor    %edx,%edx
mov    %r8d,%ecx
mov    %r9d,%r8d
mov    %rax,%r9
push   %rbp
push   %r12
push   $0x0
push   %r11
push   %r10
call   1040 <lcpf_80211headers@plt>
add    $0x30,%rsp
mov    %r14d,0x8(%rsp)
lea    0xe86(%rip),%rsi
lea    0x8(%rsp),%r14
mov    %rbx,%rdi
mov    $0x2,%edx
mov    %r14,%rcx
call   1030 <lcpa_append_copy@plt>
mov    %r15d,0x8(%rsp)
lea    0xe73(%rip),%rsi
mov    %rax,%rdi
mov    $0x2,%edx
mov    %r14,%rcx
call   1030 <lcpa_append_copy@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.lcpa_metapack = type { i32 }
@.str = [14 x i8] c"ASSOCREQCAPAB\00"
@.str.1 = [11 x i8] c"ASSOCREQLI\00"
define void @lcpf_assocreq(%struct.lcpa_metapack* %0, i32* %1, i32* %2, i32* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9) {
%11 = alloca %struct.lcpa_metapack*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca [2 x i32]
%22 = alloca i32*
store %struct.lcpa_metapack* %0, %struct.lcpa_metapack** %11
store i32* %1, i32** %12
store i32* %2, i32** %13
store i32* %3, i32** %14
store i32 %4, i32* %15
store i32 %5, i32* %16
store i32 %6, i32* %17
store i32 %7, i32* %18
store i32 %8, i32* %19
store i32 %9, i32* %20
%23 = getelementptr inbounds [2 x i32], [2 x i32]* %21, i64 0, i64 0
store i32* %23, i32** %22
%24 = load %struct.lcpa_metapack*, %struct.lcpa_metapack** %11
%25 = load i32, i32* %15
%26 = load i32, i32* %16
%27 = load i32*, i32** %12
%28 = load i32*, i32** %13
%29 = load i32*, i32** %14
%30 = load i32, i32* %17
%31 = load i32, i32* %18
%32 = call i32 @lcpf_80211headers(%struct.lcpa_metapack* %24, i32 0, i32 0, i32 %25, i32 %26, i32* %27, i32* %28, i32* %29, i32* null, i32 %30, i32 %31)
%33 = load i32, i32* %19
%34 = load i32*, i32** %22
store i32 %33, i32* %34
%35 = load %struct.lcpa_metapack*, %struct.lcpa_metapack** %11
%36 = getelementptr inbounds [2 x i32], [2 x i32]* %21, i64 0, i64 0
%37 = call %struct.lcpa_metapack* @lcpa_append_copy(%struct.lcpa_metapack* %35, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 2, i32* %36)
store %struct.lcpa_metapack* %37, %struct.lcpa_metapack** %11
%38 = load i32, i32* %20
%39 = load i32*, i32** %22
store i32 %38, i32* %39
%40 = load %struct.lcpa_metapack*, %struct.lcpa_metapack** %11
%41 = getelementptr inbounds [2 x i32], [2 x i32]* %21, i64 0, i64 0
%42 = call %struct.lcpa_metapack* @lcpa_append_copy(%struct.lcpa_metapack* %40, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 2, i32* %41)
store %struct.lcpa_metapack* %42, %struct.lcpa_metapack** %11
ret void
}

LLVM IR (-O2):
%struct.lcpa_metapack = type { i32 }
@.str = [14 x i8] c"ASSOCREQCAPAB\00"
@.str.1 = [11 x i8] c"ASSOCREQLI\00"
define void @lcpf_assocreq(%struct.lcpa_metapack* %0, i32* %1, i32* %2, i32* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9) {
%11 = alloca [2 x i32]
%12 = bitcast [2 x i32]* %11 to i8*
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
%14 = tail call i32 @lcpf_80211headers(%struct.lcpa_metapack* %0, i32 0, i32 0, i32 %4, i32 %5, i32* %1, i32* %2, i32* %3, i32* null, i32 %6, i32 %7)
store i32 %8, i32* %13
%15 = call %struct.lcpa_metapack* @lcpa_append_copy(%struct.lcpa_metapack* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 2, i32* %13)
store i32 %9, i32* %13
%16 = call %struct.lcpa_metapack* @lcpa_append_copy(%struct.lcpa_metapack* %15, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 2, i32* %13)
ret void
}