#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*/ gets(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ remove(char *);
int main(void) {
  char file[80];
  printf("File to delete: ");
  gets(file);
  if (remove(file) == 0)
    printf("Removed %s.\n", file);
  else
    perror("remove");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x60(%rbp),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
jne    1190 <main+0x50>
lea    -0x60(%rbp),%rsi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    119c <main+0x5c>
lea    0xe87(%rip),%rdi
call   1060 <perror@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   1050 <gets@plt>
mov    %rbx,%rdi
call   1030 <remove@plt>
test   %rax,%rax
jne    1184 <main+0x44>
lea    0xe9f(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret
lea    0xe93(%rip),%rdi
call   1060 <perror@plt>
jmp    117c <main+0x3c>

LLVM IR (-O0):
@.str = [17 x i8] c"File to delete: \00"
@.str.1 = [13 x i8] c"Removed %s.\0A\00"
@.str.2 = [7 x i8] c"remove\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%7 = call i64 @remove(i8* %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %14
12: ; preds = %0
%13 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"File to delete: \00"
@.str.1 = [13 x i8] c"Removed %s.\0A\00"
@.str.2 = [7 x i8] c"remove\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i64 @remove(i8* %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %11
9: ; preds = %0
%10 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
ret i32 0
}