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

/* Variables and functions */
int /*<<< orphan*/ lcpa_append_copy(struct lcpa_metapack *, char *, int,
                                    int /*<<< orphan*/ *);
int /*<<< orphan*/ lcpf_80211headers(struct lcpa_metapack *, int /*<<< orphan*/,
                                     int, int, int, int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *, int, int);
void lcpf_disassoc(struct lcpa_metapack *pack, uint8_t *src, uint8_t *dst,
                   uint8_t *bssid, int framecontrol, int duration, int fragment,
                   int sequence, int reasoncode) {
  uint8_t chunk[2];
  uint16_t *ch16 = (uint16_t *)chunk;
  lcpf_80211headers(pack, 0, 10, framecontrol, duration, dst, src, bssid, NULL,
                    fragment, sequence);
  *ch16 = reasoncode;
  lcpa_append_copy(pack, "REASONCODE", 2, chunk);
}


x86 assembly (clang, -O0):
<lcpf_disassoc>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8d,-0x34(%rbp)
mov    %r9d,-0x38(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x34(%rbp),%ecx
mov    -0x38(%rbp),%r8d
mov    -0x28(%rbp),%r9
mov    -0x20(%rbp),%rbx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10d
mov    0x18(%rbp),%eax
xor    %esi,%esi
mov    $0xa,%edx
xor    %r14d,%r14d
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    -0x48(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rdi
lea    -0x40(%rbp),%rcx
lea    0xe4c(%rip),%rsi
mov    $0x2,%edx
call   1030 <lcpa_append_copy@plt>
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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

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