#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 mmp_str_is_trimmable(char);
int test_str_is_trimmable(void) {
  char p[0xff] = {0};
  int i;
  p[' '] = p['\t'] = p['\n'] = p['\r'] = 1;
  for (i = 0; i < 0xff; ++i)
    if (mmp_str_is_trimmable((char)i) != p[i])
      return -1;
  return 0;
}


x86 assembly (clang, -O0):
<test_str_is_trimmable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1040 <memset@plt>
movb   $0x1,-0x103(%rbp)
movb   $0x1,-0x106(%rbp)
movb   $0x1,-0x107(%rbp)
movb   $0x1,-0xf0(%rbp)
movl   $0x0,-0x114(%rbp)
cmpl   $0xff,-0x114(%rbp)
jge    11c1 <test_str_is_trimmable+0xa1>
mov    -0x114(%rbp),%eax
movsbl %al,%edi
call   1030 <mmp_str_is_trimmable@plt>
movsbl %al,%eax
movslq -0x114(%rbp),%rcx
movsbl -0x110(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
je     11a8 <test_str_is_trimmable+0x88>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c8 <test_str_is_trimmable+0xa8>
jmp    11ad <test_str_is_trimmable+0x8d>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1164 <test_str_is_trimmable+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_str_is_trimmable>:
push   %rbx
sub    $0x100,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x20(%rsp)
movups %xmm0,0xef(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x10(%rsp)
movb   $0x1,0xd(%rsp)
movw   $0x101,0x9(%rsp)
movb   $0x1,0x20(%rsp)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %bl,%edi
call   1030 <mmp_str_is_trimmable@plt>
cmp    (%rsp,%rbx,1),%al
jne    11be <test_str_is_trimmable+0xae>
add    $0x1,%rbx
cmp    $0xff,%rbx
jne    11a0 <test_str_is_trimmable+0x90>
xor    %eax,%eax
jmp    11c3 <test_str_is_trimmable+0xb3>
mov    $0xffffffff,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @test_str_is_trimmable() {
%1 = alloca i32
%2 = alloca [255 x i8]
%3 = alloca i32
%4 = bitcast [255 x i8]* %2 to i8*
%5 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 13
store i8 1, i8* %5
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 10
store i8 1, i8* %6
%7 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 9
store i8 1, i8* %7
%8 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 32
store i8 1, i8* %8
store i32 0, i32* %3
br label %9
9: ; preds = %25, %0
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 255
br i1 %11, label %12, label %28
12: ; preds = %9
%13 = load i32, i32* %3
%14 = trunc i32 %13 to i8
%15 = call signext i8 @mmp_str_is_trimmable(i8 signext %14)
%16 = sext i8 %15 to i32
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %16, %21
br i1 %22, label %23, label %24
23: ; preds = %12
store i32 -1, i32* %1
br label %29
24: ; preds = %12
br label %25
25: ; preds = %24
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %9
28: ; preds = %9
store i32 0, i32* %1
br label %29
29: ; preds = %28, %23
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
define i32 @test_str_is_trimmable() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 13
store i8 1, i8* %3
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 10
store i8 1, i8* %4
%5 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 9
store i8 1, i8* %5
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 32
store i8 1, i8* %6
br label %10
7: ; preds = %10
%8 = add nuw nsw i64 %11, 1
%9 = icmp eq i64 %8, 255
br i1 %9, label %17, label %10
10: ; preds = %0, %7
%11 = phi i64 [ 0, %0 ], [ %8, %7 ]
%12 = trunc i64 %11 to i8
%13 = tail call signext i8 @mmp_str_is_trimmable(i8 signext %12)
%14 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 %11
%15 = load i8, i8* %14
%16 = icmp eq i8 %13, %15
br i1 %16, label %7, label %17
17: ; preds = %7, %10
%18 = phi i32 [ -1, %10 ], [ 0, %7 ]
ret i32 %18
}