// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]tundra/src/PathUtil.cpp
// Function: t2::PathGetSegments(char const*, t2::PathSeg*)
static int
PathGetSegments(const char* scratch, PathSeg segments[kMaxPathSegments])
{
  const char *start    = scratch;
  int         segcount = 0;
  const char *last     = scratch;

	for (;;)
	{
		char ch = *scratch;

		if ('\\' == ch || '/' == ch || '\0' == ch)
		{
			int len = (int) (scratch - last);

      if (len > 0)
      {
        int is_dotdot = 2 == len && 0 == memcmp("..", last, 2);
        int is_dot = 1 == len && '.' == last[0];

        if (segcount == kMaxPathSegments)
          Croak("too many segments in path; limit is %d", kMaxPathSegments);

        segments[segcount].offset = (uint16_t) (last - start);
        segments[segcount].len    = (uint16_t) len;
        segments[segcount].dotdot = (uint8_t) is_dotdot;
        segments[segcount].drop   = (uint8_t) is_dot;

        ++segcount;
      }
      last = scratch + 1;

			if ('\0' == ch)
				break;
		}

		++scratch;
	}

	return segcount;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movb (%rax), %al
movb %al, -0x29(%rbp)
movsbl -0x29(%rbp), %ecx
movl $0x5c, %eax
cmpl %ecx, %eax
je 0x19228
movsbl -0x29(%rbp), %ecx
movl $0x2f, %eax
cmpl %ecx, %eax
je 0x19228
movsbl -0x29(%rbp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x1934c
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jle 0x19332
xorl %eax, %eax
movl $0x2, %ecx
cmpl -0x30(%rbp), %ecx
movb %al, -0x39(%rbp)
jne 0x19270
movq -0x28(%rbp), %rsi
leaq 0xbf59(%rip), %rdi      # 0x251b3
movl $0x2, %edx
callq 0x3160
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
sete %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x34(%rbp)
xorl %eax, %eax
movl $0x1, %ecx
cmpl -0x30(%rbp), %ecx
movb %al, -0x3a(%rbp)
jne 0x1929e
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
movl $0x2e, %eax
cmpl %ecx, %eax
sete %al
movb %al, -0x3a(%rbp)
movb -0x3a(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x38(%rbp)
cmpl $0x40, -0x1c(%rbp)
jne 0x192c2
leaq 0xbf00(%rip), %rdi      # 0x251b6
movl $0x40, %esi
movb $0x0, %al
callq 0x75a0
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movw %ax, %cx
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rdx
imulq $0x6, %rdx, %rdx
addq %rdx, %rax
movw %cx, (%rax)
movl -0x30(%rbp), %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rdx
imulq $0x6, %rdx, %rdx
addq %rdx, %rax
movw %cx, 0x2(%rax)
movl -0x34(%rbp), %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rdx
imulq $0x6, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x4(%rax)
movl -0x38(%rbp), %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rdx
imulq $0x6, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x5(%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movsbl -0x29(%rbp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x1934a
jmp 0x1935d
jmp 0x1934c
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x191f7
movl -0x1c(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)