#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*/ SEEK_SET;
void *createInflatedStream(void *, int);
size_t fread(void *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
void *malloc(int);
void *getTravelStream(FILE *file, int streamOffset, int streamLength) {
  if (file == NULL || streamOffset == 0)
    return NULL;
  fseek(file, streamOffset + (0x39), SEEK_SET);
  void *wholeStream = malloc(streamLength);
  size_t readBytes = fread(wholeStream, 1, streamLength, file);
  if (readBytes != streamLength)
    return NULL;
  return createInflatedStream(wholeStream, streamLength);
}


x86 assembly (clang, -O0):
<getTravelStream>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1167 <getTravelStream+0x27>
cmpl   $0x0,-0x14(%rbp)
jne    1174 <getTravelStream+0x34>
movq   $0x0,-0x8(%rbp)
jmp    11df <getTravelStream+0x9f>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x39,%esi
mov    0x2e5b(%rip),%rax
mov    (%rax),%edx
call   1060 <fseek@plt>
mov    -0x18(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmp    %rcx,%rax
je     11cf <getTravelStream+0x8f>
movq   $0x0,-0x8(%rbp)
jmp    11df <getTravelStream+0x9f>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1040 <createInflatedStream@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTravelStream>:
push   %rbp
push   %r14
push   %rbx
test   %rdi,%rdi
je     1195 <getTravelStream+0x55>
test   %esi,%esi
je     1195 <getTravelStream+0x55>
mov    %edx,%ebp
mov    %rdi,%rbx
add    $0x39,%esi
mov    0x2e84(%rip),%rax
mov    (%rax),%edx
call   1060 <fseek@plt>
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    $0x1,%esi
mov    %ebp,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
movslq %ebp,%rcx
cmp    %rcx,%rax
jne    1195 <getTravelStream+0x55>
mov    %r14,%rdi
mov    %ebp,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <createInflatedStream@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
define i8* @getTravelStream(i32* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%10 = load i32*, i32** %5
%11 = icmp eq i32* %10, null
br i1 %11, label %15, label %12
12: ; preds = %3
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12, %3
store i8* null, i8** %4
br label %37
16: ; preds = %12
%17 = load i32*, i32** %5
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 57
%20 = load i32, i32* @SEEK_SET
%21 = call i32 @fseek(i32* %17, i32 %19, i32 %20)
%22 = load i32, i32* %7
%23 = call i8* @malloc(i32 %22)
store i8* %23, i8** %8
%24 = load i8*, i8** %8
%25 = load i32, i32* %7
%26 = load i32*, i32** %5
%27 = call i64 @fread(i8* %24, i32 1, i32 %25, i32* %26)
store i64 %27, i64* %9
%28 = load i64, i64* %9
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = icmp ne i64 %28, %30
br i1 %31, label %32, label %33
32: ; preds = %16
store i8* null, i8** %4
br label %37
33: ; preds = %16
%34 = load i8*, i8** %8
%35 = load i32, i32* %7
%36 = call i8* @createInflatedStream(i8* %34, i32 %35)
store i8* %36, i8** %4
br label %37
37: ; preds = %33, %32, %15
%38 = load i8*, i8** %4
ret i8* %38
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
define i8* @getTravelStream(i32* %0, i32 %1, i32 %2) {
%4 = icmp eq i32* %0, null
%5 = icmp eq i32 %1, 0
%6 = or i1 %4, %5
br i1 %6, label %17, label %7
7: ; preds = %3
%8 = add nsw i32 %1, 57
%9 = load i32, i32* @SEEK_SET
%10 = tail call i32 @fseek(i32* %0, i32 %8, i32 %9)
%11 = tail call i8* @malloc(i32 %2)
%12 = tail call i64 @fread(i8* %11, i32 1, i32 %2, i32* %0)
%13 = sext i32 %2 to i64
%14 = icmp eq i64 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %7
%16 = tail call i8* @createInflatedStream(i8* %11, i32 %2)
br label %17
17: ; preds = %15, %7, %3
%18 = phi i8* [ null, %3 ], [ %16, %15 ], [ null, %7 ]
ret i8* %18
}