#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 */
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  long total_in;
  long avail_in;
  int total_out;
  int avail_out;
  int /*<<< orphan*/ *next_out;
  void *opaque;
  void *zfree;
  void *zalloc;
  int /*<<< orphan*/ *next_in;
  int /*<<< orphan*/ member_0;
};
typedef TYPE_1__ z_stream;
typedef int /*<<< orphan*/ Bytef;

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ Z_FINISH;
int /*<<< orphan*/ Z_NO_FLUSH;
void *Z_NULL;
int Z_OK;
int Z_STREAM_END;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ close(int);
long file_size(char const *);
int /*<<< orphan*/ free(char *);
int inflate(TYPE_1__ *, int /*<<< orphan*/);
int inflateInit2(TYPE_1__ *, int);
char *malloc(int);
int open(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ read(int, char *, long);
float *parse_amp(const char *fname, int *count) {
  int fd;
  long fsz;
  char *zbuf;
  z_stream strm = {0};
  float *values;
  int err;
  printf("Parsing %s ...\n", fname);
  fsz = file_size(fname);
  zbuf = malloc(fsz);
  fd = open(fname, O_RDONLY);
  read(fd, zbuf, fsz);
  close(fd);
  strm.total_in = strm.avail_in = fsz;
  strm.total_out = strm.avail_out = sizeof(int);
  strm.next_in = (Bytef *)zbuf;
  strm.next_out = (Bytef *)count;
  strm.zalloc = Z_NULL;
  strm.zfree = Z_NULL;
  strm.opaque = Z_NULL;
  err = inflateInit2(&strm, (15 + 32));
  assert(err == Z_OK);
  err = inflate(&strm, Z_NO_FLUSH);
  assert(err == Z_OK);
  values = (float *)malloc(sizeof(float) * (*count));
  strm.total_out = strm.avail_out = *count * sizeof(float);
  strm.next_out = (Bytef *)values;
  err = inflate(&strm, Z_FINISH);
  assert(err == Z_STREAM_END);
  free(zbuf);
  return values;
}


x86 assembly (clang, -O0):
<parse_amp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1070 <memset@plt>
mov    -0x8(%rbp),%rsi
lea    0xe22(%rip),%rdi
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1090 <file_size@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2dd6(%rip),%rax
mov    (%rax),%esi
call   10d0 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   10a0 <read@plt>
mov    -0x14(%rbp),%edi
call   1080 <close@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    %rax,-0x70(%rbp)
movl   $0x4,-0x5c(%rbp)
movl   $0x4,-0x60(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x2d63(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    0x2d55(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
mov    0x2d47(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
lea    -0x70(%rbp),%rdi
mov    $0x2f,%esi
call   1050 <inflateInit2@plt>
mov    %eax,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
mov    0x2d55(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    0x2d17(%rip),%rax
mov    (%rax),%esi
lea    -0x70(%rbp),%rdi
call   1040 <inflate@plt>
mov    %eax,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
mov    0x2d27(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    -0x10(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x78(%rbp)
mov    -0x10(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,-0x5c(%rbp)
mov    %eax,-0x60(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x2caa(%rip),%rax
mov    (%rax),%esi
lea    -0x70(%rbp),%rdi
call   1040 <inflate@plt>
mov    %eax,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
mov    0x2cb2(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x78(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_amp>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x50,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
movq   $0x0,0x48(%rsp)
lea    0xe3e(%rip),%rdi
mov    %r15,%rsi
call   1060 <printf@plt>
mov    %r15,%rdi
call   1080 <file_size@plt>
mov    %rax,%rbx
mov    %ebx,%edi
call   10b0 <malloc@plt>
mov    %rax,%r12
mov    0x2dfa(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
call   10c0 <open@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1090 <read@plt>
mov    %ebp,%edi
call   1070 <close@plt>
mov    %rbx,0x10(%rsp)
mov    %rbx,0x8(%rsp)
movabs $0x400000004,%rax
mov    %rax,0x18(%rsp)
mov    %r12,0x40(%rsp)
mov    %r14,0x20(%rsp)
mov    0x2d90(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x38(%rsp)
mov    %rax,0x30(%rsp)
mov    %rax,0x28(%rsp)
lea    0x8(%rsp),%r15
mov    %r15,%rdi
mov    $0x2f,%esi
call   1050 <inflateInit2@plt>
mov    0x2d95(%rip),%rbx
xor    %edi,%edi
cmp    (%rbx),%eax
sete   %dil
call   10a0 <assert@plt>
mov    0x2d59(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
call   1040 <inflate@plt>
xor    %edi,%edi
cmp    (%rbx),%eax
sete   %dil
call   10a0 <assert@plt>
mov    (%r14),%ebx
shl    $0x2,%ebx
mov    %ebx,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbp
mov    %ebx,0x1c(%rsp)
mov    %ebx,0x18(%rsp)
mov    %rax,0x20(%rsp)
mov    0x2d0e(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
call   1040 <inflate@plt>
mov    0x2d1d(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%eax
sete   %dil
call   10a0 <assert@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbp,%rax
add    $0x50,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { i64, i64, i32, i32, i32*, i8*, i8*, i8*, i32*, i32 }
@.str = [16 x i8] c"Parsing %s ...\0A\00"
@O_RDONLY = global i32 0
@Z_NULL = global i8* null
@Z_OK = global i32 0
@Z_NO_FLUSH = global i32 0
@Z_FINISH = global i32 0
@Z_STREAM_END = global i32 0
define float* @parse_amp(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i64
%7 = alloca i8*
%8 = alloca %struct.TYPE_4__
%9 = alloca float*
%10 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
%11 = bitcast %struct.TYPE_4__* %8 to i8*
%12 = load i8*, i8** %3
%13 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i8*, i8** %3
%15 = call i64 @file_size(i8* %14)
store i64 %15, i64* %6
%16 = load i64, i64* %6
%17 = trunc i64 %16 to i32
%18 = call i8* @malloc(i32 %17)
store i8* %18, i8** %7
%19 = load i8*, i8** %3
%20 = load i32, i32* @O_RDONLY
%21 = call i32 @open(i8* %19, i32 %20)
store i32 %21, i32* %5
%22 = load i32, i32* %5
%23 = load i8*, i8** %7
%24 = load i64, i64* %6
%25 = call i32 @read(i32 %22, i8* %23, i64 %24)
%26 = load i32, i32* %5
%27 = call i32 @close(i32 %26)
%28 = load i64, i64* %6
%29 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 1
store i64 %28, i64* %29
%30 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 0
store i64 %28, i64* %30
%31 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 3
store i32 4, i32* %31
%32 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 2
store i32 4, i32* %32
%33 = load i8*, i8** %7
%34 = bitcast i8* %33 to i32*
%35 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 8
store i32* %34, i32** %35
%36 = load i32*, i32** %4
%37 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 4
store i32* %36, i32** %37
%38 = load i8*, i8** @Z_NULL
%39 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 7
store i8* %38, i8** %39
%40 = load i8*, i8** @Z_NULL
%41 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 6
store i8* %40, i8** %41
%42 = load i8*, i8** @Z_NULL
%43 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 5
store i8* %42, i8** %43
%44 = call i32 @inflateInit2(%struct.TYPE_4__* %8, i32 47)
store i32 %44, i32* %10
%45 = load i32, i32* %10
%46 = load i32, i32* @Z_OK
%47 = icmp eq i32 %45, %46
%48 = zext i1 %47 to i32
%49 = call i32 @assert(i32 %48)
%50 = load i32, i32* @Z_NO_FLUSH
%51 = call i32 @inflate(%struct.TYPE_4__* %8, i32 %50)
store i32 %51, i32* %10
%52 = load i32, i32* %10
%53 = load i32, i32* @Z_OK
%54 = icmp eq i32 %52, %53
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
%57 = load i32*, i32** %4
%58 = load i32, i32* %57
%59 = sext i32 %58 to i64
%60 = mul i64 4, %59
%61 = trunc i64 %60 to i32
%62 = call i8* @malloc(i32 %61)
%63 = bitcast i8* %62 to float*
store float* %63, float** %9
%64 = load i32*, i32** %4
%65 = load i32, i32* %64
%66 = sext i32 %65 to i64
%67 = mul i64 %66, 4
%68 = trunc i64 %67 to i32
%69 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 3
store i32 %68, i32* %69
%70 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 2
store i32 %68, i32* %70
%71 = load float*, float** %9
%72 = bitcast float* %71 to i32*
%73 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 4
store i32* %72, i32** %73
%74 = load i32, i32* @Z_FINISH
%75 = call i32 @inflate(%struct.TYPE_4__* %8, i32 %74)
store i32 %75, i32* %10
%76 = load i32, i32* %10
%77 = load i32, i32* @Z_STREAM_END
%78 = icmp eq i32 %76, %77
%79 = zext i1 %78 to i32
%80 = call i32 @assert(i32 %79)
%81 = load i8*, i8** %7
%82 = call i32 @free(i8* %81)
%83 = load float*, float** %9
ret float* %83
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i64, i64, i32, i32, i32*, i8*, i8*, i8*, i32*, i32 }
@.str = [16 x i8] c"Parsing %s ...\0A\00"
@O_RDONLY = global i32 0
@Z_NULL = global i8* null
@Z_OK = global i32 0
@Z_NO_FLUSH = global i32 0
@Z_FINISH = global i32 0
@Z_STREAM_END = global i32 0
define float* @parse_amp(i8* %0, i32* %1) {
%3 = alloca %struct.TYPE_4__
%4 = bitcast %struct.TYPE_4__* %3 to i8*
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %3, i64 0, i32 9
%6 = bitcast i32* %5 to i64*
store i64 0, i64* %6
%7 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = tail call i64 @file_size(i8* %0)
%9 = trunc i64 %8 to i32
%10 = tail call i8* @malloc(i32 %9)
%11 = load i32, i32* @O_RDONLY
%12 = tail call i32 @open(i8* %0, i32 %11)
%13 = tail call i32 @read(i32 %12, i8* %10, i64 %8)
%14 = tail call i32 @close(i32 %12)
%15 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %3, i64 0, i32 1
store i64 %8, i64* %15
%16 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %3, i64 0, i32 0
store i64 %8, i64* %16
%17 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %3, i64 0, i32 3
store i32 4, i32* %17
%18 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %3, i64 0, i32 2
store i32 4, i32* %18
%19 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %3, i64 0, i32 8
%20 = bitcast i32** %19 to i8**
store i8* %10, i8** %20
%21 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %3, i64 0, i32 4
store i32* %1, i32** %21
%22 = load i8*, i8** @Z_NULL
%23 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %3, i64 0, i32 7
store i8* %22, i8** %23
%24 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %3, i64 0, i32 6
store i8* %22, i8** %24
%25 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %3, i64 0, i32 5
store i8* %22, i8** %25
%26 = call i32 @inflateInit2(%struct.TYPE_4__* %3, i32 47)
%27 = load i32, i32* @Z_OK
%28 = icmp eq i32 %26, %27
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = load i32, i32* @Z_NO_FLUSH
%32 = call i32 @inflate(%struct.TYPE_4__* %3, i32 %31)
%33 = load i32, i32* @Z_OK
%34 = icmp eq i32 %32, %33
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
%37 = load i32, i32* %1
%38 = shl i32 %37, 2
%39 = call i8* @malloc(i32 %38)
%40 = bitcast i8* %39 to float*
store i32 %38, i32* %17
store i32 %38, i32* %18
%41 = bitcast i32** %21 to i8**
store i8* %39, i8** %41
%42 = load i32, i32* @Z_FINISH
%43 = call i32 @inflate(%struct.TYPE_4__* %3, i32 %42)
%44 = load i32, i32* @Z_STREAM_END
%45 = icmp eq i32 %43, %44
%46 = zext i1 %45 to i32
%47 = call i32 @assert(i32 %46)
%48 = call i32 @free(i8* %10)
ret float* %40
}