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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ remove(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  char filename[80];
  printf("Enter the filename to delete: ");
  gets(filename);
  if (remove(filename) == 0)
    printf("The file %s has been deleted.\n", filename);
  else
    fprintf(stderr, "Error deleting the file %s.\n", filename);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x60(%rbp),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
jne    1197 <main+0x57>
lea    -0x60(%rbp),%rsi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11b0 <main+0x70>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
lea    -0x60(%rbp),%rdx
lea    0xe93(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
mov    %rbx,%rdi
call   1030 <remove@plt>
test   %rax,%rax
je     1185 <main+0x45>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
lea    0xec3(%rip),%rsi
mov    %rsp,%rdx
call   1050 <fprintf@plt>
jmp    1196 <main+0x56>
lea    0xe93(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Enter the filename to delete: \00"
@.str.1 = [31 x i8] c"The file %s has been deleted.\0A\00"
@stderr = global i32 0
@.str.2 = [29 x i8] c"Error deleting the file %s.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [80 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%9 = call i32 @gets(i8* %8)
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%11 = call i64 @remove(i8* %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %14)
br label %20
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%19 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %16, %13
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"Enter the filename to delete: \00"
@.str.1 = [31 x i8] c"The file %s has been deleted.\0A\00"
@stderr = global i32 0
@.str.2 = [29 x i8] c"Error deleting the file %s.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [80 x i8]
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @gets(i8* %4)
%7 = call i64 @remove(i8* %4)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br label %14
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %4)
br label %14
14: ; preds = %11, %9
ret i32 0
}