#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct kvm_msrs {
  int nmsrs;
  TYPE_1__ *entries;
};
typedef int /*<<< orphan*/ __u64;
typedef int /*<<< orphan*/ __u32;
struct TYPE_2__ {
  int /*<<< orphan*/ data;
  int /*<<< orphan*/ index;
};

/* Variables and functions */
void msr_set(void *data, __u32 index, __u64 value) {
  struct kvm_msrs *msrs = (struct kvm_msrs *)data;
  msrs->nmsrs = 1;
  msrs->entries[0].index = index;
  msrs->entries[0].data = value;
}


x86 assembly (clang, -O0):
<msr_set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<msr_set>:
movl   $0x1,(%rdi)
mov    0x8(%rdi),%rax
mov    %esi,0x4(%rax)
mov    %edx,(%rax)
ret

LLVM IR (-O0):
%struct.kvm_msrs = type { i32, %struct.TYPE_2__* }
%struct.TYPE_2__ = type { i32, i32 }
define void @msr_set(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.kvm_msrs*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to %struct.kvm_msrs*
store %struct.kvm_msrs* %9, %struct.kvm_msrs** %7
%10 = load %struct.kvm_msrs*, %struct.kvm_msrs** %7
%11 = getelementptr inbounds %struct.kvm_msrs, %struct.kvm_msrs* %10, i32 0, i32 0
store i32 1, i32* %11
%12 = load i32, i32* %5
%13 = load %struct.kvm_msrs*, %struct.kvm_msrs** %7
%14 = getelementptr inbounds %struct.kvm_msrs, %struct.kvm_msrs* %13, i32 0, i32 1
%15 = load %struct.TYPE_2__*, %struct.TYPE_2__** %14
%16 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %15, i64 0
%17 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %16, i32 0, i32 1
store i32 %12, i32* %17
%18 = load i32, i32* %6
%19 = load %struct.kvm_msrs*, %struct.kvm_msrs** %7
%20 = getelementptr inbounds %struct.kvm_msrs, %struct.kvm_msrs* %19, i32 0, i32 1
%21 = load %struct.TYPE_2__*, %struct.TYPE_2__** %20
%22 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %21, i64 0
%23 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %22, i32 0, i32 0
store i32 %18, i32* %23
ret void
}

LLVM IR (-O2):
%struct.TYPE_2__ = type { i32, i32 }
define void @msr_set(i8* nocapture %0, i32 %1, i32 %2) {
%4 = bitcast i8* %0 to i32*
store i32 1, i32* %4
%5 = getelementptr inbounds i8, i8* %0, i64 8
%6 = bitcast i8* %5 to %struct.TYPE_2__**
%7 = load %struct.TYPE_2__*, %struct.TYPE_2__** %6
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i64 0, i32 1
store i32 %1, i32* %8
%9 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i64 0, i32 0
store i32 %2, i32* %9
ret void
}