#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 */
int compressed_parse_bit_length(unsigned char *);
int compressed_parse_deltas(unsigned char *, int *, int *, int *);
int /*<<< orphan*/ compressed_parse_medians(unsigned char *, int *, int *);
int /*<<< orphan*/ compressed_test_report(int *, int *, int *, int *, int *,
                                          int *, int, int);
void test_compressed_packet_1(void) {
  unsigned char packet[40] = {0xc0, 0x41, 0x0a, 0x19, 0x64, 0x90, 0x00, 0xfb,
                              0x38, 0x13, 0x31, 0x38, 0x19, 0x26, 0x22, 0x66,
                              0x94, 0x31, 0x06, 0xe6, 0x0d, 0x5a, 0x71, 0xc4,
                              0xc0, 0x89, 0x89, 0xcf, 0x8c, 0xc6, 0x40, 0xf0,
                              0x44, 0x18, 0xc9, 0x88, 0x19, 0x31, 0x13, 0x00};
  int i = 0;
  int medians[4];
  int expected_medians[4] = {1, 2, 1, 1};
  int quantizations[4];
  int expected_quantizations[4] = {32, 32, 32, 32};
  int deltas[16 * 4];
  int expected_deltas[16 * 4] = {
      0,   -64, 0,    32,  32,  -32, 32,  -64, 0,    64,  0,   0,   -32,
      -32, 32,  32,   -96, -32, -64, 32,  0,   -64,  0,   96,  64,  -64,
      0,   -96, 96,   -32, 32,  -64, -96, 32,  -32,  0,   -32, 32,  -32,
      32,  64,  -128, 64,  -32, 64,  0,   0,   -128, 0,   0,   -32, 0,
      -32, 64,  0,    -32, -32, 0,   64,  0,   -32,  -32, 32,  -32};
  int bits_length = 0;
  int expected_bits_length = 0;
  compressed_parse_medians(&(packet[1]), quantizations, medians);
  bits_length =
      compressed_parse_deltas(&(packet[8]), medians, quantizations, deltas);
  expected_bits_length = compressed_parse_bit_length(&(packet[6]));
  compressed_test_report(medians, expected_medians, quantizations,
                         expected_quantizations, deltas, expected_deltas,
                         bits_length, expected_bits_length);
}


x86 assembly (clang, -O0):
<test_compressed_packet_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2a0,%rsp
lea    -0x30(%rbp),%rdi
lea    0xe9a(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x34(%rbp)
mov    0xfb2(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xfaf(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xfac(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xfa9(%rip),%rax
mov    %rax,-0x78(%rbp)
lea    -0x280(%rbp),%rdi
lea    0xe7f(%rip),%rsi
mov    $0x100,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x284(%rbp)
movl   $0x0,-0x288(%rbp)
lea    -0x30(%rbp),%rdi
add    $0x1,%rdi
lea    -0x70(%rbp),%rsi
lea    -0x50(%rbp),%rdx
call   1060 <compressed_parse_medians@plt>
lea    -0x30(%rbp),%rdi
add    $0x8,%rdi
lea    -0x50(%rbp),%rsi
lea    -0x70(%rbp),%rdx
lea    -0x180(%rbp),%rcx
call   1030 <compressed_parse_deltas@plt>
mov    %eax,-0x284(%rbp)
lea    -0x30(%rbp),%rdi
add    $0x6,%rdi
call   1040 <compressed_parse_bit_length@plt>
mov    %eax,-0x288(%rbp)
lea    -0x50(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x70(%rbp),%rdx
lea    -0x80(%rbp),%rcx
lea    -0x180(%rbp),%r8
lea    -0x280(%rbp),%r9
mov    -0x284(%rbp),%r10d
mov    -0x288(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1070 <compressed_test_report@plt>
add    $0x2a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_compressed_packet_1>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x270,%rsp
movaps 0xea9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe8d(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x13311988c91844,%rax
mov    %rax,0x20(%rsp)
movaps 0xfa3(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xfa7(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0xe8b(%rip),%rsi
lea    0x70(%rsp),%r14
mov    $0x100,%edx
mov    %r14,%rdi
call   1050 <memcpy@plt>
lea    0x1(%rsp),%rdi
lea    0x50(%rsp),%r15
lea    0x60(%rsp),%r13
mov    %r15,%rsi
mov    %r13,%rdx
call   1060 <compressed_parse_medians@plt>
lea    0x8(%rsp),%rdi
lea    0x170(%rsp),%r12
mov    %r13,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1030 <compressed_parse_deltas@plt>
mov    %eax,%ebx
lea    0x6(%rsp),%rdi
call   1040 <compressed_parse_bit_length@plt>
lea    0x40(%rsp),%rsi
lea    0x30(%rsp),%rcx
mov    %r13,%rdi
mov    %r15,%rdx
mov    %r12,%r8
mov    %r14,%r9
push   %rax
push   %rbx
call   1070 <compressed_test_report@plt>
add    $0x280,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.test_compressed_packet_1.packet = [40 x i8] c"\C0A\0A\19d\90\00\FB8\1318\19&\22f\941\06\E6\0DZq\C4\C0\89\89\CF\8C\C6@\F0D\18\C9\88\191\13\00"
@__const.test_compressed_packet_1.expected_medians = [4 x i32] [i32 1, i32 2, i32 1, i32 1]
@__const.test_compressed_packet_1.expected_quantizations = [4 x i32] [i32 32, i32 32, i32 32, i32 32]
@__const.test_compressed_packet_1.expected_deltas = [64 x i32] [i32 0, i32 -64, i32 0, i32 32, i32 32, i32 -32, i32 32, i32 -64, i32 0, i32 64, i32 0, i32 0, i32 -32, i32 -32, i32 32, i32 32, i32 -96, i32 -32, i32 -64, i32 32, i32 0, i32 -64, i32 0, i32 96, i32 64, i32 -64, i32 0, i32 -96, i32 96, i32 -32, i32 32, i32 -64, i32 -96, i32 32, i32 -32, i32 0, i32 -32, i32 32, i32 -32, i32 32, i32 64, i32 -128, i32 64, i32 -32, i32 64, i32 0, i32 0, i32 -128, i32 0, i32 0, i32 -32, i32 0, i32 -32, i32 64, i32 0, i32 -32, i32 -32, i32 0, i32 64, i32 0, i32 -32, i32 -32, i32 32, i32 -32]
define void @test_compressed_packet_1() {
%1 = alloca [40 x i8]
%2 = alloca i32
%3 = alloca [4 x i32]
%4 = alloca [4 x i32]
%5 = alloca [4 x i32]
%6 = alloca [4 x i32]
%7 = alloca [64 x i32]
%8 = alloca [64 x i32]
%9 = alloca i32
%10 = alloca i32
%11 = bitcast [40 x i8]* %1 to i8*
store i32 0, i32* %2
%12 = bitcast [4 x i32]* %4 to i8*
%13 = bitcast [4 x i32]* %6 to i8*
%14 = bitcast [64 x i32]* %8 to i8*
store i32 0, i32* %9
store i32 0, i32* %10
%15 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 1
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%18 = call i32 @compressed_parse_medians(i8* %15, i32* %16, i32* %17)
%19 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 8
%20 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%22 = getelementptr inbounds [64 x i32], [64 x i32]* %7, i64 0, i64 0
%23 = call i32 @compressed_parse_deltas(i8* %19, i32* %20, i32* %21, i32* %22)
store i32 %23, i32* %9
%24 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 6
%25 = call i32 @compressed_parse_bit_length(i8* %24)
store i32 %25, i32* %10
%26 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%27 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%28 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%29 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%30 = getelementptr inbounds [64 x i32], [64 x i32]* %7, i64 0, i64 0
%31 = getelementptr inbounds [64 x i32], [64 x i32]* %8, i64 0, i64 0
%32 = load i32, i32* %9
%33 = load i32, i32* %10
%34 = call i32 @compressed_test_report(i32* %26, i32* %27, i32* %28, i32* %29, i32* %30, i32* %31, i32 %32, i32 %33)
ret void
}

LLVM IR (-O2):
@__const.test_compressed_packet_1.packet = [40 x i8] c"\C0A\0A\19d\90\00\FB8\1318\19&\22f\941\06\E6\0DZq\C4\C0\89\89\CF\8C\C6@\F0D\18\C9\88\191\13\00"
@__const.test_compressed_packet_1.expected_medians = [4 x i32] [i32 1, i32 2, i32 1, i32 1]
@__const.test_compressed_packet_1.expected_quantizations = [4 x i32] [i32 32, i32 32, i32 32, i32 32]
@__const.test_compressed_packet_1.expected_deltas = [64 x i32] [i32 0, i32 -64, i32 0, i32 32, i32 32, i32 -32, i32 32, i32 -64, i32 0, i32 64, i32 0, i32 0, i32 -32, i32 -32, i32 32, i32 32, i32 -96, i32 -32, i32 -64, i32 32, i32 0, i32 -64, i32 0, i32 96, i32 64, i32 -64, i32 0, i32 -96, i32 96, i32 -32, i32 32, i32 -64, i32 -96, i32 32, i32 -32, i32 0, i32 -32, i32 32, i32 -32, i32 32, i32 64, i32 -128, i32 64, i32 -32, i32 64, i32 0, i32 0, i32 -128, i32 0, i32 0, i32 -32, i32 0, i32 -32, i32 64, i32 0, i32 -32, i32 -32, i32 0, i32 64, i32 0, i32 -32, i32 -32, i32 32, i32 -32]
define void @test_compressed_packet_1() {
%1 = alloca [40 x i8]
%2 = alloca [4 x i32]
%3 = alloca [4 x i32]
%4 = alloca [4 x i32]
%5 = alloca [4 x i32]
%6 = alloca [64 x i32]
%7 = alloca [64 x i32]
%8 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 0
%9 = bitcast [4 x i32]* %2 to i8*
%10 = bitcast [4 x i32]* %3 to i8*
%11 = bitcast [4 x i32]* %4 to i8*
%12 = bitcast [4 x i32]* %5 to i8*
%13 = bitcast [64 x i32]* %6 to i8*
%14 = bitcast [64 x i32]* %7 to i8*
%15 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 1
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%18 = call i32 @compressed_parse_medians(i8* %15, i32* %16, i32* %17)
%19 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 8
%20 = getelementptr inbounds [64 x i32], [64 x i32]* %6, i64 0, i64 0
%21 = call i32 @compressed_parse_deltas(i8* %19, i32* %17, i32* %16, i32* %20)
%22 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 6
%23 = call i32 @compressed_parse_bit_length(i8* %22)
%24 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%25 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%26 = getelementptr inbounds [64 x i32], [64 x i32]* %7, i64 0, i64 0
%27 = call i32 @compressed_test_report(i32* %17, i32* %24, i32* %16, i32* %25, i32* %20, i32* %26, i32 %21, i32 %23)
ret void
}