#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 */
typedef void entry;
struct archnode {
  int dummy;
};

/* Variables and functions */
scalar_t__ av_namespace_get(void *);
void *av_namespace_parent(void *);
char *av_strdup(char *);
int /*<<< orphan*/ av_unref_obj(void *);
struct archnode *arch_special_entry(int n, struct entry *ent, char **namep) {
  struct archnode *nod;
  if (n == 0) {
    *namep = av_strdup(".");
    nod = (struct archnode *)av_namespace_get(ent);
    return nod;
  } else {
    struct entry *parent;
    *namep = av_strdup("..");
    parent = av_namespace_parent(ent);
    if (parent != ((void *)0))
      nod = (struct archnode *)av_namespace_get(parent);
    else
      nod = (struct archnode *)av_namespace_get(ent);
    av_unref_obj(parent);
    return nod;
  }
}


x86 assembly (clang, -O0):
<arch_special_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    118d <arch_special_entry+0x4d>
lea    0xe9d(%rip),%rdi
call   1050 <av_strdup@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rdi
call   1060 <av_namespace_get@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11eb <arch_special_entry+0xab>
lea    0xe6c(%rip),%rdi
call   1050 <av_strdup@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rdi
call   1030 <av_namespace_parent@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     11cd <arch_special_entry+0x8d>
mov    -0x30(%rbp),%rdi
call   1060 <av_namespace_get@plt>
mov    %rax,-0x28(%rbp)
jmp    11da <arch_special_entry+0x9a>
mov    -0x18(%rbp),%rdi
call   1060 <av_namespace_get@plt>
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <av_unref_obj@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arch_special_entry>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
test   %edi,%edi
je     1172 <arch_special_entry+0x32>
lea    0xeab(%rip),%rdi
call   1050 <av_strdup@plt>
mov    %rax,(%rbx)
mov    %r14,%rdi
call   1030 <av_namespace_parent@plt>
mov    %rax,%rbx
test   %rax,%rax
je     118e <arch_special_entry+0x4e>
mov    %rbx,%rdi
jmp    1191 <arch_special_entry+0x51>
lea    0xe88(%rip),%rdi
call   1050 <av_strdup@plt>
mov    %rax,(%rbx)
mov    %r14,%rdi
call   1060 <av_namespace_get@plt>
mov    %rax,%r14
jmp    11a1 <arch_special_entry+0x61>
mov    %r14,%rdi
call   1060 <av_namespace_get@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <av_unref_obj@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.archnode = type { i32 }
%struct.entry = type opaque
@.str = [2 x i8] c".\00"
@.str.1 = [3 x i8] c"..\00"
define %struct.archnode* @arch_special_entry(i32 %0, %struct.entry* %1, i8** nocapture writeonly %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %9
5: ; preds = %3
%6 = tail call i8* @av_strdup(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %2
%7 = bitcast %struct.entry* %1 to i8*
%8 = tail call i64 @av_namespace_get(i8* %7)
br label %21
9: ; preds = %3
%10 = tail call i8* @av_strdup(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i8* %10, i8** %2
%11 = bitcast %struct.entry* %1 to i8*
%12 = tail call i8* @av_namespace_parent(i8* %11)
%13 = icmp eq i8* %12, null
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = tail call i64 @av_namespace_get(i8* %12)
br label %18
16: ; preds = %9
%17 = tail call i64 @av_namespace_get(i8* %11)
br label %18
18: ; preds = %16, %14
%19 = phi i64 [ %15, %14 ], [ %17, %16 ]
%20 = tail call i32 @av_unref_obj(i8* %12)
br label %21
21: ; preds = %18, %5
%22 = phi i64 [ %8, %5 ], [ %19, %18 ]
%23 = inttoptr i64 %22 to %struct.archnode*
ret %struct.archnode* %23
}