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

/* Variables and functions */
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int read32LE(FILE *f, unsigned int *target) {
  unsigned char bytes[4];
  int got = fread(bytes, 1, 4, f);
  *target = bytes[0];
  *target |= (((unsigned short)bytes[1]) << 8) & 0xFF00;
  *target |= (((unsigned short)bytes[2]) << 16) & 0xFF0000;
  *target |= (((unsigned short)bytes[3]) << 24) & 0xFF000000;
  return got;
}


x86 assembly (clang, -O0):
<read32LE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
mov    %eax,-0x18(%rbp)
movzbl -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movzbl -0x13(%rbp),%eax
movzwl %ax,%ecx
shl    $0x8,%ecx
and    $0xff00,%ecx
mov    -0x10(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
movzbl -0x12(%rbp),%eax
movzwl %ax,%ecx
shl    $0x10,%ecx
and    $0xff0000,%ecx
mov    -0x10(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
movzbl -0x11(%rbp),%eax
movzwl %ax,%ecx
shl    $0x18,%ecx
and    $0xff000000,%ecx
mov    -0x10(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read32LE>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,%rcx
lea    0xc(%rsp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
mov    0xc(%rsp),%ecx
mov    %ecx,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @read32LE(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [4 x i8]
%6 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%8 = load i32*, i32** %3
%9 = call i32 @fread(i8* %7, i32 1, i32 4, i32* %8)
store i32 %9, i32* %6
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = load i32*, i32** %4
store i32 %12, i32* %13
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 1
%15 = load i8, i8* %14
%16 = zext i8 %15 to i16
%17 = zext i16 %16 to i32
%18 = shl i32 %17, 8
%19 = and i32 %18, 65280
%20 = load i32*, i32** %4
%21 = load i32, i32* %20
%22 = or i32 %21, %19
store i32 %22, i32* %20
%23 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 2
%24 = load i8, i8* %23
%25 = zext i8 %24 to i16
%26 = zext i16 %25 to i32
%27 = shl i32 %26, 16
%28 = and i32 %27, 16711680
%29 = load i32*, i32** %4
%30 = load i32, i32* %29
%31 = or i32 %30, %28
store i32 %31, i32* %29
%32 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 3
%33 = load i8, i8* %32
%34 = zext i8 %33 to i16
%35 = zext i16 %34 to i32
%36 = shl i32 %35, 24
%37 = and i32 %36, -16777216
%38 = load i32*, i32** %4
%39 = load i32, i32* %38
%40 = or i32 %39, %37
store i32 %40, i32* %38
%41 = load i32, i32* %6
ret i32 %41
}

LLVM IR (-O2):
define i32 @read32LE(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = alloca [4 x i8]
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = call i32 @fread(i8* %4, i32 1, i32 4, i32* %0)
%6 = load i8, i8* %4
%7 = zext i8 %6 to i32
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = shl nuw nsw i32 %10, 8
%12 = or i32 %11, %7
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = shl nuw nsw i32 %15, 16
%17 = or i32 %16, %12
%18 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = shl nuw i32 %20, 24
%22 = or i32 %21, %17
store i32 %22, i32* %1
ret i32 %5
}