#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 scalar_t__ ino_t;

/* Variables and functions */
int BUFSIZ;
int /*<<< orphan*/ chdir(char *);
scalar_t__ get_ino(char *);
int /*<<< orphan*/ inode_num_to_name(scalar_t__, char *);
int /*<<< orphan*/ printf(char *, char *);
extern void printpath(ino_t this_ino) {
  char this_inode_name[BUFSIZ];
  ino_t father_inode_num = get_ino("..");
  if (father_inode_num != this_ino) {
    inode_num_to_name(this_ino, this_inode_name);
    chdir("..");
    printpath(father_inode_num);
    printf("/%s", this_inode_name);
  }
}


x86 assembly (clang, -O0):
<printpath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e7d(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
lea    0xe71(%rip),%rdi
call   1060 <get_ino@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x8(%rbp),%rax
je     11d8 <printpath+0x88>
mov    -0x28(%rbp),%rsi
mov    -0x8(%rbp),%rdi
call   1070 <inode_num_to_name@plt>
lea    0xe46(%rip),%rdi
call   1040 <chdir@plt>
mov    -0x20(%rbp),%rdi
call   1030 <printpath@plt>
mov    -0x28(%rbp),%rsi
lea    0xe30(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printpath>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    0x2e7c(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xe82(%rip),%rdi
call   1060 <get_ino@plt>
cmp    %r14,%rax
je     11b9 <printpath+0x69>
mov    %rax,%r15
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <inode_num_to_name@plt>
lea    0xe63(%rip),%rdi
call   1040 <chdir@plt>
mov    %r15,%rdi
call   1030 <printpath@plt>
lea    0xe52(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@BUFSIZ = global i32 0
@.str = [3 x i8] c"..\00"
@.str.1 = [4 x i8] c"/%s\00"
define void @printpath(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %2
%6 = load i32, i32* @BUFSIZ
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %3
%9 = alloca i8, i64 %7
store i64 %7, i64* %4
%10 = call i64 @get_ino(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i64 %10, i64* %5
%11 = load i64, i64* %5
%12 = load i64, i64* %2
%13 = icmp ne i64 %11, %12
br i1 %13, label %14, label %20
14: ; preds = %1
%15 = load i64, i64* %2
%16 = call i32 @inode_num_to_name(i64 %15, i8* %9)
%17 = call i32 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%18 = load i64, i64* %5
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %9)
br label %20
20: ; preds = %14, %1
%21 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@.str = [3 x i8] c"..\00"
@.str.1 = [4 x i8] c"/%s\00"
define void @printpath(i64 %0) {
%2 = load i32, i32* @BUFSIZ
%3 = zext i32 %2 to i64
%4 = alloca i8, i64 %3
%5 = tail call i64 @get_ino(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, %0
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = call i32 @inode_num_to_name(i64 %0, i8* %4)
%9 = call i32 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br label %11
11: ; preds = %7, %1
ret void
}