#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(char const);
void remove_spaces(char *str_trimmed, const char *str_untrimmed) {
  while (*str_untrimmed != '\0') {
    if (!isspace(*str_untrimmed)) {
      *str_trimmed = *str_untrimmed;
      str_trimmed++;
    }
    str_untrimmed++;
  }
  *str_trimmed = '\0';
}


x86 assembly (clang, -O0):
<remove_spaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     116e <remove_spaces+0x5e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
jne    115d <remove_spaces+0x4d>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <remove_spaces+0x10>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_spaces>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rsi),%al
test   %al,%al
je     1154 <remove_spaces+0x44>
mov    %rsi,%rbx
add    $0x1,%rbx
jmp    113b <remove_spaces+0x2b>
cs nopw 0x0(%rax,%rax,1)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1154 <remove_spaces+0x44>
movsbl %al,%edi
call   1030 <isspace@plt>
test   %eax,%eax
jne    1130 <remove_spaces+0x20>
movzbl -0x1(%rbx),%eax
mov    %al,(%r14)
add    $0x1,%r14
jmp    1130 <remove_spaces+0x20>
movb   $0x0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @remove_spaces(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %21, %2
%6 = load i8*, i8** %4
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %24
10: ; preds = %5
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = call i32 @isspace(i8 signext %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %21, label %15
15: ; preds = %10
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = load i8*, i8** %3
store i8 %17, i8* %18
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %3
br label %21
21: ; preds = %15, %10
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %4
br label %5
24: ; preds = %5
%25 = load i8*, i8** %3
store i8 0, i8* %25
ret void
}

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