#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 */
scalar_t__ u_realloc(int *, int, char *, int, char *);
void insertfreq(int *ipointer, int **mast1p, int **nextp, int *i1, int *i2,
                int *ifree, int *nzs_) {
  int idof1, idof2, istart, *mast1 = NULL, *next = NULL;
  mast1 = *mast1p;
  next = *nextp;
  idof1 = *i1;
  idof2 = *i2 - 1;
  if (*ifree >= *nzs_) {
    *nzs_ = (int)(1.1 * *nzs_);
    mast1 = (int *)u_realloc(
        (int *)(mast1), (*nzs_) * sizeof(int),
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/prool/ccx_prool/refs/heads/master/CalculiX/"
        "ccx_2.12/src/insertfreq.c",
        52, "mast1");
    next = (int *)u_realloc(
        (int *)(next), (*nzs_) * sizeof(int),
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/prool/ccx_prool/refs/heads/master/CalculiX/"
        "ccx_2.12/src/insertfreq.c",
        53, "next");
  }
  mast1[*ifree] = idof1;
  next[*ifree] = ipointer[idof2];
  ipointer[idof2] = ++*ifree;
  *mast1p = mast1;
  *nextp = next;
  return;
}


x86 assembly (clang, -O0):
<insertfreq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
mov    0x10(%rbp),%rcx
cmp    (%rcx),%eax
jl     11f9 <insertfreq+0xe9>
mov    0x10(%rbp),%rax
cvtsi2sdl (%rax),%xmm1
movsd  0xe6f(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x48(%rbp),%rdi
mov    0x10(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%esi
lea    0xe51(%rip),%rdx
mov    $0x34,%ecx
lea    0xee4(%rip),%r8
call   1030 <u_realloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x50(%rbp),%rdi
mov    0x10(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%esi
lea    0xe24(%rip),%rdx
mov    $0x35,%ecx
lea    0xebd(%rip),%r8
call   1030 <u_realloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x34(%rbp),%edx
mov    -0x48(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x50(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
add    $0x1,%edx
mov    %edx,(%rax)
mov    -0x8(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x48(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x50(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insertfreq>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%rbx
mov    %rsi,%r15
mov    %rdi,%r12
mov    0x50(%rsp),%rdi
mov    (%rsi),%r13
mov    (%rdx),%rbp
mov    (%rcx),%esi
movslq (%r8),%r14
mov    (%r9),%eax
mov    (%rdi),%ecx
cmp    %ecx,%eax
jl     11b2 <insertfreq+0xa2>
cvtsi2sd %ecx,%xmm0
mulsd  0xeb4(%rip),%xmm0
mov    %esi,0xc(%rsp)
cvttsd2si %xmm0,%esi
mov    %esi,(%rdi)
shl    $0x2,%esi
lea    0xea8(%rip),%rax
lea    0xf40(%rip),%r8
mov    %r13,%rdi
mov    %rdx,0x10(%rsp)
mov    %rax,%rdx
mov    $0x34,%ecx
call   1030 <u_realloc@plt>
mov    %rax,%r13
mov    0x50(%rsp),%rax
mov    (%rax),%esi
shl    $0x2,%esi
lea    0xf1d(%rip),%r8
mov    %rbp,%rdi
lea    0xe6e(%rip),%rdx
mov    $0x35,%ecx
call   1030 <u_realloc@plt>
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%rdx
mov    %rax,%rbp
mov    (%rbx),%eax
cltq
mov    %esi,0x0(%r13,%rax,4)
mov    -0x4(%r12,%r14,4),%eax
movslq (%rbx),%rcx
mov    %eax,0x0(%rbp,%rcx,4)
mov    (%rbx),%eax
add    $0x1,%eax
mov    %eax,(%rbx)
mov    %eax,-0x4(%r12,%r14,4)
mov    %r13,(%r15)
mov    %rbp,(%rdx)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [159 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/prool/ccx_prool/refs/heads/master/CalculiX/ccx_2.12/src/insertfreq.c\00"
@.str.1 = [6 x i8] c"mast1\00"
@.str.2 = [5 x i8] c"next\00"
define void @insertfreq(i32* %0, i32** %1, i32** %2, i32* %3, i32* %4, i32* %5, i32* %6) {
%8 = alloca i32*
%9 = alloca i32**
%10 = alloca i32**
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32*
%19 = alloca i32*
store i32* %0, i32** %8
store i32** %1, i32*** %9
store i32** %2, i32*** %10
store i32* %3, i32** %11
store i32* %4, i32** %12
store i32* %5, i32** %13
store i32* %6, i32** %14
store i32* null, i32** %18
store i32* null, i32** %19
%20 = load i32**, i32*** %9
%21 = load i32*, i32** %20
store i32* %21, i32** %18
%22 = load i32**, i32*** %10
%23 = load i32*, i32** %22
store i32* %23, i32** %19
%24 = load i32*, i32** %11
%25 = load i32, i32* %24
store i32 %25, i32* %15
%26 = load i32*, i32** %12
%27 = load i32, i32* %26
%28 = sub nsw i32 %27, 1
store i32 %28, i32* %16
%29 = load i32*, i32** %13
%30 = load i32, i32* %29
%31 = load i32*, i32** %14
%32 = load i32, i32* %31
%33 = icmp sge i32 %30, %32
br i1 %33, label %34, label %57
34: ; preds = %7
%35 = load i32*, i32** %14
%36 = load i32, i32* %35
%37 = sitofp i32 %36 to double
%38 = fmul double 1.100000e+00, %37
%39 = fptosi double %38 to i32
%40 = load i32*, i32** %14
store i32 %39, i32* %40
%41 = load i32*, i32** %18
%42 = load i32*, i32** %14
%43 = load i32, i32* %42
%44 = sext i32 %43 to i64
%45 = mul i64 %44, 4
%46 = trunc i64 %45 to i32
%47 = call i64 @u_realloc(i32* %41, i32 %46, i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str, i64 0, i64 0), i32 52, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%48 = inttoptr i64 %47 to i32*
store i32* %48, i32** %18
%49 = load i32*, i32** %19
%50 = load i32*, i32** %14
%51 = load i32, i32* %50
%52 = sext i32 %51 to i64
%53 = mul i64 %52, 4
%54 = trunc i64 %53 to i32
%55 = call i64 @u_realloc(i32* %49, i32 %54, i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str, i64 0, i64 0), i32 53, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%56 = inttoptr i64 %55 to i32*
store i32* %56, i32** %19
br label %57
57: ; preds = %34, %7
%58 = load i32, i32* %15
%59 = load i32*, i32** %18
%60 = load i32*, i32** %13
%61 = load i32, i32* %60
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32, i32* %59, i64 %62
store i32 %58, i32* %63
%64 = load i32*, i32** %8
%65 = load i32, i32* %16
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i32, i32* %64, i64 %66
%68 = load i32, i32* %67
%69 = load i32*, i32** %19
%70 = load i32*, i32** %13
%71 = load i32, i32* %70
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i32, i32* %69, i64 %72
store i32 %68, i32* %73
%74 = load i32*, i32** %13
%75 = load i32, i32* %74
%76 = add nsw i32 %75, 1
store i32 %76, i32* %74
%77 = load i32*, i32** %8
%78 = load i32, i32* %16
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i32, i32* %77, i64 %79
store i32 %76, i32* %80
%81 = load i32*, i32** %18
%82 = load i32**, i32*** %9
store i32* %81, i32** %82
%83 = load i32*, i32** %19
%84 = load i32**, i32*** %10
store i32* %83, i32** %84
ret void
}

LLVM IR (-O2):
@.str = [159 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/prool/ccx_prool/refs/heads/master/CalculiX/ccx_2.12/src/insertfreq.c\00"
@.str.1 = [6 x i8] c"mast1\00"
@.str.2 = [5 x i8] c"next\00"
define void @insertfreq(i32* nocapture %0, i32** nocapture %1, i32** nocapture %2, i32* nocapture %3, i32* nocapture %4, i32* nocapture %5, i32* nocapture %6) {
%8 = load i32*, i32** %1
%9 = load i32*, i32** %2
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = icmp slt i32 %12, %13
br i1 %14, label %27, label %15
15: ; preds = %7
%16 = sitofp i32 %13 to double
%17 = fmul double %16, 1.100000e+00
%18 = fptosi double %17 to i32
store i32 %18, i32* %6
%19 = shl i32 %18, 2
%20 = tail call i64 @u_realloc(i32* %8, i32 %19, i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str, i64 0, i64 0), i32 52, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%21 = inttoptr i64 %20 to i32*
%22 = load i32, i32* %6
%23 = shl i32 %22, 2
%24 = tail call i64 @u_realloc(i32* %9, i32 %23, i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str, i64 0, i64 0), i32 53, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%25 = inttoptr i64 %24 to i32*
%26 = load i32, i32* %5
br label %27
27: ; preds = %15, %7
%28 = phi i32 [ %26, %15 ], [ %12, %7 ]
%29 = phi i32* [ %21, %15 ], [ %8, %7 ]
%30 = phi i32* [ %25, %15 ], [ %9, %7 ]
%31 = add nsw i32 %11, -1
%32 = sext i32 %28 to i64
%33 = getelementptr inbounds i32, i32* %29, i64 %32
store i32 %10, i32* %33
%34 = sext i32 %31 to i64
%35 = getelementptr inbounds i32, i32* %0, i64 %34
%36 = load i32, i32* %35
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %30, i64 %38
store i32 %36, i32* %39
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
store i32 %41, i32* %35
store i32* %29, i32** %1
store i32* %30, i32** %2
ret void
}