void canon_add(char ***pents, char *ent) {
  if (!strcmp(ent, "."))
    return;
  if (!strcmp(ent, "..")) {
    if (*pents) {
      unsigned n = dynarray_nochk_count((void **)*pents);
      if (!strcmp((*pents)[n - 1], "..")) {
      } else {
        (void)((void)((int(*)[(__builtin_types_compatible_p(char ***,
                                                            __typeof(pents)))
                                  ? 1
                                  : -1])0),
               (char *)dynarray_nochk_pop((void ***)pents));
        return;
      }
    } else {
    }
  }
  ((void)((
       int(*)[(__builtin_types_compatible_p(__typeof(ent) **, __typeof(pents)))
                  ? 1
                  : -1])0),
   dynarray_nochk_add((void ***)(pents), (void *)(ent)));
}


x86 assembly (clang, -O0):
<canon_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    116e <canon_add+0x2e>
jmp    1201 <canon_add+0xc1>
mov    -0x10(%rbp),%rdi
lea    0xe87(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11f2 <canon_add+0xb2>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     11e8 <canon_add+0xa8>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    $0x0,%al
call   1050 <dynarray_nochk_count@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,8),%rdi
lea    0xe40(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11d3 <canon_add+0x93>
jmp    11e3 <canon_add+0xa3>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1060 <dynarray_nochk_pop@plt>
jmp    1201 <canon_add+0xc1>
jmp    11ed <canon_add+0xad>
jmp    11ed <canon_add+0xad>
jmp    11f2 <canon_add+0xb2>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <dynarray_nochk_add@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<canon_add>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1184 <canon_add+0x44>
lea    0xe9c(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     118c <canon_add+0x4c>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <dynarray_nochk_add@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    (%r14),%rdi
test   %rdi,%rdi
je     1170 <canon_add+0x30>
xor    %eax,%eax
call   1050 <dynarray_nochk_count@plt>
mov    (%r14),%rcx
add    $0xffffffff,%eax
mov    (%rcx,%rax,8),%rdi
lea    0xe54(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1170 <canon_add+0x30>
mov    %r14,%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <dynarray_nochk_pop@plt>

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"..\00"
define void @canon_add(i8*** %0, i8* %1) {
%3 = alloca i8***
%4 = alloca i8*
%5 = alloca i32
store i8*** %0, i8**** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @strcmp(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %2
br label %44
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = call i32 @strcmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp ne i32 %12, 0
br i1 %13, label %40, label %14
14: ; preds = %10
%15 = load i8***, i8**** %3
%16 = load i8**, i8*** %15
%17 = icmp ne i8** %16, null
br i1 %17, label %18, label %38
18: ; preds = %14
%19 = load i8***, i8**** %3
%20 = load i8**, i8*** %19
%21 = call i32 (i8**, ...) bitcast (i32 (...)* @dynarray_nochk_count to i32 (i8**, ...)*)(i8** %20)
store i32 %21, i32* %5
%22 = load i8***, i8**** %3
%23 = load i8**, i8*** %22
%24 = load i32, i32* %5
%25 = sub i32 %24, 1
%26 = zext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %23, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @strcmp(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
br i1 %30, label %32, label %31
31: ; preds = %18
br label %37
32: ; preds = %18
%33 = load i8***, i8**** %3
%34 = call i32 (i8***, ...) bitcast (i32 (...)* @dynarray_nochk_pop to i32 (i8***, ...)*)(i8*** %33)
%35 = sext i32 %34 to i64
%36 = inttoptr i64 %35 to i8*
br label %44
37: ; preds = %31
br label %39
38: ; preds = %14
br label %39
39: ; preds = %38, %37
br label %40
40: ; preds = %39, %10
%41 = load i8***, i8**** %3
%42 = load i8*, i8** %4
%43 = call i32 (i8***, i8*, ...) bitcast (i32 (...)* @dynarray_nochk_add to i32 (i8***, i8*, ...)*)(i8*** %41, i8* %42)
br label %44
44: ; preds = %40, %32, %9
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"..\00"
define void @canon_add(i8*** %0, i8* %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %24, label %5
5: ; preds = %2
%6 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %22
8: ; preds = %5
%9 = load i8**, i8*** %0
%10 = icmp eq i8** %9, null
br i1 %10, label %22, label %11
11: ; preds = %8
%12 = tail call i32 (i8**, ...) bitcast (i32 (...)* @dynarray_nochk_count to i32 (i8**, ...)*)(i8** %9)
%13 = load i8**, i8*** %0
%14 = add i32 %12, -1
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = tail call i32 @strcmp(i8* dereferenceable(1) %17, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %11
%21 = tail call i32 (i8***, ...) bitcast (i32 (...)* @dynarray_nochk_pop to i32 (i8***, ...)*)(i8*** %0)
br label %24
22: ; preds = %11, %8, %5
%23 = tail call i32 (i8***, i8*, ...) bitcast (i32 (...)* @dynarray_nochk_add to i32 (i8***, i8*, ...)*)(i8*** %0, i8* %1)
br label %24
24: ; preds = %20, %2, %22
ret void
}