#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 */
typedef int /*<<< orphan*/ name2;
typedef int /*<<< orphan*/ name;

/* Variables and functions */
int /*<<< orphan*/ Com_DPrintf(char *, char *, char *);
int /*<<< orphan*/ Com_sprintf(char *, int, char *, int /*<<< orphan*/, char *,
                               ...);
int /*<<< orphan*/ CopyFile(char *, char *);
int /*<<< orphan*/ FS_CreatePath(char *);
int /*<<< orphan*/ FS_Gamedir();
int /*<<< orphan*/ Q_strncpyz(char *, char *, int);
int /*<<< orphan*/ SV_WipeSavegame(char *);
int /*<<< orphan*/ Sys_FindClose();
char *Sys_FindFirst(char *, int /*<<< orphan*/, int /*<<< orphan*/);
char *Sys_FindNext(int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
void SV_CopySaveGame(char *src, char *dst) {
  char name[256], name2[256];
  int l, len;
  char *found;
  Com_DPrintf("SV_CopySaveGame(%s, %s)\n", src, dst);
  SV_WipeSavegame(dst);
  Com_sprintf(name, sizeof(name), "%s/save/%s/server.ssv", FS_Gamedir(), src);
  Com_sprintf(name2, sizeof(name2), "%s/save/%s/server.ssv", FS_Gamedir(), dst);
  FS_CreatePath(name2);
  CopyFile(name, name2);
  Com_sprintf(name, sizeof(name), "%s/save/%s/game.ssv", FS_Gamedir(), src);
  Com_sprintf(name2, sizeof(name2), "%s/save/%s/game.ssv", FS_Gamedir(), dst);
  CopyFile(name, name2);
  if (strcmp(dst, "kmq2save0")) {
    Com_sprintf(name, sizeof(name), "%s/save/%s/shot.jpg", FS_Gamedir(), src);
    Com_sprintf(name2, sizeof(name2), "%s/save/%s/shot.jpg", FS_Gamedir(), dst);
    CopyFile(name, name2);
  }
  Com_sprintf(name, sizeof(name), "%s/save/%s/", FS_Gamedir(), src);
  len = strlen(name);
  Com_sprintf(name, sizeof(name), "%s/save/%s/*.sav", FS_Gamedir(), src);
  found = Sys_FindFirst(name, 0, 0);
  while (found) {
    Q_strncpyz(name + len, found + len, sizeof(name) - len);
    Com_sprintf(name2, sizeof(name2), "%s/save/%s/%s", FS_Gamedir(), dst,
                found + len);
    CopyFile(name, name2);
    l = strlen(name);
    Q_strncpyz(name + l - 3, "sv2", sizeof(name) - l + 3);
    l = strlen(name2);
    Q_strncpyz(name2 + l - 3, "sv2", sizeof(name2) - l + 3);
    CopyFile(name, name2);
    found = Sys_FindNext(0, 0);
  }
  Sys_FindClose();
}


x86 assembly (clang, -O0):
<SV_CopySaveGame>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe1e(%rip),%rdi
call   10c0 <Com_DPrintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <SV_WipeSavegame@plt>
lea    -0x110(%rbp),%rax
mov    %rax,-0x240(%rbp)
mov    $0x0,%al
call   1080 <FS_Gamedir@plt>
mov    -0x240(%rbp),%rdi
mov    %eax,%ecx
mov    -0x8(%rbp),%r8
mov    $0x100,%esi
lea    0xdfb(%rip),%rdx
mov    $0x0,%al
call   10b0 <Com_sprintf@plt>
lea    -0x210(%rbp),%rax
mov    %rax,-0x238(%rbp)
mov    $0x0,%al
call   1080 <FS_Gamedir@plt>
mov    -0x238(%rbp),%rdi
mov    %eax,%ecx
mov    -0x10(%rbp),%r8
mov    $0x100,%esi
lea    0xdc6(%rip),%rdx
mov    $0x0,%al
call   10b0 <Com_sprintf@plt>
lea    -0x210(%rbp),%rdi
call   1090 <FS_CreatePath@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   10d0 <CopyFile@plt>
lea    -0x110(%rbp),%rax
mov    %rax,-0x230(%rbp)
mov    $0x0,%al
call   1080 <FS_Gamedir@plt>
mov    -0x230(%rbp),%rdi
mov    %eax,%ecx
mov    -0x8(%rbp),%r8
mov    $0x100,%esi
lea    0xd88(%rip),%rdx
mov    $0x0,%al
call   10b0 <Com_sprintf@plt>
lea    -0x210(%rbp),%rax
mov    %rax,-0x228(%rbp)
mov    $0x0,%al
call   1080 <FS_Gamedir@plt>
mov    -0x228(%rbp),%rdi
mov    %eax,%ecx
mov    -0x10(%rbp),%r8
mov    $0x100,%esi
lea    0xd53(%rip),%rdx
mov    $0x0,%al
call   10b0 <Com_sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   10d0 <CopyFile@plt>
mov    -0x10(%rbp),%rdi
lea    0xd42(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     138d <SV_CopySaveGame+0x1cd>
lea    -0x110(%rbp),%rax
mov    %rax,-0x250(%rbp)
mov    $0x0,%al
call   1080 <FS_Gamedir@plt>
mov    -0x250(%rbp),%rdi
mov    %eax,%ecx
mov    -0x8(%rbp),%r8
mov    $0x100,%esi
lea    0xd0f(%rip),%rdx
mov    $0x0,%al
call   10b0 <Com_sprintf@plt>
lea    -0x210(%rbp),%rax
mov    %rax,-0x248(%rbp)
mov    $0x0,%al
call   1080 <FS_Gamedir@plt>
mov    -0x248(%rbp),%rdi
mov    %eax,%ecx
mov    -0x10(%rbp),%r8
mov    $0x100,%esi
lea    0xcda(%rip),%rdx
mov    $0x0,%al
call   10b0 <Com_sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   10d0 <CopyFile@plt>
lea    -0x110(%rbp),%rax
mov    %rax,-0x260(%rbp)
mov    $0x0,%al
call   1080 <FS_Gamedir@plt>
mov    -0x260(%rbp),%rdi
mov    %eax,%ecx
mov    -0x8(%rbp),%r8
mov    $0x100,%esi
lea    0xca6(%rip),%rdx
mov    $0x0,%al
call   10b0 <Com_sprintf@plt>
lea    -0x110(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x218(%rbp)
lea    -0x110(%rbp),%rax
mov    %rax,-0x258(%rbp)
mov    $0x0,%al
call   1080 <FS_Gamedir@plt>
mov    -0x258(%rbp),%rdi
mov    %eax,%ecx
mov    -0x8(%rbp),%r8
mov    $0x100,%esi
lea    0xc6b(%rip),%rdx
mov    $0x0,%al
call   10b0 <Com_sprintf@plt>
lea    -0x110(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1050 <Sys_FindFirst@plt>
mov    %rax,-0x220(%rbp)
cmpq   $0x0,-0x220(%rbp)
je     1577 <SV_CopySaveGame+0x3b7>
lea    -0x110(%rbp),%rdi
movslq -0x218(%rbp),%rax
add    %rax,%rdi
mov    -0x220(%rbp),%rsi
movslq -0x218(%rbp),%rax
add    %rax,%rsi
movslq -0x218(%rbp),%rcx
mov    $0x100,%eax
sub    %rcx,%rax
mov    %eax,%edx
call   10e0 <Q_strncpyz@plt>
lea    -0x210(%rbp),%rax
mov    %rax,-0x268(%rbp)
mov    $0x0,%al
call   1080 <FS_Gamedir@plt>
mov    -0x268(%rbp),%rdi
mov    %eax,%ecx
mov    -0x10(%rbp),%r8
mov    -0x220(%rbp),%r9
movslq -0x218(%rbp),%rax
add    %rax,%r9
mov    $0x100,%esi
lea    0xbd9(%rip),%rdx
mov    $0x0,%al
call   10b0 <Com_sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   10d0 <CopyFile@plt>
lea    -0x110(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x214(%rbp)
lea    -0x110(%rbp),%rdi
movslq -0x214(%rbp),%rax
add    %rax,%rdi
add    $0xfffffffffffffffd,%rdi
movslq -0x214(%rbp),%rcx
mov    $0x100,%eax
sub    %rcx,%rax
add    $0x3,%rax
mov    %eax,%edx
lea    0xb8a(%rip),%rsi
call   10e0 <Q_strncpyz@plt>
lea    -0x210(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x214(%rbp)
lea    -0x210(%rbp),%rdi
movslq -0x214(%rbp),%rax
add    %rax,%rdi
add    $0xfffffffffffffffd,%rdi
movslq -0x214(%rbp),%rcx
mov    $0x100,%eax
sub    %rcx,%rax
add    $0x3,%rax
mov    %eax,%edx
lea    0xb42(%rip),%rsi
call   10e0 <Q_strncpyz@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   10d0 <CopyFile@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1030 <Sys_FindNext@plt>
mov    %rax,-0x220(%rbp)
jmp    1420 <SV_CopySaveGame+0x260>
mov    $0x0,%al
call   1060 <Sys_FindClose@plt>
add    $0x270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SV_CopySaveGame>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    %rsi,%r12
mov    %rdi,%r14
lea    0xe22(%rip),%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   10c0 <Com_DPrintf@plt>
mov    %r12,%rdi
call   1040 <SV_WipeSavegame@plt>
xor    %eax,%eax
call   1080 <FS_Gamedir@plt>
lea    0xe1a(%rip),%rbx
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
mov    %r14,%r8
xor    %eax,%eax
call   10b0 <Com_sprintf@plt>
xor    %eax,%eax
call   1080 <FS_Gamedir@plt>
lea    0x110(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
mov    %r12,%r8
xor    %eax,%eax
call   10b0 <Com_sprintf@plt>
mov    %rbp,%rdi
call   1090 <FS_CreatePath@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   10d0 <CopyFile@plt>
xor    %eax,%eax
call   1080 <FS_Gamedir@plt>
lea    0xdcd(%rip),%rbx
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
mov    %r14,%r8
xor    %eax,%eax
call   10b0 <Com_sprintf@plt>
xor    %eax,%eax
call   1080 <FS_Gamedir@plt>
mov    %rbp,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
mov    %r12,%r8
xor    %eax,%eax
call   10b0 <Com_sprintf@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   10d0 <CopyFile@plt>
lea    0xd9a(%rip),%rsi
mov    %r12,%rdi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1311 <SV_CopySaveGame+0x151>
xor    %eax,%eax
call   1080 <FS_Gamedir@plt>
lea    0xd89(%rip),%rbx
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
mov    %r14,%r8
xor    %eax,%eax
call   10b0 <Com_sprintf@plt>
xor    %eax,%eax
call   1080 <FS_Gamedir@plt>
lea    0x110(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
mov    %r12,%r8
xor    %eax,%eax
call   10b0 <Com_sprintf@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   10d0 <CopyFile@plt>
xor    %eax,%eax
call   1080 <FS_Gamedir@plt>
lea    0xd42(%rip),%rdx
lea    0x10(%rsp),%rbx
movl   $0x100,0x4(%rsp)
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %eax,%ecx
mov    %r14,%r8
xor    %eax,%eax
call   10b0 <Com_sprintf@plt>
mov    %rbx,%rdi
call   1070 <strlen@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1080 <FS_Gamedir@plt>
lea    0xd15(%rip),%rdx
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %eax,%ecx
mov    %r14,%r8
xor    %eax,%eax
call   10b0 <Com_sprintf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <Sys_FindFirst@plt>
test   %rax,%rax
mov    %r12,0x8(%rsp)
je     1459 <SV_CopySaveGame+0x299>
mov    %rax,%r14
movslq %ebp,%r12
lea    (%rsp,%r12,1),%r13
add    $0x10,%r13
sub    %r12d,0x4(%rsp)
lea    0x110(%rsp),%rbp
lea    0x10(%rsp),%rbx
lea    0xcdf(%rip),%r15
nopl   (%rax)
add    %r12,%r14
mov    %r13,%rdi
mov    %r14,%rsi
mov    0x4(%rsp),%edx
call   10e0 <Q_strncpyz@plt>
xor    %eax,%eax
call   1080 <FS_Gamedir@plt>
mov    %rbp,%rdi
mov    $0x100,%esi
lea    0xca6(%rip),%rdx
mov    %eax,%ecx
mov    0x8(%rsp),%r8
mov    %r14,%r9
xor    %eax,%eax
call   10b0 <Com_sprintf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10d0 <CopyFile@plt>
mov    %rbx,%rdi
call   1070 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rdi
add    $0xd,%rdi
mov    $0x103,%edx
sub    %eax,%edx
mov    %r15,%rsi
call   10e0 <Q_strncpyz@plt>
mov    %rbp,%rdi
call   1070 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rdi
add    $0x10d,%rdi
mov    $0x103,%edx
sub    %eax,%edx
mov    %r15,%rsi
call   10e0 <Q_strncpyz@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10d0 <CopyFile@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1030 <Sys_FindNext@plt>
mov    %rax,%r14
test   %rax,%rax
jne    13b0 <SV_CopySaveGame+0x1f0>
xor    %eax,%eax
call   1060 <Sys_FindClose@plt>
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"SV_CopySaveGame(%s, %s)\0A\00"
@.str.1 = [22 x i8] c"%s/save/%s/server.ssv\00"
@.str.2 = [20 x i8] c"%s/save/%s/game.ssv\00"
@.str.3 = [10 x i8] c"kmq2save0\00"
@.str.4 = [20 x i8] c"%s/save/%s/shot.jpg\00"
@.str.5 = [12 x i8] c"%s/save/%s/\00"
@.str.6 = [17 x i8] c"%s/save/%s/*.sav\00"
@.str.7 = [14 x i8] c"%s/save/%s/%s\00"
@.str.8 = [4 x i8] c"sv2\00"
define void @SV_CopySaveGame(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%10 = load i8*, i8** %3
%11 = load i8*, i8** %4
%12 = call i32 @Com_DPrintf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11)
%13 = load i8*, i8** %4
%14 = call i32 @SV_WipeSavegame(i8* %13)
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%16 = call i32 (...) @FS_Gamedir()
%17 = load i8*, i8** %3
%18 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %15, i32 256, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %16, i8* %17)
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%20 = call i32 (...) @FS_Gamedir()
%21 = load i8*, i8** %4
%22 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %19, i32 256, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %20, i8* %21)
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%24 = call i32 @FS_CreatePath(i8* %23)
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%26 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%27 = call i32 @CopyFile(i8* %25, i8* %26)
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%29 = call i32 (...) @FS_Gamedir()
%30 = load i8*, i8** %3
%31 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %28, i32 256, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %29, i8* %30)
%32 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%33 = call i32 (...) @FS_Gamedir()
%34 = load i8*, i8** %4
%35 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %32, i32 256, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %33, i8* %34)
%36 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%37 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%38 = call i32 @CopyFile(i8* %36, i8* %37)
%39 = load i8*, i8** %4
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %54
42: ; preds = %2
%43 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%44 = call i32 (...) @FS_Gamedir()
%45 = load i8*, i8** %3
%46 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %43, i32 256, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %44, i8* %45)
%47 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%48 = call i32 (...) @FS_Gamedir()
%49 = load i8*, i8** %4
%50 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %47, i32 256, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %48, i8* %49)
%51 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%52 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%53 = call i32 @CopyFile(i8* %51, i8* %52)
br label %54
54: ; preds = %42, %2
%55 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%56 = call i32 (...) @FS_Gamedir()
%57 = load i8*, i8** %3
%58 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %55, i32 256, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %56, i8* %57)
%59 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%60 = call i32 @strlen(i8* %59)
store i32 %60, i32* %8
%61 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%62 = call i32 (...) @FS_Gamedir()
%63 = load i8*, i8** %3
%64 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %61, i32 256, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i32 %62, i8* %63)
%65 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%66 = call i8* @Sys_FindFirst(i8* %65, i32 0, i32 0)
store i8* %66, i8** %9
br label %67
67: ; preds = %70, %54
%68 = load i8*, i8** %9
%69 = icmp ne i8* %68, null
br i1 %69, label %70, label %125
70: ; preds = %67
%71 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%72 = load i32, i32* %8
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8, i8* %71, i64 %73
%75 = load i8*, i8** %9
%76 = load i32, i32* %8
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8, i8* %75, i64 %77
%79 = load i32, i32* %8
%80 = sext i32 %79 to i64
%81 = sub i64 256, %80
%82 = trunc i64 %81 to i32
%83 = call i32 @Q_strncpyz(i8* %74, i8* %78, i32 %82)
%84 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%85 = call i32 (...) @FS_Gamedir()
%86 = load i8*, i8** %4
%87 = load i8*, i8** %9
%88 = load i32, i32* %8
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i8, i8* %87, i64 %89
%91 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %84, i32 256, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %85, i8* %86, i8* %90)
%92 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%93 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%94 = call i32 @CopyFile(i8* %92, i8* %93)
%95 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%96 = call i32 @strlen(i8* %95)
store i32 %96, i32* %7
%97 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%98 = load i32, i32* %7
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i8, i8* %97, i64 %99
%101 = getelementptr inbounds i8, i8* %100, i64 -3
%102 = load i32, i32* %7
%103 = sext i32 %102 to i64
%104 = sub i64 256, %103
%105 = add i64 %104, 3
%106 = trunc i64 %105 to i32
%107 = call i32 @Q_strncpyz(i8* %101, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %106)
%108 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%109 = call i32 @strlen(i8* %108)
store i32 %109, i32* %7
%110 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%111 = load i32, i32* %7
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i8, i8* %110, i64 %112
%114 = getelementptr inbounds i8, i8* %113, i64 -3
%115 = load i32, i32* %7
%116 = sext i32 %115 to i64
%117 = sub i64 256, %116
%118 = add i64 %117, 3
%119 = trunc i64 %118 to i32
%120 = call i32 @Q_strncpyz(i8* %114, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %119)
%121 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%122 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%123 = call i32 @CopyFile(i8* %121, i8* %122)
%124 = call i8* @Sys_FindNext(i32 0, i32 0)
store i8* %124, i8** %9
br label %67
125: ; preds = %67
%126 = call i32 (...) @Sys_FindClose()
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"SV_CopySaveGame(%s, %s)\0A\00"
@.str.1 = [22 x i8] c"%s/save/%s/server.ssv\00"
@.str.2 = [20 x i8] c"%s/save/%s/game.ssv\00"
@.str.3 = [10 x i8] c"kmq2save0\00"
@.str.4 = [20 x i8] c"%s/save/%s/shot.jpg\00"
@.str.5 = [12 x i8] c"%s/save/%s/\00"
@.str.6 = [17 x i8] c"%s/save/%s/*.sav\00"
@.str.7 = [14 x i8] c"%s/save/%s/%s\00"
@.str.8 = [4 x i8] c"sv2\00"
define void @SV_CopySaveGame(i8* %0, i8* %1) {
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%7 = tail call i32 @Com_DPrintf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%8 = tail call i32 @SV_WipeSavegame(i8* %1)
%9 = tail call i32 (...) @FS_Gamedir()
%10 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %5, i32 256, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %9, i8* %0)
%11 = call i32 (...) @FS_Gamedir()
%12 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %6, i32 256, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %11, i8* %1)
%13 = call i32 @FS_CreatePath(i8* %6)
%14 = call i32 @CopyFile(i8* %5, i8* %6)
%15 = call i32 (...) @FS_Gamedir()
%16 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %5, i32 256, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %15, i8* %0)
%17 = call i32 (...) @FS_Gamedir()
%18 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %6, i32 256, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %17, i8* %1)
%19 = call i32 @CopyFile(i8* %5, i8* %6)
%20 = call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %28, label %22
22: ; preds = %2
%23 = call i32 (...) @FS_Gamedir()
%24 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %5, i32 256, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %23, i8* %0)
%25 = call i32 (...) @FS_Gamedir()
%26 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %6, i32 256, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %25, i8* %1)
%27 = call i32 @CopyFile(i8* %5, i8* %6)
br label %28
28: ; preds = %22, %2
%29 = call i32 (...) @FS_Gamedir()
%30 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %5, i32 256, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %29, i8* %0)
%31 = call i32 @strlen(i8* %5)
%32 = call i32 (...) @FS_Gamedir()
%33 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %5, i32 256, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i32 %32, i8* %0)
%34 = call i8* @Sys_FindFirst(i8* %5, i32 0, i32 0)
%35 = icmp eq i8* %34, null
br i1 %35, label %62, label %36
36: ; preds = %28
%37 = sext i32 %31 to i64
%38 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %37
%39 = sub i32 256, %31
br label %40
40: ; preds = %36, %40
%41 = phi i8* [ %34, %36 ], [ %60, %40 ]
%42 = getelementptr inbounds i8, i8* %41, i64 %37
%43 = call i32 @Q_strncpyz(i8* %38, i8* %42, i32 %39)
%44 = call i32 (...) @FS_Gamedir()
%45 = call i32 (i8*, i32, i8*, i32, i8*, ...) @Com_sprintf(i8* %6, i32 256, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %44, i8* %1, i8* %42)
%46 = call i32 @CopyFile(i8* %5, i8* %6)
%47 = call i32 @strlen(i8* %5)
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %48
%50 = getelementptr inbounds i8, i8* %49, i64 -3
%51 = sub i32 259, %47
%52 = call i32 @Q_strncpyz(i8* %50, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %51)
%53 = call i32 @strlen(i8* %6)
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %54
%56 = getelementptr inbounds i8, i8* %55, i64 -3
%57 = sub i32 259, %53
%58 = call i32 @Q_strncpyz(i8* %56, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %57)
%59 = call i32 @CopyFile(i8* %5, i8* %6)
%60 = call i8* @Sys_FindNext(i32 0, i32 0)
%61 = icmp eq i8* %60, null
br i1 %61, label %62, label %40
62: ; preds = %40, %28
%63 = call i32 (...) @Sys_FindClose()
ret void
}