#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*/ sprintf(char *, char *, char const *, char const *);
int strlen(char const *);
int /*<<< orphan*/ unlink(char *);
void MapFileUnlink(const char *rootpath, const char *filename) {
  char fullname[260];
  if (strlen(rootpath) + strlen(filename) >= 260)
    return;
  sprintf(fullname, "%s%s", rootpath, filename);
  unlink(fullname);
}


x86 assembly (clang, -O0):
<MapFileUnlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x124(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x124(%rbp),%eax
add    %ecx,%eax
cmp    $0x104,%eax
jl     1175 <MapFileUnlink+0x45>
jmp    119c <MapFileUnlink+0x6c>
lea    -0x120(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe75(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x120(%rbp),%rdi
call   1030 <unlink@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MapFileUnlink>:
push   %rbp
push   %r14
push   %rbx
sub    $0x110,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1040 <strlen@plt>
add    %ebp,%eax
cmp    $0x103,%eax
jg     1179 <MapFileUnlink+0x49>
lea    0xea0(%rip),%rsi
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1050 <sprintf@plt>
mov    %rbp,%rdi
call   1030 <unlink@plt>
add    $0x110,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s%s\00"
define void @MapFileUnlink(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [260 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
%10 = add nsw i32 %7, %9
%11 = icmp sge i32 %10, 260
br i1 %11, label %12, label %13
12: ; preds = %2
br label %20
13: ; preds = %2
%14 = getelementptr inbounds [260 x i8], [260 x i8]* %5, i64 0, i64 0
%15 = load i8*, i8** %3
%16 = load i8*, i8** %4
%17 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %16)
%18 = getelementptr inbounds [260 x i8], [260 x i8]* %5, i64 0, i64 0
%19 = call i32 @unlink(i8* %18)
br label %20
20: ; preds = %13, %12
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%s\00"
define void @MapFileUnlink(i8* %0, i8* %1) {
%3 = alloca [260 x i8]
%4 = getelementptr inbounds [260 x i8], [260 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @strlen(i8* %0)
%6 = tail call i32 @strlen(i8* %1)
%7 = add nsw i32 %6, %5
%8 = icmp sgt i32 %7, 259
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%11 = call i32 @unlink(i8* %4)
br label %12
12: ; preds = %2, %9
ret void
}