#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_cmatrix(int *ipointer, int **mast1p, int **nextp, int *i1, int *i2,
                    int *ifree, int *nzs_) {
  int idof1, idof2, *mast1 = NULL, *next = NULL;
  mast1 = *mast1p;
  next = *nextp;
  idof1 = *i2;
  idof2 = *i1 - 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.17/src/insert_cmatrix.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.17/src/insert_cmatrix.c",
        53, "next");
  }
  mast1[*ifree] = idof1;
  next[*ifree] = ipointer[idof2];
  ipointer[idof2] = ++*ifree;
  *mast1p = mast1;
  *nextp = next;
  return;
}


x86 assembly (clang, -O0):
<insert_cmatrix>:
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,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
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)
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
mov    0x10(%rbp),%rcx
cmp    (%rcx),%eax
jl     11f9 <insert_cmatrix+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    -0x40(%rbp),%rdi
mov    0x10(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%esi
lea    0xe51(%rip),%rdx
mov    $0x34,%ecx
lea    0xee8(%rip),%r8
call   1030 <u_realloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x48(%rbp),%rdi
mov    0x10(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%esi
lea    0xe24(%rip),%rdx
mov    $0x35,%ecx
lea    0xec1(%rip),%r8
call   1030 <u_realloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x34(%rbp),%edx
mov    -0x40(%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    -0x48(%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    -0x40(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x48(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_cmatrix>:
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    (%r8),%esi
movslq (%rcx),%r14
mov    (%r9),%eax
mov    (%rdi),%ecx
cmp    %ecx,%eax
jl     11b3 <insert_cmatrix+0xa3>
cvtsi2sd %ecx,%xmm0
mulsd  0xeb3(%rip),%xmm0
mov    %esi,0xc(%rsp)
cvttsd2si %xmm0,%esi
mov    %esi,(%rdi)
shl    $0x2,%esi
lea    0xea7(%rip),%rax
lea    0xf43(%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    0xf20(%rip),%r8
mov    %rbp,%rdi
lea    0xe6d(%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 = [163 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.17/src/insert_cmatrix.c\00"
@.str.1 = [6 x i8] c"mast1\00"
@.str.2 = [5 x i8] c"next\00"
define void @insert_cmatrix(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*
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** %17
store i32* null, i32** %18
%19 = load i32**, i32*** %9
%20 = load i32*, i32** %19
store i32* %20, i32** %17
%21 = load i32**, i32*** %10
%22 = load i32*, i32** %21
store i32* %22, i32** %18
%23 = load i32*, i32** %12
%24 = load i32, i32* %23
store i32 %24, i32* %15
%25 = load i32*, i32** %11
%26 = load i32, i32* %25
%27 = sub nsw i32 %26, 1
store i32 %27, i32* %16
%28 = load i32*, i32** %13
%29 = load i32, i32* %28
%30 = load i32*, i32** %14
%31 = load i32, i32* %30
%32 = icmp sge i32 %29, %31
br i1 %32, label %33, label %56
33: ; preds = %7
%34 = load i32*, i32** %14
%35 = load i32, i32* %34
%36 = sitofp i32 %35 to double
%37 = fmul double 1.100000e+00, %36
%38 = fptosi double %37 to i32
%39 = load i32*, i32** %14
store i32 %38, i32* %39
%40 = load i32*, i32** %17
%41 = load i32*, i32** %14
%42 = load i32, i32* %41
%43 = sext i32 %42 to i64
%44 = mul i64 %43, 4
%45 = trunc i64 %44 to i32
%46 = call i64 @u_realloc(i32* %40, i32 %45, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0), i32 52, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%47 = inttoptr i64 %46 to i32*
store i32* %47, i32** %17
%48 = load i32*, i32** %18
%49 = load i32*, i32** %14
%50 = load i32, i32* %49
%51 = sext i32 %50 to i64
%52 = mul i64 %51, 4
%53 = trunc i64 %52 to i32
%54 = call i64 @u_realloc(i32* %48, i32 %53, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0), i32 53, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%55 = inttoptr i64 %54 to i32*
store i32* %55, i32** %18
br label %56
56: ; preds = %33, %7
%57 = load i32, i32* %15
%58 = load i32*, i32** %17
%59 = load i32*, i32** %13
%60 = load i32, i32* %59
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i32, i32* %58, i64 %61
store i32 %57, i32* %62
%63 = load i32*, i32** %8
%64 = load i32, i32* %16
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i32, i32* %63, i64 %65
%67 = load i32, i32* %66
%68 = load i32*, i32** %18
%69 = load i32*, i32** %13
%70 = load i32, i32* %69
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i32, i32* %68, i64 %71
store i32 %67, i32* %72
%73 = load i32*, i32** %13
%74 = load i32, i32* %73
%75 = add nsw i32 %74, 1
store i32 %75, i32* %73
%76 = load i32*, i32** %8
%77 = load i32, i32* %16
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i32, i32* %76, i64 %78
store i32 %75, i32* %79
%80 = load i32*, i32** %17
%81 = load i32**, i32*** %9
store i32* %80, i32** %81
%82 = load i32*, i32** %18
%83 = load i32**, i32*** %10
store i32* %82, i32** %83
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/prool/ccx_prool/refs/heads/master/CalculiX/ccx_2.17/src/insert_cmatrix.c\00"
@.str.1 = [6 x i8] c"mast1\00"
@.str.2 = [5 x i8] c"next\00"
define void @insert_cmatrix(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* %4
%11 = load i32, i32* %3
%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 ([163 x i8], [163 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 ([163 x i8], [163 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
}