#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 */
struct fnode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ basename_r(char *, char *);
int /*<<< orphan*/ fno_fullpath(struct fnode *, char *, int);
int /*<<< orphan*/ fno_link(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void mkdir_links(struct fnode *fno) {
  char path[64], selfl[64], parentl[64], path_basename[64];
  fno_fullpath(fno, path, 64 - 4);
  strcpy(selfl, path);
  strcpy(parentl, path);
  strcat(selfl, "/.");
  strcat(parentl, "/..");
  if (fno) {
    fno_link(path, selfl);
    basename_r(path, path_basename);
    fno_link(path_basename, parentl);
  }
}


x86 assembly (clang, -O0):
<mkdir_links>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x3c,%edx
call   1060 <fno_fullpath@plt>
lea    -0x90(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0xd0(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x90(%rbp),%rdi
lea    0xe61(%rip),%rsi
call   1070 <strcat@plt>
lea    -0xd0(%rbp),%rdi
lea    0xe51(%rip),%rsi
call   1070 <strcat@plt>
cmpq   $0x0,-0x8(%rbp)
je     11f5 <mkdir_links+0xa5>
lea    -0x50(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1050 <fno_link@plt>
lea    -0x50(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1040 <basename_r@plt>
lea    -0x110(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
call   1050 <fno_link@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkdir_links>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %rdi,%rbx
lea    0x80(%rsp),%r14
mov    %r14,%rsi
mov    $0x3c,%edx
call   1060 <fno_fullpath@plt>
lea    0x40(%rsp),%r15
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rsp,%r12
mov    %r12,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
lea    0xe65(%rip),%rsi
mov    %r15,%rdi
call   1070 <strcat@plt>
lea    0xe59(%rip),%rsi
mov    %r12,%rdi
call   1070 <strcat@plt>
test   %rbx,%rbx
je     11ea <mkdir_links+0x9a>
lea    0x80(%rsp),%r14
lea    0x40(%rsp),%rsi
mov    %r14,%rdi
call   1050 <fno_link@plt>
lea    0xc0(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <basename_r@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <fno_link@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.fnode = type { i32 }
@.str = [3 x i8] c"/.\00"
@.str.1 = [4 x i8] c"/..\00"
define void @mkdir_links(%struct.fnode* %0) {
%2 = alloca %struct.fnode*
%3 = alloca [64 x i8]
%4 = alloca [64 x i8]
%5 = alloca [64 x i8]
%6 = alloca [64 x i8]
store %struct.fnode* %0, %struct.fnode** %2
%7 = load %struct.fnode*, %struct.fnode** %2
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%9 = call i32 @fno_fullpath(%struct.fnode* %7, i8* %8, i32 60)
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%14 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%17 = call i32 @strcat(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%18 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%19 = call i32 @strcat(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%20 = load %struct.fnode*, %struct.fnode** %2
%21 = icmp ne %struct.fnode* %20, null
br i1 %21, label %22, label %32
22: ; preds = %1
%23 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%25 = call i32 @fno_link(i8* %23, i8* %24)
%26 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%27 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%28 = call i32 @basename_r(i8* %26, i8* %27)
%29 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%30 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%31 = call i32 @fno_link(i8* %29, i8* %30)
br label %32
32: ; preds = %22, %1
ret void
}

LLVM IR (-O2):
%struct.fnode = type { i32 }
@.str = [3 x i8] c"/.\00"
@.str.1 = [4 x i8] c"/..\00"
define void @mkdir_links(%struct.fnode* %0) {
%2 = alloca [64 x i8]
%3 = alloca [64 x i8]
%4 = alloca [64 x i8]
%5 = alloca [64 x i8]
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%10 = call i32 @fno_fullpath(%struct.fnode* %0, i8* %6, i32 60)
%11 = call i32 @strcpy(i8* %7, i8* %6)
%12 = call i32 @strcpy(i8* %8, i8* %6)
%13 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq %struct.fnode* %0, null
br i1 %15, label %20, label %16
16: ; preds = %1
%17 = call i32 @fno_link(i8* %6, i8* %7)
%18 = call i32 @basename_r(i8* %6, i8* %9)
%19 = call i32 @fno_link(i8* %9, i8* %8)
br label %20
20: ; preds = %16, %1
ret void
}