#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 strcspn(char *, char *);
int strlen(char *);
void CheckSeqId(char *seqid) {
  const char repl_char = '_';
  char inval_id_char[1024];
  int i, j;
  if (strcspn(seqid, "!\"§$%&/()=?{[]}\\'`+*~'#;:<>|") == strlen(seqid))
    return;
  strcpy(inval_id_char, "!\"§$%&/()=?{[]}\\'`+*~'#;:<>|");
  for (i = 0; i < strlen(seqid); i++) {
    for (j = 0; j < strlen(inval_id_char); j++) {
      if (seqid[i] == inval_id_char[j]) {
        seqid[i] = repl_char;
      }
    }
  }
}


x86 assembly (clang, -O0):
<CheckSeqId>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x5f,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1050 <strcspn@plt>
mov    %eax,-0x41c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x41c(%rbp),%eax
cmp    %ecx,%eax
jne    1177 <CheckSeqId+0x47>
jmp    1252 <CheckSeqId+0x122>
lea    -0x410(%rbp),%rdi
lea    0xe7b(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x414(%rbp)
mov    -0x414(%rbp),%eax
mov    %eax,-0x420(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x420(%rbp),%eax
cmp    %ecx,%eax
jge    1252 <CheckSeqId+0x122>
movl   $0x0,-0x418(%rbp)
mov    -0x418(%rbp),%eax
mov    %eax,-0x424(%rbp)
lea    -0x410(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x424(%rbp),%eax
cmp    %ecx,%eax
jge    1239 <CheckSeqId+0x109>
mov    -0x8(%rbp),%rax
movslq -0x414(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movslq -0x418(%rbp),%rcx
movsbl -0x410(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
jne    1220 <CheckSeqId+0xf0>
mov    -0x8(%rbp),%rax
movslq -0x414(%rbp),%rcx
movb   $0x5f,(%rax,%rcx,1)
jmp    1225 <CheckSeqId+0xf5>
mov    -0x418(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x418(%rbp)
jmp    11c3 <CheckSeqId+0x93>
jmp    123e <CheckSeqId+0x10e>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    1194 <CheckSeqId+0x64>
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckSeqId>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%r15
lea    0xeb9(%rip),%rsi
call   1050 <strcspn@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebp
je     11d4 <CheckSeqId+0xa4>
lea    0xe9f(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11d4 <CheckSeqId+0xa4>
xor    %ebp,%ebp
mov    %rsp,%r14
jmp    1193 <CheckSeqId+0x63>
nopl   0x0(%rax)
add    $0x1,%rbp
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbp
jge    11d4 <CheckSeqId+0xa4>
mov    %r14,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1180 <CheckSeqId+0x50>
xor    %ebx,%ebx
jmp    11c3 <CheckSeqId+0x93>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    1180 <CheckSeqId+0x50>
movzbl (%r15,%rbp,1),%eax
cmp    (%rsp,%rbx,1),%al
jne    11b0 <CheckSeqId+0x80>
movb   $0x5f,(%r15,%rbp,1)
jmp    11b0 <CheckSeqId+0x80>
add    $0x408,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"!\22\C2\A7$%&/()=?{[]}\\'`+*~'#;:<>|\00"
define void @CheckSeqId(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca [1024 x i8]
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %2
store i8 95, i8* %3
%7 = load i8*, i8** %2
%8 = call i32 @strcspn(i8* %7, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%9 = load i8*, i8** %2
%10 = call i32 @strlen(i8* %9)
%11 = icmp eq i32 %8, %10
br i1 %11, label %12, label %13
12: ; preds = %1
br label %53
13: ; preds = %1
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%15 = call i32 @strcpy(i8* %14, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %16
16: ; preds = %50, %13
%17 = load i32, i32* %5
%18 = load i8*, i8** %2
%19 = call i32 @strlen(i8* %18)
%20 = icmp slt i32 %17, %19
br i1 %20, label %21, label %53
21: ; preds = %16
store i32 0, i32* %6
br label %22
22: ; preds = %46, %21
%23 = load i32, i32* %6
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%25 = call i32 @strlen(i8* %24)
%26 = icmp slt i32 %23, %25
br i1 %26, label %27, label %49
27: ; preds = %22
%28 = load i8*, i8** %2
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %33, %38
br i1 %39, label %40, label %45
40: ; preds = %27
%41 = load i8*, i8** %2
%42 = load i32, i32* %5
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %41, i64 %43
store i8 95, i8* %44
br label %45
45: ; preds = %40, %27
br label %46
46: ; preds = %45
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
store i32 %48, i32* %6
br label %22
49: ; preds = %22
br label %50
50: ; preds = %49
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
br label %16
53: ; preds = %12, %16
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"!\22\C2\A7$%&/()=?{[]}\\'`+*~'#;:<>|\00"
define void @CheckSeqId(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @strcspn(i8* %0, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @strlen(i8* %0)
%6 = icmp eq i32 %4, %5
br i1 %6, label %34, label %7
7: ; preds = %1
%8 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @strlen(i8* %0)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %34
11: ; preds = %7, %29
%12 = phi i64 [ %30, %29 ], [ 0, %7 ]
%13 = call i32 @strlen(i8* %3)
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %29
15: ; preds = %11
%16 = getelementptr inbounds i8, i8* %0, i64 %12
br label %17
17: ; preds = %15, %24
%18 = phi i64 [ 0, %15 ], [ %25, %24 ]
%19 = load i8, i8* %16
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %18
%21 = load i8, i8* %20
%22 = icmp eq i8 %19, %21
br i1 %22, label %23, label %24
23: ; preds = %17
store i8 95, i8* %16
br label %24
24: ; preds = %17, %23
%25 = add nuw nsw i64 %18, 1
%26 = call i32 @strlen(i8* %3)
%27 = sext i32 %26 to i64
%28 = icmp slt i64 %25, %27
br i1 %28, label %17, label %29
29: ; preds = %24, %11
%30 = add nuw nsw i64 %12, 1
%31 = call i32 @strlen(i8* %0)
%32 = sext i32 %31 to i64
%33 = icmp slt i64 %30, %32
br i1 %33, label %11, label %34
34: ; preds = %29, %7, %1
ret void
}