#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 */
char *get_arg(char **);
int /*<<< orphan*/ mark_modified(int);
int /*<<< orphan*/ printc_err(char *, ...);
scalar_t__ stab_del(char *);
int cmd_sym_del(char **arg) {
  char *name = get_arg(arg);
  if (!name) {
    printc_err("sym: need a name to delete "
               "symbol table entries\n");
    return -1;
  }
  if (stab_del(name) < 0) {
    printc_err("sym: can't delete nonexistent symbol: %s\n", name);
    return -1;
  }
  mark_modified(0x01);
  return 0;
}


x86 assembly (clang, -O0):
<cmd_sym_del>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <get_arg@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117e <cmd_sym_del+0x3e>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printc_err@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c0 <cmd_sym_del+0x80>
mov    -0x18(%rbp),%rdi
call   1040 <stab_del@plt>
cmp    $0x0,%rax
jge    11af <cmd_sym_del+0x6f>
mov    -0x18(%rbp),%rsi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printc_err@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c0 <cmd_sym_del+0x80>
mov    $0x1,%edi
call   1060 <mark_modified@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_sym_del>:
push   %rbx
call   1050 <get_arg@plt>
test   %rax,%rax
je     1169 <cmd_sym_del+0x29>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <stab_del@plt>
test   %rax,%rax
js     1179 <cmd_sym_del+0x39>
mov    $0x1,%edi
call   1060 <mark_modified@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xe90(%rip),%rdi
xor    %eax,%eax
call   1030 <printc_err@plt>
jmp    118a <cmd_sym_del+0x4a>
lea    0xeb1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printc_err@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [49 x i8] c"sym: need a name to delete symbol table entries\0A\00"
@.str.1 = [42 x i8] c"sym: can't delete nonexistent symbol: %s\0A\00"
define i32 @cmd_sym_del(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i8*
store i8** %0, i8*** %3
%5 = load i8**, i8*** %3
%6 = call i8* @get_arg(i8** %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = call i32 (i8*, ...) @printc_err(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %20
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = call i64 @stab_del(i8* %12)
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i8*, i8** %4
%17 = call i32 (i8*, ...) @printc_err(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %16)
store i32 -1, i32* %2
br label %20
18: ; preds = %11
%19 = call i32 @mark_modified(i32 1)
store i32 0, i32* %2
br label %20
20: ; preds = %18, %15, %9
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
@.str = [49 x i8] c"sym: need a name to delete symbol table entries\0A\00"
@.str.1 = [42 x i8] c"sym: can't delete nonexistent symbol: %s\0A\00"
define i32 @cmd_sym_del(i8** %0) {
%2 = tail call i8* @get_arg(i8** %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @printc_err(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
br label %13
6: ; preds = %1
%7 = tail call i64 @stab_del(i8* %2)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 (i8*, ...) @printc_err(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %13
11: ; preds = %6
%12 = tail call i32 @mark_modified(i32 1)
br label %13
13: ; preds = %11, %9, %4
%14 = phi i32 [ -1, %9 ], [ 0, %11 ], [ -1, %4 ]
ret i32 %14
}