#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 */
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
void get_maniest_file_name(char *file_name, int buffer_length) {
  int pos;
  pos = strlen(file_name) - 1;
  for (; pos >= 0; pos--) {
    if ('.' == file_name[pos]) {
      file_name[pos] = '\0';
      break;
    }
  }
  strcat(file_name, ".VisualElementsManifest.xml");
}


x86 assembly (clang, -O0):
<get_maniest_file_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     1185 <get_maniest_file_name+0x65>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x2e,%eax
cmp    %ecx,%eax
jne    1172 <get_maniest_file_name+0x52>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1185 <get_maniest_file_name+0x65>
jmp    1177 <get_maniest_file_name+0x57>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    113e <get_maniest_file_name+0x1e>
mov    -0x8(%rbp),%rdi
lea    0xe70(%rip),%rsi
call   1040 <strcat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_maniest_file_name>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%eax
nopl   0x0(%rax,%rax,1)
test   %eax,%eax
jle    1148 <get_maniest_file_name+0x28>
lea    -0x1(%rax),%rcx
cmpb   $0x2e,-0x1(%rbx,%rax,1)
mov    %rcx,%rax
jne    1130 <get_maniest_file_name+0x10>
mov    %ecx,%eax
movb   $0x0,(%rbx,%rax,1)
lea    0xeb1(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <strcat@plt>

LLVM IR (-O0):
@.str = [28 x i8] c".VisualElementsManifest.xml\00"
define void @get_maniest_file_name(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
%8 = sub nsw i32 %7, 1
store i32 %8, i32* %5
br label %9
9: ; preds = %26, %2
%10 = load i32, i32* %5
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %29
12: ; preds = %9
%13 = load i8*, i8** %3
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 46, %18
br i1 %19, label %20, label %25
20: ; preds = %12
%21 = load i8*, i8** %3
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
store i8 0, i8* %24
br label %29
25: ; preds = %12
br label %26
26: ; preds = %25
%27 = load i32, i32* %5
%28 = add nsw i32 %27, -1
store i32 %28, i32* %5
br label %9
29: ; preds = %20, %9
%30 = load i8*, i8** %3
%31 = call i32 @strcat(i8* %30, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c".VisualElementsManifest.xml\00"
define void @get_maniest_file_name(i8* %0, i32 %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = zext i32 %3 to i64
br label %5
5: ; preds = %10, %2
%6 = phi i64 [ %7, %10 ], [ %4, %2 ]
%7 = add nsw i64 %6, -1
%8 = trunc i64 %6 to i32
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %0, i64 %7
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 46
br i1 %13, label %14, label %5
14: ; preds = %10
%15 = and i64 %7, 4294967295
%16 = getelementptr inbounds i8, i8* %0, i64 %15
store i8 0, i8* %16
br label %17
17: ; preds = %5, %14
%18 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret void
}