#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*/ free(char *);
scalar_t__ hasname(char *, char const *);
int /*<<< orphan*/ in_hash_table(char *);
int /*<<< orphan*/ log_printf(char *, char *, int);
int /*<<< orphan*/ newmudstrlcpy(char *, char const *, int, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char const *);
char *str_alloc(char *, char *, int);
int /*<<< orphan*/ str_free(char *, char *, int);
void addname(char **list, const char *name) {
  char buf[8192];
  if (hasname(*list, name))
    return;
  if (*list && *list[0] != '\0')
    snprintf(buf, 8192, "%s %s", *list, name);
  else
    newmudstrlcpy((buf), (name), (8192),
                  "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                  "outputs/2022-01-22/02-19-57/repos/jpavonabian/6Dragones/"
                  "refs/heads/master/src/channels.c",
                  430);
  if (*list)
    do {
      if ((*list)) {
        if (!in_hash_table((*list))) {
          log_printf("&RSTRFREE called on str_dup pointer: %s, line %d&D\n",
                     "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/jpavonabian/6Dragones/"
                     "refs/heads/master/src/channels.c",
                     432);
          free((*list));
        } else
          str_free((*list),
                   "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/jpavonabian/6Dragones/"
                   "refs/heads/master/src/channels.c",
                   432);
      }
      (*list) = NULL;
    } while (0);
  *list = str_alloc((buf),
                    "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                    "outputs/2022-01-22/02-19-57/repos/jpavonabian/6Dragones/"
                    "refs/heads/master/src/channels.c",
                    433);
}


x86 assembly (clang, -O0):
<addname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2010,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   10a0 <hasname@plt>
cmp    $0x0,%rax
je     11b2 <addname+0x32>
jmp    12cb <addname+0x14b>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     11fb <addname+0x7b>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11fb <addname+0x7b>
lea    -0x2010(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
mov    -0x10(%rbp),%r8
mov    $0x2000,%esi
lea    0xe0f(%rip),%rdx
call   1050 <snprintf@plt>
jmp    121d <addname+0x9d>
lea    -0x2010(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x2000,%edx
lea    0xdf4(%rip),%rcx
mov    $0x1ae,%r8d
call   1060 <newmudstrlcpy@plt>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     12a9 <addname+0x129>
jmp    1230 <addname+0xb0>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1299 <addname+0x119>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <in_hash_table@plt>
cmp    $0x0,%eax
jne    127c <addname+0xfc>
lea    0xe3d(%rip),%rdi
lea    0xda5(%rip),%rsi
mov    $0x1b0,%edx
call   1070 <log_printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
jmp    1294 <addname+0x114>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
lea    0xd7c(%rip),%rsi
mov    $0x1b0,%edx
call   1090 <str_free@plt>
jmp    1299 <addname+0x119>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
jmp    12a9 <addname+0x129>
lea    -0x2010(%rbp),%rdi
lea    0xd4f(%rip),%rsi
mov    $0x1b1,%edx
call   1080 <str_alloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x2010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addname>:
push   %r14
push   %rbx
sub    $0x2008,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rdi),%rdi
call   10a0 <hasname@plt>
test   %rax,%rax
jne    1249 <addname+0xc9>
mov    (%r14),%rcx
test   %rcx,%rcx
je     11c7 <addname+0x47>
cmpb   $0x0,(%rcx)
je     11c7 <addname+0x47>
lea    0xe4b(%rip),%rdx
mov    %rsp,%rdi
mov    $0x2000,%esi
mov    %rbx,%r8
call   1050 <snprintf@plt>
jmp    11e4 <addname+0x64>
lea    0xe38(%rip),%rcx
mov    %rsp,%rdi
mov    %rbx,%rsi
mov    $0x2000,%edx
mov    $0x1ae,%r8d
call   1060 <newmudstrlcpy@plt>
mov    (%r14),%rdi
test   %rdi,%rdi
je     1232 <addname+0xb2>
call   1040 <in_hash_table@plt>
test   %eax,%eax
je     120b <addname+0x8b>
mov    (%r14),%rdi
lea    0xe07(%rip),%rsi
mov    $0x1b0,%edx
call   1090 <str_free@plt>
jmp    122b <addname+0xab>
lea    0xe85(%rip),%rdi
lea    0xded(%rip),%rsi
mov    $0x1b0,%edx
call   1070 <log_printf@plt>
mov    (%r14),%rdi
call   1030 <free@plt>
movq   $0x0,(%r14)
lea    0xdcd(%rip),%rsi
mov    %rsp,%rdi
mov    $0x1b1,%edx
call   1080 <str_alloc@plt>
mov    %rax,(%r14)
add    $0x2008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s %s\00"
@.str.1 = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/jpavonabian/6Dragones/refs/heads/master/src/channels.c\00"
@.str.2 = [52 x i8] c"&RSTRFREE called on str_dup pointer: %s, line %d&D\0A\00"
define void @addname(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca [8192 x i8]
store i8** %0, i8*** %3
store i8* %1, i8** %4
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = call i64 @hasname(i8* %7, i8* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
br label %64
12: ; preds = %2
%13 = load i8**, i8*** %3
%14 = load i8*, i8** %13
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %29
16: ; preds = %12
%17 = load i8**, i8*** %3
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %16
%24 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%25 = load i8**, i8*** %3
%26 = load i8*, i8** %25
%27 = load i8*, i8** %4
%28 = call i32 @snprintf(i8* %24, i32 8192, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %26, i8* %27)
br label %33
29: ; preds = %16, %12
%30 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%31 = load i8*, i8** %4
%32 = call i32 @newmudstrlcpy(i8* %30, i8* %31, i32 8192, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.1, i64 0, i64 0), i32 430)
br label %33
33: ; preds = %29, %23
%34 = load i8**, i8*** %3
%35 = load i8*, i8** %34
%36 = icmp ne i8* %35, null
br i1 %36, label %37, label %60
37: ; preds = %33
br label %38
38: ; preds = %37
%39 = load i8**, i8*** %3
%40 = load i8*, i8** %39
%41 = icmp ne i8* %40, null
br i1 %41, label %42, label %57
42: ; preds = %38
%43 = load i8**, i8*** %3
%44 = load i8*, i8** %43
%45 = call i32 @in_hash_table(i8* %44)
%46 = icmp ne i32 %45, 0
br i1 %46, label %52, label %47
47: ; preds = %42
%48 = call i32 @log_printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.1, i64 0, i64 0), i32 432)
%49 = load i8**, i8*** %3
%50 = load i8*, i8** %49
%51 = call i32 @free(i8* %50)
br label %56
52: ; preds = %42
%53 = load i8**, i8*** %3
%54 = load i8*, i8** %53
%55 = call i32 @str_free(i8* %54, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.1, i64 0, i64 0), i32 432)
br label %56
56: ; preds = %52, %47
br label %57
57: ; preds = %56, %38
%58 = load i8**, i8*** %3
store i8* null, i8** %58
br label %59
59: ; preds = %57
br label %60
60: ; preds = %59, %33
%61 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%62 = call i8* @str_alloc(i8* %61, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.1, i64 0, i64 0), i32 433)
%63 = load i8**, i8*** %3
store i8* %62, i8** %63
br label %64
64: ; preds = %60, %11
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s %s\00"
@.str.1 = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/jpavonabian/6Dragones/refs/heads/master/src/channels.c\00"
@.str.2 = [52 x i8] c"&RSTRFREE called on str_dup pointer: %s, line %d&D\0A\00"
define void @addname(i8** nocapture %0, i8* %1) {
%3 = alloca [8192 x i8]
%4 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %0
%6 = tail call i64 @hasname(i8* %5, i8* %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %34
8: ; preds = %2
%9 = load i8*, i8** %0
%10 = icmp eq i8* %9, null
br i1 %10, label %16, label %11
11: ; preds = %8
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = call i32 @snprintf(i8* %4, i32 8192, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %1)
br label %18
16: ; preds = %11, %8
%17 = call i32 @newmudstrlcpy(i8* %4, i8* %1, i32 8192, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.1, i64 0, i64 0), i32 430)
br label %18
18: ; preds = %16, %14
%19 = load i8*, i8** %0
%20 = icmp eq i8* %19, null
br i1 %20, label %32, label %21
21: ; preds = %18
%22 = call i32 @in_hash_table(i8* %19)
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = call i32 @log_printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.1, i64 0, i64 0), i32 432)
%26 = load i8*, i8** %0
%27 = call i32 @free(i8* %26)
br label %31
28: ; preds = %21
%29 = load i8*, i8** %0
%30 = call i32 @str_free(i8* %29, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.1, i64 0, i64 0), i32 432)
br label %31
31: ; preds = %24, %28
store i8* null, i8** %0
br label %32
32: ; preds = %31, %18
%33 = call i8* @str_alloc(i8* %4, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.1, i64 0, i64 0), i32 433)
store i8* %33, i8** %0
br label %34
34: ; preds = %2, %32
ret void
}