#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_2(void) {
  unsigned char packet[45] = {
      0xc0, 0x4b, 0x04, 0x29, 0xa4, 0x80, 0x01, 0x22, 0x04, 0x49, 0xc7, 0x0e,
      0xf0, 0x89, 0x87, 0x3f, 0x58, 0x86, 0x1c, 0xb7, 0x44, 0x62, 0x33, 0x3f,
      0x19, 0xf3, 0x13, 0x1c, 0x7c, 0x81, 0x30, 0x15, 0x84, 0x26, 0x2e, 0x93,
      0x89, 0x54, 0xa6, 0x44, 0x56, 0xd5, 0xa8, 0x52, 0xc0};
  int i = 0;
  int medians[4];
  int expected_medians[4] = {11, 1, 2, 2};
  int quantizations[4];
  int expected_quantizations[4] = {2, 32, 32, 16};
  int deltas[16 * 4];
  int expected_deltas[16 * 4] = {
      0,  -24, 8,   46,  22,  -64, -2,  -4,  44,  50,   -78, -4,  -6,
      2,  26,  40,  0,   -32, -64, -32, 64,  32,  -160, 64,  128, -32,
      32, -32, -96, 160, 0,   0,   64,  -64, 0,   -32,  96,  0,   -32,
      0,  64,  -64, 96,  -96, -32, 32,  -64, 64,  -16,  -48, -16, 32,
      32, 0,   -32, -48, 80,  -16, 48,  -16, -32, -16,  32,  16};
  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_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2a0,%rsp
lea    -0x30(%rbp),%rdi
lea    0xe9a(%rip),%rsi
mov    $0x2d,%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_2>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x270,%rsp
movups 0xeb6(%rip),%xmm0
movups %xmm0,0x1d(%rsp)
movaps 0xe9d(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe81(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xfa6(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xfaa(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0xe8e(%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_2.packet = [45 x i8] c"\C0K\04)\A4\80\01\22\04I\C7\0E\F0\89\87?X\86\1C\B7Db3?\19\F3\13\1C|\810\15\84&.\93\89T\A6DV\D5\A8R\C0"
@__const.test_compressed_packet_2.expected_medians = [4 x i32] [i32 11, i32 1, i32 2, i32 2]
@__const.test_compressed_packet_2.expected_quantizations = [4 x i32] [i32 2, i32 32, i32 32, i32 16]
@__const.test_compressed_packet_2.expected_deltas = [64 x i32] [i32 0, i32 -24, i32 8, i32 46, i32 22, i32 -64, i32 -2, i32 -4, i32 44, i32 50, i32 -78, i32 -4, i32 -6, i32 2, i32 26, i32 40, i32 0, i32 -32, i32 -64, i32 -32, i32 64, i32 32, i32 -160, i32 64, i32 128, i32 -32, i32 32, i32 -32, i32 -96, i32 160, i32 0, i32 0, i32 64, i32 -64, i32 0, i32 -32, i32 96, i32 0, i32 -32, i32 0, i32 64, i32 -64, i32 96, i32 -96, i32 -32, i32 32, i32 -64, i32 64, i32 -16, i32 -48, i32 -16, i32 32, i32 32, i32 0, i32 -32, i32 -48, i32 80, i32 -16, i32 48, i32 -16, i32 -32, i32 -16, i32 32, i32 16]
define void @test_compressed_packet_2() {
%1 = alloca [45 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 [45 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 [45 x i8], [45 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 [45 x i8], [45 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 [45 x i8], [45 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_2.packet = [45 x i8] c"\C0K\04)\A4\80\01\22\04I\C7\0E\F0\89\87?X\86\1C\B7Db3?\19\F3\13\1C|\810\15\84&.\93\89T\A6DV\D5\A8R\C0"
@__const.test_compressed_packet_2.expected_medians = [4 x i32] [i32 11, i32 1, i32 2, i32 2]
@__const.test_compressed_packet_2.expected_quantizations = [4 x i32] [i32 2, i32 32, i32 32, i32 16]
@__const.test_compressed_packet_2.expected_deltas = [64 x i32] [i32 0, i32 -24, i32 8, i32 46, i32 22, i32 -64, i32 -2, i32 -4, i32 44, i32 50, i32 -78, i32 -4, i32 -6, i32 2, i32 26, i32 40, i32 0, i32 -32, i32 -64, i32 -32, i32 64, i32 32, i32 -160, i32 64, i32 128, i32 -32, i32 32, i32 -32, i32 -96, i32 160, i32 0, i32 0, i32 64, i32 -64, i32 0, i32 -32, i32 96, i32 0, i32 -32, i32 0, i32 64, i32 -64, i32 96, i32 -96, i32 -32, i32 32, i32 -64, i32 64, i32 -16, i32 -48, i32 -16, i32 32, i32 32, i32 0, i32 -32, i32 -48, i32 80, i32 -16, i32 48, i32 -16, i32 -32, i32 -16, i32 32, i32 16]
define void @test_compressed_packet_2() {
%1 = alloca [45 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 [45 x i8], [45 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 [45 x i8], [45 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 [45 x i8], [45 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 [45 x i8], [45 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
}