#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 */
struct dirent {
  int /*<<< orphan*/ d_name;
};
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ copyFile(char *, char *);
char *getFullFileName(int /*<<< orphan*/, char *);
struct dirent *readdir(int /*<<< orphan*/ *);
char *strcat(char *, char *);
int /*<<< orphan*/ updateBackupTimes(char *, char *);
void processFile(DIR *sourceDir, char *file) {
  struct dirent *pDirent = readdir(sourceDir);
  char *sourceFile = getFullFileName(pDirent->d_name, file);
  char *destFile = strcat(sourceFile, ".bak");
  copyFile(sourceFile, destFile);
  updateBackupTimes(sourceFile, destFile);
}


x86 assembly (clang, -O0):
<processFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <readdir@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
call   1070 <getFullFileName@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1060 <strcat@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <copyFile@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <updateBackupTimes@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processFile>:
push   %rbx
mov    %rsi,%rbx
call   1040 <readdir@plt>
mov    (%rax),%edi
mov    %rbx,%rsi
call   1070 <getFullFileName@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <strlen@plt>
movl   $0x6b61622e,(%rbx,%rax,1)
movb   $0x0,0x4(%rbx,%rax,1)
mov    %rbx,%rdi
mov    %rbx,%rsi
call   1060 <copyFile@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1050 <updateBackupTimes@plt>

LLVM IR (-O0):
%struct.dirent = type { i32 }
@.str = [5 x i8] c".bak\00"
define void @processFile(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca %struct.dirent*
%6 = alloca i8*
%7 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%8 = load i32*, i32** %3
%9 = call %struct.dirent* @readdir(i32* %8)
store %struct.dirent* %9, %struct.dirent** %5
%10 = load %struct.dirent*, %struct.dirent** %5
%11 = getelementptr inbounds %struct.dirent, %struct.dirent* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = load i8*, i8** %4
%14 = call i8* @getFullFileName(i32 %12, i8* %13)
store i8* %14, i8** %6
%15 = load i8*, i8** %6
%16 = call i8* @strcat(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %16, i8** %7
%17 = load i8*, i8** %6
%18 = load i8*, i8** %7
%19 = call i32 @copyFile(i8* %17, i8* %18)
%20 = load i8*, i8** %6
%21 = load i8*, i8** %7
%22 = call i32 @updateBackupTimes(i8* %20, i8* %21)
ret void
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
@.str = [5 x i8] c".bak\00"
define void @processFile(i32* %0, i8* %1) {
%3 = tail call %struct.dirent* @readdir(i32* %0)
%4 = getelementptr inbounds %struct.dirent, %struct.dirent* %3, i64 0, i32 0
%5 = load i32, i32* %4
%6 = tail call i8* @getFullFileName(i32 %5, i8* %1)
%7 = tail call i64 @strlen(i8* dereferenceable(1) %6)
%8 = getelementptr i8, i8* %6, i64 %7
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %8, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 5, i1 false)
%9 = tail call i32 @copyFile(i8* %6, i8* %6)
%10 = tail call i32 @updateBackupTimes(i8* %6, i8* %6)
ret void
}