#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;

/* Variables and functions */
uint32_t fourcc_integer(const char *s) {
  uint32_t part, val = s[0];
  part = s[1];
  val |= (0x0000FF00 & (part << 8));
  part = s[2];
  val |= (0x00FF0000 & (part << 16));
  part = s[3];
  val |= (0xFF000000 & (part << 24));
  return val;
}


x86 assembly (clang, -O0):
<fourcc_integer>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
and    $0xff00,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x10,%eax
and    $0xff0000,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x3(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x18,%eax
and    $0xff000000,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fourcc_integer>:
movsbl (%rdi),%eax
movzbl 0x1(%rdi),%ecx
shl    $0x8,%ecx
movzwl %cx,%ecx
or     %eax,%ecx
movzbl 0x2(%rdi),%eax
movzbl %al,%edx
shl    $0x10,%edx
movzbl 0x3(%rdi),%eax
shl    $0x18,%eax
or     %edx,%eax
or     %ecx,%eax
ret

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

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