#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*/ uint32_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*/);
void us_bits_set_quadlet(void *base, uint16_t offset, uint32_t v) {
  uint8_t *data = (uint8_t *)base;
  data[offset] = US_GET_BYTE_3(v);
  data[offset + 1] = US_GET_BYTE_2(v);
  data[offset + 2] = US_GET_BYTE_1(v);
  data[offset + 3] = US_GET_BYTE_0(v);
}


x86 assembly (clang, -O0):
<us_bits_set_quadlet>:
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   1040 <US_GET_BYTE_3@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edi
call   1060 <US_GET_BYTE_2@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_1@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %edx,0x8(%rax,%rcx,4)
mov    -0x14(%rbp),%edi
call   1050 <US_GET_BYTE_0@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %edx,0xc(%rax,%rcx,4)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<us_bits_set_quadlet>:
push   %r15
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%edi
call   1040 <US_GET_BYTE_3@plt>
mov    %eax,(%r15,%r14,4)
mov    %ebx,%edi
call   1060 <US_GET_BYTE_2@plt>
mov    %eax,0x4(%r15,%r14,4)
mov    %ebx,%edi
call   1030 <US_GET_BYTE_1@plt>
mov    %eax,0x8(%r15,%r14,4)
mov    %ebx,%edi
call   1050 <US_GET_BYTE_0@plt>
mov    %eax,0xc(%r15,%r14,4)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @us_bits_set_quadlet(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_3(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_2(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_1(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_0(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
ret void
}

LLVM IR (-O2):
define void @us_bits_set_quadlet(i8* nocapture writeonly %0, i64 %1, i32 %2) {
%4 = bitcast i8* %0 to i32*
%5 = tail call i32 @US_GET_BYTE_3(i32 %2)
%6 = getelementptr inbounds i32, i32* %4, i64 %1
store i32 %5, i32* %6
%7 = tail call i32 @US_GET_BYTE_2(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_1(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_0(i32 %2)
%14 = add i64 %1, 3
%15 = getelementptr inbounds i32, i32* %4, i64 %14
store i32 %13, i32* %15
ret void
}