#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*/ isalnum(char *);
int filtering_buff(char *buff, size_t buff_size) {
  size_t i = 0;
  for (i = 0; i < buff_size; i++) {
    if (!isalnum((char *)buff[i]))
      buff[i] = ' ';
  }
  return 0;
}


x86 assembly (clang, -O0):
<filtering_buff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    117b <filtering_buff+0x6b>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbq (%rax,%rcx,1),%rdi
call   1030 <isalnum@plt>
cmp    $0x0,%eax
jne    1165 <filtering_buff+0x55>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
jmp    116a <filtering_buff+0x5a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1130 <filtering_buff+0x20>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filtering_buff>:
push   %r15
push   %r14
push   %rbx
test   %rsi,%rsi
je     114e <filtering_buff+0x3e>
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
jmp    1139 <filtering_buff+0x29>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
cmp    %rbx,%r14
je     114e <filtering_buff+0x3e>
movsbq (%r15,%rbx,1),%rdi
call   1030 <isalnum@plt>
test   %eax,%eax
jne    1130 <filtering_buff+0x20>
movb   $0x20,(%r15,%rbx,1)
jmp    1130 <filtering_buff+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

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