#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 */
unsigned int *Ptngc_warnmalloc_x(int const, char *, int);
int /*<<< orphan*/ base_decompress(unsigned char *, int const, unsigned int *);
void decompress_base_block(unsigned char **ptr, const int nvals,
                           unsigned int **vals) {
  int base_buf_len =
      (int)(((unsigned int)(*ptr)[0]) | (((unsigned int)(*ptr)[1]) << 8) |
            (((unsigned int)(*ptr)[2]) << 16) |
            (((unsigned int)(*ptr)[3]) << 24));
  (*ptr) += 4;
  *vals = Ptngc_warnmalloc_x(
      nvals * sizeof(**vals),
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/ctk3b/mdtraj/refs/heads/master/mdtraj/formats/"
      "tng/src/compression/xtc3.c",
      1694);
  base_decompress(*ptr, nvals, *vals);
  (*ptr) += base_buf_len;
}


x86 assembly (clang, -O0):
<decompress_base_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movzbl (%rax),%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
movzbl 0x3(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x4,%rcx
mov    %rcx,(%rax)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
lea    0xe71(%rip),%rsi
mov    $0x69e,%edx
call   1040 <Ptngc_warnmalloc_x@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
call   1030 <base_decompress@plt>
mov    -0x1c(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decompress_base_block>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%r15d
mov    %rdi,%rbx
mov    (%rdi),%rax
movslq (%rax),%r12
add    $0x4,%rax
mov    %rax,(%rdi)
lea    0x0(,%r15,4),%edi
lea    0xeb3(%rip),%rsi
mov    $0x69e,%edx
call   1040 <Ptngc_warnmalloc_x@plt>
mov    %rax,(%r14)
mov    (%rbx),%rdi
mov    %r15d,%esi
mov    %rax,%rdx
call   1030 <base_decompress@plt>
add    %r12,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [163 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ctk3b/mdtraj/refs/heads/master/mdtraj/formats/tng/src/compression/xtc3.c\00"
define void @decompress_base_block(i8** %0, i32 %1, i32** %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32**
%7 = alloca i32
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i32** %2, i32*** %6
%8 = load i8**, i8*** %4
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = load i8**, i8*** %4
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = or i32 %12, %18
%20 = load i8**, i8*** %4
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8, i8* %21, i64 2
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = shl i32 %24, 16
%26 = or i32 %19, %25
%27 = load i8**, i8*** %4
%28 = load i8*, i8** %27
%29 = getelementptr inbounds i8, i8* %28, i64 3
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = shl i32 %31, 24
%33 = or i32 %26, %32
store i32 %33, i32* %7
%34 = load i8**, i8*** %4
%35 = load i8*, i8** %34
%36 = getelementptr inbounds i8, i8* %35, i64 4
store i8* %36, i8** %34
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = mul i64 %38, 4
%40 = trunc i64 %39 to i32
%41 = call i32* @Ptngc_warnmalloc_x(i32 %40, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0), i32 1694)
%42 = load i32**, i32*** %6
store i32* %41, i32** %42
%43 = load i8**, i8*** %4
%44 = load i8*, i8** %43
%45 = load i32, i32* %5
%46 = load i32**, i32*** %6
%47 = load i32*, i32** %46
%48 = call i32 @base_decompress(i8* %44, i32 %45, i32* %47)
%49 = load i32, i32* %7
%50 = load i8**, i8*** %4
%51 = load i8*, i8** %50
%52 = sext i32 %49 to i64
%53 = getelementptr inbounds i8, i8* %51, i64 %52
store i8* %53, i8** %50
ret void
}

LLVM IR (-O2):
@.str = [163 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ctk3b/mdtraj/refs/heads/master/mdtraj/formats/tng/src/compression/xtc3.c\00"
define void @decompress_base_block(i8** nocapture %0, i32 %1, i32** nocapture writeonly %2) {
%4 = load i8*, i8** %0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = getelementptr inbounds i8, i8* %4, i64 1
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = shl nuw nsw i32 %9, 8
%11 = or i32 %10, %6
%12 = getelementptr inbounds i8, i8* %4, i64 2
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = shl nuw nsw i32 %14, 16
%16 = or i32 %11, %15
%17 = getelementptr inbounds i8, i8* %4, i64 3
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = shl nuw i32 %19, 24
%21 = or i32 %16, %20
%22 = getelementptr inbounds i8, i8* %4, i64 4
store i8* %22, i8** %0
%23 = shl i32 %1, 2
%24 = tail call i32* @Ptngc_warnmalloc_x(i32 %23, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0), i32 1694)
store i32* %24, i32** %2
%25 = load i8*, i8** %0
%26 = tail call i32 @base_decompress(i8* %25, i32 %1, i32* %24)
%27 = load i8*, i8** %0
%28 = sext i32 %21 to i64
%29 = getelementptr inbounds i8, i8* %27, i64 %28
store i8* %29, i8** %0
ret void
}