#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 size_t uint16_t;

/* Variables and functions */
int /*<<< orphan*/ US_GET_BYTE_0(int /*<<< orphan*/);
int /*<<< orphan*/ US_GET_BYTE_1(int /*<<< orphan*/);
int /*<<< orphan*/ US_GET_BYTE_2(int /*<<< orphan*/);
int /*<<< orphan*/ US_GET_BYTE_3(int /*<<< orphan*/);
int /*<<< orphan*/ US_GET_BYTE_4(int /*<<< orphan*/);
int /*<<< orphan*/ US_GET_BYTE_5(int /*<<< orphan*/);
int /*<<< orphan*/ US_GET_BYTE_6(int /*<<< orphan*/);
int /*<<< orphan*/ US_GET_BYTE_7(int /*<<< orphan*/);
void us_bits_set_octlet(void *base, uint16_t offset, uint64_t v) {
  uint8_t *data = (uint8_t *)base;
  data[offset] = US_GET_BYTE_7(v);
  data[offset + 1] = US_GET_BYTE_6(v);
  data[offset + 2] = US_GET_BYTE_5(v);
  data[offset + 3] = US_GET_BYTE_4(v);
  data[offset + 4] = US_GET_BYTE_3(v);
  data[offset + 5] = US_GET_BYTE_2(v);
  data[offset + 6] = US_GET_BYTE_1(v);
  data[offset + 7] = US_GET_BYTE_0(v);
}


x86 assembly (clang, -O0):
<us_bits_set_octlet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1060 <US_GET_BYTE_7@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edi
call   1080 <US_GET_BYTE_6@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %edx,0x4(%rax,%rcx,4)
mov    -0x14(%rbp),%edi
call   1030 <US_GET_BYTE_5@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %edx,0x8(%rax,%rcx,4)
mov    -0x14(%rbp),%edi
call   10a0 <US_GET_BYTE_4@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %edx,0xc(%rax,%rcx,4)
mov    -0x14(%rbp),%edi
call   1050 <US_GET_BYTE_3@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %edx,0x10(%rax,%rcx,4)
mov    -0x14(%rbp),%edi
call   1090 <US_GET_BYTE_2@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %edx,0x14(%rax,%rcx,4)
mov    -0x14(%rbp),%edi
call   1040 <US_GET_BYTE_1@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %edx,0x18(%rax,%rcx,4)
mov    -0x14(%rbp),%edi
call   1070 <US_GET_BYTE_0@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %edx,0x1c(%rax,%rcx,4)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<us_bits_set_octlet>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %edx,%edi
call   1060 <US_GET_BYTE_7@plt>
mov    %eax,(%rbx,%r14,4)
mov    %ebp,%edi
call   1080 <US_GET_BYTE_6@plt>
mov    %eax,0x4(%rbx,%r14,4)
mov    %ebp,%edi
call   1030 <US_GET_BYTE_5@plt>
mov    %eax,0x8(%rbx,%r14,4)
mov    %ebp,%edi
call   10a0 <US_GET_BYTE_4@plt>
mov    %eax,0xc(%rbx,%r14,4)
mov    %ebp,%edi
call   1050 <US_GET_BYTE_3@plt>
mov    %eax,0x10(%rbx,%r14,4)
mov    %ebp,%edi
call   1090 <US_GET_BYTE_2@plt>
mov    %eax,0x14(%rbx,%r14,4)
mov    %ebp,%edi
call   1040 <US_GET_BYTE_1@plt>
mov    %eax,0x18(%rbx,%r14,4)
mov    %ebp,%edi
call   1070 <US_GET_BYTE_0@plt>
mov    %eax,0x1c(%rbx,%r14,4)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @us_bits_set_octlet(i8* %0, i64 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
store i32* %9, i32** %7
%10 = load i32, i32* %6
%11 = call i32 @US_GET_BYTE_7(i32 %10)
%12 = load i32*, i32** %7
%13 = load i64, i64* %5
%14 = getelementptr inbounds i32, i32* %12, i64 %13
store i32 %11, i32* %14
%15 = load i32, i32* %6
%16 = call i32 @US_GET_BYTE_6(i32 %15)
%17 = load i32*, i32** %7
%18 = load i64, i64* %5
%19 = add i64 %18, 1
%20 = getelementptr inbounds i32, i32* %17, i64 %19
store i32 %16, i32* %20
%21 = load i32, i32* %6
%22 = call i32 @US_GET_BYTE_5(i32 %21)
%23 = load i32*, i32** %7
%24 = load i64, i64* %5
%25 = add i64 %24, 2
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
%27 = load i32, i32* %6
%28 = call i32 @US_GET_BYTE_4(i32 %27)
%29 = load i32*, i32** %7
%30 = load i64, i64* %5
%31 = add i64 %30, 3
%32 = getelementptr inbounds i32, i32* %29, i64 %31
store i32 %28, i32* %32
%33 = load i32, i32* %6
%34 = call i32 @US_GET_BYTE_3(i32 %33)
%35 = load i32*, i32** %7
%36 = load i64, i64* %5
%37 = add i64 %36, 4
%38 = getelementptr inbounds i32, i32* %35, i64 %37
store i32 %34, i32* %38
%39 = load i32, i32* %6
%40 = call i32 @US_GET_BYTE_2(i32 %39)
%41 = load i32*, i32** %7
%42 = load i64, i64* %5
%43 = add i64 %42, 5
%44 = getelementptr inbounds i32, i32* %41, i64 %43
store i32 %40, i32* %44
%45 = load i32, i32* %6
%46 = call i32 @US_GET_BYTE_1(i32 %45)
%47 = load i32*, i32** %7
%48 = load i64, i64* %5
%49 = add i64 %48, 6
%50 = getelementptr inbounds i32, i32* %47, i64 %49
store i32 %46, i32* %50
%51 = load i32, i32* %6
%52 = call i32 @US_GET_BYTE_0(i32 %51)
%53 = load i32*, i32** %7
%54 = load i64, i64* %5
%55 = add i64 %54, 7
%56 = getelementptr inbounds i32, i32* %53, i64 %55
store i32 %52, i32* %56
ret void
}

LLVM IR (-O2):
define void @us_bits_set_octlet(i8* nocapture writeonly %0, i64 %1, i32 %2) {
%4 = bitcast i8* %0 to i32*
%5 = tail call i32 @US_GET_BYTE_7(i32 %2)
%6 = getelementptr inbounds i32, i32* %4, i64 %1
store i32 %5, i32* %6
%7 = tail call i32 @US_GET_BYTE_6(i32 %2)
%8 = add i64 %1, 1
%9 = getelementptr inbounds i32, i32* %4, i64 %8
store i32 %7, i32* %9
%10 = tail call i32 @US_GET_BYTE_5(i32 %2)
%11 = add i64 %1, 2
%12 = getelementptr inbounds i32, i32* %4, i64 %11
store i32 %10, i32* %12
%13 = tail call i32 @US_GET_BYTE_4(i32 %2)
%14 = add i64 %1, 3
%15 = getelementptr inbounds i32, i32* %4, i64 %14
store i32 %13, i32* %15
%16 = tail call i32 @US_GET_BYTE_3(i32 %2)
%17 = add i64 %1, 4
%18 = getelementptr inbounds i32, i32* %4, i64 %17
store i32 %16, i32* %18
%19 = tail call i32 @US_GET_BYTE_2(i32 %2)
%20 = add i64 %1, 5
%21 = getelementptr inbounds i32, i32* %4, i64 %20
store i32 %19, i32* %21
%22 = tail call i32 @US_GET_BYTE_1(i32 %2)
%23 = add i64 %1, 6
%24 = getelementptr inbounds i32, i32* %4, i64 %23
store i32 %22, i32* %24
%25 = tail call i32 @US_GET_BYTE_0(i32 %2)
%26 = add i64 %1, 7
%27 = getelementptr inbounds i32, i32* %4, i64 %26
store i32 %25, i32* %27
ret void
}