#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 delete2(char *);
int /*<<< orphan*/ printf(char *, ...);
char *strtok(int /*<<< orphan*/ *, char *);
void cmdDelete(void) {
  char *token = strtok(NULL, " \t");
  if (token == NULL) {
    printf("Missing parameter\n");
    return;
  }
  int err = delete2(token);
  if (err < 0) {
    printf("Error: %d\n", err);
    return;
  }
  printf("File %s was deleted\n", token);
}


x86 assembly (clang, -O0):
<cmdDelete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
lea    0xebd(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    116a <cmdDelete+0x3a>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a8 <cmdDelete+0x78>
mov    -0x8(%rbp),%rdi
call   1050 <delete2@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1196 <cmdDelete+0x66>
mov    -0xc(%rbp),%esi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a8 <cmdDelete+0x78>
mov    -0x8(%rbp),%rsi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdDelete>:
push   %rbx
lea    0xeb8(%rip),%rsi
xor    %edi,%edi
call   1050 <strtok@plt>
test   %rax,%rax
je     1175 <cmdDelete+0x35>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <delete2@plt>
test   %eax,%eax
js     1182 <cmdDelete+0x42>
lea    0xea4(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>
lea    0xea7(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
lea    0xe7a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c" \09\00"
@.str.1 = [19 x i8] c"Missing parameter\0A\00"
@.str.2 = [11 x i8] c"Error: %d\0A\00"
@.str.3 = [21 x i8] c"File %s was deleted\0A\00"
define void @cmdDelete() {
%1 = alloca i8*
%2 = alloca i32
%3 = call i8* @strtok(i32* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %19
8: ; preds = %0
%9 = load i8*, i8** %1
%10 = call i32 @delete2(i8* %9)
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load i32, i32* %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %14)
br label %19
16: ; preds = %8
%17 = load i8*, i8** %1
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %16, %13, %6
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c" \09\00"
@.str.2 = [11 x i8] c"Error: %d\0A\00"
@.str.3 = [21 x i8] c"File %s was deleted\0A\00"
@str = [18 x i8] c"Missing parameter\00"
define void @cmdDelete() {
%1 = tail call i8* @strtok(i32* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %12
5: ; preds = %0
%6 = tail call i32 @delete2(i8* %1)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %6)
br label %12
10: ; preds = %5
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %1)
br label %12
12: ; preds = %8, %10, %3
ret void
}