void profile_list_augment(char **list, const char *items) {
  char *tmp = 0;
  if (asprintf(&tmp, "%s,%s", *list ?: "", items ?: "") < 0)
    do {
      char msgout[500];
      snprintf(msgout, 500, "Error %s: %s:%d %s", "asprintf",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/netblue30/firejail/refs/"
               "heads/master/src/firejail/profile.c",
               1970, __FUNCTION__);
      perror(msgout);
      exit(1);
    } while (0);
  free(*list);
  *list = profile_list_compress(tmp);
}


x86 assembly (clang, -O0):
<profile_list_augment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x218(%rbp)
cmp    $0x0,%rax
je     11a6 <profile_list_augment+0x46>
mov    -0x218(%rbp),%rax
mov    %rax,-0x220(%rbp)
jmp    11b9 <profile_list_augment+0x59>
lea    0xf0a(%rip),%rax
mov    %rax,-0x220(%rbp)
jmp    11b9 <profile_list_augment+0x59>
mov    -0x220(%rbp),%rax
mov    %rax,-0x230(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x228(%rbp)
cmp    $0x0,%rax
je     11ef <profile_list_augment+0x8f>
mov    -0x228(%rbp),%rax
mov    %rax,-0x238(%rbp)
jmp    1202 <profile_list_augment+0xa2>
lea    0xec1(%rip),%rax
mov    %rax,-0x238(%rbp)
jmp    1202 <profile_list_augment+0xa2>
mov    -0x230(%rbp),%rdx
mov    -0x238(%rbp),%rcx
lea    -0x18(%rbp),%rdi
lea    0xde5(%rip),%rsi
mov    $0x0,%al
call   1060 <asprintf@plt>
cmp    $0x0,%eax
jge    1281 <profile_list_augment+0x121>
jmp    1230 <profile_list_augment+0xd0>
lea    -0x210(%rbp),%rdi
mov    $0x1f4,%esi
lea    0xdc3(%rip),%rdx
lea    0xdcf(%rip),%rcx
lea    0xdd1(%rip),%r8
mov    $0x7b2,%r9d
lea    0xe5a(%rip),%rax
mov    %rax,(%rsp)
mov    $0x0,%al
call   1040 <snprintf@plt>
lea    -0x210(%rbp),%rdi
mov    $0x0,%al
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1050 <profile_list_compress@plt>
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<profile_list_augment>:
push   %rbx
sub    $0x210,%rsp
mov    %rdi,%rbx
movq   $0x0,0x8(%rsp)
mov    (%rdi),%rdx
test   %rdx,%rdx
lea    0xf36(%rip),%rcx
cmove  %rcx,%rdx
test   %rsi,%rsi
cmovne %rsi,%rcx
lea    0xe6d(%rip),%rsi
lea    0x8(%rsp),%rdi
xor    %eax,%eax
call   1060 <asprintf@plt>
test   %eax,%eax
js     11c5 <profile_list_augment+0x65>
mov    (%rbx),%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
xor    %eax,%eax
call   1050 <profile_list_compress@plt>
cltq
mov    %rax,(%rbx)
add    $0x210,%rsp
pop    %rbx
ret
lea    0xeec(%rip),%rax
mov    %rax,(%rsp)
lea    0xe2f(%rip),%rdx
lea    0xe3b(%rip),%rcx
lea    0xe3d(%rip),%r8
lea    0x10(%rsp),%rbx
mov    $0x1f4,%esi
mov    %rbx,%rdi
mov    $0x7b2,%r9d
xor    %eax,%eax
call   1040 <snprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%s,%s\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [19 x i8] c"Error %s: %s:%d %s\00"
@.str.3 = [9 x i8] c"asprintf\00"
@.str.4 = [150 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/netblue30/firejail/refs/heads/master/src/firejail/profile.c\00"
@__FUNCTION__.profile_list_augment = [21 x i8] c"profile_list_augment\00"
define void @profile_list_augment(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [500 x i8]
store i8** %0, i8*** %3
store i8* %1, i8** %4
store i8* null, i8** %5
%7 = load i8**, i8*** %3
%8 = load i8*, i8** %7
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %11
10: ; preds = %2
br label %12
11: ; preds = %2
br label %12
12: ; preds = %11, %10
%13 = phi i8* [ %8, %10 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %11 ]
%14 = load i8*, i8** %4
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %17
16: ; preds = %12
br label %18
17: ; preds = %12
br label %18
18: ; preds = %17, %16
%19 = phi i8* [ %14, %16 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %17 ]
%20 = call i32 (i8**, i8*, i8*, i8*, ...) bitcast (i32 (...)* @asprintf to i32 (i8**, i8*, i8*, i8*, ...)*)(i8** %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %19)
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %29
22: ; preds = %18
br label %23
23: ; preds = %22
%24 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%25 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %24, i64 500, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.4, i64 0, i64 0), i32 1970, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__FUNCTION__.profile_list_augment, i64 0, i64 0))
%26 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%27 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* %26)
unreachable
28: ; No predecessors!
br label %29
29: ; preds = %28, %18
%30 = load i8**, i8*** %3
%31 = load i8*, i8** %30
%32 = load i8*, i8** %5
%33 = call i32 (i8*, ...) bitcast (i32 (...)* @profile_list_compress to i32 (i8*, ...)*)(i8* %32)
%34 = sext i32 %33 to i64
%35 = inttoptr i64 %34 to i8*
%36 = load i8**, i8*** %3
store i8* %35, i8** %36
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s,%s\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [19 x i8] c"Error %s: %s:%d %s\00"
@.str.3 = [9 x i8] c"asprintf\00"
@.str.4 = [150 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/netblue30/firejail/refs/heads/master/src/firejail/profile.c\00"
@__FUNCTION__.profile_list_augment = [21 x i8] c"profile_list_augment\00"
define void @profile_list_augment(i8** nocapture %0, i8* %1) {
%3 = alloca i8*
%4 = alloca [500 x i8]
%5 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%6 = load i8*, i8** %0
%7 = icmp eq i8* %6, null
%8 = select i1 %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %6
%9 = icmp eq i8* %1, null
%10 = select i1 %9, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %1
%11 = call i32 (i8**, i8*, i8*, i8*, ...) bitcast (i32 (...)* @asprintf to i32 (i8**, i8*, i8*, i8*, ...)*)(i8** %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %10)
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i64 0, i64 0
%15 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %14, i64 500, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.4, i64 0, i64 0), i32 1970, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__FUNCTION__.profile_list_augment, i64 0, i64 0))
%16 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* %14)
unreachable
17: ; preds = %2
%18 = load i8*, i8** %0
%19 = load i8*, i8** %3
%20 = call i32 (i8*, ...) bitcast (i32 (...)* @profile_list_compress to i32 (i8*, ...)*)(i8* %19)
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to i8*
store i8* %22, i8** %0
ret void
}