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

/* Variables and functions */
int /*<<< orphan*/ asprintf(char **, char *, char *, char *, char *, char *,
                            char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
char *get_deletiondate();
void gen_trashinfo(char *username, char *filename, char *cwd_n_file) {
  FILE *infofile;
  char *dirtinfo = "/.local/share/Trash/info/";
  asprintf(&dirtinfo, "%s%s%s%s%s", "/home/", username, dirtinfo, filename,
           ".trashinfo");
  infofile = fopen(dirtinfo, "w");
  char *whatwrite;
  char *deldate;
  deldate = get_deletiondate();
  asprintf(&whatwrite, "%s%s%s%s%s", "[Trash Info]\n", "Path=", cwd_n_file,
           "\nDeletionDate=", deldate);
  fprintf(infofile, whatwrite);
  fclose(infofile);
}


x86 assembly (clang, -O0):
<gen_trashinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xe95(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x10(%rbp),%r9
lea    -0x28(%rbp),%rdi
lea    0xe94(%rip),%rsi
lea    0xe98(%rip),%rdx
lea    0xe98(%rip),%rax
mov    %rax,(%rsp)
call   1050 <asprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1060 <get_deletiondate@plt>
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%r8
mov    -0x38(%rbp),%rax
lea    -0x30(%rbp),%rdi
lea    0xe4b(%rip),%rsi
lea    0xe63(%rip),%rdx
lea    0xe6a(%rip),%rcx
lea    0xe69(%rip),%r9
mov    %rax,(%rsp)
call   1050 <asprintf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_trashinfo>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%r15
mov    %rsi,%r9
mov    %rdi,%rcx
lea    0xe97(%rip),%r8
mov    %r8,0x10(%rsp)
lea    0xeb7(%rip),%rax
mov    %rax,(%rsp)
lea    0xe9a(%rip),%r14
lea    0xe9e(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    %r14,%rsi
call   1050 <asprintf@plt>
mov    0x10(%rsp),%rdi
lea    0xe97(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <get_deletiondate@plt>
mov    %rax,(%rsp)
lea    0xe7f(%rip),%rdx
lea    0xe86(%rip),%rcx
lea    0xe85(%rip),%r9
lea    0x18(%rsp),%rdi
mov    %r14,%rsi
mov    %r15,%r8
call   1050 <asprintf@plt>
mov    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"/.local/share/Trash/info/\00"
@.str.1 = [11 x i8] c"%s%s%s%s%s\00"
@.str.2 = [7 x i8] c"/home/\00"
@.str.3 = [11 x i8] c".trashinfo\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [14 x i8] c"[Trash Info]\0A\00"
@.str.6 = [6 x i8] c"Path=\00"
@.str.7 = [15 x i8] c"\0ADeletionDate=\00"
define void @gen_trashinfo(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8** %8
%11 = load i8*, i8** %4
%12 = load i8*, i8** %8
%13 = load i8*, i8** %5
%14 = call i32 @asprintf(i8** %8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %11, i8* %12, i8* %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%15 = load i8*, i8** %8
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %16, i32** %7
%17 = call i8* (...) @get_deletiondate()
store i8* %17, i8** %10
%18 = load i8*, i8** %6
%19 = load i8*, i8** %10
%20 = call i32 @asprintf(i8** %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %18, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %19)
%21 = load i32*, i32** %7
%22 = load i8*, i8** %9
%23 = call i32 @fprintf(i32* %21, i8* %22)
%24 = load i32*, i32** %7
%25 = call i32 @fclose(i32* %24)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"/.local/share/Trash/info/\00"
@.str.1 = [11 x i8] c"%s%s%s%s%s\00"
@.str.2 = [7 x i8] c"/home/\00"
@.str.3 = [11 x i8] c".trashinfo\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [14 x i8] c"[Trash Info]\0A\00"
@.str.6 = [6 x i8] c"Path=\00"
@.str.7 = [15 x i8] c"\0ADeletionDate=\00"
define void @gen_trashinfo(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = bitcast i8** %4 to i8*
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8** %4
%7 = call i32 @asprintf(i8** %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%8 = load i8*, i8** %4
%9 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%10 = bitcast i8** %5 to i8*
%11 = call i8* (...) @get_deletiondate()
%12 = call i32 @asprintf(i8** %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %11)
%13 = load i8*, i8** %5
%14 = call i32 @fprintf(i32* %9, i8* %13)
%15 = call i32 @fclose(i32* %9)
ret void
}