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

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
uint32_t lget4(const void *p) {
  const uint8_t *u = p;
  assert(p != NULL);
  return ((uint32_t)u[0] | ((uint32_t)u[1] << 8) | ((uint32_t)u[2] << 16) |
          ((uint32_t)u[3] << 24));
}


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

x86 assembly (clang, -O2):
<lget4>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
mov    0x8(%rbx),%ecx
mov    0x10(%rbx),%edx
shl    $0x8,%ecx
or     (%rbx),%ecx
shl    $0x10,%edx
mov    0x18(%rbx),%eax
shl    $0x18,%eax
or     %edx,%eax
or     %ecx,%eax
pop    %rbx
ret

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

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