#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 /*<<< orphan*/ fread(unsigned char *, int, int, int /*<<< orphan*/ *);
unsigned int read_le_dword(FILE *f) {
  unsigned char c;
  unsigned int i;
  fread(&c, sizeof(char), 1, f);
  i = c;
  fread(&c, sizeof(char), 1, f);
  i |= (c << 8);
  fread(&c, sizeof(char), 1, f);
  i |= (c << 16);
  fread(&c, sizeof(char), 1, f);
  i |= (c << 24);
  return i;
}


x86 assembly (clang, -O0):
<read_le_dword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0x9(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
movzbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0x9(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
movzbl -0x9(%rbp),%eax
shl    $0x8,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0x9(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
movzbl -0x9(%rbp),%eax
shl    $0x10,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0x9(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
movzbl -0x9(%rbp),%eax
shl    $0x18,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_le_dword>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r12
lea    0xf(%rsp),%r14
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
movzbl 0xf(%rsp),%r15d
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
movzbl 0xf(%rsp),%ebp
shl    $0x8,%ebp
or     %r15d,%ebp
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
movzbl 0xf(%rsp),%ebx
shl    $0x10,%ebx
or     %ebp,%ebx
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
movzbl 0xf(%rsp),%eax
shl    $0x18,%eax
or     %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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