#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 */
typedef struct TYPE_6__ TYPE_2__;
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
struct TYPE_6__ {
  char *fts_path;
  TYPE_1__ *fts_child;
};
struct TYPE_5__ {
  char *fts_accpath;
  char *fts_name;
  char *fts_path;
  scalar_t__ fts_level;
  struct TYPE_5__ *fts_parent;
  struct TYPE_5__ *fts_link;
};
typedef TYPE_1__ FTSENT;
typedef TYPE_2__ FTS;

/* Variables and functions */
scalar_t__ FTS_ROOTLEVEL;
void fts_padjust(FTS *sp, FTSENT *head) {
  FTSENT *p;
  char *addr = sp->fts_path;
  for (p = sp->fts_child; p; p = p->fts_link) {
    if ((p)->fts_accpath != (p)->fts_name) {
      (p)->fts_accpath = (char *)addr + ((p)->fts_accpath - (p)->fts_path);
    }
    (p)->fts_path = addr;
  };
  for (p = head; p->fts_level >= FTS_ROOTLEVEL;) {
    {
      if ((p)->fts_accpath != (p)->fts_name) {
        (p)->fts_accpath = (char *)addr + ((p)->fts_accpath - (p)->fts_path);
      }
      (p)->fts_path = addr;
    };
    p = p->fts_link ? p->fts_link : p->fts_parent;
  }
}


x86 assembly (clang, -O0):
<fts_padjust>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1180 <fts_padjust+0x80>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    0x8(%rcx),%rax
je     1163 <fts_padjust+0x63>
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rdx
mov    0x10(%rdx),%rdx
sub    %rdx,%rax
add    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1123 <fts_padjust+0x23>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rax
mov    0x2e51(%rip),%rcx
cmp    (%rcx),%rax
jl     121a <fts_padjust+0x11a>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    0x8(%rcx),%rax
je     11d5 <fts_padjust+0xd5>
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rdx
mov    0x10(%rdx),%rdx
sub    %rdx,%rax
add    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x18(%rbp),%rax
cmpq   $0x0,0x28(%rax)
je     1201 <fts_padjust+0x101>
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    120d <fts_padjust+0x10d>
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1188 <fts_padjust+0x88>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fts_padjust>:
mov    (%rdi),%rax
mov    0x8(%rdi),%rcx
jmp    1118 <fts_padjust+0x18>
nopl   0x0(%rax)
mov    %rax,0x10(%rcx)
mov    0x28(%rcx),%rcx
test   %rcx,%rcx
je     1132 <fts_padjust+0x32>
mov    (%rcx),%rdx
cmp    0x8(%rcx),%rdx
je     1110 <fts_padjust+0x10>
sub    0x10(%rcx),%rdx
add    %rax,%rdx
mov    %rdx,(%rcx)
jmp    1110 <fts_padjust+0x10>
mov    0x2eaf(%rip),%rcx
mov    (%rcx),%rcx
cmp    %rcx,0x18(%rsi)
jge    1159 <fts_padjust+0x59>
ret
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rdx,%rsi
cmp    %rcx,0x18(%rdx)
jl     1142 <fts_padjust+0x42>
mov    (%rsi),%rdx
cmp    0x8(%rsi),%rdx
je     116c <fts_padjust+0x6c>
sub    0x10(%rsi),%rdx
add    %rax,%rdx
mov    %rdx,(%rsi)
mov    %rax,0x10(%rsi)
mov    0x28(%rsi),%rdx
test   %rdx,%rdx
jne    1150 <fts_padjust+0x50>
mov    0x20(%rsi),%rdx
jmp    1150 <fts_padjust+0x50>

LLVM IR (-O0):
%struct.TYPE_6__ = type { i8*, %struct.TYPE_5__* }
%struct.TYPE_5__ = type { i8*, i8*, i8*, i64, %struct.TYPE_5__*, %struct.TYPE_5__* }
@FTS_ROOTLEVEL = global i64 0
define void @fts_padjust(%struct.TYPE_6__* %0, %struct.TYPE_5__* %1) {
%3 = alloca %struct.TYPE_6__*
%4 = alloca %struct.TYPE_5__*
%5 = alloca %struct.TYPE_5__*
%6 = alloca i8*
store %struct.TYPE_6__* %0, %struct.TYPE_6__** %3
store %struct.TYPE_5__* %1, %struct.TYPE_5__** %4
%7 = load %struct.TYPE_6__*, %struct.TYPE_6__** %3
%8 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %7, i32 0, i32 0
%9 = load i8*, i8** %8
store i8* %9, i8** %6
%10 = load %struct.TYPE_6__*, %struct.TYPE_6__** %3
%11 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %10, i32 0, i32 1
%12 = load %struct.TYPE_5__*, %struct.TYPE_5__** %11
store %struct.TYPE_5__* %12, %struct.TYPE_5__** %5
br label %13
13: ; preds = %42, %2
%14 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%15 = icmp ne %struct.TYPE_5__* %14, null
br i1 %15, label %16, label %46
16: ; preds = %13
%17 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%18 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %17, i32 0, i32 0
%19 = load i8*, i8** %18
%20 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%21 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %20, i32 0, i32 1
%22 = load i8*, i8** %21
%23 = icmp ne i8* %19, %22
br i1 %23, label %24, label %38
24: ; preds = %16
%25 = load i8*, i8** %6
%26 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%27 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %26, i32 0, i32 0
%28 = load i8*, i8** %27
%29 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%30 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %29, i32 0, i32 2
%31 = load i8*, i8** %30
%32 = ptrtoint i8* %28 to i64
%33 = ptrtoint i8* %31 to i64
%34 = sub i64 %32, %33
%35 = getelementptr inbounds i8, i8* %25, i64 %34
%36 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%37 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %36, i32 0, i32 0
store i8* %35, i8** %37
br label %38
38: ; preds = %24, %16
%39 = load i8*, i8** %6
%40 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%41 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %40, i32 0, i32 2
store i8* %39, i8** %41
br label %42
42: ; preds = %38
%43 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%44 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %43, i32 0, i32 5
%45 = load %struct.TYPE_5__*, %struct.TYPE_5__** %44
store %struct.TYPE_5__* %45, %struct.TYPE_5__** %5
br label %13
46: ; preds = %13
%47 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
store %struct.TYPE_5__* %47, %struct.TYPE_5__** %5
br label %48
48: ; preds = %92, %46
%49 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%50 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %49, i32 0, i32 3
%51 = load i64, i64* %50
%52 = load i64, i64* @FTS_ROOTLEVEL
%53 = icmp sge i64 %51, %52
br i1 %53, label %54, label %94
54: ; preds = %48
%55 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%56 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %55, i32 0, i32 0
%57 = load i8*, i8** %56
%58 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%59 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %58, i32 0, i32 1
%60 = load i8*, i8** %59
%61 = icmp ne i8* %57, %60
br i1 %61, label %62, label %76
62: ; preds = %54
%63 = load i8*, i8** %6
%64 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%65 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %64, i32 0, i32 0
%66 = load i8*, i8** %65
%67 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%68 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %67, i32 0, i32 2
%69 = load i8*, i8** %68
%70 = ptrtoint i8* %66 to i64
%71 = ptrtoint i8* %69 to i64
%72 = sub i64 %70, %71
%73 = getelementptr inbounds i8, i8* %63, i64 %72
%74 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%75 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %74, i32 0, i32 0
store i8* %73, i8** %75
br label %76
76: ; preds = %62, %54
%77 = load i8*, i8** %6
%78 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%79 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %78, i32 0, i32 2
store i8* %77, i8** %79
%80 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%81 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %80, i32 0, i32 5
%82 = load %struct.TYPE_5__*, %struct.TYPE_5__** %81
%83 = icmp ne %struct.TYPE_5__* %82, null
br i1 %83, label %84, label %88
84: ; preds = %76
%85 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%86 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %85, i32 0, i32 5
%87 = load %struct.TYPE_5__*, %struct.TYPE_5__** %86
br label %92
88: ; preds = %76
%89 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%90 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %89, i32 0, i32 4
%91 = load %struct.TYPE_5__*, %struct.TYPE_5__** %90
br label %92
92: ; preds = %88, %84
%93 = phi %struct.TYPE_5__* [ %87, %84 ], [ %91, %88 ]
store %struct.TYPE_5__* %93, %struct.TYPE_5__** %5
br label %48
94: ; preds = %48
ret void
}

LLVM IR (-O2):
%struct.TYPE_6__ = type { i8*, %struct.TYPE_5__* }
%struct.TYPE_5__ = type { i8*, i8*, i8*, i64, %struct.TYPE_5__*, %struct.TYPE_5__* }
@FTS_ROOTLEVEL = global i64 0
define void @fts_padjust(%struct.TYPE_6__* nocapture %0, %struct.TYPE_5__* nocapture %1) {
%3 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %0, i64 0, i32 0
%4 = load i8*, i8** %3
%5 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %0, i64 0, i32 1
%6 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%7 = icmp eq %struct.TYPE_5__* %6, null
br i1 %7, label %8, label %13
8: ; preds = %27, %2
%9 = load i64, i64* @FTS_ROOTLEVEL
%10 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 3
%11 = load i64, i64* %10
%12 = icmp slt i64 %11, %9
br i1 %12, label %59, label %32
13: ; preds = %2, %27
%14 = phi %struct.TYPE_5__* [ %30, %27 ], [ %6, %2 ]
%15 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %14, i64 0, i32 0
%16 = load i8*, i8** %15
%17 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %14, i64 0, i32 1
%18 = load i8*, i8** %17
%19 = icmp eq i8* %16, %18
br i1 %19, label %27, label %20
20: ; preds = %13
%21 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %14, i64 0, i32 2
%22 = load i8*, i8** %21
%23 = ptrtoint i8* %16 to i64
%24 = ptrtoint i8* %22 to i64
%25 = sub i64 %23, %24
%26 = getelementptr inbounds i8, i8* %4, i64 %25
store i8* %26, i8** %15
br label %27
27: ; preds = %20, %13
%28 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %14, i64 0, i32 2
store i8* %4, i8** %28
%29 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %14, i64 0, i32 5
%30 = load %struct.TYPE_5__*, %struct.TYPE_5__** %29
%31 = icmp eq %struct.TYPE_5__* %30, null
br i1 %31, label %8, label %13
32: ; preds = %8, %54
%33 = phi %struct.TYPE_5__* [ %55, %54 ], [ %1, %8 ]
%34 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %33, i64 0, i32 0
%35 = load i8*, i8** %34
%36 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %33, i64 0, i32 1
%37 = load i8*, i8** %36
%38 = icmp eq i8* %35, %37
br i1 %38, label %46, label %39
39: ; preds = %32
%40 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %33, i64 0, i32 2
%41 = load i8*, i8** %40
%42 = ptrtoint i8* %35 to i64
%43 = ptrtoint i8* %41 to i64
%44 = sub i64 %42, %43
%45 = getelementptr inbounds i8, i8* %4, i64 %44
store i8* %45, i8** %34
br label %46
46: ; preds = %39, %32
%47 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %33, i64 0, i32 2
store i8* %4, i8** %47
%48 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %33, i64 0, i32 5
%49 = load %struct.TYPE_5__*, %struct.TYPE_5__** %48
%50 = icmp eq %struct.TYPE_5__* %49, null
br i1 %50, label %51, label %54
51: ; preds = %46
%52 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %33, i64 0, i32 4
%53 = load %struct.TYPE_5__*, %struct.TYPE_5__** %52
br label %54
54: ; preds = %46, %51
%55 = phi %struct.TYPE_5__* [ %53, %51 ], [ %49, %46 ]
%56 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %55, i64 0, i32 3
%57 = load i64, i64* %56
%58 = icmp slt i64 %57, %9
br i1 %58, label %59, label %32
59: ; preds = %54, %8
ret void
}