void remove_file(void) {
  unsigned short int i;
  unsigned short int j;
  unsigned short int equal;
  unsigned char device;
  unsigned char filename[16 + 2];
  unsigned char str[256];
  unsigned short int rc, c1, c2, current_block, next_block;
  puts0("filename ? ");
  for (i = 0; i < 16; i++)
    str[i] = 0;
  getsn(str, 256);
  for (i = 0; i < 16; i++)
    filename[i] = str[i];
  filename[16] = 0;
  if (remove_(filename)) {
    puts0("Can't remove file '");
    puts0(filename);
    puts0("'\r\n");
  }
}


x86 assembly (clang, -O0):
<remove_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1050 <puts0@plt>
movw   $0x0,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
cmp    $0x10,%eax
jge    1179 <remove_file+0x49>
movzwl -0x2(%rbp),%eax
movb   $0x0,-0x120(%rbp,%rax,1)
mov    -0x2(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x2(%rbp)
jmp    114f <remove_file+0x1f>
lea    -0x120(%rbp),%rdi
mov    $0x100,%esi
mov    $0x0,%al
call   1030 <getsn@plt>
movw   $0x0,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
cmp    $0x10,%eax
jge    11c3 <remove_file+0x93>
movzwl -0x2(%rbp),%eax
mov    -0x120(%rbp,%rax,1),%cl
movzwl -0x2(%rbp),%eax
mov    %cl,-0x20(%rbp,%rax,1)
mov    -0x2(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x2(%rbp)
jmp    1192 <remove_file+0x62>
movb   $0x0,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1040 <remove_@plt>
cmp    $0x0,%eax
je     1202 <remove_file+0xd2>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1050 <puts0@plt>
lea    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1050 <puts0@plt>
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1050 <puts0@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_file>:
sub    $0x128,%rsp
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1050 <puts0@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x20(%rsp),%rdi
mov    $0x100,%esi
xor    %eax,%eax
call   1030 <getsn@plt>
movaps 0x20(%rsp),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
mov    %rsp,%rdi
xor    %eax,%eax
call   1040 <remove_@plt>
test   %eax,%eax
je     11a0 <remove_file+0x70>
lea    0xe8b(%rip),%rdi
xor    %eax,%eax
call   1050 <puts0@plt>
mov    %rsp,%rdi
xor    %eax,%eax
call   1050 <puts0@plt>
lea    0xe87(%rip),%rdi
xor    %eax,%eax
call   1050 <puts0@plt>
add    $0x128,%rsp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"filename ? \00"
@.str.1 = [20 x i8] c"Can't remove file '\00"
@.str.2 = [4 x i8] c"'\0D\0A\00"
define void @remove_file() {
%1 = alloca i16
%2 = alloca i16
%3 = alloca i16
%4 = alloca i8
%5 = alloca [18 x i8]
%6 = alloca [256 x i8]
%7 = alloca i16
%8 = alloca i16
%9 = alloca i16
%10 = alloca i16
%11 = alloca i16
%12 = call i32 (i8*, ...) bitcast (i32 (...)* @puts0 to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i16 0, i16* %1
br label %13
13: ; preds = %21, %0
%14 = load i16, i16* %1
%15 = zext i16 %14 to i32
%16 = icmp slt i32 %15, 16
br i1 %16, label %17, label %24
17: ; preds = %13
%18 = load i16, i16* %1
%19 = zext i16 %18 to i64
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %19
store i8 0, i8* %20
br label %21
21: ; preds = %17
%22 = load i16, i16* %1
%23 = add i16 %22, 1
store i16 %23, i16* %1
br label %13
24: ; preds = %13
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%26 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @getsn to i32 (i8*, i32, ...)*)(i8* %25, i32 256)
store i16 0, i16* %1
br label %27
27: ; preds = %39, %24
%28 = load i16, i16* %1
%29 = zext i16 %28 to i32
%30 = icmp slt i32 %29, 16
br i1 %30, label %31, label %42
31: ; preds = %27
%32 = load i16, i16* %1
%33 = zext i16 %32 to i64
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = load i16, i16* %1
%37 = zext i16 %36 to i64
%38 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 %37
store i8 %35, i8* %38
br label %39
39: ; preds = %31
%40 = load i16, i16* %1
%41 = add i16 %40, 1
store i16 %41, i16* %1
br label %27
42: ; preds = %27
%43 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 16
store i8 0, i8* %43
%44 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 0
%45 = call i32 (i8*, ...) bitcast (i32 (...)* @remove_ to i32 (i8*, ...)*)(i8* %44)
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %52
47: ; preds = %42
%48 = call i32 (i8*, ...) bitcast (i32 (...)* @puts0 to i32 (i8*, ...)*)(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%49 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 0
%50 = call i32 (i8*, ...) bitcast (i32 (...)* @puts0 to i32 (i8*, ...)*)(i8* %49)
%51 = call i32 (i8*, ...) bitcast (i32 (...)* @puts0 to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %52
52: ; preds = %47, %42
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"filename ? \00"
@.str.1 = [20 x i8] c"Can't remove file '\00"
@.str.2 = [4 x i8] c"'\0D\0A\00"
define void @remove_file() {
%1 = alloca [18 x i8]
%2 = getelementptr inbounds [18 x i8], [18 x i8]* %1, i64 0, i64 0
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds [18 x i8], [18 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts0 to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @getsn to i32 (i8*, i32, ...)*)(i8* %6, i32 256)
%9 = getelementptr inbounds [18 x i8], [18 x i8]* %1, i64 0, i64 16
store i8 0, i8* %9
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @remove_ to i32 (i8*, ...)*)(i8* %5)
%11 = icmp eq i32 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %0
%13 = call i32 (i8*, ...) bitcast (i32 (...)* @puts0 to i32 (i8*, ...)*)(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 (i8*, ...) bitcast (i32 (...)* @puts0 to i32 (i8*, ...)*)(i8* %5)
%15 = call i32 (i8*, ...) bitcast (i32 (...)* @puts0 to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %12, %0
ret void
}