#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 */

/* Type definitions */

/* Variables and functions */
void logger_string_trimFileNameExtension(size_t *stringTrimmedLen, char *str,
                                         size_t strLen) {
  size_t offsetForLocalPathOnly = strLen;
  size_t index = strLen;
  while (index > 0U) {
    if (str[index] == '.') {
      if (index > 1) {
        offsetForLocalPathOnly = index;
        break;
      }
    }
    index--;
  }
  *stringTrimmedLen = offsetForLocalPathOnly;
}


x86 assembly (clang, -O0):
<logger_string_trimFileNameExtension>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jbe    116e <logger_string_trimFileNameExtension+0x6e>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    115d <logger_string_trimFileNameExtension+0x5d>
cmpq   $0x1,-0x28(%rbp)
jbe    1158 <logger_string_trimFileNameExtension+0x58>
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    116e <logger_string_trimFileNameExtension+0x6e>
jmp    115d <logger_string_trimFileNameExtension+0x5d>
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    1120 <logger_string_trimFileNameExtension+0x20>
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<logger_string_trimFileNameExtension>:
test   %rdx,%rdx
je     1126 <logger_string_trimFileNameExtension+0x26>
mov    %rdx,%rax
jmp    1116 <logger_string_trimFileNameExtension+0x16>
nopw   0x0(%rax,%rax,1)
add    $0xffffffffffffffff,%rax
je     112c <logger_string_trimFileNameExtension+0x2c>
cmpb   $0x2e,(%rsi,%rax,1)
jne    1110 <logger_string_trimFileNameExtension+0x10>
cmp    $0x1,%rax
je     1110 <logger_string_trimFileNameExtension+0x10>
mov    %rax,(%rdi)
ret
xor    %eax,%eax
mov    %rax,(%rdi)
ret
mov    %rdx,%rax
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
define void @logger_string_trimFileNameExtension(i64* %0, i8* %1, i64 %2) {
%4 = alloca i64*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64* %0, i64** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%9 = load i64, i64* %6
store i64 %9, i64* %7
%10 = load i64, i64* %6
store i64 %10, i64* %8
br label %11
11: ; preds = %27, %3
%12 = load i64, i64* %8
%13 = icmp ugt i64 %12, 0
br i1 %13, label %14, label %30
14: ; preds = %11
%15 = load i8*, i8** %5
%16 = load i64, i64* %8
%17 = getelementptr inbounds i8, i8* %15, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 46
br i1 %20, label %21, label %27
21: ; preds = %14
%22 = load i64, i64* %8
%23 = icmp ugt i64 %22, 1
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = load i64, i64* %8
store i64 %25, i64* %7
br label %30
26: ; preds = %21
br label %27
27: ; preds = %26, %14
%28 = load i64, i64* %8
%29 = add i64 %28, -1
store i64 %29, i64* %8
br label %11
30: ; preds = %24, %11
%31 = load i64, i64* %7
%32 = load i64*, i64** %4
store i64 %31, i64* %32
ret void
}

LLVM IR (-O2):
define void @logger_string_trimFileNameExtension(i64* nocapture writeonly %0, i8* nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %15, label %5
5: ; preds = %3, %12
%6 = phi i64 [ %13, %12 ], [ %2, %3 ]
%7 = getelementptr inbounds i8, i8* %1, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 46
%10 = icmp ne i64 %6, 1
%11 = select i1 %9, i1 %10, i1 false
br i1 %11, label %15, label %12
12: ; preds = %5
%13 = add i64 %6, -1
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %12, %5, %3
%16 = phi i64 [ 0, %3 ], [ %6, %5 ], [ %2, %12 ]
store i64 %16, i64* %0
ret void
}