#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__ is_LWS(unsigned char);
const char *strip_LWS(const char *p, const char *s) {
  if (p <= s)
    return s;
  while (p >= s && is_LWS((unsigned char)*p))
    p--;
  return p + 1;
}


x86 assembly (clang, -O0):
<strip_LWS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
ja     113b <strip_LWS+0x2b>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1196 <strip_LWS+0x86>
jmp    1140 <strip_LWS+0x30>
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x19(%rbp)
jb     1169 <strip_LWS+0x59>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1030 <is_LWS@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1179 <strip_LWS+0x69>
jmp    118a <strip_LWS+0x7a>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1140 <strip_LWS+0x30>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strip_LWS>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
cmp    %rsi,%rdi
jbe    113d <strip_LWS+0x2d>
mov    %rdi,%rbx
nop
movzbl (%rbx),%edi
call   1030 <is_LWS@plt>
test   %rax,%rax
je     1136 <strip_LWS+0x26>
add    $0xffffffffffffffff,%rbx
cmp    %r14,%rbx
jae    1120 <strip_LWS+0x10>
add    $0x1,%rbx
mov    %rbx,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strip_LWS(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = load i8*, i8** %5
%8 = icmp ule i8* %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i8*, i8** %5
store i8* %10, i8** %3
br label %29
11: ; preds = %2
br label %12
12: ; preds = %23, %11
%13 = load i8*, i8** %4
%14 = load i8*, i8** %5
%15 = icmp uge i8* %13, %14
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = call i64 @is_LWS(i8 zeroext %18)
%20 = icmp ne i64 %19, 0
br label %21
21: ; preds = %16, %12
%22 = phi i1 [ false, %12 ], [ %20, %16 ]
br i1 %22, label %23, label %26
23: ; preds = %21
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i32 -1
store i8* %25, i8** %4
br label %12
26: ; preds = %21
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i64 1
store i8* %28, i8** %3
br label %29
29: ; preds = %26, %9
%30 = load i8*, i8** %3
ret i8* %30
}

LLVM IR (-O2):
define i8* @strip_LWS(i8* %0, i8* readnone %1) {
%3 = icmp ugt i8* %0, %1
br i1 %3, label %4, label %15
4: ; preds = %2, %9
%5 = phi i8* [ %10, %9 ], [ %0, %2 ]
%6 = load i8, i8* %5
%7 = tail call i64 @is_LWS(i8 zeroext %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %5, i64 -1
%11 = icmp ult i8* %10, %1
br i1 %11, label %12, label %4
12: ; preds = %4, %9
%13 = phi i8* [ %10, %9 ], [ %5, %4 ]
%14 = getelementptr inbounds i8, i8* %13, i64 1
br label %15
15: ; preds = %2, %12
%16 = phi i8* [ %14, %12 ], [ %1, %2 ]
ret i8* %16
}