#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*/ strcpy(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, long);
char *strrchr(char *, char);
void del_extension(char *pdbfile, char *parfile) {
  char *pchar;
  long i;
  pchar = strrchr(pdbfile, '.');
  if (pchar == NULL)
    strcpy(parfile, pdbfile);
  else {
    i = pchar - pdbfile;
    strncpy(parfile, pdbfile, i);
    parfile[i] = '\0';
  }
}


x86 assembly (clang, -O0):
<del_extension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2e,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    116f <del_extension+0x3f>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcpy@plt>
jmp    119b <del_extension+0x6b>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<del_extension>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x2e,%esi
call   1050 <strrchr@plt>
test   %rax,%rax
je     1169 <del_extension+0x39>
mov    %rax,%rbx
sub    %r15,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <strncpy@plt>
movb   $0x0,(%r14,%rbx,1)
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %r14,%rdi
mov    %r15,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <strcpy@plt>

LLVM IR (-O0):
define void @del_extension(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i8* @strrchr(i8* %7, i8 signext 46)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = load i8*, i8** %3
%14 = call i32 @strcpy(i8* %12, i8* %13)
br label %28
15: ; preds = %2
%16 = load i8*, i8** %5
%17 = load i8*, i8** %3
%18 = ptrtoint i8* %16 to i64
%19 = ptrtoint i8* %17 to i64
%20 = sub i64 %18, %19
store i64 %20, i64* %6
%21 = load i8*, i8** %4
%22 = load i8*, i8** %3
%23 = load i64, i64* %6
%24 = call i32 @strncpy(i8* %21, i8* %22, i64 %23)
%25 = load i8*, i8** %4
%26 = load i64, i64* %6
%27 = getelementptr inbounds i8, i8* %25, i64 %26
store i8 0, i8* %27
br label %28
28: ; preds = %15, %11
ret void
}

LLVM IR (-O2):
define void @del_extension(i8* %0, i8* %1) {
%3 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @strcpy(i8* %1, i8* %0)
br label %13
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
%11 = tail call i32 @strncpy(i8* %1, i8* %0, i64 %10)
%12 = getelementptr inbounds i8, i8* %1, i64 %10
store i8 0, i8* %12
br label %13
13: ; preds = %7, %5
ret void
}