int str_path_isdot_t(void) {
  int i, res, rc = 0;
  char *buf;
  struct test {
    const char *str;
    int res;
  } T[] = {
      {"", 0},           {"   ", 0},       {"abc", 0},      {"/", 0},
      {".", 1},          {"./../a/b", 1},  {"//.///", 1},   {"/a/b/c/d/e", 0},
      {"/a/b///d/e", 0}, {"/a/../d/e", 1}, {"/a/./d/e", 1}, {"/a/\n/d/e", 0},
  };
  int TS = sizeof(T) / sizeof(T[0]);
  for (i = 0; i < TS; i++) {
    buf = strdup(T[i].str);
    res = str_path_isdot(buf);
    free(buf);
    if (res != T[i].res)
      rc += log_error("[%s/%02d] E[%d] R[%d]", __FUNCTION__, i, T[i].res, res);
  }
  return rc;
}


x86 assembly (clang, -O0):
<str_path_isdot_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0xc(%rbp)
lea    -0xe0(%rbp),%rdi
lea    0x2bf0(%rip),%rsi
mov    $0xc0,%edx
call   1060 <memcpy@plt>
movl   $0xc,-0xe4(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xe4(%rbp),%eax
jge    1237 <str_path_isdot_t+0xe7>
movslq -0x4(%rbp),%rcx
lea    -0xe0(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rdi
call   1070 <strdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1050 <str_path_isdot@plt>
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%eax
movslq -0x4(%rbp),%rdx
lea    -0xe0(%rbp),%rcx
shl    $0x4,%rdx
add    %rdx,%rcx
cmp    0x8(%rcx),%eax
je     1224 <str_path_isdot_t+0xd4>
mov    -0x4(%rbp),%edx
movslq -0x4(%rbp),%rcx
lea    -0xe0(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%ecx
mov    -0x8(%rbp),%r8d
lea    0xe3c(%rip),%rdi
lea    0xe4b(%rip),%rsi
mov    $0x0,%al
call   1040 <log_error@plt>
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1229 <str_path_isdot_t+0xd9>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    118b <str_path_isdot_t+0x3b>
mov    -0xc(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_path_isdot_t>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0x2c16(%rip),%r14
lea    0xf09(%rip),%r15
xor    %ebx,%ebx
xor    %r12d,%r12d
jmp    116e <str_path_isdot_t+0x2e>
add    $0x1,%rbx
add    $0x10,%r14
cmp    $0xc,%rbx
je     11b2 <str_path_isdot_t+0x72>
mov    -0x8(%r14),%rdi
call   1060 <strdup@plt>
mov    %rax,%rbp
mov    %rax,%rdi
xor    %eax,%eax
call   1050 <str_path_isdot@plt>
mov    %eax,%r13d
mov    %rbp,%rdi
call   1030 <free@plt>
mov    (%r14),%ecx
cmp    %ecx,%r13d
je     1160 <str_path_isdot_t+0x20>
lea    0xeae(%rip),%rdi
mov    %r15,%rsi
mov    %ebx,%edx
mov    %r13d,%r8d
xor    %eax,%eax
call   1040 <log_error@plt>
add    %eax,%r12d
jmp    1160 <str_path_isdot_t+0x20>
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.test = type { i8*, i32 }
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c" \00"
@.str.2 = [4 x i8] c"abc\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [2 x i8] c".\00"
@.str.5 = [9 x i8] c"./../a/b\00"
@.str.6 = [7 x i8] c"//.///\00"
@.str.7 = [11 x i8] c"/a/b/c/d/e\00"
@.str.8 = [11 x i8] c"/a/b///d/e\00"
@.str.9 = [10 x i8] c"/a/../d/e\00"
@.str.10 = [9 x i8] c"/a/./d/e\00"
@.str.11 = [9 x i8] c"/a/\0A/d/e\00"
@__const.str_path_isdot_t.T = [12 x %struct.test] [%struct.test { i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i32 0 }, %struct.test { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i32 0 }, %struct.test { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i32 0 }, %struct.test { i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0), i32 0 }, %struct.test { i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0), i32 1 }, %struct.test { i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i32 0, i32 0), i32 1 }, %struct.test { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0), i32 1 }, %struct.test { i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i32 0, i32 0), i32 0 }, %struct.test { i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i32 0, i32 0), i32 0 }, %struct.test { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i32 0, i32 0), i32 1 }, %struct.test { i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i32 0, i32 0), i32 1 }, %struct.test { i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i32 0, i32 0), i32 0 }]
@.str.12 = [22 x i8] c"[%s/%02d] E[%d] R[%d]\00"
@__FUNCTION__.str_path_isdot_t = [17 x i8] c"str_path_isdot_t\00"
define i32 @str_path_isdot_t() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [12 x %struct.test]
%6 = alloca i32
store i32 0, i32* %3
%7 = bitcast [12 x %struct.test]* %5 to i8*
store i32 12, i32* %6
store i32 0, i32* %1
br label %8
8: ; preds = %41, %0
%9 = load i32, i32* %1
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %44
12: ; preds = %8
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [12 x %struct.test], [12 x %struct.test]* %5, i64 0, i64 %14
%16 = getelementptr inbounds %struct.test, %struct.test* %15, i32 0, i32 0
%17 = load i8*, i8** %16
%18 = call i8* @strdup(i8* %17)
store i8* %18, i8** %4
%19 = load i8*, i8** %4
%20 = call i32 (i8*, ...) bitcast (i32 (...)* @str_path_isdot to i32 (i8*, ...)*)(i8* %19)
store i32 %20, i32* %2
%21 = load i8*, i8** %4
%22 = load i32, i32* %2
%23 = load i32, i32* %1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [12 x %struct.test], [12 x %struct.test]* %5, i64 0, i64 %24
%26 = getelementptr inbounds %struct.test, %struct.test* %25, i32 0, i32 1
%27 = load i32, i32* %26
%28 = icmp ne i32 %22, %27
br i1 %28, label %29, label %40
29: ; preds = %12
%30 = load i32, i32* %1
%31 = load i32, i32* %1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [12 x %struct.test], [12 x %struct.test]* %5, i64 0, i64 %32
%34 = getelementptr inbounds %struct.test, %struct.test* %33, i32 0, i32 1
%35 = load i32, i32* %34
%36 = load i32, i32* %2
%37 = call i32 (i8*, i8*, i32, i32, i32, ...) bitcast (i32 (...)* @log_error to i32 (i8*, i8*, i32, i32, i32, ...)*)(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.str_path_isdot_t, i64 0, i64 0), i32 %30, i32 %35, i32 %36)
%38 = load i32, i32* %3
%39 = add nsw i32 %38, %37
store i32 %39, i32* %3
br label %40
40: ; preds = %29, %12
br label %41
41: ; preds = %40
%42 = load i32, i32* %1
%43 = add nsw i32 %42, 1
store i32 %43, i32* %1
br label %8
44: ; preds = %8
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
%struct.test = type { i8*, i32 }
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c" \00"
@.str.2 = [4 x i8] c"abc\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [2 x i8] c".\00"
@.str.5 = [9 x i8] c"./../a/b\00"
@.str.6 = [7 x i8] c"//.///\00"
@.str.7 = [11 x i8] c"/a/b/c/d/e\00"
@.str.8 = [11 x i8] c"/a/b///d/e\00"
@.str.9 = [10 x i8] c"/a/../d/e\00"
@.str.10 = [9 x i8] c"/a/./d/e\00"
@.str.11 = [9 x i8] c"/a/\0A/d/e\00"
@__const.str_path_isdot_t.T = [12 x %struct.test] [%struct.test { i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i32 0 }, %struct.test { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i32 0 }, %struct.test { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i32 0 }, %struct.test { i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0), i32 0 }, %struct.test { i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0), i32 1 }, %struct.test { i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i32 0, i32 0), i32 1 }, %struct.test { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0), i32 1 }, %struct.test { i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i32 0, i32 0), i32 0 }, %struct.test { i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i32 0, i32 0), i32 0 }, %struct.test { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i32 0, i32 0), i32 1 }, %struct.test { i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i32 0, i32 0), i32 1 }, %struct.test { i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i32 0, i32 0), i32 0 }]
@.str.12 = [22 x i8] c"[%s/%02d] E[%d] R[%d]\00"
@__FUNCTION__.str_path_isdot_t = [17 x i8] c"str_path_isdot_t\00"
define i32 @str_path_isdot_t() {
br label %1
1: ; preds = %0, %15
%2 = phi i64 [ 0, %0 ], [ %17, %15 ]
%3 = phi i32 [ 0, %0 ], [ %16, %15 ]
%4 = getelementptr inbounds [12 x %struct.test], [12 x %struct.test]* @__const.str_path_isdot_t.T, i64 0, i64 %2, i32 0
%5 = load i8*, i8** %4
%6 = tail call i8* @strdup(i8* %5)
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @str_path_isdot to i32 (i8*, ...)*)(i8* %6)
tail call void @free(i8* %6)
%8 = getelementptr inbounds [12 x %struct.test], [12 x %struct.test]* @__const.str_path_isdot_t.T, i64 0, i64 %2, i32 1
%9 = load i32, i32* %8
%10 = icmp eq i32 %7, %9
br i1 %10, label %15, label %11
11: ; preds = %1
%12 = trunc i64 %2 to i32
%13 = tail call i32 (i8*, i8*, i32, i32, i32, ...) bitcast (i32 (...)* @log_error to i32 (i8*, i8*, i32, i32, i32, ...)*)(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.str_path_isdot_t, i64 0, i64 0), i32 %12, i32 %9, i32 %7)
%14 = add nsw i32 %13, %3
br label %15
15: ; preds = %1, %11
%16 = phi i32 [ %14, %11 ], [ %3, %1 ]
%17 = add nuw nsw i64 %2, 1
%18 = icmp eq i64 %17, 12
br i1 %18, label %19, label %1
19: ; preds = %15
ret i32 %16
}