#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 GLuint;
typedef int GLubyte;
typedef int GLint;
typedef int /*<<< orphan*/ GLdouble;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
GLdouble extractSint(int isSwap, const void *sitem) {
  GLint sint;
  if (isSwap) {
    sint = (GLuint)(((GLuint)((const GLubyte *)(sitem))[3]) << 24 |
                    ((GLuint)((const GLubyte *)(sitem))[2]) << 16 |
                    ((GLuint)((const GLubyte *)(sitem))[1]) << 8 |
                    ((const GLubyte *)(sitem))[0]);
  } else {
    sint = *(const GLint *)sitem;
  }
  assert(sint <= 0x7fffffff);
  return (GLdouble)sint;
}


x86 assembly (clang, -O0):
<extractSint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1159 <extractSint+0x49>
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%eax
shl    $0x18,%eax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
or     (%rcx),%eax
mov    %eax,-0x14(%rbp)
jmp    1162 <extractSint+0x52>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x7fffffff,-0x14(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extractSint>:
push   %rbx
test   %edi,%edi
je     112f <extractSint+0x1f>
mov    0xc(%rsi),%eax
shl    $0x18,%eax
mov    0x4(%rsi),%ebx
mov    0x8(%rsi),%ecx
shl    $0x10,%ecx
or     %eax,%ecx
shl    $0x8,%ebx
or     %ecx,%ebx
or     (%rsi),%ebx
jmp    1131 <extractSint+0x21>
mov    (%rsi),%ebx
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @extractSint(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %31
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
%11 = getelementptr inbounds i32, i32* %10, i64 3
%12 = load i32, i32* %11
%13 = shl i32 %12, 24
%14 = load i8*, i8** %4
%15 = bitcast i8* %14 to i32*
%16 = getelementptr inbounds i32, i32* %15, i64 2
%17 = load i32, i32* %16
%18 = shl i32 %17, 16
%19 = or i32 %13, %18
%20 = load i8*, i8** %4
%21 = bitcast i8* %20 to i32*
%22 = getelementptr inbounds i32, i32* %21, i64 1
%23 = load i32, i32* %22
%24 = shl i32 %23, 8
%25 = or i32 %19, %24
%26 = load i8*, i8** %4
%27 = bitcast i8* %26 to i32*
%28 = getelementptr inbounds i32, i32* %27, i64 0
%29 = load i32, i32* %28
%30 = or i32 %25, %29
store i32 %30, i32* %5
br label %35
31: ; preds = %2
%32 = load i8*, i8** %4
%33 = bitcast i8* %32 to i32*
%34 = load i32, i32* %33
store i32 %34, i32* %5
br label %35
35: ; preds = %31, %8
%36 = load i32, i32* %5
%37 = icmp sle i32 %36, 2147483647
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = load i32, i32* %5
ret i32 %40
}

LLVM IR (-O2):
define i32 @extractSint(i32 %0, i8* nocapture %1) {
%3 = icmp eq i32 %0, 0
%4 = bitcast i8* %1 to i32*
br i1 %3, label %22, label %5
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %1, i64 12
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %7
%9 = shl i32 %8, 24
%10 = getelementptr inbounds i8, i8* %1, i64 8
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
%13 = shl i32 %12, 16
%14 = or i32 %13, %9
%15 = getelementptr inbounds i8, i8* %1, i64 4
%16 = bitcast i8* %15 to i32*
%17 = load i32, i32* %16
%18 = shl i32 %17, 8
%19 = or i32 %14, %18
%20 = load i32, i32* %4
%21 = or i32 %19, %20
br label %24
22: ; preds = %2
%23 = load i32, i32* %4
br label %24
24: ; preds = %22, %5
%25 = phi i32 [ %21, %5 ], [ %23, %22 ]
%26 = tail call i32 @assert(i32 1)
ret i32 %25
}