#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_warnrealloc_x(unsigned int *, int, char *, int);
void allocate_enough_memory(unsigned int **ptr, int *nele, int *nele_alloc) {
  (*nele)++;
  if (*nele > *nele_alloc) {
    *nele_alloc = *nele + *nele / 2;
    *ptr = Ptngc_warnrealloc_x(
        *ptr, *nele_alloc * sizeof **ptr,
        "/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",
        204);
  }
}


x86 assembly (clang, -O0):
<allocate_enough_memory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jle    118c <allocate_enough_memory+0x7c>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    $0x2,%esi
cltd
idiv   %esi
add    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%esi
lea    0xe88(%rip),%rdx
mov    $0xcc,%ecx
call   1030 <Ptngc_warnrealloc_x@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocate_enough_memory>:
push   %rbx
mov    (%rsi),%ecx
lea    0x1(%rcx),%eax
mov    %eax,(%rsi)
cmp    (%rdx),%ecx
jl     1146 <allocate_enough_memory+0x36>
mov    %rdi,%rbx
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
add    %eax,%esi
mov    %esi,(%rdx)
mov    (%rdi),%rdi
shl    $0x2,%esi
lea    0xec7(%rip),%rdx
mov    $0xcc,%ecx
call   1030 <Ptngc_warnrealloc_x@plt>
mov    %rax,(%rbx)
pop    %rbx
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 @allocate_enough_memory(i32** %0, i32* %1, i32* %2) {
%4 = alloca i32**
%5 = alloca i32*
%6 = alloca i32*
store i32** %0, i32*** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %5
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 1
store i32 %9, i32* %7
%10 = load i32*, i32** %5
%11 = load i32, i32* %10
%12 = load i32*, i32** %6
%13 = load i32, i32* %12
%14 = icmp sgt i32 %11, %13
br i1 %14, label %15, label %32
15: ; preds = %3
%16 = load i32*, i32** %5
%17 = load i32, i32* %16
%18 = load i32*, i32** %5
%19 = load i32, i32* %18
%20 = sdiv i32 %19, 2
%21 = add nsw i32 %17, %20
%22 = load i32*, i32** %6
store i32 %21, i32* %22
%23 = load i32**, i32*** %4
%24 = load i32*, i32** %23
%25 = load i32*, i32** %6
%26 = load i32, i32* %25
%27 = sext i32 %26 to i64
%28 = mul i64 %27, 4
%29 = trunc i64 %28 to i32
%30 = call i32* @Ptngc_warnrealloc_x(i32* %24, i32 %29, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0), i32 204)
%31 = load i32**, i32*** %4
store i32* %30, i32** %31
br label %32
32: ; preds = %15, %3
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 @allocate_enough_memory(i32** nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 1
store i32 %5, i32* %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %4, %6
br i1 %7, label %14, label %8
8: ; preds = %3
%9 = sdiv i32 %5, 2
%10 = add nsw i32 %9, %5
store i32 %10, i32* %2
%11 = load i32*, i32** %0
%12 = shl i32 %10, 2
%13 = tail call i32* @Ptngc_warnrealloc_x(i32* %11, i32 %12, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0), i32 204)
store i32* %13, i32** %0
br label %14
14: ; preds = %8, %3
ret void
}