#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;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
scalar_t__ is_valid_lzw_file(int /*<<< orphan*/ *);
long read4(int /*<<< orphan*/ *);
long get_uncompressed_size(FILE *input_file) {
  long uncompressed_file_length;
  if (is_valid_lzw_file(input_file)) {
    fseek(input_file, 0, SEEK_SET);
    uncompressed_file_length = read4(input_file);
    fseek(input_file, 0, SEEK_SET);
    return (uncompressed_file_length);
  } else {
    return (-1);
  }
}


x86 assembly (clang, -O0):
<get_uncompressed_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <is_valid_lzw_file@plt>
cmp    $0x0,%rax
je     1191 <get_uncompressed_size+0x61>
mov    -0x10(%rbp),%rdi
mov    0x2e86(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   1030 <read4@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e65(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1199 <get_uncompressed_size+0x69>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_uncompressed_size>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1050 <is_valid_lzw_file@plt>
test   %rax,%rax
je     1173 <get_uncompressed_size+0x43>
mov    0x2e97(%rip),%r15
mov    (%r15),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %rbx,%rdi
call   1030 <read4@plt>
mov    %rax,%r14
mov    (%r15),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %r14,%rax
jmp    117a <get_uncompressed_size+0x4a>
mov    $0xffffffffffffffff,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
define i64 @get_uncompressed_size(i32* %0) {
%2 = alloca i64
%3 = alloca i32*
%4 = alloca i64
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = call i64 @is_valid_lzw_file(i32* %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %18
8: ; preds = %1
%9 = load i32*, i32** %3
%10 = load i32, i32* @SEEK_SET
%11 = call i32 @fseek(i32* %9, i32 0, i32 %10)
%12 = load i32*, i32** %3
%13 = call i64 @read4(i32* %12)
store i64 %13, i64* %4
%14 = load i32*, i32** %3
%15 = load i32, i32* @SEEK_SET
%16 = call i32 @fseek(i32* %14, i32 0, i32 %15)
%17 = load i64, i64* %4
store i64 %17, i64* %2
br label %19
18: ; preds = %1
store i64 -1, i64* %2
br label %19
19: ; preds = %18, %8
%20 = load i64, i64* %2
ret i64 %20
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
define i64 @get_uncompressed_size(i32* %0) {
%2 = tail call i64 @is_valid_lzw_file(i32* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = load i32, i32* @SEEK_SET
%6 = tail call i32 @fseek(i32* %0, i32 0, i32 %5)
%7 = tail call i64 @read4(i32* %0)
%8 = load i32, i32* @SEEK_SET
%9 = tail call i32 @fseek(i32* %0, i32 0, i32 %8)
br label %10
10: ; preds = %1, %4
%11 = phi i64 [ %7, %4 ], [ -1, %1 ]
ret i64 %11
}