#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 uint8_t;
typedef int uint32_t;
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int32_t ReadUint32Le(const void *in, uint32_t *value) {
  assert(in != NULL);
  assert(value != NULL);
  const uint8_t *buf = (const uint8_t *)in;
  uint32_t out = buf[3];
  out <<= 8;
  out |= buf[2];
  out <<= 8;
  out |= buf[1];
  out <<= 8;
  out |= buf[0];
  *value = out;
  return 4;
}


x86 assembly (clang, -O0):
<ReadUint32Le>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x4,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadUint32Le>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1030 <assert@plt>
mov    0x8(%rbx),%eax
mov    0xc(%rbx),%ecx
shl    $0x10,%ecx
shl    $0x8,%eax
or     %ecx,%eax
or     0x4(%rbx),%eax
shl    $0x8,%eax
or     (%rbx),%eax
mov    %eax,(%r14)
mov    $0x4,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @ReadUint32Le(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i32*, i32** %4
%12 = icmp ne i32* %11, null
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i8*, i8** %3
%16 = bitcast i8* %15 to i32*
store i32* %16, i32** %5
%17 = load i32*, i32** %5
%18 = getelementptr inbounds i32, i32* %17, i64 3
%19 = load i32, i32* %18
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = shl i32 %20, 8
store i32 %21, i32* %6
%22 = load i32*, i32** %5
%23 = getelementptr inbounds i32, i32* %22, i64 2
%24 = load i32, i32* %23
%25 = load i32, i32* %6
%26 = or i32 %25, %24
store i32 %26, i32* %6
%27 = load i32, i32* %6
%28 = shl i32 %27, 8
store i32 %28, i32* %6
%29 = load i32*, i32** %5
%30 = getelementptr inbounds i32, i32* %29, i64 1
%31 = load i32, i32* %30
%32 = load i32, i32* %6
%33 = or i32 %32, %31
store i32 %33, i32* %6
%34 = load i32, i32* %6
%35 = shl i32 %34, 8
store i32 %35, i32* %6
%36 = load i32*, i32** %5
%37 = getelementptr inbounds i32, i32* %36, i64 0
%38 = load i32, i32* %37
%39 = load i32, i32* %6
%40 = or i32 %39, %38
store i32 %40, i32* %6
%41 = load i32, i32* %6
%42 = load i32*, i32** %4
store i32 %41, i32* %42
ret i32 4
}

LLVM IR (-O2):
define i32 @ReadUint32Le(i8* %0, i32* writeonly %1) {
%3 = icmp ne i8* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp ne i32* %1, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = bitcast i8* %0 to i32*
%10 = getelementptr inbounds i8, i8* %0, i64 12
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
%13 = getelementptr inbounds i8, i8* %0, i64 8
%14 = bitcast i8* %13 to i32*
%15 = load i32, i32* %14
%16 = shl i32 %12, 16
%17 = shl i32 %15, 8
%18 = or i32 %17, %16
%19 = getelementptr inbounds i8, i8* %0, i64 4
%20 = bitcast i8* %19 to i32*
%21 = load i32, i32* %20
%22 = or i32 %18, %21
%23 = shl i32 %22, 8
%24 = load i32, i32* %9
%25 = or i32 %23, %24
store i32 %25, i32* %1
ret i32 4
}