#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;
  ;
  addr = sp->fts_path;
  for (p = sp->fts_child; p; p = p->fts_link)
    do {
      if ((p)->fts_accpath != (p)->fts_name)
        (p)->fts_accpath = addr + ((p)->fts_accpath - (p)->fts_path);
      (p)->fts_path = addr;
    } while (0);
  for (p = head; p->fts_level >= FTS_ROOTLEVEL;) {
    do {
      if ((p)->fts_accpath != (p)->fts_name)
        (p)->fts_accpath = addr + ((p)->fts_accpath - (p)->fts_path);
      (p)->fts_path = addr;
    } while (0);
    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     118a <fts_padjust+0x8a>
jmp    1133 <fts_padjust+0x33>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    0x8(%rcx),%rax
je     1168 <fts_padjust+0x68>
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)
jmp    1179 <fts_padjust+0x79>
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    0x2e47(%rip),%rcx
cmp    (%rcx),%rax
jl     1229 <fts_padjust+0x129>
jmp    11af <fts_padjust+0xaf>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    0x8(%rcx),%rax
je     11e4 <fts_padjust+0xe4>
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     1210 <fts_padjust+0x110>
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    121c <fts_padjust+0x11c>
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1192 <fts_padjust+0x92>
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 = %44, %2
%14 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%15 = icmp ne %struct.TYPE_5__* %14, null
br i1 %15, label %16, label %48
16: ; preds = %13
br label %17
17: ; preds = %16
%18 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%19 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %18, i32 0, i32 0
%20 = load i8*, i8** %19
%21 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%22 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %21, i32 0, i32 1
%23 = load i8*, i8** %22
%24 = icmp ne i8* %20, %23
br i1 %24, label %25, label %39
25: ; preds = %17
%26 = load i8*, i8** %6
%27 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%28 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %27, i32 0, i32 0
%29 = load i8*, i8** %28
%30 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%31 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %30, i32 0, i32 2
%32 = load i8*, i8** %31
%33 = ptrtoint i8* %29 to i64
%34 = ptrtoint i8* %32 to i64
%35 = sub i64 %33, %34
%36 = getelementptr inbounds i8, i8* %26, i64 %35
%37 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%38 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %37, i32 0, i32 0
store i8* %36, i8** %38
br label %39
39: ; preds = %25, %17
%40 = load i8*, i8** %6
%41 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%42 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %41, i32 0, i32 2
store i8* %40, i8** %42
br label %43
43: ; preds = %39
br label %44
44: ; preds = %43
%45 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%46 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %45, i32 0, i32 5
%47 = load %struct.TYPE_5__*, %struct.TYPE_5__** %46
store %struct.TYPE_5__* %47, %struct.TYPE_5__** %5
br label %13
48: ; preds = %13
%49 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
store %struct.TYPE_5__* %49, %struct.TYPE_5__** %5
br label %50
50: ; preds = %96, %48
%51 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%52 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %51, i32 0, i32 3
%53 = load i64, i64* %52
%54 = load i64, i64* @FTS_ROOTLEVEL
%55 = icmp sge i64 %53, %54
br i1 %55, label %56, label %98
56: ; preds = %50
br label %57
57: ; preds = %56
%58 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%59 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %58, i32 0, i32 0
%60 = load i8*, i8** %59
%61 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%62 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %61, i32 0, i32 1
%63 = load i8*, i8** %62
%64 = icmp ne i8* %60, %63
br i1 %64, label %65, label %79
65: ; preds = %57
%66 = load i8*, i8** %6
%67 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%68 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %67, i32 0, i32 0
%69 = load i8*, i8** %68
%70 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%71 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %70, i32 0, i32 2
%72 = load i8*, i8** %71
%73 = ptrtoint i8* %69 to i64
%74 = ptrtoint i8* %72 to i64
%75 = sub i64 %73, %74
%76 = getelementptr inbounds i8, i8* %66, i64 %75
%77 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%78 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %77, i32 0, i32 0
store i8* %76, i8** %78
br label %79
79: ; preds = %65, %57
%80 = load i8*, i8** %6
%81 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%82 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %81, i32 0, i32 2
store i8* %80, i8** %82
br label %83
83: ; preds = %79
%84 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%85 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %84, i32 0, i32 5
%86 = load %struct.TYPE_5__*, %struct.TYPE_5__** %85
%87 = icmp ne %struct.TYPE_5__* %86, null
br i1 %87, label %88, label %92
88: ; preds = %83
%89 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%90 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %89, i32 0, i32 5
%91 = load %struct.TYPE_5__*, %struct.TYPE_5__** %90
br label %96
92: ; preds = %83
%93 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%94 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %93, i32 0, i32 4
%95 = load %struct.TYPE_5__*, %struct.TYPE_5__** %94
br label %96
96: ; preds = %92, %88
%97 = phi %struct.TYPE_5__* [ %91, %88 ], [ %95, %92 ]
store %struct.TYPE_5__* %97, %struct.TYPE_5__** %5
br label %50
98: ; preds = %50
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
}