#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*/ assert(int);
char *eat_space_at_end(char *end) {
  char *real_end;
  assert('\0' == *end);
  real_end = end - 1;
  while (' ' == *real_end || '\t' == *real_end || '\n' == *real_end ||
         ':' == *real_end) {
    --real_end;
  }
  return real_end;
}


x86 assembly (clang, -O0):
<eat_space_at_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edx
mov    $0x1,%al
mov    $0x20,%ecx
cmp    %edx,%ecx
mov    %al,-0x11(%rbp)
je     119f <eat_space_at_end+0x8f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edx
mov    $0x1,%al
mov    $0x9,%ecx
cmp    %edx,%ecx
mov    %al,-0x11(%rbp)
je     119f <eat_space_at_end+0x8f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edx
mov    $0x1,%al
mov    $0xa,%ecx
cmp    %edx,%ecx
mov    %al,-0x11(%rbp)
je     119f <eat_space_at_end+0x8f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x3a,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    11af <eat_space_at_end+0x9f>
jmp    11c0 <eat_space_at_end+0xb0>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1140 <eat_space_at_end+0x30>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eat_space_at_end>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
cmpb   $0x0,(%rbx)
sete   %dil
call   1030 <assert@plt>
add    $0xffffffffffffffff,%rbx
movabs $0x400000100000600,%rax
movzbl (%rbx),%ecx
cmp    $0x3a,%rcx
ja     1145 <eat_space_at_end+0x35>
bt     %rcx,%rax
jae    1145 <eat_space_at_end+0x35>
add    $0xffffffffffffffff,%rbx
jmp    1130 <eat_space_at_end+0x20>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @eat_space_at_end(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 0, %6
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 -1
store i8* %11, i8** %3
br label %12
12: ; preds = %34, %1
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 32, %15
br i1 %16, label %32, label %17
17: ; preds = %12
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 9, %20
br i1 %21, label %32, label %22
22: ; preds = %17
%23 = load i8*, i8** %3
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 10, %25
br i1 %26, label %32, label %27
27: ; preds = %22
%28 = load i8*, i8** %3
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 58, %30
br label %32
32: ; preds = %27, %22, %17, %12
%33 = phi i1 [ true, %22 ], [ true, %17 ], [ true, %12 ], [ %31, %27 ]
br i1 %33, label %34, label %37
34: ; preds = %32
%35 = load i8*, i8** %3
%36 = getelementptr inbounds i8, i8* %35, i32 -1
store i8* %36, i8** %3
br label %12
37: ; preds = %32
%38 = load i8*, i8** %3
ret i8* %38
}

LLVM IR (-O2):
define i8* @eat_space_at_end(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
br label %6
6: ; preds = %10, %1
%7 = phi i8* [ %0, %1 ], [ %8, %10 ]
%8 = getelementptr inbounds i8, i8* %7, i64 -1
%9 = load i8, i8* %8
switch i8 %9, label %11 [
i8 32, label %10
i8 9, label %10
i8 10, label %10
i8 58, label %10
]
10: ; preds = %6, %6, %6, %6
br label %6
11: ; preds = %6
ret i8* %8
}