#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 */
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 >= 0;) {
    {
      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
cmpq   $0x0,0x18(%rax)
jl     1211 <fts_padjust+0x111>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    0x8(%rcx),%rax
je     11cc <fts_padjust+0xcc>
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     11f8 <fts_padjust+0xf8>
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1204 <fts_padjust+0x104>
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>
cmpq   $0x0,0x18(%rsi)
jns    114a <fts_padjust+0x4a>
ret
nopw   0x0(%rax,%rax,1)
cmpq   $0x0,0x18(%rcx)
mov    %rcx,%rsi
js     1139 <fts_padjust+0x39>
mov    (%rsi),%rcx
cmp    0x8(%rsi),%rcx
je     115d <fts_padjust+0x5d>
sub    0x10(%rsi),%rcx
add    %rax,%rcx
mov    %rcx,(%rsi)
mov    %rax,0x10(%rsi)
mov    0x28(%rsi),%rcx
test   %rcx,%rcx
jne    1140 <fts_padjust+0x40>
mov    0x20(%rsi),%rcx
jmp    1140 <fts_padjust+0x40>

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