#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*/ strcpy(char *, char *);
int /*<<< orphan*/ treset(char *);
void strremplaceSpace(char chaine[], char chaineR[]) {
  int i, iz;
  char rc[1000];
  treset(rc);
  char c;
  i = 0, c = 'a', iz = 0;
  while (c != 0) {
    c = chaine[i];
    if (c != ' ') {
      rc[iz] = c;
      iz++;
    }
    i++;
  }
  strcpy(chaineR, rc);
}


x86 assembly (clang, -O0):
<strremplaceSpace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x400(%rbp),%rdi
call   1040 <treset@plt>
movl   $0x0,-0x14(%rbp)
movb   $0x61,-0x401(%rbp)
movl   $0x0,-0x18(%rbp)
movsbl -0x401(%rbp),%eax
cmp    $0x0,%eax
je     11ad <strremplaceSpace+0x8d>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x401(%rbp)
movsbl -0x401(%rbp),%eax
cmp    $0x20,%eax
je     119f <strremplaceSpace+0x7f>
mov    -0x401(%rbp),%cl
movslq -0x18(%rbp),%rax
mov    %cl,-0x400(%rbp,%rax,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1154 <strremplaceSpace+0x34>
mov    -0x10(%rbp),%rdi
lea    -0x400(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strremplaceSpace>:
push   %r14
push   %rbx
sub    $0x3e8,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%rdi
call   1040 <treset@plt>
xor    %eax,%eax
jmp    1148 <strremplaceSpace+0x28>
nopl   0x0(%rax)
add    $0x1,%rbx
test   %cl,%cl
je     115a <strremplaceSpace+0x3a>
movzbl (%rbx),%ecx
cmp    $0x20,%cl
je     1140 <strremplaceSpace+0x20>
cltq
mov    %cl,(%rsp,%rax,1)
add    $0x1,%eax
jmp    1140 <strremplaceSpace+0x20>
mov    %rsp,%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

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

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