struct entry *av_namespace_lookup_all(struct namespace *ns, struct entry *prev,
                                      const char *name) {
  if (name != ((void *)0)) {
    if (strcmp(name, ".") == 0) {
      av_ref_obj(prev);
      return prev;
    }
    if (strcmp(name, "..") == 0)
      name = ((void *)0);
  }
  return av_namespace_lookup(ns, prev, name);
}


x86 assembly (clang, -O0):
<av_namespace_lookup_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11a6 <av_namespace_lookup_all+0x76>
mov    -0x20(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1180 <av_namespace_lookup_all+0x50>
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1030 <av_ref_obj@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11bf <av_namespace_lookup_all+0x8f>
mov    -0x20(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11a1 <av_namespace_lookup_all+0x71>
movq   $0x0,-0x20(%rbp)
jmp    11a6 <av_namespace_lookup_all+0x76>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1050 <av_namespace_lookup@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<av_namespace_lookup_all>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
test   %rdx,%rdx
je     116f <av_namespace_lookup_all+0x3f>
mov    %rdx,%rbx
lea    0xeb7(%rip),%rsi
mov    %rdx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1183 <av_namespace_lookup_all+0x53>
lea    0xea3(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
xor    %edx,%edx
test   %eax,%eax
cmovne %rbx,%rdx
jmp    1171 <av_namespace_lookup_all+0x41>
xor    %edx,%edx
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <av_namespace_lookup@plt>
movslq %eax,%r15
jmp    118d <av_namespace_lookup_all+0x5d>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <av_ref_obj@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.namespace = type opaque
%struct.entry = type opaque
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"..\00"
define %struct.entry* @av_namespace_lookup_all(%struct.namespace* %0, %struct.entry* %1, i8* %2) {
%4 = alloca %struct.entry*
%5 = alloca %struct.namespace*
%6 = alloca %struct.entry*
%7 = alloca i8*
store %struct.namespace* %0, %struct.namespace** %5
store %struct.entry* %1, %struct.entry** %6
store i8* %2, i8** %7
%8 = load i8*, i8** %7
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %24
10: ; preds = %3
%11 = load i8*, i8** %7
%12 = call i32 @strcmp(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load %struct.entry*, %struct.entry** %6
%16 = call i32 (%struct.entry*, ...) bitcast (i32 (...)* @av_ref_obj to i32 (%struct.entry*, ...)*)(%struct.entry* %15)
%17 = load %struct.entry*, %struct.entry** %6
store %struct.entry* %17, %struct.entry** %4
br label %31
18: ; preds = %10
%19 = load i8*, i8** %7
%20 = call i32 @strcmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
store i8* null, i8** %7
br label %23
23: ; preds = %22, %18
br label %24
24: ; preds = %23, %3
%25 = load %struct.namespace*, %struct.namespace** %5
%26 = load %struct.entry*, %struct.entry** %6
%27 = load i8*, i8** %7
%28 = call i32 (%struct.namespace*, %struct.entry*, i8*, ...) bitcast (i32 (...)* @av_namespace_lookup to i32 (%struct.namespace*, %struct.entry*, i8*, ...)*)(%struct.namespace* %25, %struct.entry* %26, i8* %27)
%29 = sext i32 %28 to i64
%30 = inttoptr i64 %29 to %struct.entry*
store %struct.entry* %30, %struct.entry** %4
br label %31
31: ; preds = %24, %14
%32 = load %struct.entry*, %struct.entry** %4
ret %struct.entry* %32
}

LLVM IR (-O2):
%struct.namespace = type opaque
%struct.entry = type opaque
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"..\00"
define %struct.entry* @av_namespace_lookup_all(%struct.namespace* %0, %struct.entry* %1, i8* %2) {
%4 = icmp eq i8* %2, null
br i1 %4, label %14, label %5
5: ; preds = %3
%6 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 (%struct.entry*, ...) bitcast (i32 (...)* @av_ref_obj to i32 (%struct.entry*, ...)*)(%struct.entry* %1)
br label %19
10: ; preds = %5
%11 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i8* null, i8* %2
br label %14
14: ; preds = %10, %3
%15 = phi i8* [ %13, %10 ], [ null, %3 ]
%16 = tail call i32 (%struct.namespace*, %struct.entry*, i8*, ...) bitcast (i32 (...)* @av_namespace_lookup to i32 (%struct.namespace*, %struct.entry*, i8*, ...)*)(%struct.namespace* %0, %struct.entry* %1, i8* %15)
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to %struct.entry*
br label %19
19: ; preds = %14, %8
%20 = phi %struct.entry* [ %1, %8 ], [ %18, %14 ]
ret %struct.entry* %20
}