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

/* Variables and functions */
int /*<<< orphan*/ asprintf(char **, char *, char *, char *, char *);
int /*<<< orphan*/ check_arguments(char **);
int /*<<< orphan*/ exists(char *);
int /*<<< orphan*/ gen_trashinfo(char *, char *, char *);
char *get_username();
int /*<<< orphan*/ getcwd(char *, int);
int /*<<< orphan*/ mv_file(char *, char *, char *);
int main(int argc, char *argv[]) {
  check_arguments(argv);
  char *filename = argv[1];
  exists(filename);
  char *cwd_n_file;
  char cwd[1024];
  getcwd(cwd, sizeof(cwd));
  asprintf(&cwd_n_file, "%s%s%s", cwd, "//", filename);
  char *username = get_username();
  gen_trashinfo(username, filename, cwd_n_file);
  mv_file(username, filename, cwd_n_file);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <check_arguments@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1090 <exists@plt>
lea    -0x420(%rbp),%rdi
mov    $0x400,%esi
call   1040 <getcwd@plt>
lea    -0x420(%rbp),%rdx
mov    -0x18(%rbp),%r8
lea    -0x20(%rbp),%rdi
lea    0xe39(%rip),%rsi
lea    0xe39(%rip),%rcx
call   1080 <asprintf@plt>
mov    $0x0,%al
call   1030 <get_username@plt>
mov    %rax,-0x428(%rbp)
mov    -0x428(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <gen_trashinfo@plt>
mov    -0x428(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1060 <mv_file@plt>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x410,%rsp
mov    %rsi,%rbx
mov    %rsi,%rdi
call   1070 <check_arguments@plt>
mov    0x8(%rbx),%r15
mov    %r15,%rdi
call   1090 <exists@plt>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x400,%esi
call   1040 <getcwd@plt>
lea    0xe54(%rip),%rsi
lea    0xe54(%rip),%rcx
lea    0x8(%rsp),%rdi
mov    %r14,%rdx
mov    %r15,%r8
call   1080 <asprintf@plt>
xor    %eax,%eax
call   1030 <get_username@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%rdx
mov    %rax,%rdi
mov    %r15,%rsi
call   1050 <gen_trashinfo@plt>
mov    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <mv_file@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s%s%s\00"
@.str.1 = [3 x i8] c"//\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [1024 x i8]
%8 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%9 = load i8**, i8*** %4
%10 = call i32 @check_arguments(i8** %9)
%11 = load i8**, i8*** %4
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
store i8* %13, i8** %5
%14 = load i8*, i8** %5
%15 = call i32 @exists(i8* %14)
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%17 = call i32 @getcwd(i8* %16, i32 1024)
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%19 = load i8*, i8** %5
%20 = call i32 @asprintf(i8** %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = call i8* (...) @get_username()
store i8* %21, i8** %8
%22 = load i8*, i8** %8
%23 = load i8*, i8** %5
%24 = load i8*, i8** %6
%25 = call i32 @gen_trashinfo(i8* %22, i8* %23, i8* %24)
%26 = load i8*, i8** %8
%27 = load i8*, i8** %5
%28 = load i8*, i8** %6
%29 = call i32 @mv_file(i8* %26, i8* %27, i8* %28)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s%s%s\00"
@.str.1 = [3 x i8] c"//\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = alloca [1024 x i8]
%5 = tail call i32 @check_arguments(i8** %1)
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @exists(i8* %7)
%9 = bitcast i8** %3 to i8*
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%11 = call i32 @getcwd(i8* %10, i32 1024)
%12 = call i32 @asprintf(i8** %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%13 = call i8* (...) @get_username()
%14 = load i8*, i8** %3
%15 = call i32 @gen_trashinfo(i8* %13, i8* %7, i8* %14)
%16 = load i8*, i8** %3
%17 = call i32 @mv_file(i8* %13, i8* %7, i8* %16)
ret i32 0
}