#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 count_file_radical(char *, char *);
int /*<<< orphan*/ file_radical(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int remove(char *);
int /*<<< orphan*/ strcpy(char *, char *);
void remove_files_created(char *file_name, char *file_extension) {
  char file_name_remove[256] = "";
  int count_file_name;
  int count;
  count_file_name = count_file_radical(file_name, file_extension);
  for (count = 0; count <= count_file_name; count++) {
    strcpy(file_name_remove, file_name);
    file_radical(file_name_remove, file_extension, count);
    if (remove(file_name_remove) == -1)
      printf("Error deleting file: %s\n", file_name_remove);
    else
      printf("File %s successfully deleted\n", file_name_remove);
  }
}


x86 assembly (clang, -O0):
<remove_files_created>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1060 <memset@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <count_file_radical@plt>
mov    %eax,-0x114(%rbp)
movl   $0x0,-0x118(%rbp)
mov    -0x118(%rbp),%eax
cmp    -0x114(%rbp),%eax
jg     1234 <remove_files_created+0xd4>
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x118(%rbp),%edx
call   1070 <file_radical@plt>
lea    -0x110(%rbp),%rdi
call   1030 <remove@plt>
cmp    $0xffffffff,%eax
jne    1208 <remove_files_created+0xa8>
lea    -0x110(%rbp),%rsi
lea    0xe02(%rip),%rdi
call   1050 <printf@plt>
jmp    121b <remove_files_created+0xbb>
lea    -0x110(%rbp),%rsi
lea    0xe03(%rip),%rdi
call   1050 <printf@plt>
jmp    1220 <remove_files_created+0xc0>
mov    -0x118(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x118(%rbp)
jmp    11a3 <remove_files_created+0x43>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_files_created>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
xorps  %xmm0,%xmm0
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
call   1070 <count_file_radical@plt>
test   %eax,%eax
js     1231 <remove_files_created+0xe1>
mov    %eax,%r12d
add    $0x1,%r12d
xor    %ebx,%ebx
mov    %rsp,%rbp
lea    0xe2c(%rip),%r13
nopl   (%rax)
mov    %rbp,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1060 <file_radical@plt>
mov    %rbp,%rdi
call   1030 <remove@plt>
cmp    $0xffffffff,%eax
mov    %r13,%rdi
lea    0xde3(%rip),%rax
cmove  %rax,%rdi
mov    %rbp,%rsi
call   1050 <printf@plt>
add    $0x1,%ebx
cmp    %ebx,%r12d
jne    11f0 <remove_files_created+0xa0>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Error deleting file: %s\0A\00"
@.str.1 = [30 x i8] c"File %s successfully deleted\0A\00"
define void @remove_files_created(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [256 x i8]
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = bitcast [256 x i8]* %5 to i8*
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = call i32 @count_file_radical(i8* %9, i8* %10)
store i32 %11, i32* %6
store i32 0, i32* %7
br label %12
12: ; preds = %34, %2
%13 = load i32, i32* %7
%14 = load i32, i32* %6
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %37
16: ; preds = %12
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%18 = load i8*, i8** %3
%19 = call i32 @strcpy(i8* %17, i8* %18)
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%21 = load i8*, i8** %4
%22 = load i32, i32* %7
%23 = call i32 @file_radical(i8* %20, i8* %21, i32 %22)
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%25 = call i32 @remove(i8* %24)
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %30
27: ; preds = %16
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%29 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %28)
br label %33
30: ; preds = %16
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%32 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %30, %27
br label %34
34: ; preds = %33
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %12
37: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Error deleting file: %s\0A\00"
@.str.1 = [30 x i8] c"File %s successfully deleted\0A\00"
define void @remove_files_created(i8* %0, i8* %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @count_file_radical(i8* %0, i8* %1)
%6 = icmp slt i32 %5, 0
br i1 %6, label %17, label %7
7: ; preds = %2, %7
%8 = phi i32 [ %15, %7 ], [ 0, %2 ]
%9 = call i32 @strcpy(i8* %4, i8* %0)
%10 = call i32 @file_radical(i8* %4, i8* %1, i32 %8)
%11 = call i32 @remove(i8* %4)
%12 = icmp eq i32 %11, -1
%13 = select i1 %12, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0)
%14 = call i32 @printf(i8* %13, i8* %4)
%15 = add nuw i32 %8, 1
%16 = icmp eq i32 %8, %5
br i1 %16, label %17, label %7
17: ; preds = %7, %2
ret void
}