#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*/ isspace(unsigned char);
int strlen(char *);
const char *conf_skip_whitespace(char *p) {
  char *end = p + strlen(p) - 1;
  while (*p) {
    if (!isspace((unsigned char)(*p))) {
      break;
    }
    p += 1;
  }
  while (end > p) {
    if (!isspace((unsigned char)(*end))) {
      break;
    }
    *end-- = '\0';
  }
  return p;
}


x86 assembly (clang, -O0):
<conf_skip_whitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1189 <conf_skip_whitespace+0x69>
mov    -0x8(%rbp),%rax
movzbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
jne    1178 <conf_skip_whitespace+0x58>
jmp    1189 <conf_skip_whitespace+0x69>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1151 <conf_skip_whitespace+0x31>
jmp    118e <conf_skip_whitespace+0x6e>
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jbe    11cd <conf_skip_whitespace+0xad>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
jne    11b6 <conf_skip_whitespace+0x96>
jmp    11cd <conf_skip_whitespace+0xad>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
jmp    118e <conf_skip_whitespace+0x6e>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<conf_skip_whitespace>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <strlen@plt>
movslq %eax,%r14
add    %rbx,%r14
mov    (%rbx),%al
test   %al,%al
je     1164 <conf_skip_whitespace+0x44>
nopl   0x0(%rax,%rax,1)
movzbl %al,%edi
call   1040 <isspace@plt>
test   %eax,%eax
je     1164 <conf_skip_whitespace+0x44>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <conf_skip_whitespace+0x20>
jmp    1164 <conf_skip_whitespace+0x44>
nopw   0x0(%rax,%rax,1)
movb   $0x0,(%r14)
add    $0xffffffffffffffff,%r14
cmp    %rbx,%r14
jbe    117a <conf_skip_whitespace+0x5a>
movzbl (%r14),%edi
call   1040 <isspace@plt>
test   %eax,%eax
jne    1160 <conf_skip_whitespace+0x40>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @conf_skip_whitespace(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %1, %12
%8 = phi i8 [ %14, %12 ], [ %5, %1 ]
%9 = phi i8* [ %13, %12 ], [ %0, %1 ]
%10 = tail call i32 @isspace(i8 zeroext %8)
%11 = icmp eq i32 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %7
%13 = getelementptr inbounds i8, i8* %9, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %7
16: ; preds = %12, %7, %1
%17 = phi i8* [ %0, %1 ], [ %9, %7 ], [ %13, %12 ]
%18 = getelementptr inbounds i8, i8* %4, i64 -1
%19 = icmp ugt i8* %18, %17
br i1 %19, label %20, label %28
20: ; preds = %16, %25
%21 = phi i8* [ %26, %25 ], [ %18, %16 ]
%22 = load i8, i8* %21
%23 = tail call i32 @isspace(i8 zeroext %22)
%24 = icmp eq i32 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %20
store i8 0, i8* %21
%26 = getelementptr inbounds i8, i8* %21, i64 -1
%27 = icmp ugt i8* %26, %17
br i1 %27, label %20, label %28
28: ; preds = %25, %20, %16
ret i8* %17
}