#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;
struct bpf_insn {
  int /*<<< orphan*/ imm;
  int /*<<< orphan*/ off;
  int /*<<< orphan*/ src_reg;
  int /*<<< orphan*/ dst_reg;
  int /*<<< orphan*/ code;
};
typedef int /*<<< orphan*/ int32_t;
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
struct bpf_insn bpf_insn(uint8_t opcode, uint8_t dst_reg, uint8_t src_reg,
                         int16_t off, int32_t imm) {
  struct bpf_insn ret = {
      .code = opcode,
      .dst_reg = dst_reg,
      .src_reg = src_reg,
      .off = off,
      .imm = imm,
  };
  return ret;
}


x86 assembly (clang, -O0):
<bpf_insn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,%rax
mov    %esi,-0x4(%rbp)
mov    %edx,-0x8(%rbp)
mov    %ecx,-0xc(%rbp)
mov    %r8d,-0x10(%rbp)
mov    %r9d,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    %ecx,(%rdi)
mov    -0x10(%rbp),%ecx
mov    %ecx,0x4(%rdi)
mov    -0xc(%rbp),%ecx
mov    %ecx,0x8(%rdi)
mov    -0x8(%rbp),%ecx
mov    %ecx,0xc(%rdi)
mov    -0x4(%rbp),%ecx
mov    %ecx,0x10(%rdi)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bpf_insn>:
mov    %rdi,%rax
mov    %r9d,(%rdi)
mov    %r8d,0x4(%rdi)
mov    %ecx,0x8(%rdi)
mov    %edx,0xc(%rdi)
mov    %esi,0x10(%rdi)
ret

LLVM IR (-O0):
%struct.bpf_insn = type { i32, i32, i32, i32, i32 }
define void @bpf_insn(%struct.bpf_insn* noalias sret(%struct.bpf_insn) align 4 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
store i32 %5, i32* %11
%12 = getelementptr inbounds %struct.bpf_insn, %struct.bpf_insn* %0, i32 0, i32 0
%13 = load i32, i32* %11
store i32 %13, i32* %12
%14 = getelementptr inbounds %struct.bpf_insn, %struct.bpf_insn* %0, i32 0, i32 1
%15 = load i32, i32* %10
store i32 %15, i32* %14
%16 = getelementptr inbounds %struct.bpf_insn, %struct.bpf_insn* %0, i32 0, i32 2
%17 = load i32, i32* %9
store i32 %17, i32* %16
%18 = getelementptr inbounds %struct.bpf_insn, %struct.bpf_insn* %0, i32 0, i32 3
%19 = load i32, i32* %8
store i32 %19, i32* %18
%20 = getelementptr inbounds %struct.bpf_insn, %struct.bpf_insn* %0, i32 0, i32 4
%21 = load i32, i32* %7
store i32 %21, i32* %20
ret void
}

LLVM IR (-O2):
%struct.bpf_insn = type { i32, i32, i32, i32, i32 }
define void @bpf_insn(%struct.bpf_insn* noalias nocapture writeonly sret(%struct.bpf_insn) align 4 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = getelementptr inbounds %struct.bpf_insn, %struct.bpf_insn* %0, i64 0, i32 0
store i32 %5, i32* %7
%8 = getelementptr inbounds %struct.bpf_insn, %struct.bpf_insn* %0, i64 0, i32 1
store i32 %4, i32* %8
%9 = getelementptr inbounds %struct.bpf_insn, %struct.bpf_insn* %0, i64 0, i32 2
store i32 %3, i32* %9
%10 = getelementptr inbounds %struct.bpf_insn, %struct.bpf_insn* %0, i64 0, i32 3
store i32 %2, i32* %10
%11 = getelementptr inbounds %struct.bpf_insn, %struct.bpf_insn* %0, i64 0, i32 4
store i32 %1, i32* %11
ret void
}