#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 uint32_t;

/* Variables and functions */
uint32_t load32(const void *src) {
  const uint8_t *p = (uint8_t *)src;
  uint32_t w = *p++;
  w |= (uint32_t)(*p++) << 8;
  w |= (uint32_t)(*p++) << 16;
  w |= (uint32_t)(*p++) << 24;
  return w;
}


x86 assembly (clang, -O0):
<load32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%eax
shl    $0x8,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%eax
shl    $0x10,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%eax
shl    $0x18,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<load32>:
mov    0x4(%rdi),%ecx
mov    0x8(%rdi),%edx
shl    $0x8,%ecx
or     (%rdi),%ecx
shl    $0x10,%edx
mov    0xc(%rdi),%eax
shl    $0x18,%eax
or     %edx,%eax
or     %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @load32(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = getelementptr inbounds i8, i8* %0, i64 4
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %2
%6 = getelementptr inbounds i8, i8* %0, i64 8
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %4
%9 = shl i32 %8, 8
%10 = or i32 %9, %5
%11 = getelementptr inbounds i8, i8* %0, i64 12
%12 = bitcast i8* %11 to i32*
%13 = load i32, i32* %7
%14 = shl i32 %13, 16
%15 = or i32 %10, %14
%16 = load i32, i32* %12
%17 = shl i32 %16, 24
%18 = or i32 %15, %17
ret i32 %18
}