#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 */

/* Variables and functions */
scalar_t__ readbufferfix(unsigned char *, int);
int tng_compress_uncompress_pos_int(char *, int *, unsigned long *,
                                    unsigned long *);
int tng_compress_uncompress_vel_int(char *, int *, unsigned long *,
                                    unsigned long *);
int tng_compress_uncompress_int(char *data, int *posvel, unsigned long *prec_hi,
                                unsigned long *prec_lo) {
  int magic_int;
  magic_int = (int)readbufferfix((unsigned char *)data, 4);
  if (magic_int == 0x50474E54)
    return tng_compress_uncompress_pos_int(data, posvel, prec_hi, prec_lo);
  else if (magic_int == 0x56474E54)
    return tng_compress_uncompress_vel_int(data, posvel, prec_hi, prec_lo);
  else
    return 1;
}


x86 assembly (clang, -O0):
<tng_compress_uncompress_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1030 <readbufferfix@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x50474e54,-0x2c(%rbp)
jne    1183 <tng_compress_uncompress_int+0x53>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1050 <tng_compress_uncompress_pos_int@plt>
mov    %eax,-0x4(%rbp)
jmp    11b4 <tng_compress_uncompress_int+0x84>
cmpl   $0x56474e54,-0x2c(%rbp)
jne    11ad <tng_compress_uncompress_int+0x7d>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1040 <tng_compress_uncompress_vel_int@plt>
mov    %eax,-0x4(%rbp)
jmp    11b4 <tng_compress_uncompress_int+0x84>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tng_compress_uncompress_int>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
mov    $0x4,%esi
call   1030 <readbufferfix@plt>
cmp    $0x56474e54,%eax
je     1178 <tng_compress_uncompress_int+0x48>
cmp    $0x50474e54,%eax
jne    1194 <tng_compress_uncompress_int+0x64>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <tng_compress_uncompress_pos_int@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <tng_compress_uncompress_vel_int@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @tng_compress_uncompress_int(i8* %0, i32* %1, i64* %2, i64* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i64*
%9 = alloca i64*
%10 = alloca i32
store i8* %0, i8** %6
store i32* %1, i32** %7
store i64* %2, i64** %8
store i64* %3, i64** %9
%11 = load i8*, i8** %6
%12 = call i64 @readbufferfix(i8* %11, i32 4)
%13 = trunc i64 %12 to i32
store i32 %13, i32* %10
%14 = load i32, i32* %10
%15 = icmp eq i32 %14, 1346850388
br i1 %15, label %16, label %22
16: ; preds = %4
%17 = load i8*, i8** %6
%18 = load i32*, i32** %7
%19 = load i64*, i64** %8
%20 = load i64*, i64** %9
%21 = call i32 @tng_compress_uncompress_pos_int(i8* %17, i32* %18, i64* %19, i64* %20)
store i32 %21, i32* %5
br label %32
22: ; preds = %4
%23 = load i32, i32* %10
%24 = icmp eq i32 %23, 1447513684
br i1 %24, label %25, label %31
25: ; preds = %22
%26 = load i8*, i8** %6
%27 = load i32*, i32** %7
%28 = load i64*, i64** %8
%29 = load i64*, i64** %9
%30 = call i32 @tng_compress_uncompress_vel_int(i8* %26, i32* %27, i64* %28, i64* %29)
store i32 %30, i32* %5
br label %32
31: ; preds = %22
store i32 1, i32* %5
br label %32
32: ; preds = %31, %25, %16
%33 = load i32, i32* %5
ret i32 %33
}

LLVM IR (-O2):
define i32 @tng_compress_uncompress_int(i8* %0, i32* %1, i64* %2, i64* %3) {
%5 = tail call i64 @readbufferfix(i8* %0, i32 4)
%6 = trunc i64 %5 to i32
switch i32 %6, label %11 [
i32 1346850388, label %7
i32 1447513684, label %9
]
7: ; preds = %4
%8 = tail call i32 @tng_compress_uncompress_pos_int(i8* %0, i32* %1, i64* %2, i64* %3)
br label %11
9: ; preds = %4
%10 = tail call i32 @tng_compress_uncompress_vel_int(i8* %0, i32* %1, i64* %2, i64* %3)
br label %11
11: ; preds = %4, %9, %7
%12 = phi i32 [ %8, %7 ], [ %10, %9 ], [ 1, %4 ]
ret i32 %12
}