#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*/ bufdelete(char *, char *);
char *getbufend();
char *getbufstart();
scalar_t__ isspace(char);
scalar_t__ recdelete(char *, char *);
int /*<<< orphan*/ refresh_bounds();
int ruboutword(char **t) {
  char *dend = *t;
  char *dstart = dend;
  while (isspace(*dstart) && (dstart > getbufstart()))
    dstart--;
  while (!isspace(*dstart) && (dstart > getbufstart()))
    dstart--;
  if (dstart != getbufstart() && ((dstart + 1) < dend))
    dstart++;
  if (dend != getbufend())
    dend++;
  if (recdelete(dstart, dend) < 0)
    return -1;
  bufdelete(dstart, dend);
  refresh_bounds();
  *t = dstart;
  return 0;
}


x86 assembly (clang, -O0):
<ruboutword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isspace@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x21(%rbp)
je     11bc <ruboutword+0x5c>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1060 <getbufstart@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
seta   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11cc <ruboutword+0x6c>
jmp    11dd <ruboutword+0x7d>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    117f <ruboutword+0x1f>
jmp    11e2 <ruboutword+0x82>
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isspace@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x31(%rbp)
jne    121f <ruboutword+0xbf>
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    $0x0,%al
call   1060 <getbufstart@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
cmp    %rcx,%rax
seta   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    122f <ruboutword+0xcf>
jmp    1240 <ruboutword+0xe0>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    11e2 <ruboutword+0x82>
mov    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    $0x0,%al
call   1060 <getbufstart@plt>
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
cmp    %rcx,%rax
je     127d <ruboutword+0x11d>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
cmp    -0x18(%rbp),%rax
jae    127d <ruboutword+0x11d>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    $0x0,%al
call   1040 <getbufend@plt>
mov    %rax,%rcx
mov    -0x50(%rbp),%rax
cmp    %rcx,%rax
je     12a8 <ruboutword+0x148>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <recdelete@plt>
cmp    $0x0,%rax
jge    12cb <ruboutword+0x16b>
movl   $0xffffffff,-0x4(%rbp)
jmp    12f1 <ruboutword+0x191>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <bufdelete@plt>
mov    $0x0,%al
call   1070 <refresh_bounds@plt>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ruboutword>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
mov    (%rdi),%r12
movsbl (%r12),%edi
call   1050 <isspace@plt>
mov    %r12,%rbp
test   %rax,%rax
je     11ae <ruboutword+0x4e>
mov    %r12,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1060 <getbufstart@plt>
cmp    %rax,%rbp
jbe    11ae <ruboutword+0x4e>
movsbl -0x1(%rbp),%edi
add    $0xffffffffffffffff,%rbp
call   1050 <isspace@plt>
test   %rax,%rax
jne    1190 <ruboutword+0x30>
movsbl 0x0(%rbp),%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
call   1050 <isspace@plt>
test   %rax,%rax
jne    11e0 <ruboutword+0x80>
xor    %eax,%eax
call   1060 <getbufstart@plt>
cmp    %rax,%rbp
jbe    11e0 <ruboutword+0x80>
movsbl -0x1(%rbp),%edi
add    $0xffffffffffffffff,%rbp
jmp    11c0 <ruboutword+0x60>
xor    %r15d,%r15d
xor    %eax,%eax
call   1060 <getbufstart@plt>
lea    0x1(%rbp),%rbx
cmp    %r12,%rbx
cmovae %rbp,%rbx
cmp    %rax,%rbp
cmove  %rbp,%rbx
xor    %eax,%eax
call   1040 <getbufend@plt>
xor    %ebp,%ebp
cmp    %rax,%r12
setne  %bpl
add    %r12,%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1030 <recdelete@plt>
test   %rax,%rax
js     1236 <ruboutword+0xd6>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1080 <bufdelete@plt>
xor    %eax,%eax
call   1070 <refresh_bounds@plt>
mov    %rbx,(%r14)
jmp    123c <ruboutword+0xdc>
mov    $0xffffffff,%r15d
mov    %r15d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ruboutword(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i8*
store i8** %0, i8*** %3
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
store i8* %7, i8** %4
%8 = load i8*, i8** %4
store i8* %8, i8** %5
br label %9
9: ; preds = %20, %1
%10 = load i8*, i8** %5
%11 = load i8, i8* %10
%12 = call i64 @isspace(i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = load i8*, i8** %5
%16 = call i8* (...) @getbufstart()
%17 = icmp ugt i8* %15, %16
br label %18
18: ; preds = %14, %9
%19 = phi i1 [ false, %9 ], [ %17, %14 ]
br i1 %19, label %20, label %23
20: ; preds = %18
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i32 -1
store i8* %22, i8** %5
br label %9
23: ; preds = %18
br label %24
24: ; preds = %35, %23
%25 = load i8*, i8** %5
%26 = load i8, i8* %25
%27 = call i64 @isspace(i8 signext %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %33, label %29
29: ; preds = %24
%30 = load i8*, i8** %5
%31 = call i8* (...) @getbufstart()
%32 = icmp ugt i8* %30, %31
br label %33
33: ; preds = %29, %24
%34 = phi i1 [ false, %24 ], [ %32, %29 ]
br i1 %34, label %35, label %38
35: ; preds = %33
%36 = load i8*, i8** %5
%37 = getelementptr inbounds i8, i8* %36, i32 -1
store i8* %37, i8** %5
br label %24
38: ; preds = %33
%39 = load i8*, i8** %5
%40 = call i8* (...) @getbufstart()
%41 = icmp ne i8* %39, %40
br i1 %41, label %42, label %50
42: ; preds = %38
%43 = load i8*, i8** %5
%44 = getelementptr inbounds i8, i8* %43, i64 1
%45 = load i8*, i8** %4
%46 = icmp ult i8* %44, %45
br i1 %46, label %47, label %50
47: ; preds = %42
%48 = load i8*, i8** %5
%49 = getelementptr inbounds i8, i8* %48, i32 1
store i8* %49, i8** %5
br label %50
50: ; preds = %47, %42, %38
%51 = load i8*, i8** %4
%52 = call i8* (...) @getbufend()
%53 = icmp ne i8* %51, %52
br i1 %53, label %54, label %57
54: ; preds = %50
%55 = load i8*, i8** %4
%56 = getelementptr inbounds i8, i8* %55, i32 1
store i8* %56, i8** %4
br label %57
57: ; preds = %54, %50
%58 = load i8*, i8** %5
%59 = load i8*, i8** %4
%60 = call i64 @recdelete(i8* %58, i8* %59)
%61 = icmp slt i64 %60, 0
br i1 %61, label %62, label %63
62: ; preds = %57
store i32 -1, i32* %2
br label %70
63: ; preds = %57
%64 = load i8*, i8** %5
%65 = load i8*, i8** %4
%66 = call i32 @bufdelete(i8* %64, i8* %65)
%67 = call i32 (...) @refresh_bounds()
%68 = load i8*, i8** %5
%69 = load i8**, i8*** %3
store i8* %68, i8** %69
store i32 0, i32* %2
br label %70
70: ; preds = %63, %62
%71 = load i32, i32* %2
ret i32 %71
}

LLVM IR (-O2):
define i32 @ruboutword(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = tail call i64 @isspace(i8 signext %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %1, %10
%7 = phi i8* [ %11, %10 ], [ %2, %1 ]
%8 = tail call i8* (...) @getbufstart()
%9 = icmp ugt i8* %7, %8
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = getelementptr inbounds i8, i8* %7, i64 -1
%12 = load i8, i8* %11
%13 = tail call i64 @isspace(i8 signext %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %6
15: ; preds = %6, %10, %1
%16 = phi i8* [ %2, %1 ], [ %11, %10 ], [ %7, %6 ]
%17 = load i8, i8* %16
%18 = tail call i64 @isspace(i8 signext %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %29
20: ; preds = %15, %24
%21 = phi i8* [ %25, %24 ], [ %16, %15 ]
%22 = tail call i8* (...) @getbufstart()
%23 = icmp ugt i8* %21, %22
br i1 %23, label %24, label %29
24: ; preds = %20
%25 = getelementptr inbounds i8, i8* %21, i64 -1
%26 = load i8, i8* %25
%27 = tail call i64 @isspace(i8 signext %26)
%28 = icmp eq i64 %27, 0
br i1 %28, label %20, label %29
29: ; preds = %20, %24, %15
%30 = phi i8* [ %16, %15 ], [ %25, %24 ], [ %21, %20 ]
%31 = tail call i8* (...) @getbufstart()
%32 = icmp ne i8* %30, %31
%33 = getelementptr inbounds i8, i8* %30, i64 1
%34 = icmp ult i8* %33, %2
%35 = select i1 %32, i1 %34, i1 false
%36 = select i1 %35, i8* %33, i8* %30
%37 = tail call i8* (...) @getbufend()
%38 = icmp ne i8* %2, %37
%39 = zext i1 %38 to i64
%40 = getelementptr i8, i8* %2, i64 %39
%41 = tail call i64 @recdelete(i8* %36, i8* %40)
%42 = icmp slt i64 %41, 0
br i1 %42, label %46, label %43
43: ; preds = %29
%44 = tail call i32 @bufdelete(i8* %36, i8* %40)
%45 = tail call i32 (...) @refresh_bounds()
store i8* %36, i8** %0
br label %46
46: ; preds = %29, %43
%47 = phi i32 [ 0, %43 ], [ -1, %29 ]
ret i32 %47
}