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

/* Variables and functions */
int ncr53c8xx_ram_readb(int, void *);
uint32_t ncr53c8xx_ram_readl(uint32_t addr, void *p) {
  uint32_t val;
  val = ncr53c8xx_ram_readb(addr, p);
  val |= ncr53c8xx_ram_readb(addr + 1, p) << 8;
  val |= ncr53c8xx_ram_readb(addr + 2, p) << 16;
  val |= ncr53c8xx_ram_readb(addr + 3, p) << 24;
  return val;
}


x86 assembly (clang, -O0):
<ncr53c8xx_ram_readl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <ncr53c8xx_ram_readb@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x10(%rbp),%rsi
call   1030 <ncr53c8xx_ram_readb@plt>
shl    $0x8,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
add    $0x2,%edi
mov    -0x10(%rbp),%rsi
call   1030 <ncr53c8xx_ram_readb@plt>
shl    $0x10,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
add    $0x3,%edi
mov    -0x10(%rbp),%rsi
call   1030 <ncr53c8xx_ram_readb@plt>
shl    $0x18,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ncr53c8xx_ram_readl>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebx
call   1030 <ncr53c8xx_ram_readb@plt>
mov    %eax,%r15d
lea    0x1(%rbx),%edi
mov    %r14,%rsi
call   1030 <ncr53c8xx_ram_readb@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
or     %r15d,%ebp
lea    0x2(%rbx),%edi
mov    %r14,%rsi
call   1030 <ncr53c8xx_ram_readb@plt>
mov    %eax,%r15d
shl    $0x10,%r15d
add    $0x3,%ebx
mov    %ebx,%edi
mov    %r14,%rsi
call   1030 <ncr53c8xx_ram_readb@plt>
shl    $0x18,%eax
or     %r15d,%eax
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @ncr53c8xx_ram_readl(i32 %0, i8* %1) {
%3 = tail call i32 @ncr53c8xx_ram_readb(i32 %0, i8* %1)
%4 = add nsw i32 %0, 1
%5 = tail call i32 @ncr53c8xx_ram_readb(i32 %4, i8* %1)
%6 = shl i32 %5, 8
%7 = or i32 %6, %3
%8 = add nsw i32 %0, 2
%9 = tail call i32 @ncr53c8xx_ram_readb(i32 %8, i8* %1)
%10 = shl i32 %9, 16
%11 = or i32 %7, %10
%12 = add nsw i32 %0, 3
%13 = tail call i32 @ncr53c8xx_ram_readb(i32 %12, i8* %1)
%14 = shl i32 %13, 24
%15 = or i32 %11, %14
ret i32 %15
}