#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 insertrad(int *ipointer, int **irowp, int **nextp, int *i1, int *i2,
               int *ifree, int *nzs_) {
  int *irow = NULL, *next = NULL;
  irow = *irowp;
  next = *nextp;
  ++*ifree;
  if (*ifree > *nzs_) {
    *nzs_ = (int)(1.1 * *nzs_);
    irow = (int *)u_realloc(
        (int *)(irow), (*nzs_) * sizeof(int),
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/makkemal/NGIMASEM/refs/heads/master/"
        "CalculiX/ccx_2.15/src/insertrad.c",
        50, "irow");
    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/makkemal/NGIMASEM/refs/heads/master/"
        "CalculiX/ccx_2.15/src/insertrad.c",
        51, "next");
  }
  irow[*ifree - 1] = *i2;
  next[*ifree - 1] = ipointer[*i1 - 1];
  ipointer[*i1 - 1] = *ifree;
  *irowp = irow;
  *nextp = next;
  return;
}


x86 assembly (clang, -O0):
<insertrad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
mov    0x10(%rbp),%rcx
cmp    (%rcx),%eax
jle    11ef <insertrad+0xdf>
mov    0x10(%rbp),%rax
cvtsi2sdl (%rax),%xmm1
movsd  0xe79(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%rdi
mov    0x10(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%esi
lea    0xe5b(%rip),%rdx
mov    $0x32,%ecx
lea    0xeef(%rip),%r8
call   1030 <u_realloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x10(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%esi
lea    0xe2e(%rip),%rdx
mov    $0x33,%ecx
lea    0xec7(%rip),%r8
call   1030 <u_realloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x40(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x38(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x40(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insertrad>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%rbx
mov    %rcx,%r12
mov    %rsi,%r15
mov    %rdi,%r13
mov    0x50(%rsp),%rdi
mov    (%rsi),%rbp
mov    (%rdx),%r14
mov    (%r9),%esi
lea    0x1(%rsi),%eax
mov    %eax,(%r9)
mov    (%rdi),%ecx
cmp    %ecx,%esi
jl     11b8 <insertrad+0xa8>
cvtsi2sd %ecx,%xmm0
mulsd  0xeb0(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    %esi,(%rdi)
shl    $0x2,%esi
lea    0xea8(%rip),%rax
mov    %rdx,0x10(%rsp)
mov    %r8,0x8(%rsp)
lea    0xf37(%rip),%r8
mov    %rbp,%rdi
mov    %rax,%rdx
mov    $0x32,%ecx
call   1030 <u_realloc@plt>
mov    %rax,%rbp
mov    0x50(%rsp),%rax
mov    (%rax),%esi
shl    $0x2,%esi
lea    0xf18(%rip),%r8
mov    %r14,%rdi
lea    0xe69(%rip),%rdx
mov    $0x33,%ecx
call   1030 <u_realloc@plt>
mov    0x8(%rsp),%r8
mov    0x10(%rsp),%rdx
mov    %rax,%r14
mov    (%rbx),%eax
mov    (%r8),%ecx
cltq
mov    %ecx,-0x4(%rbp,%rax,4)
movslq (%r12),%rax
mov    -0x4(%r13,%rax,4),%eax
movslq (%rbx),%rcx
mov    %eax,-0x4(%r14,%rcx,4)
mov    (%rbx),%eax
movslq (%r12),%rcx
mov    %eax,-0x4(%r13,%rcx,4)
mov    %rbp,(%r15)
mov    %r14,(%rdx)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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