#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*/ uint64_t;
typedef int 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, int, int, int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *, int, int);
void lcpf_proberesp(struct lcpa_metapack *pack, uint8_t *dst, uint8_t *src,
                    uint8_t *bssid, int framecontrol, int duration,
                    int fragment, int sequence, uint64_t timestamp,
                    int beaconint, int capabilities) {
  uint8_t chunk[8];
  uint16_t *sixptr = (uint16_t *)chunk;
  uint64_t *ch64 = (uint64_t *)chunk;
  lcpf_80211headers(pack, 0, 5, framecontrol, duration, dst, src, bssid, NULL,
                    fragment, sequence);
  *ch64 = timestamp;
  pack = lcpa_append_copy(pack, "BEACONBSSTIME", 8, chunk);
  *sixptr = beaconint;
  pack = lcpa_append_copy(pack, "BEACONINT", 2, chunk);
  *sixptr = capabilities;
  pack = lcpa_append_copy(pack, "BEACONCAP", 2, chunk);
}


x86 assembly (clang, -O0):
<lcpf_proberesp>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x90,%rsp
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
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    -0x60(%rbp),%rax
mov    %rax,-0x68(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x34(%rbp),%ecx
mov    -0x38(%rbp),%r8d
mov    -0x20(%rbp),%r9
mov    -0x28(%rbp),%rbx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10d
mov    0x18(%rbp),%eax
xor    %esi,%esi
mov    $0x5,%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    -0x70(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rdi
lea    -0x60(%rbp),%rcx
lea    0xe3b(%rip),%rsi
mov    $0x8,%edx
call   1030 <lcpa_append_copy@plt>
mov    %rax,-0x18(%rbp)
mov    0x28(%rbp),%ecx
mov    -0x68(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rdi
lea    -0x60(%rbp),%rcx
lea    0xe23(%rip),%rsi
mov    $0x2,%edx
call   1030 <lcpa_append_copy@plt>
mov    %rax,-0x18(%rbp)
mov    0x30(%rbp),%ecx
mov    -0x68(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rdi
lea    -0x60(%rbp),%rcx
lea    0xe07(%rip),%rsi
mov    $0x2,%edx
call   1030 <lcpa_append_copy@plt>
mov    %rax,-0x18(%rbp)
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcpf_proberesp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,%r11
mov    %rdx,%r10
mov    %rsi,%rax
mov    %rdi,%rbx
mov    0x80(%rsp),%r15d
mov    0x78(%rsp),%r12d
mov    0x70(%rsp),%r14d
mov    0x60(%rsp),%r13d
mov    0x68(%rsp),%ebp
sub    $0x8,%rsp
xor    %esi,%esi
mov    $0x5,%edx
mov    %r8d,%ecx
mov    %r9d,%r8d
mov    %rax,%r9
push   %rbp
push   %r13
push   $0x0
push   %r11
push   %r10
call   1040 <lcpf_80211headers@plt>
add    $0x30,%rsp
mov    %r14d,(%rsp)
lea    0xe7a(%rip),%rsi
mov    %rsp,%r14
mov    %rbx,%rdi
mov    $0x8,%edx
mov    %r14,%rcx
call   1030 <lcpa_append_copy@plt>
mov    %r12d,(%rsp)
lea    0xe6a(%rip),%rsi
mov    %rax,%rdi
mov    $0x2,%edx
mov    %r14,%rcx
call   1030 <lcpa_append_copy@plt>
mov    %r15d,(%rsp)
lea    0xe59(%rip),%rsi
mov    %rax,%rdi
mov    $0x2,%edx
mov    %r14,%rcx
call   1030 <lcpa_append_copy@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.lcpa_metapack = type { i32 }
@.str = [14 x i8] c"BEACONBSSTIME\00"
@.str.1 = [10 x i8] c"BEACONINT\00"
@.str.2 = [10 x i8] c"BEACONCAP\00"
define void @lcpf_proberesp(%struct.lcpa_metapack* %0, i32* %1, i32* %2, i32* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10) {
%12 = alloca %struct.lcpa_metapack*
%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 i32
%22 = alloca i32
%23 = alloca [8 x i32]
%24 = alloca i32*
%25 = alloca i32*
store %struct.lcpa_metapack* %0, %struct.lcpa_metapack** %12
store i32* %1, i32** %13
store i32* %2, i32** %14
store i32* %3, i32** %15
store i32 %4, i32* %16
store i32 %5, i32* %17
store i32 %6, i32* %18
store i32 %7, i32* %19
store i32 %8, i32* %20
store i32 %9, i32* %21
store i32 %10, i32* %22
%26 = getelementptr inbounds [8 x i32], [8 x i32]* %23, i64 0, i64 0
store i32* %26, i32** %24
%27 = getelementptr inbounds [8 x i32], [8 x i32]* %23, i64 0, i64 0
store i32* %27, i32** %25
%28 = load %struct.lcpa_metapack*, %struct.lcpa_metapack** %12
%29 = load i32, i32* %16
%30 = load i32, i32* %17
%31 = load i32*, i32** %13
%32 = load i32*, i32** %14
%33 = load i32*, i32** %15
%34 = load i32, i32* %18
%35 = load i32, i32* %19
%36 = call i32 @lcpf_80211headers(%struct.lcpa_metapack* %28, i32 0, i32 5, i32 %29, i32 %30, i32* %31, i32* %32, i32* %33, i32* null, i32 %34, i32 %35)
%37 = load i32, i32* %20
%38 = load i32*, i32** %25
store i32 %37, i32* %38
%39 = load %struct.lcpa_metapack*, %struct.lcpa_metapack** %12
%40 = getelementptr inbounds [8 x i32], [8 x i32]* %23, i64 0, i64 0
%41 = call %struct.lcpa_metapack* @lcpa_append_copy(%struct.lcpa_metapack* %39, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 8, i32* %40)
store %struct.lcpa_metapack* %41, %struct.lcpa_metapack** %12
%42 = load i32, i32* %21
%43 = load i32*, i32** %24
store i32 %42, i32* %43
%44 = load %struct.lcpa_metapack*, %struct.lcpa_metapack** %12
%45 = getelementptr inbounds [8 x i32], [8 x i32]* %23, i64 0, i64 0
%46 = call %struct.lcpa_metapack* @lcpa_append_copy(%struct.lcpa_metapack* %44, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 2, i32* %45)
store %struct.lcpa_metapack* %46, %struct.lcpa_metapack** %12
%47 = load i32, i32* %22
%48 = load i32*, i32** %24
store i32 %47, i32* %48
%49 = load %struct.lcpa_metapack*, %struct.lcpa_metapack** %12
%50 = getelementptr inbounds [8 x i32], [8 x i32]* %23, i64 0, i64 0
%51 = call %struct.lcpa_metapack* @lcpa_append_copy(%struct.lcpa_metapack* %49, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 2, i32* %50)
store %struct.lcpa_metapack* %51, %struct.lcpa_metapack** %12
ret void
}

LLVM IR (-O2):
%struct.lcpa_metapack = type { i32 }
@.str = [14 x i8] c"BEACONBSSTIME\00"
@.str.1 = [10 x i8] c"BEACONINT\00"
@.str.2 = [10 x i8] c"BEACONCAP\00"
define void @lcpf_proberesp(%struct.lcpa_metapack* %0, i32* %1, i32* %2, i32* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10) {
%12 = alloca [8 x i32]
%13 = bitcast [8 x i32]* %12 to i8*
%14 = getelementptr inbounds [8 x i32], [8 x i32]* %12, i64 0, i64 0
%15 = tail call i32 @lcpf_80211headers(%struct.lcpa_metapack* %0, i32 0, i32 5, i32 %4, i32 %5, i32* %1, i32* %2, i32* %3, i32* null, i32 %6, i32 %7)
store i32 %8, i32* %14
%16 = 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 8, i32* %14)
store i32 %9, i32* %14
%17 = call %struct.lcpa_metapack* @lcpa_append_copy(%struct.lcpa_metapack* %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 2, i32* %14)
store i32 %10, i32* %14
%18 = call %struct.lcpa_metapack* @lcpa_append_copy(%struct.lcpa_metapack* %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 2, i32* %14)
ret void
}