#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 strlen(char *);
int strspn(char *, char *);
scalar_t__ tolower(char);
void CheckSeqNt(char *seqnt, char *seqid) {
  const char repl_t_char = 'u';
  const char repl_any_char = 'n';
  char val_seq_char[1024];
  int invalid;
  int i, j;
  strcpy(val_seq_char, "aynur-cg");
  if (strspn(seqnt, "aynur-cg") == strlen(seqnt))
    return;
  for (i = 0; i < strlen(seqnt); i++) {
    invalid = 1;
    for (j = 0; j < strlen(val_seq_char); j++) {
      if ((char)tolower(seqnt[i]) == val_seq_char[j]) {
        invalid = 0;
        break;
      }
    }
    if (invalid) {
      if ((char)tolower(seqnt[i]) == 't') {
        seqnt[i] = repl_t_char;
      } else {
        seqnt[i] = repl_any_char;
      }
    }
  }
}


x86 assembly (clang, -O0):
<CheckSeqNt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x75,-0x11(%rbp)
movb   $0x6e,-0x12(%rbp)
lea    -0x420(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    0xe87(%rip),%rsi
call   1050 <strspn@plt>
mov    %eax,-0x430(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x430(%rbp),%eax
cmp    %ecx,%eax
jne    11a2 <CheckSeqNt+0x62>
jmp    12d1 <CheckSeqNt+0x191>
movl   $0x0,-0x428(%rbp)
mov    -0x428(%rbp),%eax
mov    %eax,-0x434(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x434(%rbp),%eax
cmp    %ecx,%eax
jge    12d1 <CheckSeqNt+0x191>
movl   $0x1,-0x424(%rbp)
movl   $0x0,-0x42c(%rbp)
mov    -0x42c(%rbp),%eax
mov    %eax,-0x438(%rbp)
lea    -0x420(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x438(%rbp),%eax
cmp    %ecx,%eax
jge    1263 <CheckSeqNt+0x123>
mov    -0x8(%rbp),%rax
movslq -0x428(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1060 <tolower@plt>
movsbl %al,%eax
movslq -0x42c(%rbp),%rcx
movsbl -0x420(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
jne    124a <CheckSeqNt+0x10a>
movl   $0x0,-0x424(%rbp)
jmp    1263 <CheckSeqNt+0x123>
jmp    124f <CheckSeqNt+0x10f>
mov    -0x42c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x42c(%rbp)
jmp    11e5 <CheckSeqNt+0xa5>
cmpl   $0x0,-0x424(%rbp)
je     12b8 <CheckSeqNt+0x178>
mov    -0x8(%rbp),%rax
movslq -0x428(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1060 <tolower@plt>
movsbl %al,%eax
cmp    $0x74,%eax
jne    12a4 <CheckSeqNt+0x164>
mov    -0x8(%rbp),%rax
movslq -0x428(%rbp),%rcx
movb   $0x75,(%rax,%rcx,1)
jmp    12b3 <CheckSeqNt+0x173>
mov    -0x8(%rbp),%rax
movslq -0x428(%rbp),%rcx
movb   $0x6e,(%rax,%rcx,1)
jmp    12b8 <CheckSeqNt+0x178>
jmp    12bd <CheckSeqNt+0x17d>
mov    -0x428(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x428(%rbp)
jmp    11ac <CheckSeqNt+0x6c>
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckSeqNt>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x400,%rsp
mov    %rdi,%r12
lea    0xea7(%rip),%r14
mov    %rsp,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1050 <strspn@plt>
mov    %eax,%ebp
mov    %r12,%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebp
je     120a <CheckSeqNt+0xca>
mov    %r12,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    120a <CheckSeqNt+0xca>
xor    %ebp,%ebp
mov    %rsp,%r14
mov    $0x75,%r15d
jmp    11cc <CheckSeqNt+0x8c>
xchg   %ax,%ax
movsbl (%r12,%rbp,1),%edi
call   1060 <tolower@plt>
cmp    $0x74,%al
mov    $0x6e,%eax
cmove  %r15d,%eax
mov    %al,(%r12,%rbp,1)
add    $0x1,%rbp
mov    %r12,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbp
jge    120a <CheckSeqNt+0xca>
mov    %r14,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11a0 <CheckSeqNt+0x60>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsbl (%r12,%rbp,1),%edi
call   1060 <tolower@plt>
movsbl %al,%eax
movsbl (%rsp,%rbx,1),%ecx
cmp    %ecx,%eax
je     11b9 <CheckSeqNt+0x79>
add    $0x1,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     11e0 <CheckSeqNt+0xa0>
jmp    11a0 <CheckSeqNt+0x60>
add    $0x400,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"aynur-cg\00"
define void @CheckSeqNt(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca [1024 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i8 117, i8* %5
store i8 110, i8* %6
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %3
%14 = call i32 @strspn(i8* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%15 = load i8*, i8** %3
%16 = call i32 @strlen(i8* %15)
%17 = icmp eq i32 %14, %16
br i1 %17, label %18, label %19
18: ; preds = %2
br label %79
19: ; preds = %2
store i32 0, i32* %9
br label %20
20: ; preds = %76, %19
%21 = load i32, i32* %9
%22 = load i8*, i8** %3
%23 = call i32 @strlen(i8* %22)
%24 = icmp slt i32 %21, %23
br i1 %24, label %25, label %79
25: ; preds = %20
store i32 1, i32* %8
store i32 0, i32* %10
br label %26
26: ; preds = %48, %25
%27 = load i32, i32* %10
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%29 = call i32 @strlen(i8* %28)
%30 = icmp slt i32 %27, %29
br i1 %30, label %31, label %51
31: ; preds = %26
%32 = load i8*, i8** %3
%33 = load i32, i32* %9
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i8, i8* %35
%37 = call i64 @tolower(i8 signext %36)
%38 = trunc i64 %37 to i8
%39 = sext i8 %38 to i32
%40 = load i32, i32* %10
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %39, %44
br i1 %45, label %46, label %47
46: ; preds = %31
store i32 0, i32* %8
br label %51
47: ; preds = %31
br label %48
48: ; preds = %47
%49 = load i32, i32* %10
%50 = add nsw i32 %49, 1
store i32 %50, i32* %10
br label %26
51: ; preds = %46, %26
%52 = load i32, i32* %8
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %75
54: ; preds = %51
%55 = load i8*, i8** %3
%56 = load i32, i32* %9
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %55, i64 %57
%59 = load i8, i8* %58
%60 = call i64 @tolower(i8 signext %59)
%61 = trunc i64 %60 to i8
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 116
br i1 %63, label %64, label %69
64: ; preds = %54
%65 = load i8*, i8** %3
%66 = load i32, i32* %9
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8, i8* %65, i64 %67
store i8 117, i8* %68
br label %74
69: ; preds = %54
%70 = load i8*, i8** %3
%71 = load i32, i32* %9
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8, i8* %70, i64 %72
store i8 110, i8* %73
br label %74
74: ; preds = %69, %64
br label %75
75: ; preds = %74, %51
br label %76
76: ; preds = %75
%77 = load i32, i32* %9
%78 = add nsw i32 %77, 1
store i32 %78, i32* %9
br label %20
79: ; preds = %18, %20
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"aynur-cg\00"
define void @CheckSeqNt(i8* %0, i8* nocapture readnone %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @strspn(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @strlen(i8* %0)
%8 = icmp eq i32 %6, %7
br i1 %8, label %46, label %9
9: ; preds = %2
%10 = call i32 @strlen(i8* %0)
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %46
12: ; preds = %9, %41
%13 = phi i64 [ %42, %41 ], [ 0, %9 ]
%14 = call i32 @strlen(i8* %4)
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %34
16: ; preds = %12
%17 = getelementptr inbounds i8, i8* %0, i64 %13
br label %22
18: ; preds = %22
%19 = call i32 @strlen(i8* %4)
%20 = sext i32 %19 to i64
%21 = icmp slt i64 %33, %20
br i1 %21, label %22, label %34
22: ; preds = %16, %18
%23 = phi i64 [ 0, %16 ], [ %33, %18 ]
%24 = load i8, i8* %17
%25 = call i64 @tolower(i8 signext %24)
%26 = trunc i64 %25 to i32
%27 = shl i32 %26, 24
%28 = ashr exact i32 %27, 24
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %23
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %28, %31
%33 = add nuw nsw i64 %23, 1
br i1 %32, label %41, label %18
34: ; preds = %18, %12
%35 = getelementptr inbounds i8, i8* %0, i64 %13
%36 = load i8, i8* %35
%37 = call i64 @tolower(i8 signext %36)
%38 = and i64 %37, 255
%39 = icmp eq i64 %38, 116
%40 = select i1 %39, i8 117, i8 110
store i8 %40, i8* %35
br label %41
41: ; preds = %22, %34
%42 = add nuw nsw i64 %13, 1
%43 = call i32 @strlen(i8* %0)
%44 = sext i32 %43 to i64
%45 = icmp slt i64 %42, %44
br i1 %45, label %12, label %46
46: ; preds = %41, %9, %2
ret void
}