#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 */
int /*<<< orphan*/ FerMem_Free(char *, char *, int);
void xfer_c_ptrs_(char ***src_ptr, int *src_del, int *src_offset,
                  char ***dst_ptr, int *dst_del, int *dst_offset, int *nptr) {
  int src_delta = *src_del ? 8 / sizeof(char **) : 1;
  int dst_delta = *dst_del ? 8 / sizeof(char **) : 1;
  char **src = *src_ptr + (*src_offset * src_delta);
  char **dst = *dst_ptr + (*dst_offset * dst_delta);
  int i;
  for (i = 0; i < *nptr; i++) {
    if (*dst != NULL)
      FerMem_Free(*dst,
                  "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                  "outputs/2022-01-22/02-19-57/repos/NOAA-PMEL/Ferret/refs/"
                  "heads/master/fer/ccr/xfer_c_ptrs.c",
                  57);
    *dst = *src;
    src += src_delta;
    dst += dst_delta;
  }
}


x86 assembly (clang, -O0):
<xfer_c_ptrs_>:
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)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %rax,%rax
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %rax,%rax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%ecx
imul   -0x34(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x30(%rbp),%rcx
mov    (%rcx),%ecx
imul   -0x38(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    121e <xfer_c_ptrs_+0x10e>
mov    -0x48(%rbp),%rax
cmpq   $0x0,(%rax)
je     11d8 <xfer_c_ptrs_+0xc8>
mov    -0x48(%rbp),%rax
mov    (%rax),%rdi
lea    0xe32(%rip),%rsi
mov    $0x39,%edx
call   1030 <FerMem_Free@plt>
mov    -0x40(%rbp),%rax
mov    (%rax),%rcx
mov    -0x48(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x34(%rbp),%ecx
mov    -0x40(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    11a3 <xfer_c_ptrs_+0x93>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfer_c_ptrs_>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    0x30(%rsp),%r14
mov    (%r14),%eax
test   %eax,%eax
jle    117d <xfer_c_ptrs_+0x6d>
movslq (%r9),%r13
shl    $0x3,%r13
add    (%rcx),%r13
movslq (%rdx),%r12
shl    $0x3,%r12
add    (%rdi),%r12
xor    %ebx,%ebx
lea    0xebe(%rip),%r15
jmp    1161 <xfer_c_ptrs_+0x51>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r12,%rbx,8),%rcx
mov    %rcx,0x0(%r13,%rbx,8)
add    $0x1,%rbx
cmp    %eax,%ebx
jge    117d <xfer_c_ptrs_+0x6d>
mov    0x0(%r13,%rbx,8),%rdi
test   %rdi,%rdi
je     1150 <xfer_c_ptrs_+0x40>
mov    %r15,%rsi
mov    $0x39,%edx
call   1030 <FerMem_Free@plt>
mov    (%r14),%eax
jmp    1150 <xfer_c_ptrs_+0x40>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NOAA-PMEL/Ferret/refs/heads/master/fer/ccr/xfer_c_ptrs.c\00"
define void @xfer_c_ptrs_(i8*** %0, i32* %1, i32* %2, i8*** %3, i32* %4, i32* %5, i32* %6) {
%8 = alloca i8***
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i8***
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8**
%18 = alloca i8**
%19 = alloca i32
store i8*** %0, i8**** %8
store i32* %1, i32** %9
store i32* %2, i32** %10
store i8*** %3, i8**** %11
store i32* %4, i32** %12
store i32* %5, i32** %13
store i32* %6, i32** %14
%20 = load i32*, i32** %9
%21 = load i32, i32* %20
%22 = icmp ne i32 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i64 1, i64 1
%25 = trunc i64 %24 to i32
store i32 %25, i32* %15
%26 = load i32*, i32** %12
%27 = load i32, i32* %26
%28 = icmp ne i32 %27, 0
%29 = zext i1 %28 to i64
%30 = select i1 %28, i64 1, i64 1
%31 = trunc i64 %30 to i32
store i32 %31, i32* %16
%32 = load i8***, i8**** %8
%33 = load i8**, i8*** %32
%34 = load i32*, i32** %10
%35 = load i32, i32* %34
%36 = load i32, i32* %15
%37 = mul nsw i32 %35, %36
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %33, i64 %38
store i8** %39, i8*** %17
%40 = load i8***, i8**** %11
%41 = load i8**, i8*** %40
%42 = load i32*, i32** %13
%43 = load i32, i32* %42
%44 = load i32, i32* %16
%45 = mul nsw i32 %43, %44
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8*, i8** %41, i64 %46
store i8** %47, i8*** %18
store i32 0, i32* %19
br label %48
48: ; preds = %73, %7
%49 = load i32, i32* %19
%50 = load i32*, i32** %14
%51 = load i32, i32* %50
%52 = icmp slt i32 %49, %51
br i1 %52, label %53, label %76
53: ; preds = %48
%54 = load i8**, i8*** %18
%55 = load i8*, i8** %54
%56 = icmp ne i8* %55, null
br i1 %56, label %57, label %61
57: ; preds = %53
%58 = load i8**, i8*** %18
%59 = load i8*, i8** %58
%60 = call i32 @FerMem_Free(i8* %59, i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 57)
br label %61
61: ; preds = %57, %53
%62 = load i8**, i8*** %17
%63 = load i8*, i8** %62
%64 = load i8**, i8*** %18
store i8* %63, i8** %64
%65 = load i32, i32* %15
%66 = load i8**, i8*** %17
%67 = sext i32 %65 to i64
%68 = getelementptr inbounds i8*, i8** %66, i64 %67
store i8** %68, i8*** %17
%69 = load i32, i32* %16
%70 = load i8**, i8*** %18
%71 = sext i32 %69 to i64
%72 = getelementptr inbounds i8*, i8** %70, i64 %71
store i8** %72, i8*** %18
br label %73
73: ; preds = %61
%74 = load i32, i32* %19
%75 = add nsw i32 %74, 1
store i32 %75, i32* %19
br label %48
76: ; preds = %48
ret void
}

LLVM IR (-O2):
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NOAA-PMEL/Ferret/refs/heads/master/fer/ccr/xfer_c_ptrs.c\00"
define void @xfer_c_ptrs_(i8*** nocapture %0, i32* nocapture readnone %1, i32* nocapture %2, i8*** nocapture %3, i32* nocapture readnone %4, i32* nocapture %5, i32* nocapture %6) {
%8 = load i32, i32* %6
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %36
10: ; preds = %7
%11 = load i8**, i8*** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %11, i64 %13
%15 = load i8**, i8*** %0
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
br label %19
19: ; preds = %10, %29
%20 = phi i32 [ %30, %29 ], [ %8, %10 ]
%21 = phi i32 [ %34, %29 ], [ 0, %10 ]
%22 = phi i8** [ %33, %29 ], [ %14, %10 ]
%23 = phi i8** [ %32, %29 ], [ %18, %10 ]
%24 = load i8*, i8** %22
%25 = icmp eq i8* %24, null
br i1 %25, label %29, label %26
26: ; preds = %19
%27 = tail call i32 @FerMem_Free(i8* %24, i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 57)
%28 = load i32, i32* %6
br label %29
29: ; preds = %26, %19
%30 = phi i32 [ %28, %26 ], [ %20, %19 ]
%31 = load i8*, i8** %23
store i8* %31, i8** %22
%32 = getelementptr inbounds i8*, i8** %23, i64 1
%33 = getelementptr inbounds i8*, i8** %22, i64 1
%34 = add nuw nsw i32 %21, 1
%35 = icmp slt i32 %34, %30
br i1 %35, label %19, label %36
36: ; preds = %29, %7
ret void
}