#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*/ memmove(char *, char *, int);
int strlen(char *);
char *strpbrk(char *, char *);
int strspn(char *, char *);
void HandleWhiteSpace(char *psz_node) {
  char *s = strpbrk(psz_node, "\t\r\n ");
  while (s) {
    int i_whitespace = strspn(s, "\t\r\n ");
    if (i_whitespace > 1)
      memmove(&s[1], &s[i_whitespace], strlen(s) - i_whitespace + 1);
    *s++ = ' ';
    s = strpbrk(s, "\t\r\n ");
  }
}


x86 assembly (clang, -O0):
<HandleWhiteSpace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1050 <strpbrk@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11ec <HandleWhiteSpace+0xac>
mov    -0x10(%rbp),%rdi
lea    0xe8a(%rip),%rsi
call   1040 <strspn@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jle    11c1 <HandleWhiteSpace+0x81>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
sub    -0x14(%rbp),%edx
add    $0x1,%edx
call   1060 <memmove@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rdi
lea    0xe22(%rip),%rsi
call   1050 <strpbrk@plt>
mov    %rax,-0x10(%rbp)
jmp    1160 <HandleWhiteSpace+0x20>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HandleWhiteSpace>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xeb1(%rip),%rsi
call   1050 <strpbrk@plt>
test   %rax,%rax
je     11c0 <HandleWhiteSpace+0x80>
mov    %rax,%rbx
lea    0xe9d(%rip),%r14
jmp    118a <HandleWhiteSpace+0x4a>
cs nopw 0x0(%rax,%rax,1)
nop
movb   $0x20,(%rbx)
add    $0x1,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strpbrk@plt>
mov    %rax,%rbx
test   %rax,%rax
je     11c0 <HandleWhiteSpace+0x80>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strspn@plt>
cmp    $0x2,%eax
jl     1170 <HandleWhiteSpace+0x30>
mov    %eax,%ebp
lea    0x1(%rbx),%r15
mov    %eax,%r12d
add    %rbx,%r12
mov    %rbx,%rdi
call   1030 <strlen@plt>
sub    %ebp,%eax
lea    0x1(%rax),%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <memmove@plt>
jmp    1170 <HandleWhiteSpace+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"\09\0D\0A \00"
define void @HandleWhiteSpace(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @strpbrk(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %3
br label %7
7: ; preds = %28, %1
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %33
10: ; preds = %7
%11 = load i8*, i8** %3
%12 = call i32 @strspn(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = icmp sgt i32 %13, 1
br i1 %14, label %15, label %28
15: ; preds = %10
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = load i8*, i8** %3
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8*, i8** %3
%23 = call i32 @strlen(i8* %22)
%24 = load i32, i32* %4
%25 = sub nsw i32 %23, %24
%26 = add nsw i32 %25, 1
%27 = call i32 @memmove(i8* %17, i8* %21, i32 %26)
br label %28
28: ; preds = %15, %10
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %3
store i8 32, i8* %29
%31 = load i8*, i8** %3
%32 = call i8* @strpbrk(i8* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %32, i8** %3
br label %7
33: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\09\0D\0A \00"
define void @HandleWhiteSpace(i8* %0) {
%2 = tail call i8* @strpbrk(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %20, label %4
4: ; preds = %1, %16
%5 = phi i8* [ %18, %16 ], [ %2, %1 ]
%6 = tail call i32 @strspn(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %16
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %5, i64 1
%10 = zext i32 %6 to i64
%11 = getelementptr inbounds i8, i8* %5, i64 %10
%12 = tail call i32 @strlen(i8* %5)
%13 = sub nsw i32 1, %6
%14 = add i32 %13, %12
%15 = tail call i32 @memmove(i8* %9, i8* %11, i32 %14)
br label %16
16: ; preds = %8, %4
%17 = getelementptr inbounds i8, i8* %5, i64 1
store i8 32, i8* %5
%18 = tail call i8* @strpbrk(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %4
20: ; preds = %16, %1
ret void
}