#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 */
void *__ckd_calloc__(int, int, char *, int);
int /*<<< orphan*/ __ckd_free__(void *, char *, int);
void free_and_alloc_strlst(void **arg_ptr, int new_len) {
  if (*arg_ptr)
    __ckd_free__(
        *arg_ptr,
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/gemusehaken/sunflower-simulator/refs/heads/"
        "master/benchmarks/source/sphinx3/src/libutil/cmd_ln.c",
        332);
  *arg_ptr = __ckd_calloc__(
      (new_len), (sizeof(char *)),
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/gemusehaken/sunflower-simulator/refs/heads/"
      "master/benchmarks/source/sphinx3/src/libutil/cmd_ln.c",
      334);
}


x86 assembly (clang, -O0):
<free_and_alloc_strlst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1155 <free_and_alloc_strlst+0x35>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
lea    0xeb5(%rip),%rsi
mov    $0x14c,%edx
call   1030 <__ckd_free__@plt>
mov    -0xc(%rbp),%edi
mov    $0x8,%esi
lea    0xe9c(%rip),%rdx
mov    $0x14e,%ecx
call   1040 <__ckd_calloc__@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_and_alloc_strlst>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1141 <free_and_alloc_strlst+0x21>
lea    0xec9(%rip),%rsi
mov    $0x14c,%edx
call   1030 <__ckd_free__@plt>
lea    0xeb8(%rip),%rdx
mov    %ebp,%edi
mov    $0x8,%esi
mov    $0x14e,%ecx
call   1040 <__ckd_calloc__@plt>
mov    %rax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [187 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/gemusehaken/sunflower-simulator/refs/heads/master/benchmarks/source/sphinx3/src/libutil/cmd_ln.c\00"
define void @free_and_alloc_strlst(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
%5 = load i8**, i8*** %3
%6 = load i8*, i8** %5
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8**, i8*** %3
%10 = load i8*, i8** %9
%11 = call i32 @__ckd_free__(i8* %10, i8* getelementptr inbounds ([187 x i8], [187 x i8]* @.str, i64 0, i64 0), i32 332)
br label %12
12: ; preds = %8, %2
%13 = load i32, i32* %4
%14 = call i8* @__ckd_calloc__(i32 %13, i32 8, i8* getelementptr inbounds ([187 x i8], [187 x i8]* @.str, i64 0, i64 0), i32 334)
%15 = load i8**, i8*** %3
store i8* %14, i8** %15
ret void
}

LLVM IR (-O2):
@.str = [187 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/gemusehaken/sunflower-simulator/refs/heads/master/benchmarks/source/sphinx3/src/libutil/cmd_ln.c\00"
define void @free_and_alloc_strlst(i8** nocapture %0, i32 %1) {
%3 = load i8*, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @__ckd_free__(i8* %3, i8* getelementptr inbounds ([187 x i8], [187 x i8]* @.str, i64 0, i64 0), i32 332)
br label %7
7: ; preds = %5, %2
%8 = tail call i8* @__ckd_calloc__(i32 %1, i32 8, i8* getelementptr inbounds ([187 x i8], [187 x i8]* @.str, i64 0, i64 0), i32 334)
store i8* %8, i8** %0
ret void
}