unsigned char *SearchExtPosition(ptr)
unsigned char *ptr;
{
  unsigned char *ext = 0;
  for (; *ptr; ptr++) {
    {
      if (*ptr == '/' || *ptr == '\\' || *ptr == ':') {
        ext = 0;
      } else if (*ptr == '.')
        ext = ptr;
    }
  }
  return ext;
}


x86 assembly (clang, -O0):
<SearchExtPosition>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     118d <SearchExtPosition+0x8d>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x2f,%eax
je     114d <SearchExtPosition+0x4d>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x5c,%eax
je     114d <SearchExtPosition+0x4d>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x3a,%eax
jne    115a <SearchExtPosition+0x5a>
movq   $0x0,-0x10(%rbp)
jmp    1177 <SearchExtPosition+0x77>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x2e,%eax
jne    1172 <SearchExtPosition+0x72>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1177 <SearchExtPosition+0x77>
jmp    117c <SearchExtPosition+0x7c>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <SearchExtPosition+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SearchExtPosition>:
xor    %eax,%eax
jmp    1117 <SearchExtPosition+0x17>
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rdi
mov    %rdx,%rax
movzbl (%rdi),%ecx
cmp    $0x39,%cl
jg     1140 <SearchExtPosition+0x40>
mov    %rdi,%rdx
cmp    $0x2e,%cl
je     1110 <SearchExtPosition+0x10>
mov    $0x0,%edx
cmp    $0x2f,%cl
je     1110 <SearchExtPosition+0x10>
test   %cl,%cl
jne    114f <SearchExtPosition+0x4f>
jmp    1154 <SearchExtPosition+0x54>
nopw   0x0(%rax,%rax,1)
cmp    $0x3a,%cl
je     1104 <SearchExtPosition+0x4>
mov    $0x0,%edx
cmp    $0x5c,%cl
je     1110 <SearchExtPosition+0x10>
mov    %rax,%rdx
jmp    1110 <SearchExtPosition+0x10>
ret

LLVM IR (-O0):
define i8* @SearchExtPosition(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* null, i8** %3
br label %4
4: ; preds = %33, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %36
8: ; preds = %4
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = icmp eq i32 %11, 47
br i1 %12, label %23, label %13
13: ; preds = %8
%14 = load i8*, i8** %2
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = icmp eq i32 %16, 92
br i1 %17, label %23, label %18
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = icmp eq i32 %21, 58
br i1 %22, label %23, label %24
23: ; preds = %18, %13, %8
store i8* null, i8** %3
br label %32
24: ; preds = %18
%25 = load i8*, i8** %2
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = icmp eq i32 %27, 46
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = load i8*, i8** %2
store i8* %30, i8** %3
br label %31
31: ; preds = %29, %24
br label %32
32: ; preds = %31, %23
br label %33
33: ; preds = %32
%34 = load i8*, i8** %2
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %2
br label %4
36: ; preds = %4
%37 = load i8*, i8** %3
ret i8* %37
}

LLVM IR (-O2):
define i8* @SearchExtPosition(i8* %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %10, %8 ]
%4 = phi i8* [ null, %1 ], [ %9, %8 ]
%5 = load i8, i8* %3
switch i8 %5, label %7 [
i8 0, label %11
i8 47, label %8
i8 92, label %8
i8 58, label %8
i8 46, label %6
]
6: ; preds = %2
br label %8
7: ; preds = %2
br label %8
8: ; preds = %2, %2, %2, %7, %6
%9 = phi i8* [ %3, %6 ], [ null, %2 ], [ null, %2 ], [ null, %2 ], [ %4, %7 ]
%10 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
11: ; preds = %2
ret i8* %4
}