#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;
struct arc4_stream {
  int dummy;
};

/* Variables and functions */
int arc4_getbyte(struct arc4_stream *);
uint32_t arc4_getword(struct arc4_stream *as) {
  uint32_t val;
  val = arc4_getbyte(as) << 24;
  val |= arc4_getbyte(as) << 16;
  val |= arc4_getbyte(as) << 8;
  val |= arc4_getbyte(as);
  return val;
}


x86 assembly (clang, -O0):
<arc4_getword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <arc4_getbyte@plt>
shl    $0x18,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <arc4_getbyte@plt>
shl    $0x10,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <arc4_getbyte@plt>
shl    $0x8,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <arc4_getbyte@plt>
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arc4_getword>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <arc4_getbyte@plt>
mov    %eax,%ebp
shl    $0x18,%ebp
mov    %r14,%rdi
call   1030 <arc4_getbyte@plt>
mov    %eax,%ebx
shl    $0x10,%ebx
or     %ebp,%ebx
mov    %r14,%rdi
call   1030 <arc4_getbyte@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
mov    %r14,%rdi
call   1030 <arc4_getbyte@plt>
or     %ebp,%eax
or     %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.arc4_stream = type { i32 }
define i32 @arc4_getword(%struct.arc4_stream* %0) {
%2 = alloca %struct.arc4_stream*
%3 = alloca i32
store %struct.arc4_stream* %0, %struct.arc4_stream** %2
%4 = load %struct.arc4_stream*, %struct.arc4_stream** %2
%5 = call i32 @arc4_getbyte(%struct.arc4_stream* %4)
%6 = shl i32 %5, 24
store i32 %6, i32* %3
%7 = load %struct.arc4_stream*, %struct.arc4_stream** %2
%8 = call i32 @arc4_getbyte(%struct.arc4_stream* %7)
%9 = shl i32 %8, 16
%10 = load i32, i32* %3
%11 = or i32 %10, %9
store i32 %11, i32* %3
%12 = load %struct.arc4_stream*, %struct.arc4_stream** %2
%13 = call i32 @arc4_getbyte(%struct.arc4_stream* %12)
%14 = shl i32 %13, 8
%15 = load i32, i32* %3
%16 = or i32 %15, %14
store i32 %16, i32* %3
%17 = load %struct.arc4_stream*, %struct.arc4_stream** %2
%18 = call i32 @arc4_getbyte(%struct.arc4_stream* %17)
%19 = load i32, i32* %3
%20 = or i32 %19, %18
store i32 %20, i32* %3
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
%struct.arc4_stream = type { i32 }
define i32 @arc4_getword(%struct.arc4_stream* %0) {
%2 = tail call i32 @arc4_getbyte(%struct.arc4_stream* %0)
%3 = shl i32 %2, 24
%4 = tail call i32 @arc4_getbyte(%struct.arc4_stream* %0)
%5 = shl i32 %4, 16
%6 = or i32 %5, %3
%7 = tail call i32 @arc4_getbyte(%struct.arc4_stream* %0)
%8 = shl i32 %7, 8
%9 = or i32 %6, %8
%10 = tail call i32 @arc4_getbyte(%struct.arc4_stream* %0)
%11 = or i32 %9, %10
ret i32 %11
}