#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 insert(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;
  if (*i1 == *i2)
    return;
  if (*i1 < *i2) {
    idof1 = *i2;
    idof2 = *i1 - 1;
  } else {
    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.16/src/insert.c",
        59, "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.16/src/insert.c",
        60, "next");
  }
  mast1[*ifree] = idof1;
  next[*ifree] = ipointer[idof2];
  ipointer[idof2] = ++*ifree;
  *mast1p = mast1;
  *nextp = next;
  return;
}


x86 assembly (clang, -O0):
<insert>:
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    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jne    1171 <insert+0x61>
jmp    1292 <insert+0x182>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jge    119d <insert+0x8d>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11b2 <insert+0xa2>
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     123c <insert+0x12c>
mov    0x10(%rbp),%rax
cvtsi2sdl (%rax),%xmm1
movsd  0xe2c(%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    0xe0e(%rip),%rdx
mov    $0x3b,%ecx
lea    0xe9d(%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    0xde1(%rip),%rdx
mov    $0x3c,%ecx
lea    0xe76(%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):
<insert>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    (%rcx),%r14d
mov    (%r8),%eax
cmp    %eax,%r14d
je     11ed <insert+0xdd>
mov    %r9,%rbx
mov    %rdx,%rbp
mov    0x50(%rsp),%rdx
mov    (%rsi),%r13
mov    0x0(%rbp),%r12
mov    %eax,%r15d
cmovl  %r14d,%r15d
cmovl  %eax,%r14d
add    $0xffffffff,%r15d
mov    (%r9),%eax
mov    (%rdx),%ecx
cmp    %ecx,%eax
jl     11c8 <insert+0xb8>
cvtsi2sd %ecx,%xmm0
mulsd  0xe9d(%rip),%xmm0
mov    %rsi,0x10(%rsp)
cvttsd2si %xmm0,%esi
mov    %esi,(%rdx)
shl    $0x2,%esi
lea    0xe90(%rip),%rdx
lea    0xf24(%rip),%r8
mov    %rdi,0x8(%rsp)
mov    %r13,%rdi
mov    $0x3b,%ecx
call   1030 <u_realloc@plt>
mov    %rax,%r13
mov    0x50(%rsp),%rax
mov    (%rax),%esi
shl    $0x2,%esi
lea    0xf04(%rip),%r8
mov    %r12,%rdi
lea    0xe59(%rip),%rdx
mov    $0x3c,%ecx
call   1030 <u_realloc@plt>
mov    0x8(%rsp),%rdi
mov    0x10(%rsp),%rsi
mov    %rax,%r12
mov    (%rbx),%eax
cltq
mov    %r14d,0x0(%r13,%rax,4)
movslq %r15d,%rax
mov    (%rdi,%rax,4),%ecx
movslq (%rbx),%rdx
mov    %ecx,(%r12,%rdx,4)
mov    (%rbx),%ecx
add    $0x1,%ecx
mov    %ecx,(%rbx)
mov    %ecx,(%rdi,%rax,4)
mov    %r13,(%rsi)
mov    %r12,0x0(%rbp)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [155 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.16/src/insert.c\00"
@.str.1 = [6 x i8] c"mast1\00"
@.str.2 = [5 x i8] c"next\00"
define void @insert(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
%26 = load i32*, i32** %12
%27 = load i32, i32* %26
%28 = icmp eq i32 %25, %27
br i1 %28, label %29, label %30
29: ; preds = %7
br label %105
30: ; preds = %7
%31 = load i32*, i32** %11
%32 = load i32, i32* %31
%33 = load i32*, i32** %12
%34 = load i32, i32* %33
%35 = icmp slt i32 %32, %34
br i1 %35, label %36, label %42
36: ; preds = %30
%37 = load i32*, i32** %12
%38 = load i32, i32* %37
store i32 %38, i32* %15
%39 = load i32*, i32** %11
%40 = load i32, i32* %39
%41 = sub nsw i32 %40, 1
store i32 %41, i32* %16
br label %48
42: ; preds = %30
%43 = load i32*, i32** %11
%44 = load i32, i32* %43
store i32 %44, i32* %15
%45 = load i32*, i32** %12
%46 = load i32, i32* %45
%47 = sub nsw i32 %46, 1
store i32 %47, i32* %16
br label %48
48: ; preds = %42, %36
%49 = load i32*, i32** %13
%50 = load i32, i32* %49
%51 = load i32*, i32** %14
%52 = load i32, i32* %51
%53 = icmp sge i32 %50, %52
br i1 %53, label %54, label %77
54: ; preds = %48
%55 = load i32*, i32** %14
%56 = load i32, i32* %55
%57 = sitofp i32 %56 to double
%58 = fmul double 1.100000e+00, %57
%59 = fptosi double %58 to i32
%60 = load i32*, i32** %14
store i32 %59, i32* %60
%61 = load i32*, i32** %18
%62 = load i32*, i32** %14
%63 = load i32, i32* %62
%64 = sext i32 %63 to i64
%65 = mul i64 %64, 4
%66 = trunc i64 %65 to i32
%67 = call i64 @u_realloc(i32* %61, i32 %66, i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str, i64 0, i64 0), i32 59, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%68 = inttoptr i64 %67 to i32*
store i32* %68, i32** %18
%69 = load i32*, i32** %19
%70 = load i32*, i32** %14
%71 = load i32, i32* %70
%72 = sext i32 %71 to i64
%73 = mul i64 %72, 4
%74 = trunc i64 %73 to i32
%75 = call i64 @u_realloc(i32* %69, i32 %74, i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str, i64 0, i64 0), i32 60, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%76 = inttoptr i64 %75 to i32*
store i32* %76, i32** %19
br label %77
77: ; preds = %54, %48
%78 = load i32, i32* %15
%79 = load i32*, i32** %18
%80 = load i32*, i32** %13
%81 = load i32, i32* %80
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i32, i32* %79, i64 %82
store i32 %78, i32* %83
%84 = load i32*, i32** %8
%85 = load i32, i32* %16
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i32, i32* %84, i64 %86
%88 = load i32, i32* %87
%89 = load i32*, i32** %19
%90 = load i32*, i32** %13
%91 = load i32, i32* %90
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i32, i32* %89, i64 %92
store i32 %88, i32* %93
%94 = load i32*, i32** %13
%95 = load i32, i32* %94
%96 = add nsw i32 %95, 1
store i32 %96, i32* %94
%97 = load i32*, i32** %8
%98 = load i32, i32* %16
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i32, i32* %97, i64 %99
store i32 %96, i32* %100
%101 = load i32*, i32** %18
%102 = load i32**, i32*** %9
store i32* %101, i32** %102
%103 = load i32*, i32** %19
%104 = load i32**, i32*** %10
store i32* %103, i32** %104
br label %105
105: ; preds = %77, %29
ret void
}

LLVM IR (-O2):
@.str = [155 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.16/src/insert.c\00"
@.str.1 = [6 x i8] c"mast1\00"
@.str.2 = [5 x i8] c"next\00"
define void @insert(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 = icmp eq i32 %10, %11
br i1 %12, label %47, label %13
13: ; preds = %7
%14 = icmp slt i32 %10, %11
%15 = select i1 %14, i32 %10, i32 %11
%16 = select i1 %14, i32 %11, i32 %10
%17 = add nsw i32 %15, -1
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = icmp slt i32 %18, %19
br i1 %20, label %33, label %21
21: ; preds = %13
%22 = sitofp i32 %19 to double
%23 = fmul double %22, 1.100000e+00
%24 = fptosi double %23 to i32
store i32 %24, i32* %6
%25 = shl i32 %24, 2
%26 = tail call i64 @u_realloc(i32* %8, i32 %25, i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str, i64 0, i64 0), i32 59, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%27 = inttoptr i64 %26 to i32*
%28 = load i32, i32* %6
%29 = shl i32 %28, 2
%30 = tail call i64 @u_realloc(i32* %9, i32 %29, i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str, i64 0, i64 0), i32 60, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%31 = inttoptr i64 %30 to i32*
%32 = load i32, i32* %5
br label %33
33: ; preds = %21, %13
%34 = phi i32 [ %32, %21 ], [ %18, %13 ]
%35 = phi i32* [ %27, %21 ], [ %8, %13 ]
%36 = phi i32* [ %31, %21 ], [ %9, %13 ]
%37 = sext i32 %34 to i64
%38 = getelementptr inbounds i32, i32* %35, i64 %37
store i32 %16, i32* %38
%39 = sext i32 %17 to i64
%40 = getelementptr inbounds i32, i32* %0, i64 %39
%41 = load i32, i32* %40
%42 = load i32, i32* %5
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %36, i64 %43
store i32 %41, i32* %44
%45 = load i32, i32* %5
%46 = add nsw i32 %45, 1
store i32 %46, i32* %5
store i32 %46, i32* %40
store i32* %35, i32** %1
store i32* %36, i32** %2
br label %47
47: ; preds = %7, %33
ret void
}