#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_float(char *, float *);
int tng_compress_uncompress_vel_float(char *, float *);
int tng_compress_uncompress_float(char *data, float *posvel) {
  int magic_int;
  magic_int = (int)readbufferfix((unsigned char *)data, 4);
  if (magic_int == 0x50474E54)
    return tng_compress_uncompress_pos_float(data, posvel);
  else if (magic_int == 0x56474E54)
    return tng_compress_uncompress_vel_float(data, posvel);
  else
    return 1;
}


x86 assembly (clang, -O0):
<tng_compress_uncompress_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1040 <readbufferfix@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x50474e54,-0x1c(%rbp)
jne    1173 <tng_compress_uncompress_float+0x43>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <tng_compress_uncompress_pos_float@plt>
mov    %eax,-0x4(%rbp)
jmp    119c <tng_compress_uncompress_float+0x6c>
cmpl   $0x56474e54,-0x1c(%rbp)
jne    1195 <tng_compress_uncompress_float+0x65>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <tng_compress_uncompress_vel_float@plt>
mov    %eax,-0x4(%rbp)
jmp    119c <tng_compress_uncompress_float+0x6c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tng_compress_uncompress_float>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x4,%esi
call   1040 <readbufferfix@plt>
cmp    $0x56474e54,%eax
je     1164 <tng_compress_uncompress_float+0x34>
cmp    $0x50474e54,%eax
jne    1176 <tng_compress_uncompress_float+0x46>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <tng_compress_uncompress_pos_float@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <tng_compress_uncompress_vel_float@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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