#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 *);
char *getarg(char const *, char *, int);
int /*<<< orphan*/ in_hash_table(char *);
int /*<<< orphan*/ log_printf(char *, char *, int);
int /*<<< orphan*/ mudstrlcat(char *, char *, int);
char *str_alloc(char *, char *, int);
int /*<<< orphan*/ str_free(char *, char *, int);
scalar_t__ strcasecmp(char *, char const *);
void removename(char **list, const char *name) {
  char buf[8192];
  char arg[2048];
  const char *p;
  buf[0] = 0;
  p = getarg(*list, arg, 2048);
  while (arg[0]) {
    if (strcasecmp(arg, name)) {
      if (buf[0])
        mudstrlcat(buf, " ", 8192);
      mudstrlcat(buf, arg, 8192);
    }
    p = getarg(p, arg, 2048);
  }
  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",
                   453);
        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",
                 453);
    }
    (*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",
                    454);
}


x86 assembly (clang, -O0):
<removename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2820,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x2010(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
lea    -0x2810(%rbp),%rsi
mov    $0x800,%edx
call   1050 <getarg@plt>
mov    %rax,-0x2818(%rbp)
cmpb   $0x0,-0x2810(%rbp)
je     1241 <removename+0xc1>
lea    -0x2810(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
je     121d <removename+0x9d>
cmpb   $0x0,-0x2010(%rbp)
je     1205 <removename+0x85>
lea    -0x2010(%rbp),%rdi
lea    0xe05(%rip),%rsi
mov    $0x2000,%edx
call   10a0 <mudstrlcat@plt>
lea    -0x2010(%rbp),%rdi
lea    -0x2810(%rbp),%rsi
mov    $0x2000,%edx
call   10a0 <mudstrlcat@plt>
mov    -0x2818(%rbp),%rdi
lea    -0x2810(%rbp),%rsi
mov    $0x800,%edx
call   1050 <getarg@plt>
mov    %rax,-0x2818(%rbp)
jmp    11b9 <removename+0x39>
jmp    1246 <removename+0xc6>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     12af <removename+0x12f>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1060 <in_hash_table@plt>
cmp    $0x0,%eax
jne    1292 <removename+0x112>
lea    0xd92(%rip),%rdi
lea    0xdbf(%rip),%rsi
mov    $0x1c5,%edx
call   1070 <log_printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
jmp    12aa <removename+0x12a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
lea    0xd96(%rip),%rsi
mov    $0x1c5,%edx
call   1090 <str_free@plt>
jmp    12af <removename+0x12f>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
lea    -0x2010(%rbp),%rdi
lea    0xd6e(%rip),%rsi
mov    $0x1c6,%edx
call   1080 <str_alloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x2820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removename>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2808,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
movb   $0x0,0x800(%rsp)
mov    (%rdi),%rdi
mov    %rsp,%rsi
mov    $0x800,%edx
call   1050 <getarg@plt>
cmpb   $0x0,(%rsp)
je     1225 <removename+0xa5>
mov    %rax,%rbx
mov    %rsp,%r12
lea    0x800(%rsp),%r13
lea    0xe36(%rip),%rbp
jmp    11f9 <removename+0x79>
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %r12,%rsi
mov    $0x2000,%edx
call   10a0 <mudstrlcat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x800,%edx
call   1050 <getarg@plt>
mov    %rax,%rbx
cmpb   $0x0,(%rsp)
je     1225 <removename+0xa5>
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <strcasecmp@plt>
test   %rax,%rax
je     11e0 <removename+0x60>
cmpb   $0x0,0x800(%rsp)
je     11d0 <removename+0x50>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    $0x2000,%edx
call   10a0 <mudstrlcat@plt>
jmp    11d0 <removename+0x50>
mov    (%r14),%rdi
test   %rdi,%rdi
je     126c <removename+0xec>
call   1060 <in_hash_table@plt>
test   %eax,%eax
je     124c <removename+0xcc>
mov    (%r14),%rdi
lea    0xdf6(%rip),%rsi
mov    $0x1c5,%edx
call   1090 <str_free@plt>
jmp    126c <removename+0xec>
lea    0xdaf(%rip),%rdi
lea    0xddc(%rip),%rsi
mov    $0x1c5,%edx
call   1070 <log_printf@plt>
mov    (%r14),%rdi
call   1030 <free@plt>
movq   $0x0,(%r14)
lea    0xdbc(%rip),%rsi
lea    0x800(%rsp),%rdi
mov    $0x1c6,%edx
call   1080 <str_alloc@plt>
mov    %rax,(%r14)
add    $0x2808,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [52 x i8] c"&RSTRFREE called on str_dup pointer: %s, line %d&D\0A\00"
@.str.2 = [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"
define void @removename(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca [8192 x i8]
%6 = alloca [2048 x i8]
%7 = alloca i8*
store i8** %0, i8*** %3
store i8* %1, i8** %4
%8 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
store i8 0, i8* %8
%9 = load i8**, i8*** %3
%10 = load i8*, i8** %9
%11 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%12 = call i8* @getarg(i8* %10, i8* %11, i32 2048)
store i8* %12, i8** %7
br label %13
13: ; preds = %33, %2
%14 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%15 = load i8, i8* %14
%16 = icmp ne i8 %15, 0
br i1 %16, label %17, label %37
17: ; preds = %13
%18 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%19 = load i8*, i8** %4
%20 = call i64 @strcasecmp(i8* %18, i8* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %33
22: ; preds = %17
%23 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%24 = load i8, i8* %23
%25 = icmp ne i8 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%28 = call i32 @mudstrlcat(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 8192)
br label %29
29: ; preds = %26, %22
%30 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%31 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%32 = call i32 @mudstrlcat(i8* %30, i8* %31, i32 8192)
br label %33
33: ; preds = %29, %17
%34 = load i8*, i8** %7
%35 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%36 = call i8* @getarg(i8* %34, i8* %35, i32 2048)
store i8* %36, i8** %7
br label %13
37: ; preds = %13
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.1, i64 0, i64 0), i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.2, i64 0, i64 0), i32 453)
%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.2, i64 0, i64 0), i32 453)
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
%60 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%61 = call i8* @str_alloc(i8* %60, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.2, i64 0, i64 0), i32 454)
%62 = load i8**, i8*** %3
store i8* %61, i8** %62
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [52 x i8] c"&RSTRFREE called on str_dup pointer: %s, line %d&D\0A\00"
@.str.2 = [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"
define void @removename(i8** nocapture %0, i8* nocapture %1) {
%3 = alloca [8192 x i8]
%4 = alloca [2048 x i8]
%5 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 0
store i8 0, i8* %5
%7 = load i8*, i8** %0
%8 = call i8* @getarg(i8* %7, i8* %6, i32 2048)
%9 = load i8, i8* %6
%10 = icmp eq i8 %9, 0
br i1 %10, label %26, label %11
11: ; preds = %2, %22
%12 = phi i8* [ %23, %22 ], [ %8, %2 ]
%13 = call i64 @strcasecmp(i8* %6, i8* %1)
%14 = icmp eq i64 %13, 0
br i1 %14, label %22, label %15
15: ; preds = %11
%16 = load i8, i8* %5
%17 = icmp eq i8 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = call i32 @mudstrlcat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 8192)
br label %20
20: ; preds = %18, %15
%21 = call i32 @mudstrlcat(i8* %5, i8* %6, i32 8192)
br label %22
22: ; preds = %20, %11
%23 = call i8* @getarg(i8* %12, i8* %6, i32 2048)
%24 = load i8, i8* %6
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %11
26: ; preds = %22, %2
%27 = load i8*, i8** %0
%28 = icmp eq i8* %27, null
br i1 %28, label %39, label %29
29: ; preds = %26
%30 = call i32 @in_hash_table(i8* %27)
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = call i32 @log_printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.2, i64 0, i64 0), i32 453)
%34 = load i8*, i8** %0
%35 = call i32 @free(i8* %34)
br label %39
36: ; preds = %29
%37 = load i8*, i8** %0
%38 = call i32 @str_free(i8* %37, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.2, i64 0, i64 0), i32 453)
br label %39
39: ; preds = %32, %36, %26
store i8* null, i8** %0
%40 = call i8* @str_alloc(i8* %5, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.2, i64 0, i64 0), i32 454)
store i8* %40, i8** %0
ret void
}