#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 */
scalar_t__ StringIn(char, char *);
void FeatSubstPOS(char *in, int newpos, char *out) {
  while (*in) {
    if (StringIn(*in, "NHVA9BDKRUx0«»")) {
      *out = newpos;
    } else {
      *out = *in;
    }
    in++;
    out++;
  }
  *out = '\0';
}


x86 assembly (clang, -O0):
<FeatSubstPOS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1186 <FeatSubstPOS+0x76>
mov    -0x8(%rbp),%rax
lea    0xec5(%rip),%rsi
movsbl (%rax),%edi
call   1030 <StringIn@plt>
cmp    $0x0,%rax
je     115d <FeatSubstPOS+0x4d>
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
jmp    1169 <FeatSubstPOS+0x59>
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1123 <FeatSubstPOS+0x13>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FeatSubstPOS>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    (%rdi),%al
test   %al,%al
je     116b <FeatSubstPOS+0x5b>
mov    %esi,%r14d
mov    %rdi,%rbp
add    $0x1,%rbp
lea    0xecf(%rip),%r15
jmp    1152 <FeatSubstPOS+0x42>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %cl,(%rbx)
add    $0x1,%rbx
movzbl 0x0(%rbp),%eax
add    $0x1,%rbp
test   %al,%al
je     116b <FeatSubstPOS+0x5b>
movsbl %al,%edi
mov    %r15,%rsi
call   1030 <StringIn@plt>
mov    %r14d,%ecx
test   %rax,%rax
jne    1140 <FeatSubstPOS+0x30>
movzbl -0x1(%rbp),%ecx
jmp    1140 <FeatSubstPOS+0x30>
movb   $0x0,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"NHVA9BDKRUx0\C2\AB\C2\BB\00"
define void @FeatSubstPOS(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
br label %7
7: ; preds = %24, %3
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %29
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = call i64 @StringIn(i8 signext %13, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %11
%17 = load i32, i32* %5
%18 = trunc i32 %17 to i8
%19 = load i8*, i8** %6
store i8 %18, i8* %19
br label %24
20: ; preds = %11
%21 = load i8*, i8** %4
%22 = load i8, i8* %21
%23 = load i8*, i8** %6
store i8 %22, i8* %23
br label %24
24: ; preds = %20, %16
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %4
%27 = load i8*, i8** %6
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %6
br label %7
29: ; preds = %7
%30 = load i8*, i8** %6
store i8 0, i8* %30
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"NHVA9BDKRUx0\C2\AB\C2\BB\00"
define void @FeatSubstPOS(i8* nocapture %0, i32 %1, i8* nocapture writeonly %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %22, label %6
6: ; preds = %3
%7 = trunc i32 %1 to i8
br label %8
8: ; preds = %6, %16
%9 = phi i8 [ %4, %6 ], [ %20, %16 ]
%10 = phi i8* [ %2, %6 ], [ %19, %16 ]
%11 = phi i8* [ %0, %6 ], [ %18, %16 ]
%12 = tail call i64 @StringIn(i8 signext %9, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = load i8, i8* %11
br label %16
16: ; preds = %8, %14
%17 = phi i8 [ %15, %14 ], [ %7, %8 ]
store i8 %17, i8* %10
%18 = getelementptr inbounds i8, i8* %11, i64 1
%19 = getelementptr inbounds i8, i8* %10, i64 1
%20 = load i8, i8* %18
%21 = icmp eq i8 %20, 0
br i1 %21, label %22, label %8
22: ; preds = %16, %3
%23 = phi i8* [ %2, %3 ], [ %19, %16 ]
store i8 0, i8* %23
ret void
}