#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*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ DeleteFile(char *, char **, int /*<<< orphan*/ *);
int /*<<< orphan*/ SendAll(int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *);
char *readString(char *, char **);
void DoDelete(int fd, char *data) {
  char *fileName = NULL;
  data = readString(data, &fileName);
  printf("DoDelete, filename: %s", fileName);
  char *buf = NULL;
  uint32_t sendLen = 0;
  DeleteFile(fileName, &buf, &sendLen);
  SendAll(fd, buf, sendLen);
  free(buf);
  free(fileName);
}


x86 assembly (clang, -O0):
<DoDelete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <readString@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x24(%rbp),%rdx
call   1060 <DeleteFile@plt>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1070 <SendAll@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoDelete>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rax
mov    %edi,%ebx
movq   $0x0,0x10(%rsp)
lea    0x10(%rsp),%rsi
mov    %rax,%rdi
call   1050 <readString@plt>
mov    0x10(%rsp),%rsi
lea    0xe84(%rip),%rdi
call   1040 <printf@plt>
movq   $0x0,0x18(%rsp)
movl   $0x0,0xc(%rsp)
mov    0x10(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1060 <DeleteFile@plt>
mov    0x18(%rsp),%rsi
mov    0xc(%rsp),%edx
mov    %ebx,%edi
call   1070 <SendAll@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"DoDelete, filename: %s\00"
define void @DoDelete(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
store i8* null, i8** %5
%8 = load i8*, i8** %4
%9 = call i8* @readString(i8* %8, i8** %5)
store i8* %9, i8** %4
%10 = load i8*, i8** %5
%11 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %10)
store i8* null, i8** %6
store i32 0, i32* %7
%12 = load i8*, i8** %5
%13 = call i32 @DeleteFile(i8* %12, i8** %6, i32* %7)
%14 = load i32, i32* %3
%15 = load i8*, i8** %6
%16 = load i32, i32* %7
%17 = call i32 @SendAll(i32 %14, i8* %15, i32 %16)
%18 = load i8*, i8** %6
%19 = call i32 @free(i8* %18)
%20 = load i8*, i8** %5
%21 = call i32 @free(i8* %20)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"DoDelete, filename: %s\00"
define void @DoDelete(i32 %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%7 = call i8* @readString(i8* %1, i8** %3)
%8 = load i8*, i8** %3
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%11 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%12 = load i8*, i8** %3
%13 = call i32 @DeleteFile(i8* %12, i8** %4, i32* %5)
%14 = load i8*, i8** %4
%15 = load i32, i32* %5
%16 = call i32 @SendAll(i32 %0, i8* %14, i32 %15)
%17 = load i8*, i8** %4
%18 = call i32 @free(i8* %17)
%19 = load i8*, i8** %3
%20 = call i32 @free(i8* %19)
ret void
}