#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 */
scalar_t__ ft_isinarray(char const, char *);
size_t ft_strtrim_count_end(char const *s, size_t len) {
  size_t count;
  int i;
  count = 0;
  i = len - 1;
  while (i >= 0 && ft_isinarray(s[i], " \t\n\r\v\f")) {
    ++count;
    --i;
  }
  return (count);
}


x86 assembly (clang, -O0):
<ft_strtrim_count_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
sub    $0x1,%rax
mov    %eax,-0x1c(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0x1d(%rbp)
jl     1164 <ft_strtrim_count_end+0x54>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
lea    0xeaf(%rip),%rsi
movsbl (%rax,%rcx,1),%edi
call   1030 <ft_isinarray@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1174 <ft_strtrim_count_end+0x64>
jmp    118e <ft_strtrim_count_end+0x7e>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1133 <ft_strtrim_count_end+0x23>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strtrim_count_end>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebp
add    $0xffffffff,%ebp
js     1165 <ft_strtrim_count_end+0x55>
mov    %rdi,%r14
mov    %ebp,%r12d
add    $0x1,%r12
mov    %esi,%r13d
xor    %ebx,%ebx
lea    0xec8(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %ebp,%eax
movsbl (%r14,%rax,1),%edi
mov    %r15,%rsi
call   1030 <ft_isinarray@plt>
test   %rax,%rax
je     1167 <ft_strtrim_count_end+0x57>
add    $0x1,%rbx
add    $0xffffffff,%ebp
cmp    %rbx,%r13
jne    1140 <ft_strtrim_count_end+0x30>
mov    %r12,%rbx
jmp    1167 <ft_strtrim_count_end+0x57>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c" \09\0A\0D\0B\0C\00"
define i64 @ft_strtrim_count_end(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
store i64 0, i64* %5
%7 = load i64, i64* %4
%8 = sub i64 %7, 1
%9 = trunc i64 %8 to i32
store i32 %9, i32* %6
br label %10
10: ; preds = %23, %2
%11 = load i32, i32* %6
%12 = icmp sge i32 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load i8*, i8** %3
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = call i64 @ft_isinarray(i8 signext %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%20 = icmp ne i64 %19, 0
br label %21
21: ; preds = %13, %10
%22 = phi i1 [ false, %10 ], [ %20, %13 ]
br i1 %22, label %23, label %28
23: ; preds = %21
%24 = load i64, i64* %5
%25 = add i64 %24, 1
store i64 %25, i64* %5
%26 = load i32, i32* %6
%27 = add nsw i32 %26, -1
store i32 %27, i32* %6
br label %10
28: ; preds = %21
%29 = load i64, i64* %5
ret i64 %29
}

LLVM IR (-O2):
@.str = [7 x i8] c" \09\0A\0D\0B\0C\00"
define i64 @ft_strtrim_count_end(i8* nocapture %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = add i32 %3, -1
%5 = icmp sgt i32 %4, -1
br i1 %5, label %6, label %22
6: ; preds = %2
%7 = zext i32 %4 to i64
%8 = add nuw nsw i64 %7, 1
%9 = and i64 %1, 4294967295
br label %10
10: ; preds = %6, %18
%11 = phi i32 [ %20, %18 ], [ %4, %6 ]
%12 = phi i64 [ %19, %18 ], [ 0, %6 ]
%13 = zext i32 %11 to i64
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = tail call i64 @ft_isinarray(i8 signext %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %10
%19 = add nuw nsw i64 %12, 1
%20 = add i32 %11, -1
%21 = icmp eq i64 %19, %9
br i1 %21, label %22, label %10
22: ; preds = %10, %18, %2
%23 = phi i64 [ 0, %2 ], [ %8, %18 ], [ %12, %10 ]
ret i64 %23
}