#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 fgetc(int /*<<< orphan*/ *);
void GetLong(unsigned int *ret_val, FILE *fp) {
  unsigned int val;
  val = (long)(fgetc(fp) & 0xFF);
  val |= ((long)(fgetc(fp) & 0xFF) << 0x08);
  val |= ((long)(fgetc(fp) & 0xFF) << 0x10);
  val |= ((long)(fgetc(fp) & 0xFF) << 0x18);
  *ret_val = val;
}


x86 assembly (clang, -O0):
<GetLong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
and    $0xff,%eax
cltq
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
and    $0xff,%eax
movslq %eax,%rcx
shl    $0x8,%rcx
mov    -0x14(%rbp),%eax
or     %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
and    $0xff,%eax
movslq %eax,%rcx
shl    $0x10,%rcx
mov    -0x14(%rbp),%eax
or     %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
and    $0xff,%eax
movslq %eax,%rcx
shl    $0x18,%rcx
mov    -0x14(%rbp),%eax
or     %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetLong>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <fgetc@plt>
movzbl %al,%r15d
mov    %r12,%rdi
call   1030 <fgetc@plt>
shl    $0x8,%eax
movzwl %ax,%ebp
or     %r15d,%ebp
mov    %r12,%rdi
call   1030 <fgetc@plt>
movzbl %al,%ebx
shl    $0x10,%ebx
or     %ebp,%ebx
mov    %r12,%rdi
call   1030 <fgetc@plt>
shl    $0x18,%eax
or     %ebx,%eax
mov    %eax,(%r14)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @GetLong(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = call i32 @fgetc(i32* %6)
%8 = and i32 %7, 255
%9 = sext i32 %8 to i64
%10 = trunc i64 %9 to i32
store i32 %10, i32* %5
%11 = load i32*, i32** %4
%12 = call i32 @fgetc(i32* %11)
%13 = and i32 %12, 255
%14 = sext i32 %13 to i64
%15 = shl i64 %14, 8
%16 = load i32, i32* %5
%17 = zext i32 %16 to i64
%18 = or i64 %17, %15
%19 = trunc i64 %18 to i32
store i32 %19, i32* %5
%20 = load i32*, i32** %4
%21 = call i32 @fgetc(i32* %20)
%22 = and i32 %21, 255
%23 = sext i32 %22 to i64
%24 = shl i64 %23, 16
%25 = load i32, i32* %5
%26 = zext i32 %25 to i64
%27 = or i64 %26, %24
%28 = trunc i64 %27 to i32
store i32 %28, i32* %5
%29 = load i32*, i32** %4
%30 = call i32 @fgetc(i32* %29)
%31 = and i32 %30, 255
%32 = sext i32 %31 to i64
%33 = shl i64 %32, 24
%34 = load i32, i32* %5
%35 = zext i32 %34 to i64
%36 = or i64 %35, %33
%37 = trunc i64 %36 to i32
store i32 %37, i32* %5
%38 = load i32, i32* %5
%39 = load i32*, i32** %3
store i32 %38, i32* %39
ret void
}

LLVM IR (-O2):
define void @GetLong(i32* nocapture writeonly %0, i32* nocapture %1) {
%3 = tail call i32 @fgetc(i32* %1)
%4 = and i32 %3, 255
%5 = tail call i32 @fgetc(i32* %1)
%6 = shl i32 %5, 8
%7 = and i32 %6, 65280
%8 = or i32 %7, %4
%9 = tail call i32 @fgetc(i32* %1)
%10 = shl i32 %9, 16
%11 = and i32 %10, 16711680
%12 = or i32 %8, %11
%13 = tail call i32 @fgetc(i32* %1)
%14 = shl i32 %13, 24
%15 = or i32 %12, %14
store i32 %15, i32* %0
ret void
}