#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *);
int remove(char *);
void remove_t() {
  int ret;
  FILE *fp;
  char filename[] = "file.txt";
  fp = fopen(filename, "w");
  fprintf(fp, "%s", "This is tutorialspoint.com");
  fclose(fp);
  ret = remove(filename);
  if (ret == 0) {
    printf("File deleted successfully");
  } else {
    printf("Error: unable to delete the file");
  }
}


x86 assembly (clang, -O0):
<remove_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xea1(%rip),%rax
mov    %rax,-0x19(%rbp)
mov    0xe9f(%rip),%al
mov    %al,-0x11(%rbp)
lea    -0x19(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe80(%rip),%rsi
lea    0xe7c(%rip),%rdx
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x19(%rbp),%rdi
call   1030 <remove@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    11c7 <remove_t+0x77>
lea    0xe6c(%rip),%rdi
call   1050 <printf@plt>
jmp    11d3 <remove_t+0x83>
lea    0xe75(%rip),%rdi
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_t>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movabs $0x7478742e656c6966,%rax
74 78 74
mov    %rax,0x8(%rsp)
movb   $0x0,0x10(%rsp)
lea    0xe97(%rip),%rsi
lea    0x8(%rsp),%r14
mov    %r14,%rdi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xe82(%rip),%rdi
mov    $0x1a,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1070 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1030 <remove@plt>
test   %eax,%eax
lea    0xe72(%rip),%rax
lea    0xe85(%rip),%rdi
cmove  %rax,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r14
jmp    1050 <printf@plt>

LLVM IR (-O0):
@__const.remove_t.filename = [9 x i8] c"file.txt\00"
@.str = [2 x i8] c"w\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [27 x i8] c"This is tutorialspoint.com\00"
@.str.3 = [26 x i8] c"File deleted successfully\00"
@.str.4 = [33 x i8] c"Error: unable to delete the file\00"
define void @remove_t() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [9 x i8]
%4 = bitcast [9 x i8]* %3 to i8*
%5 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %2
%7 = load i32*, i32** %2
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32*, i32** %2
%10 = call i32 @fclose(i32* %9)
%11 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%12 = call i32 @remove(i8* %11)
store i32 %12, i32* %1
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %19
17: ; preds = %0
%18 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
br label %19
19: ; preds = %17, %15
ret void
}

LLVM IR (-O2):
@__const.remove_t.filename = [9 x i8] c"file.txt\00"
@.str = [2 x i8] c"w\00"
@.str.2 = [27 x i8] c"This is tutorialspoint.com\00"
@.str.3 = [26 x i8] c"File deleted successfully\00"
@.str.4 = [33 x i8] c"Error: unable to delete the file\00"
define void @remove_t() {
%1 = alloca [9 x i8]
%2 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%3 = call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i64 26, i64 1, i32* %3)
%5 = tail call i32 @fclose(i32* %3)
%6 = call i32 @remove(i8* %2)
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0)
%9 = tail call i32 @printf(i8* dereferenceable(1) %8)
ret void
}