#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*/ printf(char *);
char remove_whitespace(char *input_buffer, int *previous_end,
                       int *current_pos) {
  static char current_char;
  if ((current_char = input_buffer[*current_pos]) == ' ') {
    do {
      if (0 & 2)
        printf("--sh: removing whitespace\n");
      (*current_pos) += 1;
      (*previous_end) += 1;
    } while ((current_char = input_buffer[*current_pos]) == ' ');
  }
  return current_char;
}


x86 assembly (clang, -O0):
<remove_whitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,0x2efd(%rip)
movsbl %al,%eax
cmp    $0x20,%eax
jne    1170 <remove_whitespace+0x70>
jmp    1135 <remove_whitespace+0x35>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,0x2ec2(%rip)
movsbl %al,%eax
cmp    $0x20,%eax
je     1135 <remove_whitespace+0x35>
jmp    1170 <remove_whitespace+0x70>
movsbl 0x2eaa(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_whitespace>:
movslq (%rdx),%rcx
movzbl (%rdi,%rcx,1),%eax
cmp    $0x20,%al
jne    1115 <remove_whitespace+0x15>
add    $0x1,%ecx
mov    %ecx,(%rdx)
addl   $0x1,(%rsi)
jmp    1100 <remove_whitespace>
ret

LLVM IR (-O0):
@remove_whitespace.current_char = internal global i8 0
define signext i8 @remove_whitespace(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = load i32*, i32** %6
%9 = load i32, i32* %8
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %7, i64 %10
%12 = load i8, i8* %11
store i8 %12, i8* @remove_whitespace.current_char
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 32
br i1 %14, label %15, label %33
15: ; preds = %3
br label %16
16: ; preds = %23, %15
%17 = load i32*, i32** %6
%18 = load i32, i32* %17
%19 = add nsw i32 %18, 1
store i32 %19, i32* %17
%20 = load i32*, i32** %5
%21 = load i32, i32* %20
%22 = add nsw i32 %21, 1
store i32 %22, i32* %20
br label %23
23: ; preds = %16
%24 = load i8*, i8** %4
%25 = load i32*, i32** %6
%26 = load i32, i32* %25
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %24, i64 %27
%29 = load i8, i8* %28
store i8 %29, i8* @remove_whitespace.current_char
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 32
br i1 %31, label %16, label %32
32: ; preds = %23
br label %33
33: ; preds = %32, %3
%34 = load i8, i8* @remove_whitespace.current_char
ret i8 %34
}

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