#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 */

/* Variables and functions */
scalar_t__ gcspy_arrayInputBaseRead(char *);
int gcspy_arrayInputReadInt(char *buffer) {
  int res = 0;
  res = (int)gcspy_arrayInputBaseRead(buffer);
  res <<= 8;
  res |= (int)gcspy_arrayInputBaseRead(buffer + 1);
  res <<= 8;
  res |= (int)gcspy_arrayInputBaseRead(buffer + 2);
  res <<= 8;
  res |= (int)gcspy_arrayInputBaseRead(buffer + 3);
  return res;
}


x86 assembly (clang, -O0):
<gcspy_arrayInputReadInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <gcspy_arrayInputBaseRead@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
call   1030 <gcspy_arrayInputBaseRead@plt>
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x2,%rdi
call   1030 <gcspy_arrayInputBaseRead@plt>
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x3,%rdi
call   1030 <gcspy_arrayInputBaseRead@plt>
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcspy_arrayInputReadInt>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
call   1030 <gcspy_arrayInputBaseRead@plt>
mov    %rax,%r14
lea    0x1(%r12),%rdi
call   1030 <gcspy_arrayInputBaseRead@plt>
mov    %rax,%r15
shl    $0x10,%r14d
shl    $0x8,%r15d
lea    0x2(%r12),%rdi
call   1030 <gcspy_arrayInputBaseRead@plt>
mov    %rax,%rbx
or     %r14d,%ebx
or     %r15d,%ebx
shl    $0x8,%ebx
add    $0x3,%r12
mov    %r12,%rdi
call   1030 <gcspy_arrayInputBaseRead@plt>
or     %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @gcspy_arrayInputReadInt(i8* %0) {
%2 = tail call i64 @gcspy_arrayInputBaseRead(i8* %0)
%3 = trunc i64 %2 to i32
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = tail call i64 @gcspy_arrayInputBaseRead(i8* %4)
%6 = trunc i64 %5 to i32
%7 = shl i32 %3, 16
%8 = shl i32 %6, 8
%9 = or i32 %8, %7
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = tail call i64 @gcspy_arrayInputBaseRead(i8* %10)
%12 = trunc i64 %11 to i32
%13 = or i32 %9, %12
%14 = shl i32 %13, 8
%15 = getelementptr inbounds i8, i8* %0, i64 3
%16 = tail call i64 @gcspy_arrayInputBaseRead(i8* %15)
%17 = trunc i64 %16 to i32
%18 = or i32 %14, %17
ret i32 %18
}